-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblockly.html
141 lines (129 loc) · 5.59 KB
/
blockly.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!--<meta charset="utf-8">-->
<script src="js/blockly/libraries/jquery-2.1.1.js"></script>
<!--4 files for Blockly-->
<script src="js/blockly/libraries/blockly_compressed.js"></script>
<!--<script src="js/libraries/blocks_compressed.js"></script>-->
<!--REPLACING SINGLE FILE WITH UNCOMPRESSED-->
<script src="js/blockly/libraries/blocks/logic.js"></script>
<!--Modified repeat block-->
<script src="js/blockly/libraries/blocks/loops.js"></script>
<script src="js/blockly/libraries/blocks/math.js"></script>
<script src="js/blockly/libraries/blocks/text.js"></script>
<script src="js/blockly/libraries/blocks/lists.js"></script>
<script src="js/blockly/libraries/blocks/colour.js"></script>
<script src="js/blockly/libraries/blocks/variables.js"></script>
<script src="js/blockly/libraries/blocks/procedures.js"></script>
<!--<script src="js/libraries/javascript_compressed.js"></script>-->
<!--REPLACING SINGLE FILE WITH UNCOMPRESSED-->
<script src="js/blockly/libraries/generators/javascript.js"></script>
<script src="js/blockly/libraries/generators/javascript/logic.js"></script>
<script src="js/blockly/libraries/generators/javascript/loops.js"></script>
<script src="js/blockly/libraries/generators/javascript/math.js"></script>
<script src="js/blockly/libraries/generators/javascript/text.js"></script>
<script src="js/blockly/libraries/generators/javascript/lists.js"></script>
<script src="js/blockly/libraries/generators/javascript/colour.js"></script>
<script src="js/blockly/libraries/generators/javascript/variables.js"></script>
<script src="js/blockly/libraries/generators/javascript/procedures.js"></script>
<script src="js/blockly/msg/js/en.js"></script>
<script src="js/blockly/libraries/acorn_interpreter.js"></script>
<!-- CUSTOM BLOCKS -->
<script src="js/blockly/custom/blocks/start.js"></script>
<script src="js/blockly/custom/blocks/collectible_number.js"></script>
<script src="js/blockly/custom/blocks/walk.js"></script>
<script src="js/blockly/custom/blocks/forward.js"></script>
<script src="js/blockly/custom/blocks/turn_right.js"></script>
<script src="js/blockly/custom/blocks/turn_left.js"></script>
<script src="js/blockly/custom/blocks/jump.js"></script>
<script src="js/blockly/custom/blocks/super_jump.js"></script>
<script src="js/blockly/custom/blocks/long_jump.js"></script>
<script src="js/blockly/custom/blocks/empty.js"></script>
<script src="js/blockly/custom/blocks/empty_cell.js"></script>
<script src="js/blockly/custom/blocks/empty_cell_left.js"></script>
<script src="js/blockly/custom/blocks/empty_cell_right.js"></script>
<script src="js/blockly/custom/blocks/obstacle.js"></script>
<script src="js/blockly/custom/blocks/obstacle2.js"></script>
<script src="js/blockly/custom/blocks/obstacle3.js"></script>
<script src="js/blockly/custom/blocks/obstacle4.js"></script>
<script src="js/blockly/custom/blocks/target.js"></script>
<script src="js/blockly/custom/blocks/target2.js"></script>
<script src="js/blockly/custom/blocks/repeat_until.js"></script>
<script src="js/blockly/custom/blocks/repeat_while.js"></script>
<style>
html, body {
background-color: #fff;
margin: 0;
padding: 0;
overflow: hidden;
height: 100%;
}
.blocklySvg {
height: 100%;
width: 100%;
}
</style>
<script>
function init() {
Blockly.inject(document.body,
{
toolbox: document.getElementById('toolbox'),
maxBlocks: 9,
scrollbars: false,
});
// Let the top-level application know that Blockly is ready.
window.parent.blocklyLoaded(Blockly);
function onchange() {
var blocksLeft = Blockly.mainWorkspace.remainingCapacity();
console.log(blocksLeft + " blocks left");
}
Blockly.addChangeListener(onchange);
}
</script>
</head>
<body onload="init()">
<xml id="toolbox" style="display: none">
<block type="forward"></block>
<block type="turn_left"></block>
<block type="turn_right"></block>
<block type="controls_repeat">
<field name="TIMES">3</field>
</block>
<block type="controls_repeat_ext">
</block>
<block type="math_number" editable="false">
<field name="NUM">3</field>
</block>
<!-- <block type="controls_for">
<value name="FROM">
<block type="math_number">
<field name="NUM">1</field>
</block>
</value>
<value name="TO">
<block type="math_number">
<field name="NUM">10</field>
</block>
</value>
<value name="BY">
<block type="math_number">
<field name="NUM">1</field>
</block>
</value>
</block> -->
<!-- <category name="Core"> -->
<!-- <category name="Control"> -->
<!-- <block type="controls_if"></block>
<block type="controls_whileUntil"></block> -->
<!-- </category> -->
<!-- <category name="Logic"> -->
<!-- <block type="logic_compare"></block>
<block type="logic_operation"></block>
<block type="logic_boolean"></block> -->
<!-- </category> -->
<!-- </category> -->
</xml>
</body>
</html>