Remove interpolateMsg.

This commit is contained in:
Neil Fraser
2015-06-08 18:38:33 -07:00
parent 9050e32954
commit 838a6a954b
118 changed files with 480 additions and 514 deletions

View File

@@ -207,14 +207,25 @@ Blockly.Blocks['lists_repeat'] = {
* @this Blockly.Block
*/
init: function() {
this.setHelpUrl(Blockly.Msg.LISTS_REPEAT_HELPURL);
this.setColour(Blockly.Blocks.lists.HUE);
this.setOutput(true, 'Array');
this.interpolateMsg(Blockly.Msg.LISTS_REPEAT_TITLE,
['ITEM', null, Blockly.ALIGN_RIGHT],
['NUM', 'Number', Blockly.ALIGN_RIGHT],
Blockly.ALIGN_RIGHT);
this.setTooltip(Blockly.Msg.LISTS_REPEAT_TOOLTIP);
this.jsonInit({
"message": Blockly.Msg.LISTS_REPEAT_TITLE,
"args": [
{
"type": "input_value",
"name": "ITEM"
},
{
"type": "input_value",
"name": "NUM",
"check": "Number"
}
],
"inputsInline": true,
"output": "Array",
"colour": Blockly.Blocks.lists.HUE,
"tooltip": Blockly.Msg.LISTS_REPEAT_TOOLTIP,
"helpUrl": Blockly.Msg.LISTS_REPEAT_HELPURL
});
}
};
@@ -224,13 +235,20 @@ Blockly.Blocks['lists_length'] = {
* @this Blockly.Block
*/
init: function() {
this.setHelpUrl(Blockly.Msg.LISTS_LENGTH_HELPURL);
this.setColour(Blockly.Blocks.lists.HUE);
this.interpolateMsg(Blockly.Msg.LISTS_LENGTH_TITLE,
['VALUE', ['Array', 'String'], Blockly.ALIGN_RIGHT],
Blockly.ALIGN_RIGHT);
this.setOutput(true, 'Number');
this.setTooltip(Blockly.Msg.LISTS_LENGTH_TOOLTIP);
this.jsonInit({
"message": Blockly.Msg.LISTS_LENGTH_TITLE,
"args": [
{
"type": "input_value",
"name": "VALUE",
"check": ['String', 'Array']
}
],
"output": 'Number',
"colour": Blockly.Blocks.lists.HUE,
"tooltip": Blockly.Msg.LISTS_LENGTH_TOOLTIP,
"helpUrl": Blockly.Msg.LISTS_LENGTH_HELPURL
});
}
};
@@ -240,14 +258,21 @@ Blockly.Blocks['lists_isEmpty'] = {
* @this Blockly.Block
*/
init: function() {
this.setHelpUrl(Blockly.Msg.LISTS_IS_EMPTY_HELPURL);
this.setColour(Blockly.Blocks.lists.HUE);
this.interpolateMsg(Blockly.Msg.LISTS_IS_EMPTY_TITLE,
['VALUE', ['Array', 'String'], Blockly.ALIGN_RIGHT],
Blockly.ALIGN_RIGHT);
this.setInputsInline(true);
this.setOutput(true, 'Boolean');
this.setTooltip(Blockly.Msg.LISTS_TOOLTIP);
this.jsonInit({
"message": Blockly.Msg.LISTS_ISEMPTY_TITLE,
"args": [
{
"type": "input_value",
"name": "VALUE",
"check": ['String', 'Array']
}
],
"inputsInline": true,
"output": 'Boolean',
"colour": Blockly.Blocks.lists.HUE,
"tooltip": Blockly.Msg.LISTS_ISEMPTY_TOOLTIP,
"helpUrl": Blockly.Msg.LISTS_ISEMPTY_HELPURL
});
}
};

View File

