index.html 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="target-densitydpi=device-dpi, height=660, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  6. <title>Blockly Demo: Block Factory</title>
  7. <script src="/storage.js"></script>
  8. <script src="factory.js"></script>
  9. <script src="../../blockly_compressed.js"></script>
  10. <script src="../../msg/messages.js"></script>
  11. <script src="blocks.js"></script>
  12. <style>
  13. html, body {
  14. height: 100%;
  15. }
  16. body {
  17. background-color: #fff;
  18. font-family: sans-serif;
  19. margin: 0 5px;
  20. overflow: hidden
  21. }
  22. h1 {
  23. font-weight: normal;
  24. font-size: 140%;
  25. }
  26. h3 {
  27. margin-top: 5px;
  28. margin-bottom: 0;
  29. }
  30. table {
  31. height: 100%;
  32. width: 100%;
  33. }
  34. td {
  35. vertical-align: top;
  36. padding: 0;
  37. }
  38. #blockly {
  39. position: fixed;
  40. }
  41. #blocklyMask {
  42. background-color: #000;
  43. cursor: not-allowed;
  44. display: none;
  45. position: fixed;
  46. opacity: 0.2;
  47. z-index: 9;
  48. }
  49. #preview {
  50. position: absolute;
  51. }
  52. pre,
  53. #languageTA {
  54. border: #ddd 1px solid;
  55. margin-top: 0;
  56. position: absolute;
  57. overflow: scroll;
  58. }
  59. #languageTA {
  60. display: none;
  61. font-family: monospace;
  62. font-size: 10pt;
  63. }
  64. button {
  65. border-radius: 4px;
  66. border: 1px solid #ddd;
  67. background-color: #eee;
  68. color: #000;
  69. padding: 10px;
  70. margin: 0 5px;
  71. font-size: large;
  72. }
  73. button:hover:not(:disabled) {
  74. box-shadow: 2px 2px 5px #888;
  75. }
  76. button:disabled {
  77. opacity: 0.6;
  78. }
  79. button>* {
  80. opacity: 0.6;
  81. vertical-align: text-bottom;
  82. }
  83. button:hover:not(:disabled)>* {
  84. opacity: 1;
  85. }
  86. #linkButton {
  87. display: none;
  88. }
  89. </style>
  90. <link rel="stylesheet" href="../prettify.css">
  91. <script src="../prettify.js"></script>
  92. </head>
  93. <body>
  94. <table>
  95. <tr>
  96. <td width="50%" height="5%">
  97. <h1><a href="https://developers.google.com/blockly/">Blockly</a> &gt;
  98. <a href="../index.html">Demos</a> &gt; Block Factory</h1>
  99. </td>
  100. <td width="50%" height="5%">
  101. <table>
  102. <tr>
  103. <td style="vertical-align: bottom;">
  104. <h3>Preview:
  105. <select id="direction">
  106. <option value="ltr">LTR</option>
  107. <option value="rtl">RTL</option>
  108. </select>
  109. </h3>
  110. </td>
  111. <td style="vertical-align: middle; text-align: right;">
  112. <button id="linkButton" title="Save and link to blocks.">
  113. <img src="link.png" height="21" width="21">
  114. </button>
  115. <button id="linkButton" title="Save and link to blocks.">
  116. <img src="link.png" height="21" width="21">
  117. </button>
  118. <button id="helpButton" title="View documentation in new window.">
  119. <span>Help</span>
  120. </button>
  121. </td>
  122. </tr>
  123. </table>
  124. </td>
  125. </tr>
  126. <tr>
  127. <td width="50%" height="95%" style="padding: 2px;">
  128. <div id="blockly"></div>
  129. <div id="blocklyMask"></div>
  130. </td>
  131. <td width="50%" height="95%">
  132. <table>
  133. <tr>
  134. <td height="30%">
  135. <div id="preview"></div>
  136. </td>
  137. </tr>
  138. <tr>
  139. <td height="5%">
  140. <h3>Language code:
  141. <select id="format">
  142. <option value="JSON">JSON</option>
  143. <option value="JavaScript">JavaScript</option>
  144. <option value="Manual">Manual edit&hellip;</option>
  145. </select>
  146. </h3>
  147. </td>
  148. </tr>
  149. <tr>
  150. <td height="30%">
  151. <pre id="languagePre"></pre>
  152. <textarea id="languageTA"></textarea>
  153. </td>
  154. </tr>
  155. <tr>
  156. <td height="5%">
  157. <h3>Generator stub:
  158. <select id="language">
  159. <option value="JavaScript">JavaScript</option>
  160. <option value="Python">Python</option>
  161. <option value="PHP">PHP</option>
  162. <option value="Lua">Lua</option>
  163. <option value="Dart">Dart</option>
  164. </select>
  165. </h3>
  166. </td>
  167. </tr>
  168. <tr>
  169. <td height="30%">
  170. <pre id="generatorPre"></pre>
  171. </td>
  172. </tr>
  173. </table>
  174. </td>
  175. </tr>
  176. </table>
  177. <xml id="toolbox" style="display: none">
  178. <category name="Input">
  179. <block type="input_value">
  180. <value name="TYPE">
  181. <shadow type="type_null"></shadow>
  182. </value>
  183. </block>
  184. <block type="input_statement">
  185. <value name="TYPE">
  186. <shadow type="type_null"></shadow>
  187. </value>
  188. </block>
  189. <block type="input_dummy"></block>
  190. </category>
  191. <category name="Field">
  192. <block type="field_static"></block>
  193. <block type="field_input"></block>
  194. <block type="field_number"></block>
  195. <block type="field_angle"></block>
  196. <block type="field_dropdown"></block>
  197. <block type="field_checkbox"></block>
  198. <block type="field_colour"></block>
  199. <!--
  200. Date picker commented out since it increases footprint by 60%.
  201. Add it only if you need it. See also goog.require in blockly.js.
  202. <block type="field_date"></block>
  203. -->
  204. <block type="field_variable"></block>
  205. <block type="field_image"></block>
  206. </category>
  207. <category name="Type">
  208. <block type="type_group"></block>
  209. <block type="type_null"></block>
  210. <block type="type_boolean"></block>
  211. <block type="type_number"></block>
  212. <block type="type_string"></block>
  213. <block type="type_list"></block>
  214. <block type="type_other"></block>
  215. </category>
  216. <category name="Colour" id="colourCategory">
  217. <block type="colour_hue"><mutation colour="20"></mutation><field name="HUE">20</field></block>
  218. <block type="colour_hue"><mutation colour="65"></mutation><field name="HUE">65</field></block>
  219. <block type="colour_hue"><mutation colour="120"></mutation><field name="HUE">120</field></block>
  220. <block type="colour_hue"><mutation colour="160"></mutation><field name="HUE">160</field></block>
  221. <block type="colour_hue"><mutation colour="210"></mutation><field name="HUE">210</field></block>
  222. <block type="colour_hue"><mutation colour="230"></mutation><field name="HUE">230</field></block>
  223. <block type="colour_hue"><mutation colour="260"></mutation><field name="HUE">260</field></block>
  224. <block type="colour_hue"><mutation colour="290"></mutation><field name="HUE">290</field></block>
  225. <block type="colour_hue"><mutation colour="330"></mutation><field name="HUE">330</field></block>
  226. </category>
  227. </xml>
  228. </body>
  229. </html>