-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
453 lines (402 loc) · 12.9 KB
/
index.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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>遮罩层</title>
<script src="./blockly-master/blockly_compressed.js"></script> <!-- 生成器类文件 -->
<script src="./blockly-master/blocks_compressed.js"></script>
<script src="./blockly-master/msg/js/en.js"></script>
<script src="./blockly-master/python_compressed.js"></script>
<link rel="stylesheet" type="text/css" href="css/animate.min.css">
<style type="text/css">
*{
box-sizing: border-box;
margin: 0;padding: 0;
}
body {
background-color: #fff;
font-family: sans-serif;
}
h1 {
font-weight: normal;
font-size: 140%;
}
#blocklyDiv{
height: 800px;
width: 100%;
}
.blocklySvg{
background:#000!important;
}
.button{
width: 100px;
height: 50px;
background-color: #eee;
border:none;
box-shadow: 3px 3px 0 0 #ccc;
}
.header{
width: 100px;
z-index: 1000;
}
.blocklyFlyout{
/*display: none;*/
}
.blocklyFlyout .blocklyFlyoutBackground{
fill: rgba(63,63,63,0.)!important;
}
#bg {
display: none;
position: absolute;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
background-color: black;
z-index: 1001;
-moz-opacity: 0.7;
opacity: .70;
filter: alpha(opacity=70);
}
#show {
display: none;
position: absolute;
top: 25%;
left: 22%;
/*width: 53%;*/
/*height: 49%;*/
width: 600px;
padding: 8px;
z-index: 1002;
overflow: auto;
background-color: #333;
border: 8px solid #383838;
border-radius: 10px;
margin: 0 150px;
/*margin: 0 auto;*/
}
body
{
/*padding-top: 100px;*/
color: #fff;
font-size: 20px;
}
header p{
padding: 10px 0;
/*margin: 10px 0;*/
}
.body_content{
/* border:1px solid #000; */
/*width: 900px;*/
/* height: 300px; */
margin: 0 auto;
}
/*颜色*/
.clod{
width: 75px;
height: 50px;
border-radius: 10px;
background: #007acc;
float: left;
box-shadow:2px 2px 5px #007acc;
}
.theme{
height: 60px;
}
.theme div{
margin-right: 5px;
height: 50px;
}
.theme .clod:hover{
transition:all .5s;
transform:scale(1.1);
}
.body_content .text_a{
padding-bottom: 10px;
}
.btn_list{
text-align: right;
padding: 10px 0;
}
.btn_list button{
width: 68px;
height: 36px;
border-radius: 5px;
border:none;
color: #fff;
}
.btn_list button.cancel{
background-color: #ff5f2e;
}
.btn_list button.determine{
background-color: #3ac569;
}
.body_strip{
border-top:1px solid #fff;
border-bottom:1px solid #fff;
height: 300px;
overflow-y: scroll;
}
/* 滚动条样式 */
.body_strip::-webkit-scrollbar {
width: 8px;
}
.body_strip::-webkit-scrollbar-track {
background-color:#fff;
border-radius: 2em;
}
.body_strip::-webkit-scrollbar-thumb {
background-color:#333;
border-radius: 2em;
}
.body_strip .body_content tbody tr{
height: 50px;
}
.input_text{
width: 380px;
height: 30px;
border-radius: 5px;
border: none;
text-indent: 10px;
}
</style>
</head>
<body>
<!-- <input id="btnshow" type="button" value="Show" onclick="showdiv();"/> -->
<div id="bg"></div>
<div id="show">
<header>
<p>设置</p>
</header>
<div class="body_strip">
<div>
<table class="body_content animated flip pulse">
<tbody>
<tr>
<td>Api key :</td>
<td>
<input type="text" class="input_text">
</td>
</tr>
<tr>
<td style="text-indent: 30px;">语言 :</td>
<td>
<select name="" id="" class="input_text">
<option value="en">简体中文</option>
<option value="雅蠛蝶">日语</option>
<option value="塞瓦蒂卡">泰语</option>
<option value="沙拉嘿哟">韩语</option>
<option value="english">English</option>
</select>
</td>
</tr>
<tr>
<td style="text-indent: 30px;">类别 :</td>
<td>
<select name="" id="" class="input_text">
<option value="Core">Core</option>
<option value="Stick">Stick</option>
</select>
</td>
</tr>
<tr>
<td style="text-indent: -8px;">主题颜色 :</td>
<td class="theme">
<div class="clod"></div>
<div class="clod"></div>
<div class="clod"></div>
<div class="clod"></div>
<div class="clod"></div>
</td>
</tr>
<tr>
<td style="text-indent: 30px;">固件 :</td>
<td class="text_a">
<a href="">M5Burner-Flow-For-Windows</a>
</td>
</tr>
<tr>
<td></td>
<td class="text_a">
<a href="">M5Burner-Flow-For-Windows</a>
</td>
</tr>
<tr>
<td></td>
<td class="text_a">
<a href="">M5Burner-Flow-For-Windows</a>
</td>
</tr>
<tr>
<td style="text-indent: 30px;">文档 :</td>
<td class="text_a">
<a href="">M5Burner-Flow-For-Windows</a>
</td>
</tr>
<tr>
<td></td>
<td class="text_a">
<a href="">M5Burner-Flow-For-Windows</a>
</td>
</tr>
<tr>
<td></td>
<td class="text_a">
<a href="">M5Burner-Flow-For-Windows</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<footer>
<div class="btn_list">
<button class="cancel" id="btnclose" onclick="hidediv();">取消</button>
<button class="determine">确定</button>
</div>
</footer>
</div>
<p>
<button onclick="showCode()" class="button">Show Code</button>
<button onclick="shouView()" class="button">Show View</button>
</p>
<div id="blocklyDiv"></div>
<xml id="toolbox" style="display: none">
<category name="控制" colour="200">
<block type="controls_if"></block>
<block type="controls_whileUntil"></block>
<block type="controls_for">
</category>
<category name="逻辑">
<block type="logic_compare"></block>
<block type="logic_operation"></block>
<block type="logic_boolean"></block>
</category>
<category name="自定义块">
<block type="lu"></block>
<block type="wen"></block>
<block type="peng"></block>
<block type="ming"></block>
<block type="zhan"></block>
</category>
<category name="Variables" colour="330" custom="VARIABLE"></category>
<category name="Functions" colour="290" custom="PROCEDURE"></category>
</xml>
<!-- start 界面显示块 -->
<xml id="startBlocks" style="display: none">
<block type="daluji"></block>
</xml>
<!-- end 界面显示块 -->
<!-- 代码输入 -->
<textarea id="text"></textarea>
<script>
Blockly.Msg.EVERYTHING_HUE = 42; //声明一个变量这样
//start 自定义的 块
Blockly.Blocks['controls_repeat_ext_daluji'] = {
/**
* Block for repeat n times (external number).
* @this Blockly.Block
*/
init: function() {
this.jsonInit({
"message0": Blockly.Msg.CONTROLS_REPEAT_TITLE,
"args0": [
{
"type": "input_value",
"name": "TIMESa",
"check": "Number"
}
],
"previousStatement": null,
"nextStatement": null,
"colour": Blockly.Blocks.loops.HUE,
"tooltip": Blockly.Msg.CONTROLS_REPEAT_TOOLTIP,
"helpUrl": Blockly.Msg.CONTROLS_REPEAT_HELPURL
});
this.appendStatementInput('DO').appendField(Blockly.Msg.CONTROLS_REPEAT_INPUT_DO);
}
};
Blockly.Python['controls_repeat_ext_daluji'] = function(block) { //这段代码是输出python 代码
return 'for count in range(0):pass'; //这段是代码
}
Blockly.Blocks['daluji']={
init:function() {
this.jsonInit({
"type": "setup",
"message0": "Setup",
"nextStatement": null,
"colour": 230,
"tooltip": "",
"helpUrl": ""
});
}
};
Blockly.Python['daluji']=function(){
return "for count in range(0):pass";
}
//end 自定义的块
//start 配置
var workspace = Blockly.inject('blocklyDiv',
{
media: './blockly-master/media/',
toolbox: document.getElementById('toolbox'),
sounds: false, //关闭声音
collapse:true,
trashcan:true, //垃圾桶
maxTrashcanContents:20, //垃圾数量
scrollbars:true, //滚动条
grid:{ //网格
spacing: 15, //网格点之间的距离
length: 2,
colour: '#ccc',
trashcan: true,
snap: true},
zoom:
{
controls: true,
wheel: false, //滚动监听,放大
startScale: 1.0,
maxScale: 3,
minScale: 0.3,
scaleSpeed: 1.2
}
// trashcan: true});
});
console.log(workspace);
Blockly.Xml.domToWorkspace(document.getElementById('startBlocks'),workspace);
//end 配置
//显示代码
var t_box = document.getElementById('blocklyDiv');
var text = document.getElementById('text');
function showCode() {
var code = Blockly.Python.workspaceToCode(workspace);
console.log(code);
t_box.style.display="none";
if (text.style.display=="none") {
text.style.display="block";
}else if (text.style.display=="block") {
text.style.display="none";
}
text.innerHTML=code;
console.log(code);
}
//显示视图
function shouView(){
t_box.style.display="block";
text.style.display="none";
return true;
}
</script>
<script type="text/javascript">
(function () {
document.getElementById("bg").style.display ="block";
document.getElementById("show").style.display ="block";
})();
//取消按钮
function hidediv() {
document.getElementById("bg").style.display ='none';
document.getElementById("show").style.display ='none';
}
</script>
<script src="./js/js.js"></script>
</body>
</html>