Commit 535b4202 authored by Neil Fraser's avatar Neil Fraser

Convert 5 blocks to JSON.

No functional change.
parent 20820b58
...@@ -40,12 +40,20 @@ Blockly.Blocks['colour_picker'] = { ...@@ -40,12 +40,20 @@ Blockly.Blocks['colour_picker'] = {
* @this Blockly.Block * @this Blockly.Block
*/ */
init: function() { init: function() {
this.setHelpUrl(Blockly.Msg.COLOUR_PICKER_HELPURL); this.jsonInit({
this.setColour(Blockly.Blocks.colour.HUE); "message0": "%1",
this.appendDummyInput() "args0": [
.appendField(new Blockly.FieldColour('#ff0000'), 'COLOUR'); {
this.setOutput(true, 'Colour'); "type": "field_colour",
this.setTooltip(Blockly.Msg.COLOUR_PICKER_TOOLTIP); "name": "COLOUR",
"colour": "#ff0000"
}
],
"output": "Colour",
"colour": Blockly.Blocks.colour.HUE,
"tooltip": Blockly.Msg.COLOUR_PICKER_TOOLTIP,
"helpUrl": Blockly.Msg.COLOUR_PICKER_HELPURL
});
} }
}; };
...@@ -55,12 +63,13 @@ Blockly.Blocks['colour_random'] = { ...@@ -55,12 +63,13 @@ Blockly.Blocks['colour_random'] = {
* @this Blockly.Block * @this Blockly.Block
*/ */
init: function() { init: function() {
this.setHelpUrl(Blockly.Msg.COLOUR_RANDOM_HELPURL); this.jsonInit({
this.setColour(Blockly.Blocks.colour.HUE); "message0": Blockly.Msg.COLOUR_RANDOM_TITLE,
this.appendDummyInput() "output": "Colour",
.appendField(Blockly.Msg.COLOUR_RANDOM_TITLE); "colour": Blockly.Blocks.colour.HUE,
this.setOutput(true, 'Colour'); "tooltip": Blockly.Msg.COLOUR_RANDOM_TOOLTIP,
this.setTooltip(Blockly.Msg.COLOUR_RANDOM_TOOLTIP); "helpUrl": Blockly.Msg.COLOUR_RANDOM_HELPURL
});
} }
}; };
......
...@@ -40,12 +40,13 @@ Blockly.Blocks['lists_create_empty'] = { ...@@ -40,12 +40,13 @@ Blockly.Blocks['lists_create_empty'] = {
* @this Blockly.Block * @this Blockly.Block
*/ */
init: function() { init: function() {
this.setHelpUrl(Blockly.Msg.LISTS_CREATE_EMPTY_HELPURL); this.jsonInit({
this.setColour(Blockly.Blocks.lists.HUE); "message0": Blockly.Msg.LISTS_CREATE_EMPTY_TITLE,
this.setOutput(true, 'Array'); "output": "Array",
this.appendDummyInput() "colour": Blockly.Blocks.lists.HUE,
.appendField(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE); "tooltip": Blockly.Msg.LISTS_CREATE_EMPTY_TOOLTIP,
this.setTooltip(Blockly.Msg.LISTS_CREATE_EMPTY_TOOLTIP); "helpUrl": Blockly.Msg.LISTS_CREATE_EMPTY_HELPURL
});
} }
}; };
......
...@@ -389,15 +389,23 @@ Blockly.Blocks['logic_boolean'] = { ...@@ -389,15 +389,23 @@ Blockly.Blocks['logic_boolean'] = {
* @this Blockly.Block * @this Blockly.Block
*/ */
init: function() { init: function() {
var BOOLEANS = this.jsonInit({
[[Blockly.Msg.LOGIC_BOOLEAN_TRUE, 'TRUE'], "message0": "%1",
[Blockly.Msg.LOGIC_BOOLEAN_FALSE, 'FALSE']]; "args0": [
this.setHelpUrl(Blockly.Msg.LOGIC_BOOLEAN_HELPURL); {
this.setColour(Blockly.Blocks.logic.HUE); "type": "field_dropdown",
this.setOutput(true, 'Boolean'); "name": "BOOL",
this.appendDummyInput() "options": [
.appendField(new Blockly.FieldDropdown(BOOLEANS), 'BOOL'); [Blockly.Msg.LOGIC_BOOLEAN_TRUE, "TRUE"],
this.setTooltip(Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP); [Blockly.Msg.LOGIC_BOOLEAN_FALSE, "FALSE"]
]
}
],
"output": "Boolean",
"colour": Blockly.Blocks.logic.HUE,
"tooltip": Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP,
"helpUrl": Blockly.Msg.LOGIC_BOOLEAN_HELPURL
});
} }
}; };
...@@ -407,12 +415,13 @@ Blockly.Blocks['logic_null'] = { ...@@ -407,12 +415,13 @@ Blockly.Blocks['logic_null'] = {
* @this Blockly.Block * @this Blockly.Block
*/ */
init: function() { init: function() {
this.setHelpUrl(Blockly.Msg.LOGIC_NULL_HELPURL); this.jsonInit({
this.setColour(Blockly.Blocks.logic.HUE); "message0": Blockly.Msg.LOGIC_NULL,
this.setOutput(true); "output": null,
this.appendDummyInput() "colour": Blockly.Blocks.logic.HUE,
.appendField(Blockly.Msg.LOGIC_NULL); "tooltip": Blockly.Msg.LOGIC_NULL_TOOLTIP,
this.setTooltip(Blockly.Msg.LOGIC_NULL_TOOLTIP); "helpUrl": Blockly.Msg.LOGIC_NULL_HELPURL
});
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment