From 49be85b89db54f3dfdb5b847a327333549e2f32e Mon Sep 17 00:00:00 2001 From: Andrew n marshall Date: Tue, 17 Apr 2018 12:38:06 -0700 Subject: [PATCH] Correct block color reference in demos/graph (#1794) --- demos/graph/index.html | 52 ++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/demos/graph/index.html b/demos/graph/index.html index f8ebcdbe2..e7c2b6a98 100644 --- a/demos/graph/index.html +++ b/demos/graph/index.html @@ -192,42 +192,34 @@ if (typeof google == 'object') { } // Define the custom blocks and their JS generators. -Blockly.Blocks['graph_get_x'] = { - // x variable getter. - init: function() { - this.jsonInit({ - "message0": "x", - "output": "Number", - "colour": Blockly.Blocks.variables.HUE, - "tooltip": Blockly.Msg.VARIABLES_GET_TOOLTIP, - "helpUrl": Blockly.Msg.VARIABLES_GET_HELPURL - }); - } -}; +Blockly.defineBlocksWithJsonArray([{ + "type": "graph_get_x", + "message0": "x", + "output": "Number", + "colour": Blockly.Msg.VARIABLES_HUE, + "tooltip": Blockly.Msg.VARIABLES_GET_TOOLTIP, + "helpUrl": Blockly.Msg.VARIABLES_GET_HELPURL +}]); Blockly.JavaScript['graph_get_x'] = function(block) { // x variable getter. return ['x', Blockly.JavaScript.ORDER_ATOMIC]; }; -Blockly.Blocks['graph_set_y'] = { - // y variable setter. - init: function() { - this.jsonInit({ - "message0": "y = %1", - "args0": [ - { - "type": "input_value", - "name": "VALUE", - "check": "Number" - } - ], - "colour": Blockly.Blocks.variables.HUE, - "tooltip": Blockly.Msg.VARIABLES_SET_TOOLTIP, - "helpUrl": Blockly.Msg.VARIABLES_SET_HELPURL - }); - } -}; +Blockly.defineBlocksWithJsonArray([{ + "type": "graph_set_y", + "message0": "y = %1", + "args0": [ + { + "type": "input_value", + "name": "VALUE", + "check": "Number" + } + ], + "colour": Blockly.Msg.VARIABLES_HUE, + "tooltip": Blockly.Msg.VARIABLES_SET_TOOLTIP, + "helpUrl": Blockly.Msg.VARIABLES_SET_HELPURL +}]); Blockly.JavaScript['graph_set_y'] = function(block) { // y variable setter.