@@ -101,10 +101,9 @@ Blockly.Blocks['math_single'] = {
this.setHelpUrl(Blockly.Msg.MATH_SINGLE_HELPURL);
this.setColour(Blockly.Blocks.math.HUE);
this.setOutput(true, 'Number');
this.interpolateMsg('%1 %2',
['OP', new Blockly.FieldDropdown(OPERATORS)],
['NUM', 'Number', Blockly.ALIGN_RIGHT],
Blockly.ALIGN_RIGHT);
this.appendValueInput('NUM')
.setCheck('Number')
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
// Assign 'this' to a variable for use in the tooltip closure below.
var thisBlock = this;
this.setTooltip(function() {
@@ -379,15 +378,26 @@ Blockly.Blocks['math_modulo'] = {
* @this Blockly.Block
*/
init: function() {
this.setHelpUrl(Blockly.Msg.MATH_MODULO_HELPURL);
this.setColour(Blockly.Blocks.math.HUE);
this.setOutput(true, 'Number');
this.interpolateMsg(Blockly.Msg.MATH_MODULO_TITLE,
['DIVIDEND', 'Number', Blockly.ALIGN_RIGHT],
['DIVISOR', 'Number', Blockly.ALIGN_RIGHT],
Blockly.ALIGN_RIGHT);
this.setInputsInline(true);
this.setTooltip(Blockly.Msg.MATH_MODULO_TOOLTIP);
this.jsonInit({
"message": Blockly.Msg.MATH_MODULO_TITLE,
"args": [
{
"type": "input_value",
"name": "DIVIDEND",
"check": "Number"
},
{
"type": "input_value",
"name": "DIVISOR",
"check": "Number"
}
],
"inputsInline": true,
"output": "Number",
"colour": Blockly.Blocks.math.HUE,
"tooltip": Blockly.Msg.MATH_MODULO_TOOLTIP,
"helpUrl": Blockly.Msg.MATH_MODULO_HELPURL
});
}
};
@@ -397,16 +407,31 @@ Blockly.Blocks['math_constrain'] = {
* @this Blockly.Block
*/
init: function() {
this.setHelpUrl(Blockly.Msg.MATH_CONSTRAIN_HELPURL);
this.setColour(Blockly.Blocks.math.HUE);
this.setOutput(true, 'Number');
this.interpolateMsg(Blockly.Msg.MATH_CONSTRAIN_TITLE,
['VALUE', 'Number', Blockly.ALIGN_RIGHT],
['LOW', 'Number', Blockly.ALIGN_RIGHT],
['HIGH', 'Number', Blockly.ALIGN_RIGHT],
Blockly.ALIGN_RIGHT);
this.setInputsInline(true);
this.setTooltip(Blockly.Msg.MATH_CONSTRAIN_TOOLTIP);
this.jsonInit({
"message": Blockly.Msg.MATH_CONSTRAIN_TITLE,
"args": [
{
"type": "input_value",
"name": "VALUE",
"check": "Number"
},
{
"type": "input_value",
"name": "LOW",
"check": "Number"
},
{
"type": "input_value",
"name": "HIGH",
"check": "Number"
}
],
"inputsInline": true,
"output": "Number",
"colour": Blockly.Blocks.math.HUE,
"tooltip": Blockly.Msg.MATH_CONSTRAIN_TOOLTIP,
"helpUrl": Blockly.Msg.MATH_CONSTRAIN_HELPURL
});
}
};
@@ -416,15 +441,26 @@ Blockly.Blocks['math_random_int'] = {
* @this Blockly.Block
*/
init: function() {
this.setHelpUrl(Blockly.Msg.MATH_RANDOM_INT_HELPURL);
this.setColour(Blockly.Blocks.math.HUE);
this.setOutput(true, 'Number');
this.interpolateMsg(Blockly.Msg.MATH_RANDOM_INT_TITLE,
['FROM', 'Number', Blockly.ALIGN_RIGHT],
['TO', 'Number', Blockly.ALIGN_RIGHT],
Blockly.ALIGN_RIGHT);
this.setInputsInline(true);
this.setTooltip(Blockly.Msg.MATH_RANDOM_INT_TOOLTIP);
this.jsonInit({
"message": Blockly.Msg.MATH_RANDOM_INT_TITLE,
"args": [
{
"type": "input_value",
"name": "FROM",
"check": "Number"
},
{
"type": "input_value",
"name": "TO",
"check": "Number"
}
],
"inputsInline": true,
"output": "Number",
"colour": Blockly.Blocks.math.HUE,
"tooltip": Blockly.Msg.MATH_RANDOM_INT_TOOLTIP,
"helpUrl": Blockly.Msg.MATH_RANDOM_INT_HELPURL
});
}
};

View File

@@ -270,13 +270,20 @@ Blockly.Blocks['text_length'] = {
* @this Blockly.Block
*/
init: function() {
this.setHelpUrl(Blockly.Msg.TEXT_LENGTH_HELPURL);
this.setColour(Blockly.Blocks.texts.HUE);
this.interpolateMsg(Blockly.Msg.TEXT_LENGTH_TITLE,
['VALUE', ['String', 'Array'], Blockly.ALIGN_RIGHT],
Blockly.ALIGN_RIGHT);
this.setOutput(true, 'Number');
this.setTooltip(Blockly.Msg.TEXT_LENGTH_TOOLTIP);
this.jsonInit({
"message": Blockly.Msg.TEXT_LENGTH_TITLE,
"args": [
{
"type": "input_value",
"name": "VALUE",
"check": ['String', 'Array']
}
],
"output": 'Number',
"colour": Blockly.Blocks.texts.HUE,
"tooltip": Blockly.Msg.TEXT_LENGTH_TOOLTIP,
"helpUrl": Blockly.Msg.TEXT_LENGTH_HELPURL
});
}
};
@@ -286,13 +293,21 @@ Blockly.Blocks['text_isEmpty'] = {
* @this Blockly.Block
*/
init: function() {
this.setHelpUrl(Blockly.Msg.TEXT_ISEMPTY_HELPURL);
this.setColour(Blockly.Blocks.texts.HUE);
this.interpolateMsg(Blockly.Msg.TEXT_ISEMPTY_TITLE,
['VALUE', ['String', 'Array'], Blockly.ALIGN_RIGHT],
Blockly.ALIGN_RIGHT);
this.setOutput(true, 'Boolean');
this.setTooltip(Blockly.Msg.TEXT_ISEMPTY_TOOLTIP);
this.jsonInit({
"message": Blockly.Msg.TEXT_ISEMPTY_TITLE,
"args": [
{
"type": "input_value",
"name": "VALUE",
"check": ['String', 'Array']
}
],
"inputsInline": true,
"output": 'Boolean',
"colour": Blockly.Blocks.texts.HUE,
"tooltip": Blockly.Msg.TEXT_ISEMPTY_TOOLTIP,
"helpUrl": Blockly.Msg.TEXT_ISEMPTY_HELPURL
});
}
};
@@ -559,14 +574,20 @@ Blockly.Blocks['text_print'] = {
* @this Blockly.Block
*/
init: function() {
this.setHelpUrl(Blockly.Msg.TEXT_PRINT_HELPURL);
this.setColour(Blockly.Blocks.texts.HUE);
this.interpolateMsg(Blockly.Msg.TEXT_PRINT_TITLE,
['TEXT', null, Blockly.ALIGN_RIGHT],
Blockly.ALIGN_RIGHT);
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setTooltip(Blockly.Msg.TEXT_PRINT_TOOLTIP);
this.jsonInit({
"message": Blockly.Msg.TEXT_PRINT_TITLE,
"args": [
{
"type": "input_value",
"name": "TEXT"
}
],
"previousStatement": null,
"nextStatement": null,
"colour": Blockly.Blocks.texts.HUE,
"tooltip": Blockly.Msg.TEXT_PRINT_TOOLTIP,
"helpUrl": Blockly.Msg.TEXT_PRINT_HELPURL
});
}
};