editor.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. html {
  6. box-sizing: border-box;
  7. }
  8. *, *:before, *:after {
  9. box-sizing: inherit;
  10. }
  11. body {
  12. margin: 0;
  13. font-family: sans-serif;
  14. overflow: hidden;
  15. height: 100vh;
  16. }
  17. a {
  18. text-decoration: none;
  19. color: inherit;
  20. }
  21. iframe {
  22. display: block;
  23. border: none;
  24. }
  25. .frame {
  26. height: 100vh;
  27. display: flex;
  28. flex-direction: column;
  29. background: #444;
  30. color: #AAA;
  31. }
  32. .tabs {
  33. flex: 0 0 auto;
  34. display: flex;
  35. justify-content: space-between;
  36. align-items: center;
  37. background: #666;
  38. }
  39. .panes {
  40. display: flex;
  41. flex: 1 1 auto;
  42. height: 50%; /* this is needed for firefox. It won't actually be 50% because the flex: 1 1 auto means stretch */
  43. }
  44. .panes>div {
  45. display: none;
  46. flex: 1 1 50%;
  47. flex-direction: column;
  48. min-width: 0;
  49. }
  50. .panes .code {
  51. flex: 1 1 auto;
  52. position: relative;
  53. height: 100%;
  54. }
  55. .panes .code > div {
  56. height: 100%;
  57. }
  58. .panes .files {
  59. position: relative;
  60. }
  61. .panes .fileSelected {
  62. color: white;
  63. background: #666;
  64. }
  65. .panes .files > div {
  66. border: 1px solid black;
  67. font-family: monospace;
  68. text-overflow: ellipsis;
  69. overflow: hidden;
  70. width: 100%;
  71. white-space: nowrap;
  72. cursor: pointer;
  73. }
  74. .panes>div.other {
  75. display: block
  76. }
  77. .editor {
  78. g-overflow: auto;
  79. }
  80. .result {
  81. overflow: auto;
  82. }
  83. .result>iframe {
  84. width: 100%;
  85. height: 100%;
  86. background: white;
  87. }
  88. .result .console .log {
  89. white-space: pre-line;
  90. }
  91. .other>div,
  92. .other>div>div {
  93. display: flex;
  94. justify-content: center;
  95. align-items: center;
  96. align-content: center;
  97. font-size: xx-large;
  98. }
  99. .other>div {
  100. height: 100%;
  101. flex-direction: column;
  102. }
  103. .other .loading {
  104. height: 2em;
  105. width: 2em;
  106. animation: rotate 0.8s infinite linear;
  107. border: 0.4em solid #fff;
  108. border-right-color: transparent;
  109. border-radius: 50%;
  110. }
  111. .dialog {
  112. position: absolute;
  113. left: 0;
  114. top: 0;
  115. width: 100%;
  116. height: 100%;
  117. background: rgba(0, 0, 0, 0.8);
  118. display: flex;
  119. justify-content: center;
  120. align-items: center;
  121. }
  122. .dialog>div {
  123. background: #444;
  124. color: white;
  125. padding: 1em;
  126. outline: none;
  127. max-width: 90%;
  128. }
  129. .dialog p {
  130. margin-left: 0.25em;
  131. }
  132. .dialog a {
  133. color: lightseagreen;
  134. }
  135. .dialog a:hover {
  136. color: orange;
  137. }
  138. /* ---- */
  139. .export .export-buttons {
  140. display: flex;
  141. flex-wrap: wrap;
  142. }
  143. .export .export-buttons button {
  144. width: 8em;
  145. }
  146. /* ---- */
  147. .copy-dialog .copy-area {
  148. height: 8em;
  149. overflow: auto;
  150. user-select: all;
  151. background: #222;
  152. padding: 0.5em;
  153. }
  154. /* ---- */
  155. @keyframes rotate {
  156. 0% { transform: rotate(0deg); }
  157. 100% { transform: rotate(360deg); }
  158. }
  159. .tabs>div {
  160. padding: 0.125em;
  161. }
  162. button {
  163. padding: 0.5em;
  164. border: none;
  165. background: #AAA;
  166. border-bottom: 5px solid black;
  167. margin: 0.25em;
  168. width: 5em;
  169. cursor: pointer;
  170. }
  171. button:hover {
  172. background-color: orange;
  173. }
  174. button:focus {
  175. outline: none;
  176. }
  177. .panelogo {
  178. font-size: medium;
  179. }
  180. .panelogo>*>* {
  181. vertical-align: middle;
  182. display: inline-block;
  183. color: #CCC;
  184. }
  185. .show {
  186. background: #FFF !important;
  187. border-bottom: none !important;
  188. border-top: 5px solid #666 !important;
  189. }
  190. .button-result {
  191. margin-left: 2em !important;
  192. }
  193. .panebuttons>.button-fullscreen {
  194. background-image: url(editor-fullscreen-icon.svg);
  195. background-size: 80% 80%;
  196. background-position: center center;
  197. background-repeat: no-repeat no-repeat;
  198. }
  199. .fullscreen .panebuttons>.button-fullscreen {
  200. background-image: url(editor-unfullscreen-icon.svg) !important;
  201. }
  202. @media ( max-width: 950px ) {
  203. .panebuttons>button, body {
  204. font-size: x-small;
  205. }
  206. }
  207. @media ( max-width: 740px ) {
  208. .panelogo>div>a:nth-child(1) {
  209. display: none;
  210. }
  211. }
  212. @media ( max-width: 590px ) {
  213. .tabs {
  214. display: none;
  215. }
  216. .panes>div {
  217. display: none !important;
  218. height: auto;
  219. }
  220. .panes>.result {
  221. display: block !important;
  222. }
  223. }
  224. </style>
  225. </head>
  226. <body>
  227. <div class="frame notranslate">
  228. <div class="tabs">
  229. <div class="panebuttons">
  230. <button class="button-js">JS</button>
  231. <button class="button-html">HTML</button>
  232. <button class="button-css">CSS</button>
  233. <button class="button-export">Export</button>
  234. <button class="button-result">Result</button>
  235. <button class="button-run">Run</button>
  236. <button class="button-fullscreen">&nbsp;</button>
  237. </div>
  238. <div class="panelogo">
  239. <div><a href="/"><span data-subst="textContent|name"></span>&nbsp;</a><a href="/"><img data-subst="src|icon" width="32" height="32"/></a></div>
  240. </div>
  241. </div>
  242. <div class="panes">
  243. <div class="js"><div class="files"></div><div class="code"></div></div>
  244. <div class="html"><div class="files"></div><div class="code"></div></div>
  245. <div class="css"><div class="files"></div><div class="code"></div></div>
  246. <div class="result"><iframe></iframe></div>
  247. <div class="other">
  248. <div>
  249. <div><a href="/"><span data-subst="textContent|name"></span>&nbsp;</a><a href="/"><img data-subst="src|icon" width="64" height="64"/></a></div>
  250. <div class="loading"></div>
  251. </div>
  252. </div>
  253. </div>
  254. </div>
  255. <div class="dialog export" style="display: none;">
  256. <div tabindex="-1">
  257. <p>Export To: </p>
  258. <div class="export-buttons">
  259. <button class="button-jsgist">jsGist</button>
  260. <button class="button-codepen">Codepen</button>
  261. <button class="button-jsfiddle">JSFiddle</button>
  262. <button class="button-codesandbox">CodeSandbox</button>
  263. <button class="button-stackoverflow">Stack Overflow</button>
  264. </div>
  265. </div>
  266. </div>
  267. <div class="dialog copy-dialog" style="display: none;">
  268. <div tabindex="-1">
  269. <p>Copy and paste the text below into a <a href="" target="_blank">stack overflow question</a>.</p>
  270. <pre class="copy-area"></pre>
  271. </div>
  272. </div>
  273. </body>
  274. <script src="https://cdn.jsdelivr.net/npm/monaco-editor@0.40.0/min/vs/loader.js"></script>
  275. <script src="editor-settings.js"></script>
  276. <script src="editor.js"></script>
  277. </html>