mirror of
https://github.com/google/blockly.git
synced 2026-01-05 08:00:09 +01:00
Automatic commit Sat Jan 4 03:00:02 PST 2014
This commit is contained in:
BIN
appengine/apple-touch-icon.png
Normal file
BIN
appengine/apple-touch-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
@@ -851,7 +851,7 @@ Blockly.Block.prototype.appendStatementInput=function(a){return this.appendInput
|
||||
Blockly.Block.prototype.interpolateMsg=function(a,b){goog.asserts.assertString(a);var c=arguments[arguments.length-1];goog.asserts.assert(c===Blockly.ALIGN_LEFT||c===Blockly.ALIGN_CENTRE||c===Blockly.ALIGN_RIGHT,'Illegal final argument "%d" is not an alignment.',c);arguments.length-=1;for(var d=a.split(/(%\d)/),e=0;e<d.length;e+=2){var f=goog.string.trim(d[e]),g=d[e+1];if(g){var h=parseInt(g.charAt(1),10),k=arguments[h];goog.asserts.assertArray(k,'Message symbol "%s" is out of range.',g);this.appendValueInput(k[0]).setCheck(k[1]).setAlign(k[2]).appendField(f);
|
||||
arguments[h]=null}else f&&this.appendDummyInput().setAlign(c).appendField(f)}for(e=1;e<arguments.length-1;e++)goog.asserts.assert(null===arguments[e],'Input "%%s" not used in message: "%s"',e,a);this.setInputsInline(!a.match(/%1\s*$/))};Blockly.Block.prototype.appendInput_=function(a,b){var c=null;if(a==Blockly.INPUT_VALUE||a==Blockly.NEXT_STATEMENT)c=new Blockly.Connection(this,a);c=new Blockly.Input(a,b,this,c);this.inputList.push(c);this.rendered&&(this.render(),this.bumpNeighbours_());return c};
|
||||
Blockly.Block.prototype.moveInputBefore=function(a,b){if(a!=b){for(var c=-1,d=b?-1:this.inputList.length,e=0,f;f=this.inputList[e];e++)if(f.name==a){if(c=e,-1!=d)break}else if(b&&f.name==b&&(d=e,-1!=c))break;goog.asserts.assert(-1!=c,'Named input "%s" not found.',a);goog.asserts.assert(-1!=d,'Reference input "%s" not found.',b);this.moveNumberedInputBefore(c,d)}};
|
||||
Blockly.Block.prototype.moveNumberedInputBefore=function(a,b){goog.asserts.assert(a!=b,"Can't move input to itself.");goog.asserts.assert(a<this.inputList.length,"Input index "+a+" out of bounds.");goog.asserts.assert(b<this.inputList.length,"Reference input "+b+" out of bounds.");var c=this.inputList[a];this.inputList.splice(a,1);a<b&&b--;this.inputList.splice(b,0,c);this.rendered&&(this.render(),this.bumpNeighbours_())};
|
||||
Blockly.Block.prototype.moveNumberedInputBefore=function(a,b){goog.asserts.assert(a!=b,"Can't move input to itself.");goog.asserts.assert(a<this.inputList.length,"Input index "+a+" out of bounds.");goog.asserts.assert(b<=this.inputList.length,"Reference input "+b+" out of bounds.");var c=this.inputList[a];this.inputList.splice(a,1);a<b&&b--;this.inputList.splice(b,0,c);this.rendered&&(this.render(),this.bumpNeighbours_())};
|
||||
Blockly.Block.prototype.removeInput=function(a,b){for(var c=0,d;d=this.inputList[c];c++)if(d.name==a){d.connection&&d.connection.targetConnection&&d.connection.targetBlock().setParent(null);d.dispose();this.inputList.splice(c,1);this.rendered&&(this.render(),this.bumpNeighbours_());return}b||goog.asserts.fail('Input "%s" not found.',a)};Blockly.Block.prototype.getInput=function(a){for(var b=0,c;c=this.inputList[b];b++)if(c.name==a)return c;return null};
|
||||
Blockly.Block.prototype.getInputTargetBlock=function(a){return(a=this.getInput(a))&&a.connection&&a.connection.targetBlock()};Blockly.Block.prototype.setMutator=function(a){this.mutator&&this.mutator!==a&&this.mutator.dispose();a&&(a.block_=this,this.mutator=a,this.svg_&&a.createIcon())};Blockly.Block.prototype.getCommentText=function(){return this.comment?this.comment.getText().replace(/\s+$/,"").replace(/ +\n/g,"\n"):""};
|
||||
Blockly.Block.prototype.setCommentText=function(a){var b=!1;goog.isString(a)?(this.comment||(this.comment=new Blockly.Comment(this),b=!0),this.comment.setText(a)):this.comment&&(this.comment.dispose(),b=!0);this.rendered&&(this.render(),b&&this.bumpNeighbours_())};
|
||||
|
||||
@@ -286,7 +286,7 @@ Blockly.Blocks['logic_operation'] = {
|
||||
AND: Blockly.Msg.LOGIC_OPERATION_TOOLTIP_AND,
|
||||
OR: Blockly.Msg.LOGIC_OPERATION_TOOLTIP_OR
|
||||
};
|
||||
return thisBlock.TOOLTIPS[op];
|
||||
return TOOLTIPS[op];
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -300,7 +300,7 @@ Blockly.Blocks['logic_negate'] = {
|
||||
this.setOutput(true, 'Boolean');
|
||||
this.interpolateMsg(Blockly.Msg.LOGIC_NEGATE_TITLE,
|
||||
['BOOL', 'Boolean', Blockly.ALIGN_RIGHT],
|
||||
Blockly.ALIGN_RIGHT)
|
||||
Blockly.ALIGN_RIGHT);
|
||||
this.setTooltip(Blockly.Msg.LOGIC_NEGATE_TOOLTIP);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -41,8 +41,8 @@ Blockly.Blocks.controls_if_elseif={init:function(){this.setColour(210);this.appe
|
||||
Blockly.Blocks.controls_if_else={init:function(){this.setColour(210);this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE);this.setPreviousStatement(!0);this.setTooltip(Blockly.Msg.CONTROLS_IF_ELSE_TOOLTIP);this.contextMenu=!1}};
|
||||
Blockly.Blocks.logic_compare={init:function(){var a=Blockly.RTL?[["=","EQ"],["\u2260","NEQ"],[">","LT"],["\u2265","LTE"],["<","GT"],["\u2264","GTE"]]:[["=","EQ"],["\u2260","NEQ"],["<","LT"],["\u2264","LTE"],[">","GT"],["\u2265","GTE"]];this.setHelpUrl(Blockly.Msg.LOGIC_COMPARE_HELPURL);this.setColour(210);this.setOutput(!0,"Boolean");this.appendValueInput("A");this.appendValueInput("B").appendField(new Blockly.FieldDropdown(a),"OP");this.setInputsInline(!0);var b=this;this.setTooltip(function(){var a=
|
||||
b.getFieldValue("OP");return{EQ:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_EQ,NEQ:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_NEQ,LT:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LT,LTE:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LTE,GT:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GT,GTE:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GTE}[a]})}};
|
||||
Blockly.Blocks.logic_operation={init:function(){var a=[[Blockly.Msg.LOGIC_OPERATION_AND,"AND"],[Blockly.Msg.LOGIC_OPERATION_OR,"OR"]];this.setHelpUrl(Blockly.Msg.LOGIC_OPERATION_HELPURL);this.setColour(210);this.setOutput(!0,"Boolean");this.appendValueInput("A").setCheck("Boolean");this.appendValueInput("B").setCheck("Boolean").appendField(new Blockly.FieldDropdown(a),"OP");this.setInputsInline(!0);var b=this;this.setTooltip(function(){var a=b.getFieldValue("OP");return b.TOOLTIPS[a]})}};
|
||||
Blockly.Blocks.logic_negate={init:function(){this.setHelpUrl(Blockly.Msg.LOGIC_NEGATE_HELPURL);this.setColour(210);this.setOutput(!0,"Boolean");this.interpolateMsg(Blockly.Msg.LOGIC_NEGATE_TITLE,["BOOL","Boolean",Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT);this.setTooltip(Blockly.Msg.LOGIC_NEGATE_TOOLTIP)}};
|
||||
Blockly.Blocks.logic_operation={init:function(){var a=[[Blockly.Msg.LOGIC_OPERATION_AND,"AND"],[Blockly.Msg.LOGIC_OPERATION_OR,"OR"]];this.setHelpUrl(Blockly.Msg.LOGIC_OPERATION_HELPURL);this.setColour(210);this.setOutput(!0,"Boolean");this.appendValueInput("A").setCheck("Boolean");this.appendValueInput("B").setCheck("Boolean").appendField(new Blockly.FieldDropdown(a),"OP");this.setInputsInline(!0);var b=this;this.setTooltip(function(){var a=b.getFieldValue("OP");return{AND:Blockly.Msg.LOGIC_OPERATION_TOOLTIP_AND,
|
||||
OR:Blockly.Msg.LOGIC_OPERATION_TOOLTIP_OR}[a]})}};Blockly.Blocks.logic_negate={init:function(){this.setHelpUrl(Blockly.Msg.LOGIC_NEGATE_HELPURL);this.setColour(210);this.setOutput(!0,"Boolean");this.interpolateMsg(Blockly.Msg.LOGIC_NEGATE_TITLE,["BOOL","Boolean",Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT);this.setTooltip(Blockly.Msg.LOGIC_NEGATE_TOOLTIP)}};
|
||||
Blockly.Blocks.logic_boolean={init:function(){var a=[[Blockly.Msg.LOGIC_BOOLEAN_TRUE,"TRUE"],[Blockly.Msg.LOGIC_BOOLEAN_FALSE,"FALSE"]];this.setHelpUrl(Blockly.Msg.LOGIC_BOOLEAN_HELPURL);this.setColour(210);this.setOutput(!0,"Boolean");this.appendDummyInput().appendField(new Blockly.FieldDropdown(a),"BOOL");this.setTooltip(Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP)}};
|
||||
Blockly.Blocks.logic_null={init:function(){this.setHelpUrl(Blockly.Msg.LOGIC_NULL_HELPURL);this.setColour(210);this.setOutput(!0);this.appendDummyInput().appendField(Blockly.Msg.LOGIC_NULL);this.setTooltip(Blockly.Msg.LOGIC_NULL_TOOLTIP)}};
|
||||
Blockly.Blocks.logic_ternary={init:function(){this.setHelpUrl(Blockly.Msg.LOGIC_TERNARY_HELPURL);this.setColour(210);this.appendValueInput("IF").setCheck("Boolean").appendField(Blockly.Msg.LOGIC_TERNARY_CONDITION);this.appendValueInput("THEN").appendField(Blockly.Msg.LOGIC_TERNARY_IF_TRUE);this.appendValueInput("ELSE").appendField(Blockly.Msg.LOGIC_TERNARY_IF_FALSE);this.setOutput(!0);this.setTooltip(Blockly.Msg.LOGIC_TERNARY_TOOLTIP)}};Blockly.Blocks.loops={};
|
||||
|
||||
@@ -1532,12 +1532,12 @@ Blockly.Block.prototype.moveInputBefore = function(name, refName) {
|
||||
* @param {number} refIndex Index of input that should be after the moved input.
|
||||
*/
|
||||
Blockly.Block.prototype.moveNumberedInputBefore = function(
|
||||
inputIndex, refIndex) {
|
||||
inputIndex, refIndex) {
|
||||
// Validate arguments.
|
||||
goog.asserts.assert(inputIndex != refIndex, 'Can\'t move input to itself.');
|
||||
goog.asserts.assert(inputIndex < this.inputList.length,
|
||||
'Input index ' + inputIndex + ' out of bounds.')
|
||||
goog.asserts.assert(refIndex < this.inputList.length,
|
||||
goog.asserts.assert(refIndex <= this.inputList.length,
|
||||
'Reference input ' + refIndex + ' out of bounds.')
|
||||
// Remove input.
|
||||
var input = this.inputList[inputIndex];
|
||||
|
||||
Reference in New Issue
Block a user