-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathworkspace.html
258 lines (249 loc) · 14.8 KB
/
workspace.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
<html>
<title>InventJS - Workspace</title>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<script src="https://unpkg.com/blockly/blockly.min.js"></script>
<script src="https://unpkg.com/[email protected]/javascript_compressed.js"></script>
<script src="https://unpkg.com/[email protected]/python_compressed.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.0/beautify.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="./w3-codecolor.js"></script>
<script src="./customblocks.js"></script>
<script src="https://unpkg.com/split.js/dist/split.min.js"></script>
<style>.sc {overflow: auto;} .title * { display:inline-block;min-width:32px; }
.bord { border:1px solid rgb(180,180,180);border-radius:2px; }
.Abtn {background-color:rgb(233,233,237);padding: 2px 4px 2px 4px;border:1px solid rgb(143,143,157);border-radius:5px;cursor:pointer;}
.Abtn:hover {background-color:rgb(208,208,215);}
.Aw3-bar-item:hover .btn, .Aw3-dropdown-hover:hover .btn {background-color:rgb(208,208,215);}
.btn {padding: 2px 2px 2px 2px;}
.w3-gblack{ padding:5px 16px !important;border-bottom: 6px solid rgb(140,190,145) !important;}
body {background:rgb(230,230,230);} .city,.bbg {background: rgb(247,247,247)}
.city {margin-top:.5rem;}
.outputFrame { width:100%;height:100%; }
.titl {font-family:"Segoe UI",Arial,sans-serif;font-weight:610;}
.runb {border:1px solid green;padding:4px 8px 4px 8px;width:100%;border-radius:6px;background-color:rgb(230,241,230);transition-property: background-color;
transition-duration: .2s;}
.runb:hover {background-color:rgb(205,220,205)}
.n:hover {background-color:inherit !important;}
*{transition-property:background-color;transition-duration: .2s;}
.fa-save,.fa-download {padding:0 10px 0 10px;font-size:1.3rem;}
.split {display:flex;flex-direction:row}.splitv {display:flex;flex-direction:column}
.gutter {background:#eee;background-repeat:no-repeat;background-position:50%;z-index:5}
.gutter.gutter-horizontal{background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==');cursor:col-resize;}
.gutter.gutter-vertical{background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAFAQMAAABo7865AAAABlBMVEVHcEzMzMzyAv2sAAAAAXRSTlMAQObYZgAAABBJREFUeF5jOAMEEAIEEFwAn3kMwcB6I2AAAAAASUVORK5CYII=');cursor:row-resize}
#textarea{
font-family:consolas,Menlo,"courier new",monospace;
font-size:15px;padding:8px;
resize:none;border:none;
line-height:normal;
z-index:0;
}
</style>
<div class="w3-bar w3-light-grey">
<a class="w3-bar-item w3-button w3-black titl"><span class="w3-hide-small w3-hide-medium">InventJS™</span><span class="w3-hide-large">Invent<sub>JS</sub></span></a>
<div class="w3-dropdown-hover" style="margin-left:1rem;">
<button class="w3-button" onclick="saveB()"><span class="btn"><i class="fa fa-save"></i><i class="fa fa-caret-down"></i></span></button>
<div class="w3-dropdown-content w3-bar-block w3-card-4" style="z-index:100;">
<a href="#" class="w3-bar-item w3-button" onclick="saveB()"><span class="btn">Save</span></a>
<a href="#" class="w3-bar-item w3-button" onclick="saveBlocks()"><span class="btn">Save As..</span></a>
</div>
</div>
<div class="w3-dropdown-hover">
<button class="w3-button"><span class="btn"><i class="fa fa-download"></i><i class="fa fa-caret-down"></i></span></button>
<div class="w3-dropdown-content w3-bar-block w3-card-4">
<a href="#" onclick="downloadP('test')" class="w3-bar-item w3-button"><span class="btn">Download Blocks...</span></a>
<a href="#" class="w3-bar-item w3-button"><input type="file" id="files" style="display:none;"/><label for="files" class="btn">Load from Download</label></a>
<a href="#" onclick="packageHTML()" class="w3-bar-item w3-button"><span class="btn">Download as Runnable Webpage</span></a>
</div>
</div>
<a href="#" class="w3-bar-item w3-button n"><span onclick="runC()" class="runb">Run <i class="fa fa-play" style="color:green"></i></span></a>
</div>
<div class="w3-container" style="padding-top:.5rem;padding-left:.7rem;padding-right:0;">
<div class="w3-row split">
<div class="sc w3-mobile" id="blocklyArea" style="width:56%;float:left;widtah:55vw;height:88vh;">
<div id="blocklyDiv" class="sc1 bord"></div>
</div>
<div class="w3-mobile" id="outarea" style="width:44%;wiadth:41vw;display:inline-block;padding-left:0;margin-top:-3rem;">
<div class="w3-bar w3-blak" style="margin:0;padding:0;">
<span class="w3-bar-item w3-hide-small w3-hide-medium">Code Output: </span>
<button class="w3-bar-item w3-button tablink w3-gblack" onclick="openCity(event,'djs')">JS</button>
<!--<button class="w3-bar-item w3-button tablink" onclick="openCity(event,'dpy')">Python</button>-->
</div>
<div id="djs" class="w3-container w3-border city"><div id="textarea" style="height:38vh;padding-top:1rem;width:100%;" class="jsHigh sc"> </div></div>
<!--<div id="dpy" class="w3-container w3-border city" style="display:none"><div id="textpy" style="height:38vh;padding-top:1rem;" class="pythonHigh sc"> </div></div>-->
<div class="title" style="margin:2px;">Output: </div>
<div id="output" class="bord bbg" style="height:44vh;padding:8px;z-index:100;"></div>
</div>
</div>
<div style="position:absolute;bottom:4px;left:1rem;" class="w3-container w3-light-gray w3-hide-small w3-hide-medium">
InventJS™ © 2021 by Isaiah. <a target="_blank" href="https://developers.google.com/blockly">Blocky API</a> by Google
</div>
<script>
var inst = Split(['#blocklyArea','#outarea'],{ minSize:200,gutterAlign:'end',snapOffset:10,dragInterval:5 });
inst.setSizes([55, 44])
</script>
<xml id="toolbox" style="display: none">
<category name="Logic" categorystyle="logic_category">
<block type="controls_if"></block>
<block type="logic_compare"></block>
<block type="logic_operation"></block>
<block type="logic_negate"></block>
<block type="logic_boolean"></block>
<block type="logic_null"></block>
<block type="logic_ternary"></block>
</category>
<category name="Loops" categorystyle="loop_category">
<block type="controls_repeat_ext">
<value name="TIMES"><shadow type="math_number"><field name="NUM">10</field></shadow></value>
</block>
<block type="controls_repeat" disabled="true"></block>
<block type="controls_whileUntil"></block>
<block type="controls_for">
<value name="FROM"><shadow type="math_number"><field name="NUM">1</field></shadow></value>
<value name="TO"><shadow type="math_number"><field name="NUM">10</field></shadow></value>
<value name="BY"><shadow type="math_number"><field name="NUM">1</field></shadow></value>
</block>
<block type="controls_forEach"></block>
<block type="controls_flow_statements"></block>
</category>
<category name="Math" categorystyle="math_category">
<block type="math_number" gap="32"><field name="NUM">123</field></block>
<block type="math_arithmetic">
<value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value>
<value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value>
</block>
<block type="math_single">
<value name="NUM"><shadow type="math_number"><field name="NUM">9</field></shadow></value>
</block>
<block type="math_trig">
<value name="NUM"><shadow type="math_number"><field name="NUM">45</field></shadow></value>
</block>
<block type="math_constant"></block>
<block type="math_number_property">
<value name="NUMBER_TO_CHECK"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
</block>
<block type="math_round">
<value name="NUM"><shadow type="math_number"><field name="NUM">3.1</field></shadow></value>
</block>
<block type="math_on_list"></block>
<block type="math_modulo">
<value name="DIVIDEND"><shadow type="math_number"><field name="NUM">64</field></shadow></value>
<value name="DIVISOR"><shadow type="math_number"><field name="NUM">10</field></shadow></value>
</block>
<block type="math_constrain">
<value name="VALUE"><shadow type="math_number"><field name="NUM">50</field></shadow></value>
<value name="LOW"><shadow type="math_number"><field name="NUM">1</field></shadow></value>
<value name="HIGH"><shadow type="math_number"><field name="NUM">100</field></shadow></value>
</block>
<block type="math_random_int">
<value name="FROM"><shadow type="math_number"><field name="NUM">1</field></shadow></value>
<value name="TO"><shadow type="math_number"><field name="NUM">100</field></shadow></value>
</block>
<block type="math_random_float"></block>
<block type="math_atan2">
<value name="X"><shadow type="math_number"><field name="NUM">1</field></shadow></value>
<value name="Y"><shadow type="math_number"><field name="NUM">1</field></shadow></value>
</block>
</category>
<category name="Text" categorystyle="text_category">
<block type="text"></block>
<block type="text_multiline"></block>
<block type="text_join"></block>
<block type="text_append"><value name="TEXT"><shadow type="text"></shadow></value></block>
<block type="text_length"><value name="VALUE"><shadow type="text"><field name="TEXT">abc</field></shadow></value></block>
<block type="text_isEmpty"><value name="VALUE"><shadow type="text"><field name="TEXT"></field></shadow></value></block>
<block type="text_indexOf">
<value name="VALUE"><block type="variables_get"><field name="VAR">text</field></block></value>
<value name="FIND"><shadow type="text"><field name="TEXT">abc</field></shadow></value>
</block>
<block type="text_charAt"><value name="VALUE"><block type="variables_get"><field name="VAR">text</field></block></value></block>
<block type="text_getSubstring"><value name="STRING"><block type="variables_get"><field name="VAR">text</field></block></value></block>
<block type="text_changeCase"><value name="TEXT"><shadow type="text"><field name="TEXT">abc</field></shadow></value></block>
<block type="text_trim"><value name="TEXT"><shadow type="text"><field name="TEXT">abc</field></shadow></value></block>
<block type="text_count"><value name="SUB"><shadow type="text"></shadow></value><value name="TEXT"><shadow type="text"></shadow></value></block>
<block type="text_replace">
<value name="FROM"><shadow type="text"></shadow></value>
<value name="TO"><shadow type="text"></shadow></value>
<value name="TEXT"><shadow type="text"></shadow></value>
</block>
<block type="text_reverse"><value name="TEXT"><shadow type="text"></shadow></value>
</block>
<label text="Input/Output:" web-class="ioLabel"></label>
<block type="text_print"><value name="TEXT"><shadow type="text"><field name="TEXT">abc</field></shadow></value></block>
<block type="text_prompt_ext"><value name="TEXT"><shadow type="text"><field name="TEXT">abc</field></shadow></value></block>
</category>
<category name="Lists" categorystyle="list_category">
<block type="lists_create_with">
<mutation items="0"></mutation>
</block>
<block type="lists_create_with"></block>
<block type="lists_repeat">
<value name="NUM"><shadow type="math_number"><field name="NUM">5</field></shadow></value>
</block>
<block type="lists_length"></block>
<block type="lists_isEmpty"></block>
<block type="lists_indexOf"><value name="VALUE"><block type="variables_get"><field name="VAR">list</field></block></value></block>
<block type="lists_getIndex"><value name="VALUE"><block type="variables_get"><field name="VAR">list</field></block></value></block>
<block type="lists_setIndex"><value name="LIST"><block type="variables_get"><field name="VAR">list</field></block></value></block>
<block type="lists_getSublist"><value name="LIST"><block type="variables_get"><field name="VAR">list</field></block></value></block>
<block type="lists_split"><value name="DELIM"><shadow type="text"><field name="TEXT">,</field></shadow></value></block>
<block type="lists_sort"></block>
<block type="lists_reverse"></block>
</category>
<category name="Colour" categorystyle="colour_category">
<block type="colour_picker"></block>
<block type="colour_random"></block>
<block type="colour_rgb">
<value name="RED"><shadow type="math_number"><field name="NUM">100</field></shadow></value>
<value name="GREEN"><shadow type="math_number"><field name="NUM">50</field></shadow></value>
<value name="BLUE"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
</block>
<block type="colour_blend">
<value name="COLOUR1"><shadow type="colour_picker"><field name="COLOUR">#ff0000</field></shadow></value>
<value name="COLOUR2"><shadow type="colour_picker"><field name="COLOUR">#3333ff</field></shadow></value>
<value name="RATIO"><shadow type="math_number"><field name="NUM">0.5</field></shadow></value>
</block>
</category>
<sep></sep>
<category name="Variables" categorystyle="variable_category" custom="VARIABLE">
</category>
<category name="Functions" categorystyle="procedure_category"
custom="PROCEDURE"></category>
<sep></sep>
<category name="JS UI" colour="255">
<block type="text"></block>
<block type="text_print"></block>
<block type="js_raw"></block>
<block type="js_elm_by_id"></block>
<block type="js_create_elm"></block>
<block type="js_2"></block>
<block type="js_elm_inner"></block>
<block type="js_onclick"></block>
<block type="js_elm_x"></block>
<block type="js_elm_y"></block>
<block type="js_remove"></block>
<block type="js_coll"></block>
<block type="js_innerWidth"></block>
<block type="js_innerHeight"></block>
</category>
<category name="UI Styles" colour="180">
<block type="js_pos"></block>
<block type="js_top"></block>
<block type="js_left"></block>
<block type="js_bg"></block>
<block type="js_display"></block>
<block type="js_fontSize"></block>
</category>
<category name="Events" colour="255">
<block type="js_onclick"></block>
<block type="js_keydown"></block>
<block type="js_keyup"></block>
<block type="js_keychar"></block>
</category>
<category name="Timer" colour="200">
<block type="js_runlater"></block>
<block type="js_test"></block>
</category>
</xml>
</div>
<script src="./main.js"></script>
</html>