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'] = {
* @this Blockly.Block
*/
init: function() {
this.setHelpUrl(Blockly.Msg.COLOUR_PICKER_HELPURL);
this.setColour(Blockly.Blocks.colour.HUE);
this.appendDummyInput()
.appendField(new Blockly.FieldColour('#ff0000'), 'COLOUR');
this.setOutput(true, 'Colour');
this.setTooltip(Blockly.Msg.COLOUR_PICKER_TOOLTIP);
this.jsonInit({
"message0": "%1",
"args0": [
{
"type": "field_colour",
"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'] = {
* @this Blockly.Block
*/
init: function() {
this.setHelpUrl(Blockly.Msg.COLOUR_RANDOM_HELPURL);
this.setColour(Blockly.Blocks.colour.HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.COLOUR_RANDOM_TITLE);
this.setOutput(true, 'Colour');
this.setTooltip(Blockly.Msg.COLOUR_RANDOM_TOOLTIP);
this.jsonInit({
"message0": Blockly.Msg.COLOUR_RANDOM_TITLE,
"output": "Colour",
"colour": Blockly.Blocks.colour.HUE,
"tooltip": Blockly.Msg.COLOUR_RANDOM_TOOLTIP,
"helpUrl": Blockly.Msg.COLOUR_RANDOM_HELPURL
});
}
};
......
......@@ -40,12 +40,13 @@ Blockly.Blocks['lists_create_empty'] = {
* @this Blockly.Block
*/
init: function() {
this.setHelpUrl(Blockly.Msg.LISTS_CREATE_EMPTY_HELPURL);
this.setColour(Blockly.Blocks.lists.HUE);
this.setOutput(true, 'Array');
this.appendDummyInput()
.appendField(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE);
this.setTooltip(Blockly.Msg.LISTS_CREATE_EMPTY_TOOLTIP);
this.jsonInit({
"message0": Blockly.Msg.LISTS_CREATE_EMPTY_TITLE,
"output": "Array",
"colour": Blockly.Blocks.lists.HUE,
"tooltip": Blockly.Msg.LISTS_CREATE_EMPTY_TOOLTIP,
"helpUrl": Blockly.Msg.LISTS_CREATE_EMPTY_HELPURL
});
}
};
......
......@@ -389,15 +389,23 @@ Blockly.Blocks['logic_boolean'] = {
* @this Blockly.Block
*/
init: function() {
var BOOLEANS =
[[Blockly.Msg.LOGIC_BOOLEAN_TRUE, 'TRUE'],
[Blockly.Msg.LOGIC_BOOLEAN_FALSE, 'FALSE']];
this.setHelpUrl(Blockly.Msg.LOGIC_BOOLEAN_HELPURL);
this.setColour(Blockly.Blocks.logic.HUE);
this.setOutput(true, 'Boolean');
this.appendDummyInput()
.appendField(new Blockly.FieldDropdown(BOOLEANS), 'BOOL');
this.setTooltip(Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP);
this.jsonInit({
"message0": "%1",
"args0": [
{
"type": "field_dropdown",
"name": "BOOL",
"options": [
[Blockly.Msg.LOGIC_BOOLEAN_TRUE, "TRUE"],
[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'] = {
* @this Blockly.Block
*/
init: function() {
this.setHelpUrl(Blockly.Msg.LOGIC_NULL_HELPURL);
this.setColour(Blockly.Blocks.logic.HUE);
this.setOutput(true);
this.appendDummyInput()
.appendField(Blockly.Msg.LOGIC_NULL);
this.setTooltip(Blockly.Msg.LOGIC_NULL_TOOLTIP);
this.jsonInit({
"message0": Blockly.Msg.LOGIC_NULL,
"output": null,
"colour": Blockly.Blocks.logic.HUE,
"tooltip": 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