editor.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <!DOCTYPE html>
  2. <style>
  3. html {
  4. box-sizing: border-box;
  5. }
  6. *, *:before, *:after {
  7. box-sizing: inherit;
  8. }
  9. body {
  10. margin: 0;
  11. font-family: sans-serif;
  12. overflow: hidden;
  13. height: 100vh;
  14. }
  15. a {
  16. text-decoration: none;
  17. color: inherit;
  18. }
  19. iframe {
  20. display: block;
  21. border: none;
  22. }
  23. .frame {
  24. min-width: 100vw;
  25. min-height: 100vh;
  26. max-width: 100vw;
  27. max-height: 100vh;
  28. display: flex;
  29. flex-direction: column;
  30. background: #444;
  31. color: #AAA;
  32. }
  33. .tabs {
  34. flex: 0 0 auto;
  35. display: flex;
  36. justify-content: space-between;
  37. align-items: center;
  38. background: #666;
  39. }
  40. .panes {
  41. display: flex;
  42. flex: 1 1 auto;
  43. }
  44. .panes>div {
  45. display: none;
  46. flex: 1 1 50%;
  47. flex-direction: column;
  48. min-width: 0;
  49. /*
  50. this calc is to get things to work in safari.
  51. but firefox and chrome will let children of
  52. the panes go 100% size but not safari
  53. */
  54. height: calc(100vh - 2.5em - 5px - 1px);
  55. }
  56. .panes .code {
  57. flex: 1 1 auto;
  58. position: relative;
  59. height: 100%;
  60. }
  61. .panes .code > div {
  62. height: 100%;
  63. }
  64. .panes .files {
  65. position: relative;
  66. }
  67. .panes .fileSelected {
  68. color: white;
  69. background: #666;
  70. }
  71. .panes .files > div {
  72. border: 1px solid black;
  73. font-family: monospace;
  74. text-overflow: ellipsis;
  75. overflow: hidden;
  76. width: 100%;
  77. white-space: nowrap;
  78. cursor: pointer;
  79. }
  80. .panes>div.other {
  81. display: block
  82. }
  83. .editor {
  84. g-overflow: auto;
  85. }
  86. .result {
  87. overflow: auto;
  88. }
  89. .result>iframe {
  90. width: 100%;
  91. height: 100%;
  92. background: white;
  93. }
  94. .other>div,
  95. .other>div>div {
  96. display: flex;
  97. justify-content: center;
  98. align-items: center;
  99. align-content: center;
  100. font-size: xx-large;
  101. }
  102. .other>div {
  103. height: 100%;
  104. flex-direction: column;
  105. }
  106. .other .loading {
  107. height: 2em;
  108. width: 2em;
  109. animation: rotate 0.8s infinite linear;
  110. border: 0.4em solid #fff;
  111. border-right-color: transparent;
  112. border-radius: 50%;
  113. }
  114. @keyframes rotate {
  115. 0% { transform: rotate(0deg); }
  116. 100% { transform: rotate(360deg); }
  117. }
  118. .tabs>div {
  119. padding: 0.125em;
  120. }
  121. .panebuttons>button {
  122. padding: 0.5em;
  123. border: none;
  124. background: #AAA;
  125. border-bottom: 5px solid black;
  126. margin: 0.25em;
  127. width: 5em;
  128. cursor: pointer;
  129. }
  130. .panebuttons>button:focus {
  131. outline: none;
  132. }
  133. .panelogo {
  134. font-size: medium;
  135. }
  136. .panelogo>*>* {
  137. vertical-align: middle;
  138. display: inline-block;
  139. color: #CCC;
  140. }
  141. .show {
  142. background: #FFF !important;
  143. border-bottom: none !important;
  144. border-top: 5px solid #666 !important;
  145. }
  146. .button-result {
  147. margin-left: 2em !important;
  148. }
  149. .panebuttons>.button-fullscreen {
  150. background-image: url(editor-fullscreen-icon.svg);
  151. background-size: 80% 80%;
  152. background-position: center center;
  153. background-repeat: no-repeat no-repeat;
  154. }
  155. .fullscreen .panebuttons>.button-fullscreen {
  156. background-image: url(editor-unfullscreen-icon.svg) !important;
  157. }
  158. @media ( max-width: 740px ) {
  159. .panelogo>div>a:nth-child(1) {
  160. display: none;
  161. }
  162. }
  163. @media ( max-width: 590px ) {
  164. .tabs {
  165. display: none;
  166. }
  167. .panes>div {
  168. display: none !important;
  169. height: auto;
  170. }
  171. .panes>.result {
  172. display: block !important;
  173. }
  174. }
  175. </style>
  176. <body>
  177. <div class="frame">
  178. <div class="tabs">
  179. <div class="panebuttons">
  180. <button class="button-js">JS</button>
  181. <button class="button-html">HTML</button>
  182. <button class="button-css">CSS</button>
  183. <button class="button-codepen">Codepen</button>
  184. <button class="button-jsfiddle">JSFiddle</button>
  185. <button class="button-result">Result</button>
  186. <button class="button-run">Run</button>
  187. <button class="button-fullscreen">&nbsp;</button>
  188. </div>
  189. <div class="panelogo">
  190. <div><a href="/"><span data-subst="textContent|name"></span>&nbsp;</a><a href="/"><img data-subst="src|icon" width="32" height="32"/></a></div>
  191. </div>
  192. </div>
  193. <div class="panes">
  194. <div class="js"><div class="files"></div><div class="code"></div></div>
  195. <div class="html"><div class="files"></div><div class="code"></div></div>
  196. <div class="css"><div class="files"></div><div class="code"></div></div>
  197. <div class="result"><iframe></iframe></div>
  198. <div class="other">
  199. <div>
  200. <div><a href="/"><span data-subst="textContent|name"></span>&nbsp;</a><a href="/"><img data-subst="src|icon" width="64" height="64"/></a></div>
  201. <div class="loading"></div>
  202. </div>
  203. </div>
  204. </div>
  205. </div>
  206. </body>
  207. <script src="/monaco-editor/min/vs/loader.js"></script>
  208. <script src="editor-settings.js"></script>
  209. <script src="editor.js"></script>