| 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 |
|
| 65 |
button { |
| 66 |
border-radius: 4px; |
| 67 |
border: 1px solid #ddd; |
| 68 |
background-color: #eee; |
| 69 |
color: #000; |
| 70 |
padding: 10px; |
| 71 |
margin: 0 5px; |
| 72 |
font-size: large; |
| 73 |
} |
| 74 |
button:hover:not(:disabled) { |
| 75 |
box-shadow: 2px 2px 5px #888; |
| 76 |
} |
| 77 |
button:disabled { |
| 78 |
opacity: 0.6; |
| 79 |
} |
| 80 |
button>* { |
| 81 |
opacity: 0.6; |
| 82 |
vertical-align: text-bottom; |
| 83 |
} |
| 84 |
button:hover:not(:disabled)>* { |
| 85 |
opacity: 1; |
| 86 |
} |
| 87 |
#linkButton { |
| 88 |
display: none; |
| 89 |
} |
| 90 |
</style> |
| 91 |
<link rel="stylesheet" href="../prettify.css"> |
| 92 |
<script src="../prettify.js"></script> |
| 93 |
</head> |
| 94 |
<body> |
| 95 |
<table> |
| 96 |
<tr> |
| 97 |
<td width="50%" height="5%"> |
| 98 |
<h1><a href="https://developers.google.com/blockly/">Blockly</a> > |
| 99 |
<a href="../index.html">Demos</a> > Block Factory</h1> |
| 100 |
</td> |
| 101 |
<td width="50%" height="5%"> |
| 102 |
<table> |
| 103 |
<tr> |
| 104 |
<td style="vertical-align: bottom;"> |
| 105 |
<h3>Preview: |
| 106 |
<select id="direction"> |
| 107 |
<option value="ltr">LTR</option> |
| 108 |
<option value="rtl">RTL</option> |
| 109 |
</select> |
| 110 |
</h3> |
| 111 |
</td> |
| 112 |
<td style="vertical-align: middle; text-align: right;"> |
| 113 |
<button id="linkButton" title="Save and link to blocks."> |
| 114 |
<img src="link.png" height="21" width="21"> |
| 115 |
</button> |
| 116 |
<button id="linkButton" title="Save and link to blocks."> |
| 117 |
<img src="link.png" height="21" width="21"> |
| 118 |
</button> |
| 119 |
<button id="helpButton" title="View documentation in new window."> |
| 120 |
<span>Help</span> |
| 121 |
</button> |
| 122 |
</td> |
| 123 |
</tr> |
| 124 |
</table> |
| 125 |
</td> |
| 126 |
</tr> |
| 127 |
<tr> |
| 128 |
<td width="50%" height="95%" style="padding: 2px;"> |
| 129 |
<div id="blockly"></div> |
| 130 |
<div id="blocklyMask"></div> |
| 131 |
</td> |
| 132 |
<td width="50%" height="95%"> |
| 133 |
<table> |
| 134 |
<tr> |
| 135 |
<td height="30%"> |
| 136 |
<div id="preview"></div> |
| 137 |
</td> |
| 138 |
</tr> |
| 139 |
<tr> |
| 140 |
<td height="5%"> |
| 141 |
<h3>Language code: |
| 142 |
<select id="format"> |
| 143 |
<option value="JavaScript">JavaScript</option> |
| 144 |
<option value="JSON">JSON</option> |
| 145 |
<option value="Manual">Manual edit...</option> |
| 146 |
</select> |
| 147 |
</h3> |
| 148 |
</td> |
| 149 |
</tr> |
| 150 |
<tr> |
| 151 |
<td height="30%"> |
| 152 |
<pre id="languagePre"></pre> |
| 153 |
<textarea id="languageTA"></textarea> |
| 154 |
</td> |
| 155 |
</tr> |
| 156 |
<tr> |
| 157 |
<td height="5%"> |
| 158 |
<h3>Generator stub: |
| 159 |
<select id="language"> |
| 160 |
<option value="JavaScript">JavaScript</option> |
| 161 |
<option value="Python">Python</option> |
| 162 |
<option value="PHP">PHP</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"></block> |
| 180 |
<block type="input_statement"></block> |
| 181 |
<block type="input_dummy"></block> |
| 182 |
</category> |
| 183 |
<category name="Field"> |
| 184 |
<block type="field_static"></block> |
| 185 |
<block type="field_input"></block> |
| 186 |
<block type="field_angle"></block> |
| 187 |
<block type="field_dropdown"></block> |
| 188 |
<block type="field_checkbox"></block> |
| 189 |
<block type="field_colour"></block> |
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
<block type="field_variable"></block> |
| 196 |
<block type="field_image"></block> |
| 197 |
</category> |
| 198 |
<category name="Type"> |
| 199 |
<block type="type_group"></block> |
| 200 |
<block type="type_null"></block> |
| 201 |
<block type="type_boolean"></block> |
| 202 |
<block type="type_number"></block> |
| 203 |
<block type="type_string"></block> |
| 204 |
<block type="type_list"></block> |
| 205 |
<block type="type_other"></block> |
| 206 |
</category> |
| 207 |
<category name="Colour" id="colourCategory"> |
| 208 |
<block type="colour_hue"><mutation colour="20"></mutation><field name="HUE">20</field></block> |
| 209 |
<block type="colour_hue"><mutation colour="65"></mutation><field name="HUE">65</field></block> |
| 210 |
<block type="colour_hue"><mutation colour="120"></mutation><field name="HUE">120</field></block> |
| 211 |
<block type="colour_hue"><mutation colour="160"></mutation><field name="HUE">160</field></block> |
| 212 |
<block type="colour_hue"><mutation colour="210"></mutation><field name="HUE">210</field></block> |
| 213 |
<block type="colour_hue"><mutation colour="230"></mutation><field name="HUE">230</field></block> |
| 214 |
<block type="colour_hue"><mutation colour="260"></mutation><field name="HUE">260</field></block> |
| 215 |
<block type="colour_hue"><mutation colour="290"></mutation><field name="HUE">290</field></block> |
| 216 |
<block type="colour_hue"><mutation colour="330"></mutation><field name="HUE">330</field></block> |
| 217 |
</category> |
| 218 |
</xml> |
| 219 |
</body> |
| 220 |
</html> |