-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblocks.js
106 lines (99 loc) · 2.99 KB
/
blocks.js
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
Blockly.Blocks['page_settings'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(120);
this.appendStatementInput("page_header")
.appendField("Header:");
this.appendValueInput("page_color")
.setCheck("color")
.appendField("Text Color:");
this.appendValueInput("page_background")
.setCheck("color")
.appendField("Background Color:");
this.appendValueInput("page_paragraph")
.setCheck("String")
.appendField("Paragraph:");
this.setTooltip('');
}
};
Blockly.Blocks['page_header'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(240);
this.appendValueInput("header_text")
.setCheck("String")
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("Header Text:");
this.appendValueInput("page_color")
.setCheck("color")
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("Color:");
this.setPreviousStatement(true, "page_settings");
this.setTooltip('');
}
};
Blockly.Blocks['page_text'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(300);
this.appendDummyInput()
.appendField(new Blockly.FieldTextInput("Your text."), "page_text");
this.setOutput(true, "String");
this.setTooltip('');
}
};
Blockly.Blocks['color_blue'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(60);
this.appendDummyInput()
.appendField("Blue:")
.appendField(new Blockly.FieldColour("#3333ff"), "blue");
this.setOutput(true, "color");
this.setTooltip('');
}
};
Blockly.Blocks['color_red'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(60);
this.appendDummyInput()
.appendField("Red:")
.appendField(new Blockly.FieldColour("#ff3333"), "red");
this.setOutput(true, "color");
this.setTooltip('');
}
};
Blockly.Blocks['color_green'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(60);
this.appendDummyInput()
.appendField("Green:")
.appendField(new Blockly.FieldColour("#33ff33"), "green");
this.setOutput(true, "color");
this.setTooltip('');
}
};
Blockly.Blocks['color_black'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(60);
this.appendDummyInput()
.appendField("Black:")
.appendField(new Blockly.FieldColour("#000000"), "black");
this.setOutput(true, "color");
this.setTooltip('');
}
};
Blockly.Blocks['color_white'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
this.setColour(60);
this.appendDummyInput()
.appendField("White:")
.appendField(new Blockly.FieldColour("#ffffff"), "white");
this.setOutput(true, "color");
this.setTooltip('');
}
};