|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
goog.provide('Blockly.Blocks.operators');
|
|
|
|
goog.require('Blockly.Blocks');
|
|
goog.require('Blockly.Colours');
|
|
goog.require('Blockly.constants');
|
|
goog.require('Blockly.ScratchBlocks.VerticalExtensions');
|
|
|
|
|
|
Blockly.Blocks['operator_add'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": Blockly.Msg.OPERATORS_ADD,
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "NUM1"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "NUM2"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_number"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks['operator_subtract'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": Blockly.Msg.OPERATORS_SUBTRACT,
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "NUM1"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "NUM2"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_number"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks['operator_multiply'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": Blockly.Msg.OPERATORS_MULTIPLY,
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "NUM1"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "NUM2"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_number"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks['operator_divide'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": Blockly.Msg.OPERATORS_DIVIDE,
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "NUM1"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "NUM2"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_number"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks['operator_random'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": Blockly.Msg.OPERATORS_RANDOM,
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "FROM"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "TO"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_number"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks['operator_lt'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": Blockly.Msg.OPERATORS_LT,
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND1"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND2"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_boolean"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks['operator_equals'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": Blockly.Msg.OPERATORS_EQUALS,
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND1"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND2"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_boolean"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks['operator_gt'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": Blockly.Msg.OPERATORS_GT,
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND1"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND2"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_boolean"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks['operator_gtorequal'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": "%1 ≥ %2",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND1"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND2"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_boolean"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks['operator_ltorequal'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": "%1 ≤ %2",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND1"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND2"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_boolean"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks['operator_notequal'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": "%1 ≠ %2",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND1"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND2"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_boolean"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks['operator_and'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": Blockly.Msg.OPERATORS_AND,
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND1",
|
|
"check": "Boolean"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND2",
|
|
"check": "Boolean"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_boolean"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks['operator_nand'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": "%1 nand %2",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND1",
|
|
"check": "Boolean"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND2",
|
|
"check": "Boolean"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_boolean"]
|
|
});
|
|
}
|
|
};
|
|
Blockly.Blocks['operator_nor'] = {
|
|
|
|
|
|
|
|
|
|
init: function () {
|
|
this.jsonInit({
|
|
"message0": "%1 nor %2",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND1",
|
|
"check": "Boolean"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND2",
|
|
"check": "Boolean"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_boolean"]
|
|
});
|
|
}
|
|
};
|
|
Blockly.Blocks['operator_xor'] = {
|
|
|
|
|
|
|
|
|
|
init: function () {
|
|
this.jsonInit({
|
|
"message0": "%1 xor %2",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND1",
|
|
"check": "Boolean"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND2",
|
|
"check": "Boolean"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_boolean"]
|
|
});
|
|
}
|
|
};
|
|
Blockly.Blocks['operator_xnor'] = {
|
|
|
|
|
|
|
|
|
|
init: function () {
|
|
this.jsonInit({
|
|
"message0": "%1 xnor %2",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND1",
|
|
"check": "Boolean"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND2",
|
|
"check": "Boolean"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_boolean"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks['operator_or'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": Blockly.Msg.OPERATORS_OR,
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND1",
|
|
"check": "Boolean"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND2",
|
|
"check": "Boolean"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_boolean"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks['operator_not'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": Blockly.Msg.OPERATORS_NOT,
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "OPERAND",
|
|
"check": "Boolean"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_boolean"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks['operator_join'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": Blockly.Msg.OPERATORS_JOIN,
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "STRING1"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "STRING2"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_string"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks['operator_join3'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": Blockly.Msg.OPERATORS_JOIN3,
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "STRING1"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "STRING2"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "STRING3"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_string"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks['operator_letter_of'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": Blockly.Msg.OPERATORS_LETTEROF,
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "LETTER"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "STRING"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_string"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks['operator_length'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": Blockly.Msg.OPERATORS_LENGTH,
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "STRING"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_string"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks['operator_contains'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": Blockly.Msg.OPERATORS_CONTAINS,
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "STRING1"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "STRING2"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_boolean"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks['operator_mod'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": Blockly.Msg.OPERATORS_MOD,
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "NUM1"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "NUM2"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_number"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks['operator_round'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": Blockly.Msg.OPERATORS_ROUND,
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "NUM"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_number"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks['operator_mathop'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": Blockly.Msg.OPERATORS_MATHOP,
|
|
"args0": [
|
|
{
|
|
"type": "field_dropdown",
|
|
"name": "OPERATOR",
|
|
"options": [
|
|
[Blockly.Msg.OPERATORS_MATHOP_ABS, 'abs'],
|
|
[Blockly.Msg.OPERATORS_MATHOP_FLOOR, 'floor'],
|
|
[Blockly.Msg.OPERATORS_MATHOP_CEILING, 'ceiling'],
|
|
['sign', 'sign'],
|
|
[Blockly.Msg.OPERATORS_MATHOP_SQRT, 'sqrt'],
|
|
[Blockly.Msg.OPERATORS_MATHOP_SIN, 'sin'],
|
|
[Blockly.Msg.OPERATORS_MATHOP_COS, 'cos'],
|
|
[Blockly.Msg.OPERATORS_MATHOP_TAN, 'tan'],
|
|
[Blockly.Msg.OPERATORS_MATHOP_ASIN, 'asin'],
|
|
[Blockly.Msg.OPERATORS_MATHOP_ACOS, 'acos'],
|
|
[Blockly.Msg.OPERATORS_MATHOP_ATAN, 'atan'],
|
|
[Blockly.Msg.OPERATORS_MATHOP_LN, 'ln'],
|
|
[Blockly.Msg.OPERATORS_MATHOP_LOG, 'log'],
|
|
['log2', 'log2'],
|
|
[Blockly.Msg.OPERATORS_MATHOP_EEXP, 'e ^'],
|
|
[Blockly.Msg.OPERATORS_MATHOP_10EXP, '10 ^']
|
|
]
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "NUM"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_number"]
|
|
});
|
|
}
|
|
};
|
|
Blockly.Blocks['operator_advlog'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": Blockly.Msg.OPERATORS_ADVLOG,
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "NUM1",
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "NUM2"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_number"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_regexmatch"] = {
|
|
init: function() {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "match %1 with regex %2 %3",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "text"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "reg"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "regrule"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_string"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_replaceAll"] = {
|
|
init: function() {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "in %1 replace all %2 with %3",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "text"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "term"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "res"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_string"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_replaceFirst"] = {
|
|
init: function() {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "in %1 replace first %2 with %3",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "text"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "term"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "res"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_string"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_getLettersFromIndexToIndexInText"] = {
|
|
init: function() {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "letters from %1 up to before %2 in %3",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "INDEX1"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "INDEX2"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "TEXT"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_string"]
|
|
});
|
|
}
|
|
};
|
|
|
|
|
|
Blockly.Blocks["operator_getLettersFromIndexToIndexInTextFixed"] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": Blockly.Msg.OPERATORS_LETTERSFROMTOIN,
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "INDEX1"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "INDEX2"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "TEXT"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_string"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_readLineInMultilineText"] = {
|
|
init: function() {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "read line %1 in %2",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "LINE"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "TEXT"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_string"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_newLine"] = {
|
|
init: function() {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "new line",
|
|
"args0": [],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_string"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_tabCharacter"] = {
|
|
init: function() {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "tab character",
|
|
"args0": [],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_string"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_stringify"] = {
|
|
init: function() {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "%1",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "ONE"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_string"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_boolify"] = {
|
|
init: function () {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "%1",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "ONE"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_boolean"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_character_to_code"] = {
|
|
init: function () {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "character %1 to id",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "ONE"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_number"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_code_to_character"] = {
|
|
init: function () {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "id %1 to character",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "ONE"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_string"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_lerpFunc"] = {
|
|
init: function() {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "interpolate %1 to %2 by %3",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "ONE"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "TWO"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "AMOUNT"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_string"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_advMath"] = {
|
|
init: function() {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "%1 %2 %3",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "ONE"
|
|
},
|
|
{
|
|
"type": "field_dropdown",
|
|
"name": "OPTION",
|
|
"options": [
|
|
["^", "^"],
|
|
["root", "root"],
|
|
["log", "log"]
|
|
]
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "TWO"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_string"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_advMathExpanded"] = {
|
|
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "%1 * %2 %3 %4",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "ONE"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "TWO"
|
|
},
|
|
{
|
|
"type": "field_dropdown",
|
|
"name": "OPTION",
|
|
"options": [
|
|
["root", "root"],
|
|
["log", "log"]
|
|
]
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "THREE"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_number"]
|
|
});
|
|
}
|
|
};
|
|
Blockly.Blocks['operator_power'] = {
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
this.jsonInit({
|
|
"message0": "%1 ^ %2",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "NUM1"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "NUM2"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_number"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_constrainnumber"] = {
|
|
init: function() {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "constrain %1 min %2 max %3",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "inp"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "min"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "max"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_string"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_trueBoolean"] = {
|
|
init: function() {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "true",
|
|
"args0": [],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_boolean"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_falseBoolean"] = {
|
|
init: function() {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "false",
|
|
"args0": [],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_boolean"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_randomBoolean"] = {
|
|
init: function() {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "random",
|
|
"args0": [],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_boolean"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_indexOfTextInText"] = {
|
|
init: function() {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "index of %1 in %2",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "TEXT1"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "TEXT2"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operator,
|
|
"extensions": ["colours_operators", "output_number"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_lastIndexOfTextInText"] = {
|
|
init: function() {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "last index of %1 in %2",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "TEXT1"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "TEXT2"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operator,
|
|
"extensions": ["colours_operators", "output_number"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_countAppearTimes"] = {
|
|
init: function() {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "amount of times %1 appears in %2",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "TEXT1"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "TEXT2"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operator,
|
|
"extensions": ["colours_operators", "output_number"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_textIncludesLetterFrom"] = {
|
|
init: function () {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "%1 includes a letter from %2?",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "TEXT1"
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "TEXT2"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operator,
|
|
"extensions": ["colours_operators", "output_boolean"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_textStartsOrEndsWith"] = {
|
|
init: function() {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "%1 %2 with %3?",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "TEXT1"
|
|
},
|
|
{
|
|
"type": "field_dropdown",
|
|
"name": "OPTION",
|
|
"options": [
|
|
["starts", "starts"],
|
|
["ends", "ends"]
|
|
]
|
|
},
|
|
{
|
|
"type": "input_value",
|
|
"name": "TEXT2"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operator,
|
|
"extensions": ["colours_operators", "output_boolean"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_toUpperLowerCase"] = {
|
|
init: function() {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "%1 to %2",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "TEXT"
|
|
},
|
|
{
|
|
"type": "field_dropdown",
|
|
"name": "OPTION",
|
|
"options": [
|
|
["uppercase", "upper"],
|
|
["lowercase", "lower"]
|
|
]
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_string"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_javascript_output"] = {
|
|
init: function () {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "javascript %1",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "JS"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_string"]
|
|
});
|
|
}
|
|
};
|
|
|
|
Blockly.Blocks["operator_javascript_boolean"] = {
|
|
init: function () {
|
|
this.jsonInit({
|
|
"inputsInline": true,
|
|
"message0": "javascript %1",
|
|
"args0": [
|
|
{
|
|
"type": "input_value",
|
|
"name": "JS"
|
|
}
|
|
],
|
|
"category": Blockly.Categories.operators,
|
|
"extensions": ["colours_operators", "output_boolean"]
|
|
});
|
|
}
|
|
};
|
|
|