Initial commit
This commit is contained in:
208
admin/google-blockly/own/blocks_action.js
Normal file
208
admin/google-blockly/own/blocks_action.js
Normal file
@@ -0,0 +1,208 @@
|
||||
'use strict';
|
||||
|
||||
goog.provide('Blockly.JavaScript.Action');
|
||||
|
||||
goog.require('Blockly.JavaScript');
|
||||
|
||||
Blockly.CustomBlocks = Blockly.CustomBlocks || [];
|
||||
Blockly.CustomBlocks.push('Action');
|
||||
|
||||
Blockly.Action = {
|
||||
HUE: 330,
|
||||
blocks: {}
|
||||
};
|
||||
|
||||
// --- action exec --------------------------------------------------
|
||||
|
||||
Blockly.Action.blocks['exec'] =
|
||||
'<block type="exec">'
|
||||
+ ' <value name="COMMAND">'
|
||||
+ ' <shadow type="text">'
|
||||
+ ' <field name="TEXT">text</field>'
|
||||
+ ' </shadow>'
|
||||
+ ' </value>'
|
||||
+ ' <value name="LOG">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="WITH_STATEMENT">'
|
||||
+ ' </value>'
|
||||
+ ' <mutation with_statement="false"></mutation>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['exec'] = {
|
||||
init: function() {
|
||||
this.appendDummyInput('TEXT')
|
||||
.appendField(Blockly.Words['exec'][systemLang]);
|
||||
|
||||
this.appendValueInput('COMMAND')
|
||||
.appendField(Blockly.Words['exec_command'][systemLang]);
|
||||
|
||||
this.appendDummyInput('WITH_STATEMENT')
|
||||
.appendField(Blockly.Words['exec_statement'][systemLang])
|
||||
.appendField(new Blockly.FieldCheckbox('FALSE', function (option) {
|
||||
var delayInput = (option == true);
|
||||
this.sourceBlock_.updateShape_(delayInput);
|
||||
}), 'WITH_STATEMENT');
|
||||
|
||||
this.appendDummyInput('LOG')
|
||||
.appendField(Blockly.Words['exec_log'][systemLang])
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Words['exec_log_none'][systemLang], ''],
|
||||
[Blockly.Words['exec_log_info'][systemLang], 'log'],
|
||||
[Blockly.Words['exec_log_debug'][systemLang], 'debug'],
|
||||
[Blockly.Words['exec_log_warn'][systemLang], 'warn'],
|
||||
[Blockly.Words['exec_log_error'][systemLang], 'error']
|
||||
]), 'LOG');
|
||||
|
||||
this.setInputsInline(false);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
|
||||
this.setColour(Blockly.Action.HUE);
|
||||
this.setTooltip(Blockly.Words['exec_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('exec_help'));
|
||||
},
|
||||
mutationToDom: function() {
|
||||
var container = document.createElement('mutation');
|
||||
container.setAttribute('with_statement', this.getFieldValue('WITH_STATEMENT') === 'TRUE');
|
||||
return container;
|
||||
},
|
||||
domToMutation: function(xmlElement) {
|
||||
this.updateShape_(xmlElement.getAttribute('with_statement') == 'true');
|
||||
},
|
||||
updateShape_: function(withStatement) {
|
||||
// Add or remove a statement Input.
|
||||
var inputExists = this.getInput('STATEMENT');
|
||||
|
||||
if (withStatement) {
|
||||
if (!inputExists) {
|
||||
this.appendStatementInput('STATEMENT');
|
||||
}
|
||||
} else if (inputExists) {
|
||||
this.removeInput('STATEMENT');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['exec'] = function(block) {
|
||||
var logLevel = block.getFieldValue('LOG');
|
||||
var value_command = Blockly.JavaScript.valueToCode(block, 'COMMAND', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
var withStatement = block.getFieldValue('WITH_STATEMENT');
|
||||
|
||||
var logText;
|
||||
if (logLevel) {
|
||||
logText = 'console.' + logLevel + '("exec: " + ' + value_command + ');\n'
|
||||
} else {
|
||||
logText = '';
|
||||
}
|
||||
|
||||
if (withStatement === 'TRUE') {
|
||||
var statement = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
|
||||
if (statement) {
|
||||
return 'exec(' + value_command + ', function (error, result, stderr) {\n ' + statement + '});\n' +
|
||||
logText;
|
||||
} else {
|
||||
return 'exec(' + value_command + ');\n' +
|
||||
logText;
|
||||
}
|
||||
} else {
|
||||
return 'exec(' + value_command + ');\n' +
|
||||
logText;
|
||||
}
|
||||
};
|
||||
|
||||
// --- action request --------------------------------------------------
|
||||
Blockly.Action.blocks['request'] =
|
||||
'<block type="request">'
|
||||
+ ' <value name="URL">'
|
||||
+ ' <shadow type="text">'
|
||||
+ ' <field name="TEXT">text</field>'
|
||||
+ ' </shadow>'
|
||||
+ ' </value>'
|
||||
+ ' <value name="LOG">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="WITH_STATEMENT">'
|
||||
+ ' </value>'
|
||||
+ ' <mutation with_statement="false"></mutation>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['request'] = {
|
||||
init: function() {
|
||||
this.appendDummyInput('TEXT')
|
||||
.appendField(Blockly.Words['request'][systemLang]);
|
||||
|
||||
this.appendValueInput('URL')
|
||||
.appendField(Blockly.Words['request_url'][systemLang]);
|
||||
|
||||
this.appendDummyInput('WITH_STATEMENT')
|
||||
.appendField(Blockly.Words['request_statement'][systemLang])
|
||||
.appendField(new Blockly.FieldCheckbox('FALSE', function (option) {
|
||||
var delayInput = (option == true);
|
||||
this.sourceBlock_.updateShape_(delayInput);
|
||||
}), 'WITH_STATEMENT');
|
||||
|
||||
this.appendDummyInput('LOG')
|
||||
.appendField(Blockly.Words['request_log'][systemLang])
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Words['request_log_none'][systemLang], ''],
|
||||
[Blockly.Words['request_log_info'][systemLang], 'log'],
|
||||
[Blockly.Words['request_log_debug'][systemLang], 'debug'],
|
||||
[Blockly.Words['request_log_warn'][systemLang], 'warn'],
|
||||
[Blockly.Words['request_log_error'][systemLang], 'error']
|
||||
]), 'LOG');
|
||||
|
||||
this.setInputsInline(false);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
|
||||
this.setColour(Blockly.Action.HUE);
|
||||
this.setTooltip(Blockly.Words['request_tooltip'][systemLang]);
|
||||
this.setHelpUrl(Blockly.Words['request_help'][systemLang]);
|
||||
},
|
||||
mutationToDom: function() {
|
||||
var container = document.createElement('mutation');
|
||||
container.setAttribute('with_statement', this.getFieldValue('WITH_STATEMENT') === 'TRUE');
|
||||
return container;
|
||||
},
|
||||
domToMutation: function(xmlElement) {
|
||||
this.updateShape_(xmlElement.getAttribute('with_statement') == 'true');
|
||||
},
|
||||
updateShape_: function(withStatement) {
|
||||
// Add or remove a statement Input.
|
||||
var inputExists = this.getInput('STATEMENT');
|
||||
|
||||
if (withStatement) {
|
||||
if (!inputExists) {
|
||||
this.appendStatementInput('STATEMENT');
|
||||
}
|
||||
} else if (inputExists) {
|
||||
this.removeInput('STATEMENT');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['request'] = function(block) {
|
||||
var logLevel = block.getFieldValue('LOG');
|
||||
var URL = Blockly.JavaScript.valueToCode(block, 'URL', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
var withStatement = block.getFieldValue('WITH_STATEMENT');
|
||||
|
||||
var logText;
|
||||
if (logLevel) {
|
||||
logText = 'console.' + logLevel + '("request: " + ' + URL + ');\n'
|
||||
} else {
|
||||
logText = '';
|
||||
}
|
||||
|
||||
if (withStatement === 'TRUE') {
|
||||
var statement = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
|
||||
if (statement) {
|
||||
return 'try {\n require("request")(' + URL + ', function (error, response, result) {\n ' + statement + ' }).on("error", function (e) {console.error(e);});\n} catch (e) { console.error(e); }\n' +
|
||||
logText;
|
||||
} else {
|
||||
return 'try {\n require("request")(' + URL + ').on("error", function (e) {console.error(e);});\n} catch (e) { console.error(e); }\n' +
|
||||
logText;
|
||||
}
|
||||
} else {
|
||||
return 'try {\n require("request")(' + URL + ').on("error", function (e) {console.error(e);});\n} catch (e) { console.error(e); }\n' +
|
||||
logText;
|
||||
}
|
||||
};
|
||||
336
admin/google-blockly/own/blocks_convert.js
Normal file
336
admin/google-blockly/own/blocks_convert.js
Normal file
@@ -0,0 +1,336 @@
|
||||
'use strict';
|
||||
|
||||
goog.provide('Blockly.JavaScript.Convert');
|
||||
|
||||
goog.require('Blockly.JavaScript');
|
||||
|
||||
Blockly.CustomBlocks = Blockly.CustomBlocks || [];
|
||||
Blockly.CustomBlocks.push('Convert');
|
||||
|
||||
Blockly.Convert = {
|
||||
HUE: 280,
|
||||
blocks: {}
|
||||
};
|
||||
|
||||
Blockly.Blocks.Convert = {};
|
||||
Blockly.JavaScript.Convert = {};
|
||||
|
||||
// --- to Number --------------------------------------------------
|
||||
Blockly.Convert.blocks['convert_tonumber'] =
|
||||
'<block type="convert_tonumber">'
|
||||
+ ' <value name="VALUE">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks.convert_tonumber = {
|
||||
init: function () {
|
||||
this.setColour(Blockly.Convert.HUE);
|
||||
|
||||
this.appendValueInput("VALUE")
|
||||
.appendField(Blockly.Words['convert_tonumber'][systemLang]);
|
||||
|
||||
this.setOutput(true, "Number");
|
||||
this.setTooltip(Blockly.Words['convert_tonumber_tooltip'][systemLang]);
|
||||
}
|
||||
};
|
||||
Blockly.JavaScript.convert_tonumber = function (a) {
|
||||
return ["parseFloat(" + Blockly.JavaScript.valueToCode(a, "VALUE", Blockly.JavaScript.ORDER_ATOMIC) + ")", Blockly.JavaScript.ORDER_ATOMIC];
|
||||
};
|
||||
|
||||
// --- to Boolean --------------------------------------------------
|
||||
Blockly.Convert.blocks['convert_toboolean'] =
|
||||
'<block type="convert_toboolean">'
|
||||
+ ' <value name="VALUE">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks.convert_toboolean = {
|
||||
init: function () {
|
||||
this.setColour(Blockly.Convert.HUE);
|
||||
this.appendValueInput("VALUE").appendField(Blockly.Words['convert_toboolean'][systemLang]);
|
||||
this.setOutput(true, "Boolean");
|
||||
this.setTooltip(Blockly.Words['convert_toboolean_tooltip'][systemLang])
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript.convert_toboolean = function (a) {
|
||||
return ["(function (){var val = " + Blockly.JavaScript.valueToCode(a, "VALUE", Blockly.JavaScript.ORDER_ATOMIC) + "; if (val === 'true') return true; if (val === 'false') return false; return !!val;})()", Blockly.JavaScript.ORDER_ATOMIC];
|
||||
};
|
||||
|
||||
// --- to String --------------------------------------------------
|
||||
Blockly.Convert.blocks['convert_tostring'] =
|
||||
'<block type="convert_tostring">'
|
||||
+ ' <value name="VALUE">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks.convert_tostring = {
|
||||
init: function () {
|
||||
this.setColour(Blockly.Convert.HUE);
|
||||
this.appendValueInput("VALUE").appendField(Blockly.Words['convert_tostring'][systemLang]);
|
||||
this.setOutput(true, "String");
|
||||
this.setTooltip(Blockly.Words['convert_tostring_tooltip'][systemLang])
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript.convert_tostring = function (a) {
|
||||
return ["('' + " + Blockly.JavaScript.valueToCode(a, "VALUE", Blockly.JavaScript.ORDER_ATOMIC) + ")", Blockly.JavaScript.ORDER_ATOMIC];
|
||||
};
|
||||
|
||||
// --- get type --------------------------------------------------
|
||||
Blockly.Convert.blocks['convert_type'] =
|
||||
'<block type="convert_type">'
|
||||
+ ' <value name="ITEM">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks.convert_type = {
|
||||
init: function () {
|
||||
this.setColour(Blockly.Convert.HUE);
|
||||
|
||||
this.appendValueInput('ITEM')
|
||||
.appendField(Blockly.Words['convert_type'][systemLang]);
|
||||
|
||||
this.setOutput(true, 'String');
|
||||
this.setTooltip(Blockly.Words['convert_type_tooltip'][systemLang])
|
||||
}
|
||||
};
|
||||
Blockly.JavaScript.convert_type = function (a) {
|
||||
return ['typeof ' + Blockly.JavaScript.valueToCode(a, 'ITEM', Blockly.JavaScript.ORDER_ATOMIC), Blockly.JavaScript.ORDER_ATOMIC];
|
||||
};
|
||||
|
||||
// --- to Date --------------------------------------------------
|
||||
Blockly.Convert.blocks['convert_to_date'] =
|
||||
'<block type="convert_to_date">'
|
||||
+ ' <value name="VALUE">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks.convert_to_date = {
|
||||
init: function () {
|
||||
|
||||
this.appendValueInput('VALUE')
|
||||
.appendField(Blockly.Words['convert_to_date'][systemLang]);
|
||||
|
||||
this.setColour(Blockly.Convert.HUE);
|
||||
this.setOutput(true, 'Date');
|
||||
this.setTooltip(Blockly.Words['convert_to_date_tooltip'][systemLang])
|
||||
}
|
||||
};
|
||||
Blockly.JavaScript.convert_to_date = function (a) {
|
||||
return ['getDateObject(' + Blockly.JavaScript.valueToCode(a, 'VALUE', Blockly.JavaScript.ORDER_ATOMIC) + ').getTime()', Blockly.JavaScript.ORDER_ATOMIC];
|
||||
};
|
||||
|
||||
// --- from Date --------------------------------------------------
|
||||
Blockly.Convert.blocks['convert_from_date'] =
|
||||
'<block type="convert_from_date">'
|
||||
+ ' <value name="VALUE">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="OPTION">'
|
||||
+ ' </value>'
|
||||
+ ' <mutation format="false" language="false"></mutation>'
|
||||
+ ' <value name="FORMAT">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="LANGUAGE">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks.convert_from_date = {
|
||||
init: function () {
|
||||
this.setColour(Blockly.Convert.HUE);
|
||||
this.appendValueInput('VALUE')
|
||||
.appendField(Blockly.Words['convert_from_date'][systemLang]);
|
||||
|
||||
this.appendDummyInput('OPTION')
|
||||
.appendField(Blockly.Words['convert_to'][systemLang])
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Words['time_get_object'][systemLang] , 'object'],
|
||||
[Blockly.Words['time_get_ms'][systemLang] , 'ms'],
|
||||
[Blockly.Words['time_get_s'][systemLang] , 's'],
|
||||
[Blockly.Words['time_get_sid'][systemLang] , 'sid'],
|
||||
[Blockly.Words['time_get_m'][systemLang] , 'm'],
|
||||
[Blockly.Words['time_get_mid'][systemLang] , 'mid'],
|
||||
[Blockly.Words['time_get_h'][systemLang] , 'h'],
|
||||
[Blockly.Words['time_get_d'][systemLang] , 'd'],
|
||||
[Blockly.Words['time_get_M'][systemLang] , 'M'],
|
||||
[Blockly.Words['time_get_Mt'][systemLang] , 'Mt'],
|
||||
[Blockly.Words['time_get_Mts'][systemLang] , 'Mts'],
|
||||
[Blockly.Words['time_get_y'][systemLang] , 'y'],
|
||||
[Blockly.Words['time_get_fy'][systemLang] , 'fy'],
|
||||
[Blockly.Words['time_get_wdt'][systemLang] , 'wdt'],
|
||||
[Blockly.Words['time_get_wdts'][systemLang] , 'wdts'],
|
||||
[Blockly.Words['time_get_wd'][systemLang] , 'wd'],
|
||||
[Blockly.Words['time_get_custom'][systemLang] , 'custom'],
|
||||
[Blockly.Words['time_get_yyyy.mm.dd'][systemLang] , [Blockly.Words['time_get_yyyy.mm.dd'] .format]],
|
||||
[Blockly.Words['time_get_yyyy/mm/dd'][systemLang] , [Blockly.Words['time_get_yyyy/mm/dd'] .format]],
|
||||
[Blockly.Words['time_get_yy.mm.dd'][systemLang] , [Blockly.Words['time_get_yy.mm.dd'] .format]],
|
||||
[Blockly.Words['time_get_yy/mm/dd'][systemLang] , [Blockly.Words['time_get_yy/mm/dd'] .format]],
|
||||
[Blockly.Words['time_get_dd.mm.yyyy'][systemLang] , [Blockly.Words['time_get_dd.mm.yyyy'] .format]],
|
||||
[Blockly.Words['time_get_dd/mm/yyyy'][systemLang] , [Blockly.Words['time_get_dd/mm/yyyy'] .format]],
|
||||
[Blockly.Words['time_get_dd.mm.yy'][systemLang] , [Blockly.Words['time_get_dd.mm.yy'] .format]],
|
||||
[Blockly.Words['time_get_dd/mm/yy'][systemLang] , [Blockly.Words['time_get_dd/mm/yy'] .format]],
|
||||
[Blockly.Words['time_get_mm/dd/yyyy'][systemLang] , [Blockly.Words['time_get_mm/dd/yyyy'] .format]],
|
||||
[Blockly.Words['time_get_mm/dd/yy'][systemLang] , [Blockly.Words['time_get_mm/dd/yy'] .format]],
|
||||
[Blockly.Words['time_get_dd.mm'][systemLang] , [Blockly.Words['time_get_dd.mm'] .format]],
|
||||
[Blockly.Words['time_get_dd/mm'][systemLang] , [Blockly.Words['time_get_dd/mm'] .format]],
|
||||
[Blockly.Words['time_get_mm.dd'][systemLang] , [Blockly.Words['time_get_mm.dd'] .format]],
|
||||
[Blockly.Words['time_get_mm/dd'][systemLang] , [Blockly.Words['time_get_mm/dd'] .format]],
|
||||
[Blockly.Words['time_get_hh_mm'][systemLang] , [Blockly.Words['time_get_hh_mm'] .format]],
|
||||
[Blockly.Words['time_get_hh_mm_ss'][systemLang] , [Blockly.Words['time_get_hh_mm_ss'] .format]],
|
||||
[Blockly.Words['time_get_hh_mm_ss.sss'][systemLang] , [Blockly.Words['time_get_hh_mm_ss.sss'].format]]
|
||||
], function (option) {
|
||||
this.sourceBlock_.updateShape_(option === 'custom', option === 'wdts' || option === 'wdt' || option === 'Mt' || option === 'Mts');
|
||||
}), 'OPTION');
|
||||
|
||||
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
this.setTooltip(Blockly.Words['convert_from_date_tooltip'][systemLang])
|
||||
},
|
||||
mutationToDom: function() {
|
||||
var container = document.createElement('mutation');
|
||||
var option = this.getFieldValue('OPTION');
|
||||
container.setAttribute('format', option === 'custom' ? 'true' : 'false');
|
||||
container.setAttribute('language', option === 'wdt' || option === 'wdts' || option === 'Mt' || option === 'Mts' ? 'true' : 'false');
|
||||
return container;
|
||||
},
|
||||
domToMutation: function(xmlElement) {
|
||||
this.updateShape_(xmlElement.getAttribute('format') === 'true', xmlElement.getAttribute('language') === 'true');
|
||||
},
|
||||
updateShape_: function(isFormat, isLanguage) {
|
||||
// Add or remove a delay Input.
|
||||
var inputExists = this.getInput('FORMAT');
|
||||
|
||||
if (isFormat) {
|
||||
if (!inputExists) {
|
||||
this.appendDummyInput('FORMAT')
|
||||
.appendField(' ')
|
||||
.appendField(new Blockly.FieldTextInput(Blockly.Words['time_get_default_format'][systemLang]), 'FORMAT');
|
||||
}
|
||||
} else if (inputExists) {
|
||||
this.removeInput('FORMAT');
|
||||
}
|
||||
|
||||
inputExists = this.getInput('LANGUAGE');
|
||||
|
||||
if (isLanguage) {
|
||||
if (!inputExists) {
|
||||
var languages;
|
||||
if (systemLang === 'en') {
|
||||
languages = [['in english', 'en'], ['auf deutsch', 'de'], ['на русском', 'ru']];
|
||||
} else if (systemLang === 'de') {
|
||||
languages = [['auf deutsch', 'de'], ['in english', 'en'], ['на русском', 'ru']];
|
||||
} else if (systemLang === 'ru') {
|
||||
languages = [['на русском', 'ru'], ['in english', 'en'], ['auf deutsch', 'de']];
|
||||
} else {
|
||||
languages = [['in english', 'en'], ['auf deutsch', 'de'], ['на русском', 'ru']];
|
||||
}
|
||||
this.appendDummyInput('LANGUAGE')
|
||||
.appendField(new Blockly.FieldDropdown(languages), 'LANGUAGE');
|
||||
}
|
||||
} else if (inputExists) {
|
||||
this.removeInput('LANGUAGE');
|
||||
}
|
||||
}
|
||||
};
|
||||
Blockly.JavaScript.convert_from_date = function (block) {
|
||||
var option = block.getFieldValue('OPTION');
|
||||
var format = block.getFieldValue('FORMAT');
|
||||
var lang = block.getFieldValue('LANGUAGE');
|
||||
|
||||
var value = Blockly.JavaScript.valueToCode(block, 'VALUE', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
|
||||
var code;
|
||||
if (option === 'object') {
|
||||
code = 'getDateObject(' + value + ').getTime()';
|
||||
} else if (option === 'ms') {
|
||||
code = 'getDateObject(' + value + ').getMilliseconds()';
|
||||
} else if (option === 's') {
|
||||
code = 'getDateObject(' + value + ').getSeconds()';
|
||||
} else if (option === 'sid') {
|
||||
code = '(function () {var v = getDateObject(' + value + '); return v.getHours() * 3600 + v.getMinutes() * 60 + v.getSeconds();})()';
|
||||
} else if (option === 'm') {
|
||||
code = '(getDateObject(' + value + ').getMinutes())';
|
||||
} else if (option === 'mid') {
|
||||
code = '(function () {var v = getDateObject(' + value + '); return v.getHours() * 60 + v.getMinutes();})()';
|
||||
} else if (option === 'h') {
|
||||
code = 'getDateObject(' + value + ').getHours()';
|
||||
} else if (option === 'd') {
|
||||
code = 'getDateObject(' + value + ').getDate()';
|
||||
} else if (option === 'M') {
|
||||
code = '(getDateObject(' + value + ').getMonth() + 1)';
|
||||
} else if (option === 'Mt') {
|
||||
code = 'formatDate(getDateObject(' + value + '), "OO", "' + lang + '")';
|
||||
} else if (option === 'Mts') {
|
||||
code = 'formatDate(getDateObject(' + value + '), "O", "' + lang + '")';
|
||||
} else if (option === 'y') {
|
||||
code = 'getDateObject(' + value + ').getYear()';
|
||||
} else if (option === 'fy') {
|
||||
code = 'getDateObject(' + value + ').getFullYear()';
|
||||
} else if (option === 'wdt') {
|
||||
code = 'formatDate(getDateObject(' + value + ').getDay(), "WW", "' + lang + '")';
|
||||
} else if (option === 'wdts') {
|
||||
code = 'formatDate(getDateObject(' + value + ').getDay(), "W", "' + lang + '")';
|
||||
} else if (option === 'wd') {
|
||||
code = 'getDateObject(' + value + ').getDay()';
|
||||
} else if (option === 'custom') {
|
||||
code = 'formatDate(getDateObject(' + value + '), "' + format + '")';
|
||||
} else {
|
||||
code = 'formatDate(getDateObject(' + value + '), "' + option + '")';
|
||||
}
|
||||
|
||||
return [code, Blockly.JavaScript.ORDER_ATOMIC];
|
||||
};
|
||||
|
||||
// --- json2object --------------------------------------------------
|
||||
Blockly.Convert.blocks['convert_json2object'] =
|
||||
'<block type="convert_json2object">'
|
||||
+ ' <value name="VALUE">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks.convert_json2object = {
|
||||
init: function () {
|
||||
|
||||
this.appendValueInput('VALUE')
|
||||
.appendField(Blockly.Words['convert_json2object'][systemLang]);
|
||||
|
||||
this.setColour(Blockly.Convert.HUE);
|
||||
this.setOutput(true);
|
||||
this.setTooltip(Blockly.Words['convert_json2object_tooltip'][systemLang])
|
||||
}
|
||||
};
|
||||
Blockly.JavaScript.convert_json2object = function (a) {
|
||||
return ['(function () { try {return JSON.parse(' + Blockly.JavaScript.valueToCode(a, 'VALUE', Blockly.JavaScript.ORDER_ATOMIC) + ');} catch(e) {return {};}})()', Blockly.JavaScript.ORDER_ATOMIC];
|
||||
};
|
||||
|
||||
// --- object2json --------------------------------------------------
|
||||
Blockly.Convert.blocks['convert_object2json'] =
|
||||
'<block type="convert_object2json">'
|
||||
+ ' <value name="VALUE">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="PRETTIFY">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks.convert_object2json = {
|
||||
init: function () {
|
||||
|
||||
this.appendValueInput('VALUE')
|
||||
.appendField(Blockly.Words['convert_object2json'][systemLang]);
|
||||
|
||||
this.appendDummyInput('PRETTIFY')
|
||||
.appendField(Blockly.Words['convert_object2json_prettify'][systemLang])
|
||||
.appendField(new Blockly.FieldCheckbox('FALSE'), 'PRETTIFY');
|
||||
|
||||
this.setColour(Blockly.Convert.HUE);
|
||||
this.setOutput(true, 'String');
|
||||
this.setTooltip(Blockly.Words['convert_object2json_tooltip'][systemLang])
|
||||
}
|
||||
};
|
||||
Blockly.JavaScript.convert_object2json = function (block) {
|
||||
var prettify = block.getFieldValue('PRETTIFY');
|
||||
|
||||
return ['JSON.stringify(' + Blockly.JavaScript.valueToCode(block, 'VALUE', Blockly.JavaScript.ORDER_ATOMIC) + (prettify == 'TRUE' ? ', null, 2' : '') + ')', Blockly.JavaScript.ORDER_ATOMIC];
|
||||
};
|
||||
|
||||
337
admin/google-blockly/own/blocks_procedures.js
Normal file
337
admin/google-blockly/own/blocks_procedures.js
Normal file
@@ -0,0 +1,337 @@
|
||||
if (Blockly.Blocks['procedures_ifreturn'].FUNCTION_TYPES.indexOf('procedures_defcustomreturn') === -1) {
|
||||
Blockly.Blocks['procedures_ifreturn'].FUNCTION_TYPES.push('procedures_defcustomreturn');
|
||||
}
|
||||
if (Blockly.Blocks['procedures_ifreturn'].FUNCTION_TYPES.indexOf('procedures_defcustomnoreturn') === -1) {
|
||||
Blockly.Blocks['procedures_ifreturn'].FUNCTION_TYPES.push('procedures_defcustomnoreturn');
|
||||
}
|
||||
// derived from core/procedures.js
|
||||
/**
|
||||
* Find all user-created procedure definitions in a workspace.
|
||||
* @param {!Blockly.Workspace} root Root workspace.
|
||||
* @return {!Array.<!Array.<!Array>>} Pair of arrays, the
|
||||
* first contains procedures without return variables, the second with.
|
||||
* Each procedure is defined by a three-element list of name, parameter
|
||||
* list, and return value boolean.
|
||||
*/
|
||||
Blockly.Procedures.allProcedures = function(root) {
|
||||
var blocks = root.getAllBlocks();
|
||||
var proceduresReturn = [];
|
||||
var proceduresNoReturn = [];
|
||||
var proceduresCustomReturn = [];
|
||||
var proceduresCustomNoReturn = [];
|
||||
for (var i = 0; i < blocks.length; i++) {
|
||||
if (blocks[i].getProcedureDef) {
|
||||
var tuple = blocks[i].getProcedureDef();
|
||||
if (tuple) {
|
||||
if (tuple[3]) {
|
||||
if (tuple[2]) {
|
||||
proceduresCustomReturn.push(tuple);
|
||||
} else {
|
||||
proceduresCustomNoReturn.push(tuple);
|
||||
}
|
||||
} else {
|
||||
if (tuple[2]) {
|
||||
proceduresReturn.push(tuple);
|
||||
} else {
|
||||
proceduresNoReturn.push(tuple);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
proceduresNoReturn.sort(Blockly.Procedures.procTupleComparator_);
|
||||
proceduresReturn.sort(Blockly.Procedures.procTupleComparator_);
|
||||
return [proceduresNoReturn, proceduresReturn, proceduresCustomNoReturn, proceduresCustomReturn];
|
||||
};
|
||||
|
||||
/**
|
||||
* Construct the blocks required by the flyout for the procedure category.
|
||||
* @param {!Blockly.Workspace} workspace The workspace contianing procedures.
|
||||
* @return {!Array.<!Element>} Array of XML block elements.
|
||||
*/
|
||||
Blockly.Procedures.flyoutCategory = function(workspace) {
|
||||
var xmlList = [];
|
||||
var block;
|
||||
if (Blockly.Blocks['procedures_defnoreturn']) {
|
||||
// <block type="procedures_defnoreturn" gap="16"></block>
|
||||
block = goog.dom.createDom('block');
|
||||
block.setAttribute('type', 'procedures_defnoreturn');
|
||||
block.setAttribute('gap', 16);
|
||||
xmlList.push(block);
|
||||
}
|
||||
if (Blockly.Blocks['procedures_defreturn']) {
|
||||
// <block type="procedures_defreturn" gap="16"></block>
|
||||
block = goog.dom.createDom('block');
|
||||
block.setAttribute('type', 'procedures_defreturn');
|
||||
block.setAttribute('gap', 16);
|
||||
xmlList.push(block);
|
||||
}
|
||||
if (Blockly.Blocks['procedures_ifreturn']) {
|
||||
// <block type="procedures_ifreturn" gap="16"></block>
|
||||
block = goog.dom.createDom('block');
|
||||
block.setAttribute('type', 'procedures_ifreturn');
|
||||
block.setAttribute('gap', 16);
|
||||
xmlList.push(block);
|
||||
}
|
||||
if (Blockly.Blocks['procedures_defcustomnoreturn']) {
|
||||
// <block type="procedures_defnoreturn" gap="16"></block>
|
||||
block = goog.dom.createDom('block');
|
||||
block.setAttribute('type', 'procedures_defcustomnoreturn');
|
||||
block.setAttribute('gap', 16);
|
||||
xmlList.push(block);
|
||||
}
|
||||
if (Blockly.Blocks['procedures_defcustomreturn']) {
|
||||
// <block type="procedures_defnoreturn" gap="16"></block>
|
||||
block = goog.dom.createDom('block');
|
||||
block.setAttribute('type', 'procedures_defcustomreturn');
|
||||
block.setAttribute('gap', 16);
|
||||
xmlList.push(block);
|
||||
}
|
||||
if (xmlList.length) {
|
||||
// Add slightly larger gap between system blocks and user calls.
|
||||
xmlList[xmlList.length - 1].setAttribute('gap', 24);
|
||||
}
|
||||
|
||||
function populateProcedures(procedureList, templateName) {
|
||||
for (var i = 0; i < procedureList.length; i++) {
|
||||
var name = procedureList[i][0];
|
||||
var args = procedureList[i][1];
|
||||
// <block type="procedures_callnoreturn" gap="16">
|
||||
// <mutation name="do something">
|
||||
// <arg name="x"></arg>
|
||||
// </mutation>
|
||||
// </block>
|
||||
var block = goog.dom.createDom('block');
|
||||
block.setAttribute('type', templateName);
|
||||
block.setAttribute('gap', 16);
|
||||
var mutation = goog.dom.createDom('mutation');
|
||||
mutation.setAttribute('name', name);
|
||||
block.appendChild(mutation);
|
||||
for (var j = 0; j < args.length; j++) {
|
||||
var arg = goog.dom.createDom('arg');
|
||||
arg.setAttribute('name', args[j]);
|
||||
mutation.appendChild(arg);
|
||||
}
|
||||
xmlList.push(block);
|
||||
}
|
||||
}
|
||||
|
||||
var tuple = Blockly.Procedures.allProcedures(workspace);
|
||||
populateProcedures(tuple[0], 'procedures_callnoreturn');
|
||||
populateProcedures(tuple[1], 'procedures_callreturn');
|
||||
populateProcedures(tuple[2], 'procedures_callcustomnoreturn');
|
||||
populateProcedures(tuple[3], 'procedures_callcustomreturn');
|
||||
return xmlList;
|
||||
};
|
||||
|
||||
// ---------------------- custom function with return ------------------------------
|
||||
Blockly.Words['procedures_defcustomreturn_name'] = {'en': 'JS function with return', 'de': 'JS-Funktion mit Ergebnis', 'ru': 'JS функция с результатом'};
|
||||
|
||||
Blockly.Blocks['procedures_defcustomreturn'] = {
|
||||
/**
|
||||
* Block for defining a procedure with a return value.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
init: function() {
|
||||
var nameField = new Blockly.FieldTextInput(
|
||||
Blockly.Words['procedures_defcustomreturn_name'][systemLang],
|
||||
Blockly.Procedures.rename);
|
||||
|
||||
nameField.setSpellcheck(false);
|
||||
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.PROCEDURES_DEFRETURN_TITLE)
|
||||
.appendField(nameField, 'NAME')
|
||||
.appendField('', 'PARAMS');
|
||||
|
||||
this.appendDummyInput('SCRIPT')
|
||||
.appendField(new Blockly.FieldScript(btoa('return 0;')), 'SCRIPT');
|
||||
|
||||
this.setMutator(new Blockly.Mutator(['procedures_mutatorarg']));
|
||||
|
||||
if (Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT) {
|
||||
this.setCommentText(Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT);
|
||||
}
|
||||
|
||||
this.setInputsInline(true);
|
||||
this.setColour(Blockly.Blocks.procedures.HUE);
|
||||
this.setTooltip(Blockly.Msg.PROCEDURES_DEFRETURN_TOOLTIP);
|
||||
this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFRETURN_HELPURL);
|
||||
this.arguments_ = [];
|
||||
this.setStatements_(false);
|
||||
this.statementConnection_ = null;
|
||||
},
|
||||
setStatements_: Blockly.Blocks['procedures_defreturn'].setStatements_,
|
||||
updateParams_: Blockly.Blocks['procedures_defreturn'].updateParams_,
|
||||
mutationToDom: Blockly.Blocks['procedures_defreturn'].mutationToDom,
|
||||
domToMutation: Blockly.Blocks['procedures_defreturn'].domToMutation,
|
||||
/**
|
||||
* Populate the mutator's dialog with this block's components.
|
||||
* @param {!Blockly.Workspace} workspace Mutator's workspace.
|
||||
* @return {!Blockly.Block} Root block in mutator.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
decompose: function(workspace) {
|
||||
var containerBlock = workspace.newBlock('procedures_mutatorcontainer');
|
||||
containerBlock.initSvg();
|
||||
|
||||
// Check/uncheck the allow statement box.
|
||||
containerBlock.getInput('STATEMENT_INPUT').setVisible(false);
|
||||
|
||||
// Parameter list.
|
||||
var connection = containerBlock.getInput('STACK').connection;
|
||||
for (var i = 0; i < this.arguments_.length; i++) {
|
||||
var paramBlock = workspace.newBlock('procedures_mutatorarg');
|
||||
paramBlock.initSvg();
|
||||
paramBlock.setFieldValue(this.arguments_[i], 'NAME');
|
||||
// Store the old location.
|
||||
paramBlock.oldLocation = i;
|
||||
connection.connect(paramBlock.previousConnection);
|
||||
connection = paramBlock.nextConnection;
|
||||
}
|
||||
// Initialize procedure's callers with blank IDs.
|
||||
Blockly.Procedures.mutateCallers(this);
|
||||
return containerBlock;
|
||||
},
|
||||
/**
|
||||
* Reconfigure this block based on the mutator dialog's components.
|
||||
* @param {!Blockly.Block} containerBlock Root block in mutator.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
compose: function(containerBlock) {
|
||||
// Parameter list.
|
||||
this.arguments_ = [];
|
||||
this.paramIds_ = [];
|
||||
var paramBlock = containerBlock.getInputTargetBlock('STACK');
|
||||
while (paramBlock) {
|
||||
this.arguments_.push(paramBlock.getFieldValue('NAME'));
|
||||
this.paramIds_.push(paramBlock.id);
|
||||
paramBlock = paramBlock.nextConnection &&
|
||||
paramBlock.nextConnection.targetBlock();
|
||||
}
|
||||
this.updateParams_();
|
||||
Blockly.Procedures.mutateCallers(this);
|
||||
},
|
||||
/**
|
||||
* Return the signature of this procedure definition.
|
||||
* @return {!Array} Tuple containing three elements:
|
||||
* - the name of the defined procedure,
|
||||
* - a list of all its arguments,
|
||||
* - that it DOES NOT have a return value.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
getProcedureDef: function() {
|
||||
return [this.getFieldValue('NAME'), this.arguments_, true, true];
|
||||
},
|
||||
getVars: Blockly.Blocks['procedures_defreturn'].getVars,
|
||||
renameVar: Blockly.Blocks['procedures_defreturn'].renameVar,
|
||||
customContextMenu: Blockly.Blocks['procedures_defreturn'].customContextMenu,
|
||||
callType_: 'procedures_callcustomreturn'
|
||||
};
|
||||
|
||||
Blockly.JavaScript['procedures_defcustomreturn'] = function(block) {
|
||||
// Define a procedure with a return value.
|
||||
var funcName = Blockly.JavaScript.variableDB_.getName(block.getFieldValue('NAME'), Blockly.Procedures.NAME_TYPE);
|
||||
|
||||
var args = [];
|
||||
for (var i = 0; i < block.arguments_.length; i++) {
|
||||
args[i] = Blockly.JavaScript.variableDB_.getName(block.arguments_[i], Blockly.Variables.NAME_TYPE);
|
||||
}
|
||||
|
||||
var script = atob(block.getFieldValue('SCRIPT'));
|
||||
var lines = script.split('\n');
|
||||
for (var l = 0; l < lines.length; l++) {
|
||||
lines[l] = ' ' + lines[l];
|
||||
}
|
||||
|
||||
var code = 'function ' + funcName + '(' + args.join(', ') + ') {\n' +
|
||||
lines.join('\n') + '\n}';
|
||||
|
||||
code = Blockly.JavaScript.scrub_(block, code);
|
||||
|
||||
// Add % so as not to collide with helper functions in definitions list.
|
||||
Blockly.JavaScript.definitions_['%' + funcName] = code;
|
||||
return null;
|
||||
};
|
||||
|
||||
Blockly.Blocks['procedures_callcustomreturn'] = {
|
||||
init: Blockly.Blocks['procedures_callreturn'].init,
|
||||
getProcedureCall: Blockly.Blocks['procedures_callreturn'].getProcedureCall,
|
||||
renameProcedure: Blockly.Blocks['procedures_callreturn'].renameProcedure,
|
||||
setProcedureParameters_: Blockly.Blocks['procedures_callreturn'].setProcedureParameters_,
|
||||
updateShape_: Blockly.Blocks['procedures_callreturn'].updateShape_,
|
||||
mutationToDom: Blockly.Blocks['procedures_callreturn'].mutationToDom,
|
||||
domToMutation: Blockly.Blocks['procedures_callreturn'].domToMutation,
|
||||
renameVar: Blockly.Blocks['procedures_callreturn'].renameVar,
|
||||
onchange: Blockly.Blocks['procedures_callreturn'].onchange,
|
||||
customContextMenu: Blockly.Blocks['procedures_callreturn'].customContextMenu,
|
||||
defType_: 'procedures_defcustomreturn'
|
||||
};
|
||||
|
||||
Blockly.JavaScript['procedures_callcustomreturn'] = Blockly.JavaScript['procedures_callreturn'];
|
||||
|
||||
// ---------------------- custom function with no return ------------------------------
|
||||
Blockly.Words['procedures_defcustomnoreturn_name'] = {'en': 'Javascript function', 'de': 'Javascript-Funktion', 'ru': 'Javascript функция'};
|
||||
|
||||
Blockly.Blocks['procedures_defcustomnoreturn'] = {
|
||||
init: function() {
|
||||
var nameField = new Blockly.FieldTextInput(
|
||||
Blockly.Words['procedures_defcustomnoreturn_name'][systemLang],
|
||||
Blockly.Procedures.rename);
|
||||
|
||||
nameField.setSpellcheck(false);
|
||||
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.PROCEDURES_DEFRETURN_TITLE)
|
||||
.appendField(nameField, 'NAME')
|
||||
.appendField('', 'PARAMS');
|
||||
|
||||
this.appendDummyInput('SCRIPT')
|
||||
.appendField(new Blockly.FieldScript(''), 'SCRIPT');
|
||||
|
||||
this.setMutator(new Blockly.Mutator(['procedures_mutatorarg']));
|
||||
|
||||
if (Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT) {
|
||||
this.setCommentText(Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT);
|
||||
}
|
||||
|
||||
this.setInputsInline(true);
|
||||
this.setColour(Blockly.Blocks.procedures.HUE);
|
||||
this.setTooltip(Blockly.Msg.PROCEDURES_DEFRETURN_TOOLTIP);
|
||||
this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFRETURN_HELPURL);
|
||||
this.arguments_ = [];
|
||||
this.setStatements_(false);
|
||||
this.statementConnection_ = null;
|
||||
},
|
||||
setStatements_: Blockly.Blocks['procedures_defnoreturn'].setStatements_,
|
||||
updateParams_: Blockly.Blocks['procedures_defnoreturn'].updateParams_,
|
||||
mutationToDom: Blockly.Blocks['procedures_defnoreturn'].mutationToDom,
|
||||
domToMutation: Blockly.Blocks['procedures_defnoreturn'].domToMutation,
|
||||
decompose: Blockly.Blocks['procedures_defcustomreturn'].decompose,
|
||||
compose: Blockly.Blocks['procedures_defcustomreturn'].compose,
|
||||
getProcedureDef: function() {
|
||||
return [this.getFieldValue('NAME'), this.arguments_, false, true];
|
||||
},
|
||||
getVars: Blockly.Blocks['procedures_defnoreturn'].getVars,
|
||||
renameVar: Blockly.Blocks['procedures_defnoreturn'].renameVar,
|
||||
customContextMenu: Blockly.Blocks['procedures_defnoreturn'].customContextMenu,
|
||||
callType_: 'procedures_callcustomnoreturn'
|
||||
};
|
||||
|
||||
Blockly.JavaScript['procedures_defcustomnoreturn'] = Blockly.JavaScript['procedures_defcustomreturn'];
|
||||
|
||||
Blockly.Blocks['procedures_callcustomnoreturn'] = {
|
||||
init: Blockly.Blocks['procedures_callnoreturn'].init,
|
||||
getProcedureCall: Blockly.Blocks['procedures_callnoreturn'].getProcedureCall,
|
||||
renameProcedure: Blockly.Blocks['procedures_callnoreturn'].renameProcedure,
|
||||
setProcedureParameters_: Blockly.Blocks['procedures_callnoreturn'].setProcedureParameters_,
|
||||
updateShape_: Blockly.Blocks['procedures_callnoreturn'].updateShape_,
|
||||
mutationToDom: Blockly.Blocks['procedures_callnoreturn'].mutationToDom,
|
||||
domToMutation: Blockly.Blocks['procedures_callnoreturn'].domToMutation,
|
||||
renameVar: Blockly.Blocks['procedures_callnoreturn'].renameVar,
|
||||
onchange: Blockly.Blocks['procedures_callnoreturn'].onchange,
|
||||
customContextMenu: Blockly.Blocks['procedures_callnoreturn'].customContextMenu,
|
||||
defType_: 'procedures_defcustomnoreturn'
|
||||
};
|
||||
|
||||
Blockly.JavaScript['procedures_callcustomnoreturn'] = Blockly.JavaScript['procedures_callnoreturn'];
|
||||
334
admin/google-blockly/own/blocks_sendto.js
Normal file
334
admin/google-blockly/own/blocks_sendto.js
Normal file
@@ -0,0 +1,334 @@
|
||||
'use strict';
|
||||
|
||||
goog.provide('Blockly.JavaScript.Sendto');
|
||||
|
||||
goog.require('Blockly.JavaScript');
|
||||
|
||||
Blockly.CustomBlocks = Blockly.CustomBlocks || [];
|
||||
Blockly.CustomBlocks.push('Sendto');
|
||||
|
||||
Blockly.Sendto = {
|
||||
HUE: 310,
|
||||
blocks: {}
|
||||
};
|
||||
|
||||
// --- sendTo Custom --------------------------------------------------
|
||||
Blockly.Sendto.blocks['sendto_custom'] =
|
||||
'<block type="sendto_custom">'
|
||||
+ ' <value name="INSTANCE">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="COMMAND">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="LOG">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="WITH_STATEMENT">'
|
||||
+ ' </value>'
|
||||
+ ' <mutation with_statement="false" items="parameter1"></mutation>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['sendto_custom_container'] = {
|
||||
/**
|
||||
* Mutator block for container.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
init: function () {
|
||||
this.setColour(Blockly.Sendto.HUE);
|
||||
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['sendto_custom_arguments'][systemLang]);
|
||||
|
||||
this.appendStatementInput('STACK');
|
||||
this.setTooltip(Blockly.Words['sendto_custom_arg_tooltip'][systemLang]);
|
||||
this.contextMenu = false;
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.Blocks['sendto_custom_item'] = {
|
||||
/**
|
||||
* Mutator block for add items.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
init: function () {
|
||||
this.setColour(Blockly.Sendto.HUE);
|
||||
|
||||
this.appendDummyInput('NAME')
|
||||
.appendField(Blockly.Words['sendto_custom_argument'][systemLang]);
|
||||
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
this.setTooltip(Blockly.Words['sendto_custom_arg_tooltip'][systemLang]);
|
||||
this.contextMenu = false;
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.Blocks['sendto_custom'] = {
|
||||
/**
|
||||
* Block for creating a string made up of any number of elements of any type.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
init: function () {
|
||||
var options = [];
|
||||
if (typeof main !== 'undefined' && main.instances) {
|
||||
for (var i = 0; i < main.instances.length; i++) {
|
||||
if (main.objects[main.instances[i]].common.messagebox) {
|
||||
var id = main.instances[i].substring('system.adapter.'.length);
|
||||
options.push([id, id]);
|
||||
}
|
||||
}
|
||||
/*for (var h = 0; h < scripts.hosts.length; h++) {
|
||||
options.push([scripts.hosts[h], scripts.hosts[h]]);
|
||||
}*/
|
||||
this.appendDummyInput('INSTANCE')
|
||||
.appendField(Blockly.Words['sendto_custom'][systemLang])
|
||||
.appendField(new Blockly.FieldDropdown(options), 'INSTANCE');
|
||||
} else {
|
||||
this.appendDummyInput('INSTANCE')
|
||||
.appendField(Blockly.Words['sendto_custom'][systemLang])
|
||||
.appendField(new Blockly.FieldTextInput('adapter.0'), 'INSTANCE');
|
||||
}
|
||||
|
||||
this.appendDummyInput('COMMAND')
|
||||
.appendField(Blockly.Words['sendto_custom_command'][systemLang])
|
||||
.appendField(new Blockly.FieldTextInput('send'), 'COMMAND');
|
||||
|
||||
this.setColour(Blockly.Sendto.HUE);
|
||||
|
||||
this.itemCount_ = 1;
|
||||
this.updateShape_();
|
||||
this.setInputsInline(false);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setMutator(new Blockly.Mutator(['sendto_custom_item']));
|
||||
this.setTooltip(Blockly.Words['sendto_custom_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('sendto_custom_help'));
|
||||
},
|
||||
/**
|
||||
* Create XML to represent number of text inputs.
|
||||
* @return {!Element} XML storage element.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
mutationToDom: function () {
|
||||
var container = document.createElement('mutation');
|
||||
var names = [];
|
||||
for (var i = 0; i < this.itemCount_; i++) {
|
||||
var input = this.getInput('ARG' + i);
|
||||
names[i] = input.fieldRow[0].getValue();
|
||||
}
|
||||
|
||||
container.setAttribute('items', names.join(','));
|
||||
container.setAttribute('with_statement', this.getFieldValue('WITH_STATEMENT') === 'TRUE');
|
||||
return container;
|
||||
},
|
||||
/**
|
||||
* Parse XML to restore the text inputs.
|
||||
* @param {!Element} xmlElement XML storage element.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
domToMutation: function (xmlElement) {
|
||||
var names = xmlElement.getAttribute('items').split(',');
|
||||
this.itemCount_ = names.length;
|
||||
this.updateShape_(names, xmlElement.getAttribute('with_statement') == 'true');
|
||||
},
|
||||
/**
|
||||
* Populate the mutator's dialog with this block's components.
|
||||
* @param {!Blockly.Workspace} workspace Mutator's workspace.
|
||||
* @return {!Blockly.Block} Root block in mutator.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
decompose: function (workspace) {
|
||||
var containerBlock = workspace.newBlock('sendto_custom_container');
|
||||
containerBlock.initSvg();
|
||||
var connection = containerBlock.getInput('STACK').connection;
|
||||
for (var i = 0; i < this.itemCount_; i++) {
|
||||
var itemBlock = workspace.newBlock('sendto_custom_item');
|
||||
itemBlock.initSvg();
|
||||
connection.connect(itemBlock.previousConnection);
|
||||
connection = itemBlock.nextConnection;
|
||||
}
|
||||
return containerBlock;
|
||||
},
|
||||
/**
|
||||
* Reconfigure this block based on the mutator dialog's components.
|
||||
* @param {!Blockly.Block} containerBlock Root block in mutator.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
compose: function (containerBlock) {
|
||||
var itemBlock = containerBlock.getInputTargetBlock('STACK');
|
||||
// Count number of inputs.
|
||||
var connections = [];
|
||||
var names = [];
|
||||
while (itemBlock) {
|
||||
connections.push(itemBlock.valueConnection_);
|
||||
itemBlock = itemBlock.nextConnection &&
|
||||
itemBlock.nextConnection.targetBlock();
|
||||
}
|
||||
// Disconnect any children that don't belong.
|
||||
for (var i = 0; i < this.itemCount_; i++) {
|
||||
var input = this.getInput('ARG' + i);
|
||||
var connection = input.connection.targetConnection;
|
||||
names[i] = input.fieldRow[0].getValue();
|
||||
if (connection && connections.indexOf(connection) === -1) {
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
this.itemCount_ = connections.length;
|
||||
if (this.itemCount_ < 1) this.itemCount_ = 1;
|
||||
this.updateShape_(names);
|
||||
// Reconnect any child blocks.
|
||||
for (var j = 0; j < this.itemCount_; j++) {
|
||||
Blockly.Mutator.reconnect(connections[j], this, 'ARG' + j);
|
||||
|
||||
}
|
||||
},
|
||||
getArgNames_: function () {
|
||||
var names = [];
|
||||
for (var n = 0; n < this.itemCount_; n++) {
|
||||
var input = this.getInput('ARG' + n);
|
||||
names.push(input.fieldRow[0].getValue());
|
||||
}
|
||||
return names;
|
||||
},
|
||||
/**
|
||||
* Store pointers to any connected child blocks.
|
||||
* @param {!Blockly.Block} containerBlock Root block in mutator.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
saveConnections: function (containerBlock) {
|
||||
var itemBlock = containerBlock.getInputTargetBlock('STACK');
|
||||
var i = 0;
|
||||
while (itemBlock) {
|
||||
var input = this.getInput('ARG' + i);
|
||||
itemBlock.valueConnection_ = input && input.connection.targetConnection;
|
||||
itemBlock = itemBlock.nextConnection && itemBlock.nextConnection.targetBlock();
|
||||
i++;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Modify this block to have the correct number of inputs.
|
||||
* @private
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
updateShape_: function (names, withStatement) {
|
||||
this.removeInput('LOG');
|
||||
this.removeInput('WITH_STATEMENT');
|
||||
names = names || [];
|
||||
var _input;
|
||||
// Add new inputs.
|
||||
for (var i = 0; i < this.itemCount_; i++) {
|
||||
_input = this.getInput('ARG' + i);
|
||||
if (!_input) {
|
||||
_input = this.appendValueInput('ARG' + i);
|
||||
if (!names[i]) names[i] = Blockly.Words['sendto_custom_argument'][systemLang] + (i + 1);
|
||||
_input.appendField(new Blockly.FieldTextInput(names[i]));
|
||||
|
||||
var _shadow = this.workspace.newBlock('text');
|
||||
_shadow.setShadow(true);
|
||||
_shadow.outputConnection.connect(_input.connection);
|
||||
_shadow.initSvg();
|
||||
_shadow.render();
|
||||
//console.log('New ' + names[i]);
|
||||
} else {
|
||||
_input.fieldRow[0].setValue(names[i]);
|
||||
//console.log('Exist ' + names[i]);
|
||||
if (!_input.connection.isConnected()) {
|
||||
console.log('Create ' + names[i]);
|
||||
var shadow = this.workspace.newBlock('text');
|
||||
|
||||
shadow.setShadow(true);
|
||||
|
||||
shadow.outputConnection.connect(_input.connection);
|
||||
shadow.initSvg();
|
||||
shadow.render();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Remove deleted inputs.
|
||||
var blocks = [];
|
||||
while (_input = this.getInput('ARG' + i)) {
|
||||
var b = _input.connection.targetBlock();
|
||||
if (b && b.isShadow()) {
|
||||
blocks.push(b);
|
||||
}
|
||||
this.removeInput('ARG' + i);
|
||||
i++;
|
||||
}
|
||||
if (blocks.length) {
|
||||
var ws = this.workspace;
|
||||
setTimeout(function () {
|
||||
for(var b = 0; b < blocks.length; b++) {
|
||||
ws.removeTopBlock(blocks[b]);
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
|
||||
this.appendDummyInput('WITH_STATEMENT')
|
||||
.appendField(Blockly.Words['request_statement'][systemLang])
|
||||
.appendField(new Blockly.FieldCheckbox(withStatement ? 'TRUE': 'FALSE', function (option) {
|
||||
var withStatement = (option == true);
|
||||
this.sourceBlock_.updateShape_(this.sourceBlock_.getArgNames_(), withStatement);
|
||||
}), 'WITH_STATEMENT');
|
||||
|
||||
this.appendDummyInput('LOG')
|
||||
.appendField(Blockly.Words['sendto_log'][systemLang])
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Words['sendto_log_none'][systemLang], ''],
|
||||
[Blockly.Words['sendto_log_info'][systemLang], 'log'],
|
||||
[Blockly.Words['sendto_log_debug'][systemLang], 'debug'],
|
||||
[Blockly.Words['sendto_log_warn'][systemLang], 'warn'],
|
||||
[Blockly.Words['sendto_log_error'][systemLang], 'error']
|
||||
]), 'LOG');
|
||||
|
||||
// Add or remove a statement Input.
|
||||
var inputExists = this.getInput('STATEMENT');
|
||||
|
||||
if (withStatement) {
|
||||
if (!inputExists) {
|
||||
this.appendStatementInput('STATEMENT');
|
||||
}
|
||||
} else if (inputExists) {
|
||||
this.removeInput('STATEMENT');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['sendto_custom'] = function (block) {
|
||||
var instance = block.getFieldValue('INSTANCE');
|
||||
var logLevel = block.getFieldValue('LOG');
|
||||
var command = block.getFieldValue('COMMAND');
|
||||
var withStatement = block.getFieldValue('WITH_STATEMENT');
|
||||
var args = [];
|
||||
var logText;
|
||||
if (logLevel) {
|
||||
logText = 'console.' + logLevel + '("' + instance + ': " + "' + (args.length ? args.join(',') + '\n' : '') + '");\n'
|
||||
} else {
|
||||
logText = '';
|
||||
}
|
||||
var statement;
|
||||
if (withStatement === 'TRUE') {
|
||||
statement = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
|
||||
}
|
||||
|
||||
for (var n = 0; n < block.itemCount_; n++) {
|
||||
var input = this.getInput('ARG' + n);
|
||||
var val = Blockly.JavaScript.valueToCode(block, 'ARG' + n, Blockly.JavaScript.ORDER_COMMA);
|
||||
// if JSON
|
||||
if (val && val[0] === "'" && val[1] === '{') {
|
||||
val = val.substring(1, val.length - 1);
|
||||
}
|
||||
args.push('\n "' + input.fieldRow[0].getValue() + '": ' + val);
|
||||
|
||||
if (block.itemCount_ === 1 && !input.fieldRow[0].getValue()) {
|
||||
if (statement) {
|
||||
return 'sendTo("' + instance + '", "' + command + '", ' + val + ', function (result) {\n ' + statement + ' });\n' + logText;
|
||||
} else {
|
||||
return 'sendTo("' + instance + '", "' + command + '", ' + val + ');\n' + logText;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (statement) {
|
||||
return 'sendTo("' + instance + '", "' + command + '", {' + (args.length ? args.join(',') + '\n' : '') + '}, function (result) {\n ' + statement + ' });\n' + logText;
|
||||
} else {
|
||||
return 'sendTo("' + instance + '", "' + command + '", {' + (args.length ? args.join(',') + '\n' : '') + '});\n' + logText;
|
||||
}
|
||||
};
|
||||
788
admin/google-blockly/own/blocks_system.js
Normal file
788
admin/google-blockly/own/blocks_system.js
Normal file
@@ -0,0 +1,788 @@
|
||||
'use strict';
|
||||
|
||||
goog.provide('Blockly.JavaScript.System');
|
||||
|
||||
goog.require('Blockly.JavaScript');
|
||||
|
||||
Blockly.CustomBlocks = Blockly.CustomBlocks || [];
|
||||
Blockly.CustomBlocks.push('System');
|
||||
|
||||
function getHelp(word) {
|
||||
return 'https://git.spacen.net/yunkong2/yunkong2.javascript/blob/master/README.md#' + Blockly.Words[word][systemLang];
|
||||
}
|
||||
|
||||
Blockly.System = {
|
||||
HUE: 210,
|
||||
blocks: {}
|
||||
};
|
||||
|
||||
// --- Debug output --------------------------------------------------
|
||||
Blockly.System.blocks['debug'] =
|
||||
'<block type="debug">'
|
||||
+ ' <value name="TEXT">'
|
||||
+ ' <shadow type="text">'
|
||||
+ ' <field name="TEXT">test</field>'
|
||||
+ ' </shadow>'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['debug'] = {
|
||||
init: function() {
|
||||
this.appendValueInput('TEXT')
|
||||
.setCheck(null)
|
||||
.appendField(Blockly.Words['debug'][systemLang]);
|
||||
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldDropdown([['info', 'log'], ['debug', 'debug'], ['warning', 'warn'], ['error', 'error']]), 'Severity');
|
||||
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(false);
|
||||
this.setColour(Blockly.System.HUE);
|
||||
this.setTooltip(Blockly.Words['debug_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('debug_help'));
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['debug'] = function(block) {
|
||||
var value_text = Blockly.JavaScript.valueToCode(block, 'TEXT', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
var dropdown_severity = block.getFieldValue('Severity');
|
||||
return 'console.' + dropdown_severity + '(' + value_text + ');\n';
|
||||
};
|
||||
|
||||
// --- comment --------------------------------------------------
|
||||
Blockly.System.blocks['comment'] =
|
||||
'<block type="comment">'
|
||||
+ ' <value name="COMMENT">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['comment'] = {
|
||||
init: function() {
|
||||
this.appendDummyInput('COMMENT')
|
||||
.appendField(new Blockly.FieldTextInput(Blockly.Words['comment'][systemLang]), 'COMMENT');
|
||||
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(false);
|
||||
this.setColour('#FFFF00');
|
||||
this.setTooltip(Blockly.Words['comment_tooltip'][systemLang]);
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['comment'] = function(block) {
|
||||
var comment = block.getFieldValue('COMMENT');
|
||||
return '// ' + comment + '\n';
|
||||
};
|
||||
|
||||
// --- control -----------------------------------------------------------
|
||||
Blockly.System.blocks['control'] =
|
||||
'<block type="control">'
|
||||
+ ' <value name="OID">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="VALUE">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="WITH_DELAY">'
|
||||
+ ' </value>'
|
||||
+ ' <mutation delay_input="false"></mutation>'
|
||||
+ ' <value name="DELAY_MS">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="UNIT">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="CLEAR_RUNNING">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['control'] = {
|
||||
init: function() {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['control'][systemLang]);
|
||||
|
||||
this.appendDummyInput('OID')
|
||||
.appendField(new Blockly.FieldOID('Object ID', main.initSelectId(), main.objects), 'OID');
|
||||
|
||||
this.appendValueInput('VALUE')
|
||||
.setCheck(null)
|
||||
.appendField(Blockly.Words['control_with'][systemLang]);
|
||||
|
||||
this.appendDummyInput('WITH_DELAY')
|
||||
.appendField(Blockly.Words['control_delay'][systemLang])
|
||||
.appendField(new Blockly.FieldCheckbox('FALSE', function(option) {
|
||||
var delayInput = (option == true);
|
||||
this.sourceBlock_.updateShape_(delayInput);
|
||||
}), 'WITH_DELAY');
|
||||
|
||||
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setColour(Blockly.System.HUE);
|
||||
this.setTooltip(Blockly.Words['control_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('control_help'));
|
||||
},
|
||||
mutationToDom: function() {
|
||||
var container = document.createElement('mutation');
|
||||
container.setAttribute('delay_input', this.getFieldValue('WITH_DELAY') === 'TRUE');
|
||||
return container;
|
||||
},
|
||||
domToMutation: function(xmlElement) {
|
||||
this.updateShape_(xmlElement.getAttribute('delay_input') == 'true');
|
||||
},
|
||||
updateShape_: function(delayInput) {
|
||||
// Add or remove a delay Input.
|
||||
var inputExists = this.getInput('DELAY');
|
||||
|
||||
if (delayInput) {
|
||||
if (!inputExists) {
|
||||
this.appendDummyInput('DELAY')
|
||||
.appendField(' ')
|
||||
.appendField(new Blockly.FieldTextInput('1000'), 'DELAY_MS')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Words['control_ms'][systemLang], 'ms'],
|
||||
[Blockly.Words['control_sec'][systemLang], 'sec'],
|
||||
[Blockly.Words['control_min'][systemLang], 'min']
|
||||
]), 'UNIT');
|
||||
//.appendField(Blockly.Words['control_ms'][systemLang]);
|
||||
}
|
||||
} else if (inputExists) {
|
||||
this.removeInput('DELAY');
|
||||
}
|
||||
|
||||
inputExists = this.getInput('CLEAR_RUNNING_INPUT');
|
||||
|
||||
if (delayInput) {
|
||||
if (!inputExists) {
|
||||
this.appendDummyInput('CLEAR_RUNNING_INPUT')
|
||||
.appendField(Blockly.Words['control_clear_running'][systemLang])
|
||||
.appendField(new Blockly.FieldCheckbox(), 'CLEAR_RUNNING');
|
||||
}
|
||||
} else if (inputExists) {
|
||||
this.removeInput('CLEAR_RUNNING_INPUT');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['control'] = function(block) {
|
||||
var valueObjectID = block.getFieldValue('OID');
|
||||
|
||||
Blockly.Msg.VARIABLES_DEFAULT_NAME = 'value';
|
||||
|
||||
var valueDelay = parseInt(block.getFieldValue('DELAY_MS'), 10);
|
||||
var unit = block.getFieldValue('UNIT');
|
||||
if (unit === 'min') {
|
||||
valueDelay *= 60000;
|
||||
} else if (unit === 'sec') {
|
||||
valueDelay *= 1000;
|
||||
}
|
||||
var clearRunning = block.getFieldValue('CLEAR_RUNNING') === 'TRUE';
|
||||
var valueValue = Blockly.JavaScript.valueToCode(block, 'VALUE', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
var objectName = main.objects[valueObjectID] && main.objects[valueObjectID].common && main.objects[valueObjectID].common.name ? main.objects[valueObjectID].common.name : '';
|
||||
var code;
|
||||
|
||||
if (this.getFieldValue('WITH_DELAY') === 'TRUE') {
|
||||
code = 'setStateDelayed("' + valueObjectID + '"' + (objectName ? '/*' + objectName + '*/' : '') + ', ' + valueValue + ', ' + valueDelay + ', ' + clearRunning + ');\n';
|
||||
} else {
|
||||
code = 'setState("' + valueObjectID + '"' + (objectName ? '/*' + objectName + '*/' : '') + ', ' + valueValue + ');\n';
|
||||
}
|
||||
|
||||
return code;
|
||||
};
|
||||
|
||||
// --- toggle -----------------------------------------------------------
|
||||
Blockly.System.blocks['toggle'] =
|
||||
'<block type="toggle">'
|
||||
+ ' <value name="OID">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="WITH_DELAY">'
|
||||
+ ' </value>'
|
||||
+ ' <mutation delay_input="false"></mutation>'
|
||||
+ ' <value name="DELAY_MS">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="UNIT">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="CLEAR_RUNNING">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['toggle'] = {
|
||||
init: function() {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['toggle'][systemLang]);
|
||||
|
||||
this.appendDummyInput('OID')
|
||||
.appendField(new Blockly.FieldOID('Object ID', main.initSelectId(), main.objects), 'OID');
|
||||
|
||||
this.appendDummyInput('WITH_DELAY')
|
||||
.appendField(Blockly.Words['toggle_delay'][systemLang])
|
||||
.appendField(new Blockly.FieldCheckbox('FALSE', function(option) {
|
||||
var delayInput = (option == true);
|
||||
this.sourceBlock_.updateShape_(delayInput);
|
||||
}), 'WITH_DELAY');
|
||||
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setColour(Blockly.System.HUE);
|
||||
this.setTooltip(Blockly.Words['toggle_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('toggle_help'));
|
||||
},
|
||||
mutationToDom: function() {
|
||||
var container = document.createElement('mutation');
|
||||
container.setAttribute('delay_input', this.getFieldValue('WITH_DELAY') === 'TRUE');
|
||||
return container;
|
||||
},
|
||||
domToMutation: function(xmlElement) {
|
||||
this.updateShape_(xmlElement.getAttribute('delay_input') == 'true');
|
||||
},
|
||||
updateShape_: function(delayInput) {
|
||||
// Add or remove a delay Input.
|
||||
var inputExists = this.getInput('DELAY');
|
||||
|
||||
if (delayInput) {
|
||||
if (!inputExists) {
|
||||
this.appendDummyInput('DELAY')
|
||||
.appendField(' ')
|
||||
.appendField(new Blockly.FieldTextInput('1000'), 'DELAY_MS')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Words['control_ms'][systemLang], 'ms'],
|
||||
[Blockly.Words['control_sec'][systemLang], 'sec'],
|
||||
[Blockly.Words['control_min'][systemLang], 'min']
|
||||
]), 'UNIT');
|
||||
//.appendField(Blockly.Words['toggle_ms'][systemLang]);
|
||||
}
|
||||
} else if (inputExists) {
|
||||
this.removeInput('DELAY');
|
||||
}
|
||||
|
||||
inputExists = this.getInput('CLEAR_RUNNING_INPUT');
|
||||
|
||||
if (delayInput) {
|
||||
if (!inputExists) {
|
||||
this.appendDummyInput('CLEAR_RUNNING_INPUT')
|
||||
.appendField(Blockly.Words['toggle_clear_running'][systemLang])
|
||||
.appendField(new Blockly.FieldCheckbox(), 'CLEAR_RUNNING');
|
||||
}
|
||||
} else if (inputExists) {
|
||||
this.removeInput('CLEAR_RUNNING_INPUT');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['toggle'] = function(block) {
|
||||
var valueObjectID = block.getFieldValue('OID');
|
||||
|
||||
Blockly.Msg.VARIABLES_DEFAULT_NAME = 'value';
|
||||
|
||||
var valueDelay = parseInt(block.getFieldValue('DELAY_MS'), 10);
|
||||
var unit = block.getFieldValue('UNIT');
|
||||
if (unit === 'min') {
|
||||
valueDelay *= 60000;
|
||||
} else if (unit === 'sec') {
|
||||
valueDelay *= 1000;
|
||||
}
|
||||
var clearRunning = block.getFieldValue('CLEAR_RUNNING') === 'TRUE';
|
||||
var objectName = main.objects[valueObjectID] && main.objects[valueObjectID].common && main.objects[valueObjectID].common.name ? main.objects[valueObjectID].common.name : '';
|
||||
var objectType = main.objects[valueObjectID] && main.objects[valueObjectID].common && main.objects[valueObjectID].common.type ? main.objects[valueObjectID].common.type : 'boolean';
|
||||
var code;
|
||||
var setCommand;
|
||||
if (objectType === 'number') {
|
||||
var max = 100;
|
||||
var min = 0;
|
||||
if (main.objects[valueObjectID].common.max !== undefined) {
|
||||
max = parseFloat(main.objects[valueObjectID].common.max);
|
||||
}
|
||||
if (main.objects[valueObjectID].common.min !== undefined) {
|
||||
min = parseFloat(main.objects[valueObjectID].common.min);
|
||||
}
|
||||
setCommand = ' setState("' + valueObjectID + '"' + (objectName ? '/*' + objectName + '*/' : '') + ', state ? (state.val == ' + min + ' ? ' + max + ' : ' + min + ') : ' + max + ');\n';
|
||||
} else {
|
||||
setCommand = ' setState("' + valueObjectID + '"' + (objectName ? '/*' + objectName + '*/' : '') + ', state ? !state.val : true);\n';
|
||||
}
|
||||
|
||||
if (this.getFieldValue('WITH_DELAY') === 'TRUE') {
|
||||
code =
|
||||
'getState("' + valueObjectID + '", function (err, state) {\n' +
|
||||
' setStateDelayed("' + valueObjectID + '"' + (objectName ? '/*' + objectName + '*/' : '') + ', state ? !state.val : true, ' + valueDelay + ', ' + clearRunning + ');\n' +
|
||||
'});\n';
|
||||
} else {
|
||||
code =
|
||||
'getState("' + valueObjectID + '", function (err, state) {\n' +
|
||||
setCommand +
|
||||
'});\n';
|
||||
}
|
||||
|
||||
return code;
|
||||
};
|
||||
|
||||
// --- update -----------------------------------------------------------
|
||||
Blockly.System.blocks['update'] =
|
||||
'<block type="update">'
|
||||
+ ' <value name="OID">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="VALUE">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="WITH_DELAY">'
|
||||
+ ' </value>'
|
||||
+ ' <mutation delay_input="false"></mutation>'
|
||||
+ ' <value name="DELAY_MS">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="UNIT">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="CLEAR_RUNNING">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['update'] = {
|
||||
init: function() {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['update'][systemLang]);
|
||||
|
||||
this.appendDummyInput('OID')
|
||||
.appendField(new Blockly.FieldOID("Object ID", main.initSelectId(), main.objects), 'OID');
|
||||
|
||||
|
||||
this.appendValueInput('VALUE')
|
||||
.setCheck(null)
|
||||
.appendField(Blockly.Words['update_with'][systemLang]);
|
||||
|
||||
this.appendDummyInput('WITH_DELAY')
|
||||
.appendField(Blockly.Words['update_delay'][systemLang])
|
||||
.appendField(new Blockly.FieldCheckbox('FALSE', function(option) {
|
||||
this.sourceBlock_.updateShape_(option == true);
|
||||
}), 'WITH_DELAY');
|
||||
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setColour(Blockly.System.HUE);
|
||||
this.setTooltip(Blockly.Words['update_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('update_help'));
|
||||
},
|
||||
mutationToDom: function() {
|
||||
var container = document.createElement('mutation');
|
||||
container.setAttribute('delay_input', this.getFieldValue('WITH_DELAY') === 'TRUE');
|
||||
return container;
|
||||
},
|
||||
domToMutation: function(xmlElement) {
|
||||
this.updateShape_(xmlElement.getAttribute('delay_input') == 'true');
|
||||
},
|
||||
updateShape_: function(delayInput) {
|
||||
// Add or remove a delay Input.
|
||||
var inputExists = this.getInput('DELAY');
|
||||
|
||||
if (delayInput) {
|
||||
if (!inputExists) {
|
||||
this.appendDummyInput('DELAY')
|
||||
.appendField(' ')
|
||||
.appendField(new Blockly.FieldTextInput('1000'), 'DELAY_MS')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Words['control_ms'][systemLang], 'ms'],
|
||||
[Blockly.Words['control_sec'][systemLang], 'sec'],
|
||||
[Blockly.Words['control_min'][systemLang], 'min']
|
||||
]), 'UNIT');
|
||||
//.appendField(Blockly.Words['update_ms'][systemLang]);
|
||||
}
|
||||
} else if (inputExists) {
|
||||
this.removeInput('DELAY');
|
||||
}
|
||||
|
||||
inputExists = this.getInput('CLEAR_RUNNING_INPUT');
|
||||
|
||||
if (delayInput) {
|
||||
if (!inputExists) {
|
||||
this.appendDummyInput('CLEAR_RUNNING_INPUT')
|
||||
.appendField(Blockly.Words['control_clear_running'][systemLang])
|
||||
.appendField(new Blockly.FieldCheckbox(), 'CLEAR_RUNNING');
|
||||
}
|
||||
} else if (inputExists) {
|
||||
this.removeInput('CLEAR_RUNNING_INPUT');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['update'] = function(block) {
|
||||
var value_objectid = block.getFieldValue('OID');
|
||||
|
||||
Blockly.Msg.VARIABLES_DEFAULT_NAME = 'value';
|
||||
|
||||
var value_value = Blockly.JavaScript.valueToCode(block, 'VALUE', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
var value_delay = parseInt(block.getFieldValue('DELAY_MS'), 10);
|
||||
var clearRunning = block.getFieldValue('CLEAR_RUNNING') === 'TRUE';
|
||||
var unit = block.getFieldValue('UNIT');
|
||||
if (unit === 'min') {
|
||||
value_delay *= 60000;
|
||||
} else if (unit === 'sec') {
|
||||
value_delay *= 1000;
|
||||
}
|
||||
var objectname = main.objects[value_objectid] && main.objects[value_objectid].common && main.objects[value_objectid].common.name ? main.objects[value_objectid].common.name : '';
|
||||
var code;
|
||||
if (this.getFieldValue('WITH_DELAY') === 'TRUE') {
|
||||
code = 'setStateDelayed("' + value_objectid + '"' + (objectname ? '/*' + objectname + '*/' : '') + ', ' + value_value + ', true, ' + value_delay + ', ' + clearRunning + ');\n';
|
||||
} else {
|
||||
code = 'setState("' + value_objectid + '"' + (objectname ? '/*' + objectname + '*/' : '') + ', ' + value_value + ', true);\n';
|
||||
}
|
||||
|
||||
return code;
|
||||
};
|
||||
|
||||
// --- direct binding -----------------------------------------------------------
|
||||
Blockly.System.blocks['direct'] =
|
||||
'<block type="direct">'
|
||||
+ ' <value name="OID_SRC">'
|
||||
+ ' <shadow type="field_oid">'
|
||||
+ ' <field name="oid">Object ID 1</field>'
|
||||
+ ' </shadow>'
|
||||
+ ' </value>'
|
||||
+ ' <value name="OID_DST">'
|
||||
+ ' <shadow type="field_oid">'
|
||||
+ ' <field name="oid">Object ID 2</field>'
|
||||
+ ' </shadow>'
|
||||
+ ' </value>'
|
||||
+ ' <value name="ONLY_CHANGES">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['direct'] = {
|
||||
init: function() {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['direct'][systemLang]);
|
||||
|
||||
this.appendValueInput('OID_SRC')
|
||||
.setCheck('String')
|
||||
.appendField(Blockly.Words['direct_oid_src'][systemLang]);
|
||||
|
||||
this.appendValueInput('OID_DST')
|
||||
.setCheck('String')
|
||||
.appendField(Blockly.Words['direct_oid_dst'][systemLang]);
|
||||
|
||||
this.appendDummyInput('ONLY_CHANGES')
|
||||
.appendField(Blockly.Words['direct_only_changes'][systemLang])
|
||||
.appendField(new Blockly.FieldCheckbox('TRUE'), 'ONLY_CHANGES');
|
||||
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setColour(Blockly.System.HUE);
|
||||
this.setTooltip(Blockly.Words['direct_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('direct_help'));
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['direct'] = function(block) {
|
||||
var oidSrc = Blockly.JavaScript.valueToCode(block, 'OID_SRC', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
var onlyChanges = block.getFieldValue('ONLY_CHANGES');
|
||||
var oidDest = Blockly.JavaScript.valueToCode(block, 'OID_DST', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
|
||||
return 'on({id: ' + oidSrc + ', change: "' + (onlyChanges == 'TRUE' ? 'ne' : 'any') + '"}, function (obj) {\n setState(' + oidDest + ', obj.state.val);\n});';
|
||||
};
|
||||
|
||||
// --- control ex -----------------------------------------------------------
|
||||
Blockly.System.blocks['control_ex'] =
|
||||
'<block type="control_ex">'
|
||||
+ ' <value name="OID">'
|
||||
+ ' <shadow type="field_oid">'
|
||||
+ ' <field name="oid">Object ID</field>'
|
||||
+ ' </shadow>'
|
||||
+ ' </value>'
|
||||
+ ' <value name="VALUE">'
|
||||
+ ' <shadow type="logic_boolean">'
|
||||
+ ' <field name="BOOL">TRUE</field>'
|
||||
+ ' </shadow>'
|
||||
+ ' </value>'
|
||||
+ ' <value name="TYPE">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="DELAY_MS">'
|
||||
+ ' <shadow type="math_number">'
|
||||
+ ' <field name="NUM">0</field>'
|
||||
+ ' </shadow>'
|
||||
+ ' </value>'
|
||||
+ ' <value name="CLEAR_RUNNING">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['control_ex'] = {
|
||||
init: function() {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['control_ex'][systemLang]);
|
||||
|
||||
this.appendValueInput('OID')
|
||||
.setCheck('String')
|
||||
.appendField(Blockly.Words['field_oid_OID'][systemLang]);
|
||||
|
||||
this.appendDummyInput('TYPE')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Words['control_ex_control'][systemLang], 'false'],
|
||||
[Blockly.Words['control_ex_update'][systemLang], 'true']
|
||||
]), 'TYPE');
|
||||
|
||||
this.appendValueInput('VALUE')
|
||||
.setCheck(null)
|
||||
.appendField(Blockly.Words['control_ex_value'][systemLang]);
|
||||
|
||||
this.appendValueInput('DELAY_MS')
|
||||
.setCheck('Number')
|
||||
.appendField(Blockly.Words['control_ex_delay'][systemLang]);
|
||||
|
||||
this.appendDummyInput('CLEAR_RUNNING_INPUT')
|
||||
.appendField(Blockly.Words['control_ex_clear_running'][systemLang])
|
||||
.appendField(new Blockly.FieldCheckbox(), 'CLEAR_RUNNING');
|
||||
|
||||
this.setInputsInline(false);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setColour(Blockly.System.HUE);
|
||||
this.setTooltip(Blockly.Words['control_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('control_help'));
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['control_ex'] = function(block) {
|
||||
var valueObjectID = Blockly.JavaScript.valueToCode(block, 'OID', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
var value = Blockly.JavaScript.valueToCode(block, 'VALUE', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
var valueDelay = Blockly.JavaScript.valueToCode(block, 'DELAY_MS', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
var clearRunning = block.getFieldValue('CLEAR_RUNNING') === 'TRUE';
|
||||
var type = block.getFieldValue('TYPE') === 'true';
|
||||
return 'setStateDelayed(' + valueObjectID + ', ' + value + ', ' + type + ', parseInt(' + valueDelay + ', 10), ' + clearRunning + ');\n';
|
||||
};
|
||||
|
||||
// --- create state --------------------------------------------------
|
||||
Blockly.System.blocks['create'] =
|
||||
'<block type="create">'
|
||||
+ ' <value name="NAME">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="STATEMENT">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['create'] = {
|
||||
init: function() {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['create'][systemLang]);
|
||||
|
||||
this.appendDummyInput('NAME')
|
||||
.appendField(new Blockly.FieldTextInput(Blockly.Words['create_jsState'][systemLang]), 'NAME');
|
||||
|
||||
this.appendStatementInput('STATEMENT')
|
||||
.setCheck(null);
|
||||
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
|
||||
this.setInputsInline(true);
|
||||
this.setColour(Blockly.System.HUE);
|
||||
this.setTooltip(Blockly.Words['create_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('create_help'));
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['create'] = function(block) {
|
||||
var name = block.getFieldValue('NAME');
|
||||
var statement = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
|
||||
|
||||
return 'createState("' + name + '", function () {\n' + statement + '});\n';
|
||||
};
|
||||
|
||||
// --- get value --------------------------------------------------
|
||||
Blockly.System.blocks['get_value'] =
|
||||
'<block type="get_value">'
|
||||
+ ' <value name="ATTR">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="OID">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['get_value'] = {
|
||||
// Checkbox.
|
||||
init: function() {
|
||||
|
||||
this.appendDummyInput('ATTR')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Words['get_value_val'][systemLang], 'val'],
|
||||
[Blockly.Words['get_value_ack'][systemLang], 'ack'],
|
||||
[Blockly.Words['get_value_ts'][systemLang], 'ts'],
|
||||
[Blockly.Words['get_value_lc'][systemLang], 'lc'],
|
||||
[Blockly.Words['get_value_q'][systemLang] , 'q'],
|
||||
[Blockly.Words['get_value_from'][systemLang], 'from']
|
||||
]), 'ATTR');
|
||||
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['get_value_OID'][systemLang]);
|
||||
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldOID(Blockly.Words['get_value_default'][systemLang], main.initSelectId(), main.objects), 'OID');
|
||||
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
this.setColour(Blockly.System.HUE);
|
||||
this.setTooltip(Blockly.Words['get_value_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('get_value_help'));
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['get_value'] = function(block) {
|
||||
var oid = block.getFieldValue('OID');
|
||||
var attr = block.getFieldValue('ATTR');
|
||||
return ['getState("' + oid + '").' + attr, Blockly.JavaScript.ORDER_ATOMIC];
|
||||
};
|
||||
|
||||
// --- get value async--------------------------------------------------
|
||||
Blockly.System.blocks['get_value_async'] =
|
||||
'<block type="get_value_async">'
|
||||
+ ' <value name="ATTR">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="OID">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="STATEMENT">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['get_value_async'] = {
|
||||
// Checkbox.
|
||||
init: function() {
|
||||
|
||||
this.appendDummyInput('ATTR')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Words['get_value_val'][systemLang], 'val'],
|
||||
[Blockly.Words['get_value_ack'][systemLang], 'ack'],
|
||||
[Blockly.Words['get_value_ts'][systemLang], 'ts'],
|
||||
[Blockly.Words['get_value_lc'][systemLang], 'lc'],
|
||||
[Blockly.Words['get_value_q'][systemLang] , 'q'],
|
||||
[Blockly.Words['get_value_from'][systemLang], 'from']
|
||||
]), 'ATTR');
|
||||
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['get_value_OID'][systemLang]);
|
||||
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldOID(Blockly.Words['get_value_default'][systemLang], main.initSelectId(), main.objects), 'OID');
|
||||
|
||||
this.appendStatementInput('STATEMENT')
|
||||
.setCheck(null);
|
||||
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
|
||||
this.setInputsInline(true);
|
||||
this.setColour(Blockly.System.HUE);
|
||||
this.setTooltip(Blockly.Words['get_value_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('get_value_help'));
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['get_value_async'] = function(block) {
|
||||
var oid = block.getFieldValue('OID');
|
||||
var attr = block.getFieldValue('ATTR');
|
||||
var statement = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
|
||||
return 'getState("' + oid + '", function (err, state) {\n var value = state.' + attr + ';\n' + statement + '});\n';
|
||||
};
|
||||
|
||||
// --- select OID --------------------------------------------------
|
||||
Blockly.System.blocks['field_oid'] =
|
||||
'<block type="field_oid">'
|
||||
+ ' <value name="TEXT">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['field_oid'] = {
|
||||
// Checkbox.
|
||||
init: function() {
|
||||
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['field_oid_OID'][systemLang]);
|
||||
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldOID('default', main.initSelectId(), main.objects), 'oid');
|
||||
|
||||
this.setInputsInline(true);
|
||||
this.setColour(Blockly.System.HUE);
|
||||
this.setOutput(true, 'String');
|
||||
this.setTooltip(Blockly.Words['field_oid_tooltip'][systemLang]);
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['field_oid'] = function(block) {
|
||||
var oid = block.getFieldValue('oid');
|
||||
return ['\'' + oid + '\'', Blockly.JavaScript.ORDER_ATOMIC]
|
||||
};
|
||||
|
||||
|
||||
// --- get attribute --------------------------------------------------
|
||||
Blockly.System.blocks['get_attr'] =
|
||||
'<block type="get_attr">'
|
||||
+ ' <value name="PATH">'
|
||||
+ ' <shadow type="text">'
|
||||
+ ' <field name="PATH">attr1.attr2</field>'
|
||||
+ ' </shadow>'
|
||||
+ ' </value>'
|
||||
+ ' <value name="OBJECT">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['get_attr'] = {
|
||||
init: function() {
|
||||
|
||||
this.appendValueInput('PATH')
|
||||
.setCheck(null)
|
||||
.appendField(Blockly.Words['get_attr_path'][systemLang]);
|
||||
|
||||
// this.appendDummyInput()
|
||||
|
||||
this.appendValueInput('OBJECT')
|
||||
.appendField(Blockly.Words['get_attr_by'][systemLang]);
|
||||
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
this.setColour(Blockly.System.HUE);
|
||||
this.setTooltip(Blockly.Words['get_attr_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('get_attr_help'));
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['get_attr'] = function(block) {
|
||||
var path = Blockly.JavaScript.valueToCode(block, 'PATH', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
var obj = Blockly.JavaScript.valueToCode(block, 'OBJECT', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
return ['getAttr(' + obj + ', ' + path + ')', Blockly.JavaScript.ORDER_ATOMIC];
|
||||
};
|
||||
|
||||
// --- Text new line --------------------------------------------------
|
||||
Blockly.Blocks['text_newline'] = {
|
||||
// Checkbox.
|
||||
init: function() {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['text_newline'][systemLang]);
|
||||
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldDropdown([['\\n', '\\n'], ['\\r\\n', '\\r\\n'], ['\\r', '\\r']]), 'Type');
|
||||
this.setInputsInline(true);
|
||||
this.setColour(Blockly.Blocks.texts.HUE);
|
||||
this.setOutput(true, 'String');
|
||||
this.setTooltip(Blockly.Words['text_newline_tooltip'][systemLang]);
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['text_newline'] = function(block) {
|
||||
var dropdown_type = block.getFieldValue('Type');
|
||||
return ['\'' + dropdown_type + '\'', Blockly.JavaScript.ORDER_ATOMIC]
|
||||
};
|
||||
|
||||
// --- Round Number to n decimal places -------------------------------
|
||||
Blockly.Blocks['math_rndfixed'] = {
|
||||
init: function() {
|
||||
this.appendValueInput('x')
|
||||
.setCheck('Number')
|
||||
.appendField(Blockly.Words['math_rndfixed_round'][systemLang]);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['math_rndfixed_to'][systemLang])
|
||||
.appendField(new Blockly.FieldNumber(0, 1, 25), 'n')
|
||||
.appendField(Blockly.Words['math_rndfixed_decplcs'][systemLang]);
|
||||
this.setInputsInline(true);
|
||||
this.setColour(Blockly.Blocks.math.HUE);
|
||||
this.setOutput(true, 'Number');
|
||||
this.setTooltip(Blockly.Words['math_rndfixed_tooltip'][systemLang]);
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['math_rndfixed'] = function(block) {
|
||||
var x = Blockly.JavaScript.valueToCode(block, 'x', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
const exp = Math.pow(10, block.getFieldValue('n'));
|
||||
return ['Math.round(' + x + '*' + exp + ')/' + exp, Blockly.JavaScript.ORDER_ATOMIC];
|
||||
};
|
||||
469
admin/google-blockly/own/blocks_time.js
Normal file
469
admin/google-blockly/own/blocks_time.js
Normal file
@@ -0,0 +1,469 @@
|
||||
'use strict';
|
||||
|
||||
goog.provide('Blockly.JavaScript.Time');
|
||||
|
||||
goog.require('Blockly.JavaScript');
|
||||
|
||||
Blockly.CustomBlocks = Blockly.CustomBlocks || [];
|
||||
Blockly.CustomBlocks.push('Time');
|
||||
|
||||
Blockly.Time = {
|
||||
HUE: 270,
|
||||
blocks: {}
|
||||
};
|
||||
|
||||
|
||||
// if time greater, less, between
|
||||
// --- time compare --------------------------------------------------
|
||||
Blockly.Time.blocks['time_compare_ex'] =
|
||||
'<block type="time_compare_ex">'
|
||||
+ ' <value name="OPTION">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="USE_ACTUAL_TIME">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="START_TIME">'
|
||||
+ ' <shadow type="text">'
|
||||
+ ' <field name="TEXT">12:00</field>'
|
||||
+ ' </shadow>'
|
||||
+ ' </value>'
|
||||
+ ' <mutation end_time="false" actual_time="true"></mutation>'
|
||||
+ ' <value name="END_TIME">'
|
||||
+ ' <shadow type="text">'
|
||||
+ ' <field name="TEXT">18:00</field>'
|
||||
+ ' </shadow>'
|
||||
+ ' </value>'
|
||||
+ ' <value name="CUSTOM_TIME">'
|
||||
+ ' <shadow type="text">'
|
||||
+ ' <field name="TEXT">14:00</field>'
|
||||
+ ' </shadow>'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['time_compare_ex'] = {
|
||||
init: function() {
|
||||
this.appendDummyInput('TIME_TEXT')
|
||||
.appendField(Blockly.Words['time_compare_ex'][systemLang]);
|
||||
|
||||
this.appendDummyInput('USE_ACTUAL_TIME')
|
||||
.appendField(new Blockly.FieldCheckbox('TRUE', function (option) {
|
||||
this.sourceBlock_.updateShape_(undefined, option);
|
||||
}), 'USE_ACTUAL_TIME');
|
||||
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['time_compare_is_ex'][systemLang]);
|
||||
|
||||
this.appendDummyInput('OPTION')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Words['time_compare_lt'][systemLang], '<'],
|
||||
[Blockly.Words['time_compare_le'][systemLang], '<='],
|
||||
[Blockly.Words['time_compare_gt'][systemLang], '>'],
|
||||
[Blockly.Words['time_compare_ge'][systemLang], '>='],
|
||||
[Blockly.Words['time_compare_eq'][systemLang], '=='],
|
||||
[Blockly.Words['time_compare_bw'][systemLang], 'between'],
|
||||
[Blockly.Words['time_compare_nb'][systemLang], 'not between']
|
||||
], function (option) {
|
||||
this.sourceBlock_.updateShape_((option === 'between' || option === 'not between'));
|
||||
}), 'OPTION');
|
||||
|
||||
this.appendDummyInput()
|
||||
.appendField(' ');
|
||||
|
||||
this.appendValueInput('START_TIME');
|
||||
|
||||
this.setInputsInline(true);
|
||||
//this.setPreviousStatement(true, null);
|
||||
//this.setNextStatement(true, null);
|
||||
|
||||
this.setOutput(true, 'Boolean');
|
||||
|
||||
this.setColour(Blockly.Time.HUE);
|
||||
this.setTooltip(Blockly.Words['time_compare_ex_tooltip'][systemLang]);
|
||||
this.setHelpUrl(Blockly.Words['time_compare_ex_help'][systemLang]);
|
||||
},
|
||||
mutationToDom: function() {
|
||||
var container = document.createElement('mutation');
|
||||
var option = this.getFieldValue('OPTION');
|
||||
var use_actual_time = this.getFieldValue('USE_ACTUAL_TIME');
|
||||
container.setAttribute('end_time', (option === 'between' || option === 'not between') ? 'true' : 'false');
|
||||
container.setAttribute('actual_time', (use_actual_time === 'TRUE') ? 'true' : 'false');
|
||||
return container;
|
||||
},
|
||||
domToMutation: function(xmlElement) {
|
||||
this.updateShape_(xmlElement.getAttribute('end_time') === 'true', xmlElement.getAttribute('actual_time') === 'true');
|
||||
},
|
||||
updateShape_: function(isBetween, useActualTime) {
|
||||
if (isBetween === undefined) {
|
||||
isBetween = (this.getFieldValue('OPTION') === 'between' || this.getFieldValue('OPTION') === 'not between');
|
||||
}
|
||||
// Add or remove a delay Input.
|
||||
var inputExists = this.getInput('END_TIME');
|
||||
|
||||
if (isBetween) {
|
||||
if (!inputExists) {
|
||||
inputExists = this.getInput('CUSTOM_TIME');
|
||||
if (inputExists) {
|
||||
this.removeInput('CUSTOM_TIME');
|
||||
this.removeInput('CUSTOM_TEXT');
|
||||
}
|
||||
|
||||
this.appendDummyInput('AND')
|
||||
.appendField(Blockly.Words['time_compare_and'][systemLang]);
|
||||
|
||||
var input = this.appendValueInput('END_TIME');
|
||||
var shadow = this.workspace.newBlock('text');
|
||||
shadow.setShadow(true);
|
||||
shadow.outputConnection.connect(input.connection);
|
||||
shadow.setFieldValue('18:00', 'TEXT');
|
||||
shadow.initSvg();
|
||||
shadow.render();
|
||||
}
|
||||
} else if (inputExists) {
|
||||
this.removeInput('END_TIME');
|
||||
this.removeInput('AND');
|
||||
}
|
||||
|
||||
if (useActualTime === undefined) {
|
||||
useActualTime = this.getFieldValue('USE_ACTUAL_TIME') === 'TRUE';
|
||||
}
|
||||
inputExists = this.getInput('CUSTOM_TIME');
|
||||
|
||||
if (!useActualTime) {
|
||||
this.getInput('TIME_TEXT').fieldRow[0].setText(Blockly.Words['time_compare_custom_ex'][systemLang]);
|
||||
|
||||
if (!inputExists) {
|
||||
this.appendDummyInput('CUSTOM_TEXT')
|
||||
.appendField(Blockly.Words['time_compare_ex_custom'][systemLang]);
|
||||
|
||||
this.appendValueInput('CUSTOM_TIME');
|
||||
}
|
||||
} else if (inputExists) {
|
||||
this.getInput('TIME_TEXT').fieldRow[0].setText(Blockly.Words['time_compare_ex'][systemLang]);
|
||||
this.removeInput('CUSTOM_TIME');
|
||||
this.removeInput('CUSTOM_TEXT');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['time_compare_ex'] = function(block) {
|
||||
var option = block.getFieldValue('OPTION');
|
||||
var start_time = Blockly.JavaScript.valueToCode(block, 'START_TIME', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
var end_time = Blockly.JavaScript.valueToCode(block, 'END_TIME', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
var time = Blockly.JavaScript.valueToCode(block, 'CUSTOM_TIME', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
if (!end_time) end_time = null;
|
||||
if (!time) time = null;
|
||||
return ['compareTime(' + start_time + ', ' + end_time + ', "' + option + '", ' + time + ')', Blockly.JavaScript.ORDER_ATOMIC];
|
||||
};
|
||||
|
||||
// if time greater, less, between
|
||||
// --- time compare --------------------------------------------------
|
||||
Blockly.Time.blocks['time_compare'] =
|
||||
'<block type="time_compare">'
|
||||
+ ' <value name="OPTION">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="START_TIME">'
|
||||
+ ' </value>'
|
||||
+ ' <mutation end_time="false"></mutation>'
|
||||
+ ' <value name="END_TIME">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['time_compare'] = {
|
||||
init: function() {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['time_compare'][systemLang]);
|
||||
|
||||
this.appendDummyInput('OPTION')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Words['time_compare_lt'][systemLang], "<"],
|
||||
[Blockly.Words['time_compare_le'][systemLang], "<="],
|
||||
[Blockly.Words['time_compare_gt'][systemLang], ">"],
|
||||
[Blockly.Words['time_compare_ge'][systemLang], ">="],
|
||||
[Blockly.Words['time_compare_eq'][systemLang], "=="],
|
||||
[Blockly.Words['time_compare_bw'][systemLang], "between"],
|
||||
[Blockly.Words['time_compare_nb'][systemLang], "not between"]
|
||||
], function (option) {
|
||||
this.sourceBlock_.updateShape_((option === 'between' || option === 'not between'));
|
||||
}), 'OPTION');
|
||||
|
||||
this.appendDummyInput()
|
||||
.appendField(' ');
|
||||
|
||||
this.appendDummyInput('START_TIME')
|
||||
.appendField(new Blockly.FieldTextInput('12:00'), 'START_TIME');
|
||||
|
||||
this.setInputsInline(true);
|
||||
//this.setPreviousStatement(true, null);
|
||||
//this.setNextStatement(true, null);
|
||||
|
||||
this.setOutput(true, 'Boolean');
|
||||
|
||||
this.setColour(Blockly.Time.HUE);
|
||||
this.setTooltip(Blockly.Words['time_compare_tooltip'][systemLang]);
|
||||
this.setHelpUrl(Blockly.Words['time_compare_help'][systemLang]);
|
||||
},
|
||||
|
||||
mutationToDom: function() {
|
||||
var container = document.createElement('mutation');
|
||||
var option = this.getFieldValue('OPTION');
|
||||
container.setAttribute('end_time', (option === 'between' || option === 'not between') ? 'true' : 'false');
|
||||
return container;
|
||||
},
|
||||
domToMutation: function(xmlElement) {
|
||||
this.updateShape_(xmlElement.getAttribute('end_time') === 'true');
|
||||
},
|
||||
updateShape_: function(isBetween) {
|
||||
// Add or remove a delay Input.
|
||||
var inputExists = this.getInput('END_TIME');
|
||||
|
||||
if (isBetween) {
|
||||
if (!inputExists) {
|
||||
this.appendDummyInput('AND')
|
||||
.appendField(Blockly.Words['time_compare_and'][systemLang]);
|
||||
|
||||
this.appendDummyInput('END_TIME')
|
||||
.appendField(new Blockly.FieldTextInput('18:00'), 'END_TIME');
|
||||
}
|
||||
} else if (inputExists) {
|
||||
this.removeInput('END_TIME');
|
||||
this.removeInput('AND');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['time_compare'] = function(block) {
|
||||
var option = block.getFieldValue('OPTION');
|
||||
var start_time = block.getFieldValue('START_TIME');
|
||||
var end_time = block.getFieldValue('END_TIME');
|
||||
if (!end_time) end_time = null;
|
||||
|
||||
return ['compareTime("' + start_time + '", "' + end_time + '", "' + option + '")', Blockly.JavaScript.ORDER_ATOMIC];
|
||||
};
|
||||
|
||||
// --- get time --------------------------------------------------
|
||||
Blockly.Words['time_get_yyyy.mm.dd'] .format = 'YYYY.MM.DD';
|
||||
Blockly.Words['time_get_yyyy/mm/dd'] .format = 'YYYY/MM/DD';
|
||||
Blockly.Words['time_get_yy.mm.dd'] .format = 'YY.MM.DD';
|
||||
Blockly.Words['time_get_yy/mm/dd'] .format = 'YY/MM/DD';
|
||||
Blockly.Words['time_get_dd.mm.yyyy'] .format = 'DD.MM.YYYY';
|
||||
Blockly.Words['time_get_dd/mm/yyyy'] .format = 'DD/MM/YYYY';
|
||||
Blockly.Words['time_get_dd.mm.yy'] .format = 'DD.MM.YY';
|
||||
Blockly.Words['time_get_dd/mm/yy'] .format = 'DD/MM/YY';
|
||||
Blockly.Words['time_get_mm/dd/yyyy'] .format = 'MM/DD/YYYY';
|
||||
Blockly.Words['time_get_mm/dd/yy'] .format = 'MM/DD/YY';
|
||||
Blockly.Words['time_get_dd.mm'] .format = 'DD.MM.';
|
||||
Blockly.Words['time_get_dd/mm'] .format = 'DD/MM';
|
||||
Blockly.Words['time_get_mm.dd'] .format = 'MM.DD';
|
||||
Blockly.Words['time_get_mm/dd'] .format = 'MM/DD';
|
||||
Blockly.Words['time_get_hh_mm'] .format = 'hh:mm';
|
||||
Blockly.Words['time_get_hh_mm_ss'] .format = 'hh:mm:ss';
|
||||
Blockly.Words['time_get_hh_mm_ss.sss'].format = 'hh:mm:ss.sss';
|
||||
|
||||
Blockly.Time.blocks['time_get'] =
|
||||
'<block type="time_get">'
|
||||
+ ' <value name="OPTION">'
|
||||
+ ' </value>'
|
||||
+ ' <mutation format="false" language="false"></mutation>'
|
||||
+ ' <value name="FORMAT">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="LANGUAGE">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['time_get'] = {
|
||||
init: function() {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['time_get'][systemLang]);
|
||||
|
||||
this.appendDummyInput('OPTION')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Words['time_get_object'][systemLang] , 'object'],
|
||||
[Blockly.Words['time_get_ms'][systemLang] , 'ms'],
|
||||
[Blockly.Words['time_get_s'][systemLang] , 's'],
|
||||
[Blockly.Words['time_get_sid'][systemLang] , 'sid'],
|
||||
[Blockly.Words['time_get_m'][systemLang] , 'm'],
|
||||
[Blockly.Words['time_get_mid'][systemLang] , 'mid'],
|
||||
[Blockly.Words['time_get_h'][systemLang] , 'h'],
|
||||
[Blockly.Words['time_get_d'][systemLang] , 'd'],
|
||||
[Blockly.Words['time_get_M'][systemLang] , 'M'],
|
||||
[Blockly.Words['time_get_Mt'][systemLang] , 'Mt'],
|
||||
[Blockly.Words['time_get_Mts'][systemLang] , 'Mts'],
|
||||
[Blockly.Words['time_get_y'][systemLang] , 'y'],
|
||||
[Blockly.Words['time_get_fy'][systemLang] , 'fy'],
|
||||
[Blockly.Words['time_get_wdt'][systemLang] , 'wdt'],
|
||||
[Blockly.Words['time_get_wdts'][systemLang] , 'wdts'],
|
||||
[Blockly.Words['time_get_wd'][systemLang] , 'wd'],
|
||||
[Blockly.Words['time_get_custom'][systemLang] , 'custom'],
|
||||
[Blockly.Words['time_get_yyyy.mm.dd'][systemLang] , [Blockly.Words['time_get_yyyy.mm.dd'] .format]],
|
||||
[Blockly.Words['time_get_yyyy/mm/dd'][systemLang] , [Blockly.Words['time_get_yyyy/mm/dd'] .format]],
|
||||
[Blockly.Words['time_get_yy.mm.dd'][systemLang] , [Blockly.Words['time_get_yy.mm.dd'] .format]],
|
||||
[Blockly.Words['time_get_yy/mm/dd'][systemLang] , [Blockly.Words['time_get_yy/mm/dd'] .format]],
|
||||
[Blockly.Words['time_get_dd.mm.yyyy'][systemLang] , [Blockly.Words['time_get_dd.mm.yyyy'] .format]],
|
||||
[Blockly.Words['time_get_dd/mm/yyyy'][systemLang] , [Blockly.Words['time_get_dd/mm/yyyy'] .format]],
|
||||
[Blockly.Words['time_get_dd.mm.yy'][systemLang] , [Blockly.Words['time_get_dd.mm.yy'] .format]],
|
||||
[Blockly.Words['time_get_dd/mm/yy'][systemLang] , [Blockly.Words['time_get_dd/mm/yy'] .format]],
|
||||
[Blockly.Words['time_get_mm/dd/yyyy'][systemLang] , [Blockly.Words['time_get_mm/dd/yyyy'] .format]],
|
||||
[Blockly.Words['time_get_mm/dd/yy'][systemLang] , [Blockly.Words['time_get_mm/dd/yy'] .format]],
|
||||
[Blockly.Words['time_get_dd.mm'][systemLang] , [Blockly.Words['time_get_dd.mm'] .format]],
|
||||
[Blockly.Words['time_get_dd/mm'][systemLang] , [Blockly.Words['time_get_dd/mm'] .format]],
|
||||
[Blockly.Words['time_get_mm.dd'][systemLang] , [Blockly.Words['time_get_mm.dd'] .format]],
|
||||
[Blockly.Words['time_get_mm/dd'][systemLang] , [Blockly.Words['time_get_mm/dd'] .format]],
|
||||
[Blockly.Words['time_get_hh_mm'][systemLang] , [Blockly.Words['time_get_hh_mm'] .format]],
|
||||
[Blockly.Words['time_get_hh_mm_ss'][systemLang] , [Blockly.Words['time_get_hh_mm_ss'] .format]],
|
||||
[Blockly.Words['time_get_hh_mm_ss.sss'][systemLang] , [Blockly.Words['time_get_hh_mm_ss.sss'].format]]
|
||||
], function (option) {
|
||||
this.sourceBlock_.updateShape_(option === 'custom', option === 'wdt' || option === 'wdts' || option === 'Mt' || option === 'Mts');
|
||||
}), 'OPTION');
|
||||
|
||||
this.setInputsInline(true);
|
||||
|
||||
this.setOutput(true);
|
||||
|
||||
this.setColour(Blockly.Time.HUE);
|
||||
this.setTooltip(Blockly.Words['time_get_tooltip'][systemLang]);
|
||||
this.setHelpUrl(Blockly.Words['time_get_help'][systemLang]);
|
||||
},
|
||||
mutationToDom: function() {
|
||||
var container = document.createElement('mutation');
|
||||
var option = this.getFieldValue('OPTION');
|
||||
container.setAttribute('format', option === 'custom' ? 'true' : 'false');
|
||||
container.setAttribute('language', option === 'wdt' || option === 'wdts' || option === 'Mt' || option === 'Mts' ? 'true' : 'false');
|
||||
return container;
|
||||
},
|
||||
domToMutation: function(xmlElement) {
|
||||
this.updateShape_(xmlElement.getAttribute('format') === 'true', xmlElement.getAttribute('language') === 'true');
|
||||
},
|
||||
updateShape_: function(isFormat, isLanguage) {
|
||||
// Add or remove a delay Input.
|
||||
var inputExists = this.getInput('FORMAT');
|
||||
|
||||
if (isFormat) {
|
||||
if (!inputExists) {
|
||||
this.appendDummyInput('FORMAT')
|
||||
.appendField(' ')
|
||||
.appendField(new Blockly.FieldTextInput(Blockly.Words['time_get_default_format'][systemLang]), 'FORMAT');
|
||||
}
|
||||
} else if (inputExists) {
|
||||
this.removeInput('FORMAT');
|
||||
}
|
||||
|
||||
inputExists = this.getInput('LANGUAGE');
|
||||
|
||||
if (isLanguage) {
|
||||
if (!inputExists) {
|
||||
var languages;
|
||||
if (systemLang === 'en') {
|
||||
languages = [['in english', 'en'], ['auf deutsch', 'de'], ['на русском', 'ru']];
|
||||
} else if (systemLang === 'de') {
|
||||
languages = [['auf deutsch', 'de'], ['in english', 'en'], ['на русском', 'ru']];
|
||||
} else if (systemLang === 'ru') {
|
||||
languages = [['на русском', 'ru'], ['in english', 'en'], ['auf deutsch', 'de']];
|
||||
} else {
|
||||
languages = [['in english', 'en'], ['auf deutsch', 'de'], ['на русском', 'ru']];
|
||||
}
|
||||
this.appendDummyInput('LANGUAGE')
|
||||
.appendField(new Blockly.FieldDropdown(languages), 'LANGUAGE');
|
||||
}
|
||||
} else if (inputExists) {
|
||||
this.removeInput('LANGUAGE');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['time_get'] = function(block) {
|
||||
var option = block.getFieldValue('OPTION');
|
||||
var format = block.getFieldValue('FORMAT');
|
||||
var lang = block.getFieldValue('LANGUAGE');
|
||||
|
||||
var code;
|
||||
if (option === 'object') {
|
||||
code = '(new Date().getTime())';
|
||||
} else if (option === 'ms') {
|
||||
code = '(new Date().getMilliseconds())';
|
||||
} else if (option === 's') {
|
||||
code = '(new Date().getSeconds())';
|
||||
} else if (option === 'sid') {
|
||||
code = '(new Date().getHours() * 3600 + new Date().getMinutes() * 60 + new Date().getSeconds())';
|
||||
} else if (option === 'm') {
|
||||
code = '(new Date().getMinutes())';
|
||||
} else if (option === 'mid') {
|
||||
code = '(function () {var v = new Date(); return v.getHours() * 60 + v.getMinutes();})()';
|
||||
} else if (option === 'h') {
|
||||
code = '(new Date().getHours())';
|
||||
} else if (option === 'd') {
|
||||
code = '(new Date().getDate())';
|
||||
} else if (option === 'M') {
|
||||
code = '(new Date().getMonth() + 1)';
|
||||
} else if (option === 'Mt') {
|
||||
code = 'formatDate(new Date(), "OO", "' + lang + '")';
|
||||
} else if (option === 'Mts') {
|
||||
code = 'formatDate(new Date(), "O", "' + lang + '")';
|
||||
} else if (option === 'y') {
|
||||
code = '(new Date().getYear())';
|
||||
} else if (option === 'fy') {
|
||||
code = '(new Date().getFullYear())';
|
||||
} else if (option === 'wdt') {
|
||||
code = 'formatDate(new Date(), "WW", "' + lang + '")';
|
||||
} else if (option === 'wdts') {
|
||||
code = 'formatDate(new Date(), "W", "' + lang + '")';
|
||||
} else if (option === 'wd') {
|
||||
code = '(new Date().getDay() === 0 ? 7 : new Date().getDay())';
|
||||
} else if (option === 'custom') {
|
||||
code = 'formatDate(new Date(), "' + format + '")';
|
||||
} else {
|
||||
code = 'formatDate(new Date(), "' + option + '")';
|
||||
}
|
||||
|
||||
return [code, Blockly.JavaScript.ORDER_ATOMIC];
|
||||
};
|
||||
|
||||
// --- get astro time --------------------------------------------------
|
||||
Blockly.Time.blocks['time_astro'] =
|
||||
'<block type="time_astro">'
|
||||
+ ' <value name="TYPE">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="OFFSET">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['time_astro'] = {
|
||||
init: function() {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['time_astro'][systemLang]);
|
||||
|
||||
this.appendDummyInput('TYPE')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Words['astro_sunriseText'][systemLang], 'sunrise'],
|
||||
[Blockly.Words['astro_sunriseEndText'][systemLang], 'sunriseEnd'],
|
||||
[Blockly.Words['astro_goldenHourEndText'][systemLang], 'goldenHourEnd'],
|
||||
[Blockly.Words['astro_solarNoonText'][systemLang], 'solarNoon'],
|
||||
[Blockly.Words['astro_goldenHourText'][systemLang], 'goldenHour'],
|
||||
[Blockly.Words['astro_sunsetStartText'][systemLang], 'sunsetStart'],
|
||||
[Blockly.Words['astro_sunsetText'][systemLang], 'sunset'],
|
||||
[Blockly.Words['astro_duskText'][systemLang], 'dusk'],
|
||||
[Blockly.Words['astro_nauticalDuskText'][systemLang], 'nauticalDusk'],
|
||||
[Blockly.Words['astro_nightText'][systemLang], 'night'],
|
||||
[Blockly.Words['astro_nightEndText'][systemLang], 'nightEnd'],
|
||||
[Blockly.Words['astro_nauticalDawnText'][systemLang], 'nauticalDawn'],
|
||||
[Blockly.Words['astro_dawnText'][systemLang], 'dawn'],
|
||||
[Blockly.Words['astro_nadirText'][systemLang], 'nadir']
|
||||
]), 'TYPE');
|
||||
|
||||
this.appendDummyInput('OFFSET')
|
||||
.appendField(Blockly.Words['time_astro_offset'][systemLang])
|
||||
.appendField(new Blockly.FieldTextInput('0'), 'OFFSET');
|
||||
|
||||
this.setInputsInline(true);
|
||||
|
||||
this.setOutput(true);
|
||||
|
||||
this.setColour(Blockly.Time.HUE);
|
||||
this.setTooltip(Blockly.Words['time_astro_tooltip'][systemLang]);
|
||||
this.setHelpUrl(Blockly.Words['time_astro_help'][systemLang]);
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['time_astro'] = function(block) {
|
||||
var type = block.getFieldValue('TYPE');
|
||||
var offset = parseFloat(block.getFieldValue('OFFSET'));
|
||||
return ['getAstroDate("' + type + '", undefined, ' + offset + ')', Blockly.JavaScript.ORDER_ATOMIC];
|
||||
};
|
||||
289
admin/google-blockly/own/blocks_timeout.js
Normal file
289
admin/google-blockly/own/blocks_timeout.js
Normal file
@@ -0,0 +1,289 @@
|
||||
'use strict';
|
||||
|
||||
goog.provide('Blockly.JavaScript.Timeouts');
|
||||
|
||||
goog.require('Blockly.JavaScript');
|
||||
|
||||
Blockly.CustomBlocks = Blockly.CustomBlocks || [];
|
||||
Blockly.CustomBlocks.push('Timeouts');
|
||||
|
||||
Blockly.Timeouts = {
|
||||
HUE: 70,
|
||||
blocks: {}
|
||||
};
|
||||
|
||||
/**
|
||||
* Ensure two identically-named procedures don't exist.
|
||||
* @param {string} name Proposed procedure name.
|
||||
* @param {!Blockly.Block} block Block to disambiguate.
|
||||
* @return {string} Non-colliding name.
|
||||
*/
|
||||
Blockly.Timeouts.findLegalName = function(name, block) {
|
||||
if (block.isInFlyout) {
|
||||
// Flyouts can have multiple procedures called 'do something'.
|
||||
return name;
|
||||
}
|
||||
while (!Blockly.Timeouts.isLegalName_(name, block.workspace, block)) {
|
||||
// Collision with another procedure.
|
||||
var r = name.match(/^(.*?)(\d+)$/);
|
||||
if (!r) {
|
||||
name += '2';
|
||||
} else {
|
||||
name = r[1] + (parseInt(r[2], 10) + 1);
|
||||
}
|
||||
}
|
||||
return name;
|
||||
};
|
||||
|
||||
/**
|
||||
* Does this procedure have a legal name? Illegal names include names of
|
||||
* procedures already defined.
|
||||
* @param {string} name The questionable name.
|
||||
* @param {!Blockly.Workspace} workspace The workspace to scan for collisions.
|
||||
* @param {Blockly.Block=} opt_exclude Optional block to exclude from
|
||||
* comparisons (one doesn't want to collide with oneself).
|
||||
* @return {boolean} True if the name is legal.
|
||||
* @private
|
||||
*/
|
||||
Blockly.Timeouts.isLegalName_ = function(name, workspace, opt_exclude) {
|
||||
var blocks = workspace.getAllBlocks();
|
||||
// Iterate through every block and check the name.
|
||||
for (var i = 0; i < blocks.length; i++) {
|
||||
if (blocks[i] == opt_exclude) {
|
||||
continue;
|
||||
}
|
||||
if (blocks[i].isTimeout_ || blocks[i].isInterval_) {
|
||||
var blockName = blocks[i].getFieldValue('NAME');
|
||||
if (Blockly.Names.equals(blockName, name)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Rename a procedure. Called by the editable field.
|
||||
* @param {string} name The proposed new name.
|
||||
* @return {string} The accepted name.
|
||||
* @this {!Blockly.Field}
|
||||
*/
|
||||
Blockly.Timeouts.rename = function (name) {
|
||||
// Strip leading and trailing whitespace. Beyond this, all names are legal.
|
||||
name = name.replace(/^[\s\xa0]+|[\s\xa0]+$/g, '');
|
||||
return Blockly.Timeouts.findLegalName(name, this.sourceBlock_);
|
||||
};
|
||||
|
||||
// --- setTimeout -----------------------------------------------------------
|
||||
Blockly.Timeouts.blocks['timeouts_settimeout'] =
|
||||
'<block type="timeouts_settimeout">'
|
||||
+ ' <value name="NAME">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="DELAY">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="UNIT">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="STATEMENT">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['timeouts_settimeout'] = {
|
||||
init: function() {
|
||||
var nameField = new Blockly.FieldTextInput(
|
||||
Blockly.Timeouts.findLegalName('timeout', this),
|
||||
Blockly.Timeouts.rename);
|
||||
|
||||
nameField.setSpellcheck(false);
|
||||
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['timeouts_settimeout'][systemLang])
|
||||
.appendField(nameField, 'NAME')
|
||||
.appendField(Blockly.Words['timeouts_settimeout_in'][systemLang])
|
||||
.appendField(new Blockly.FieldTextInput(1000), "DELAY")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Words['timeouts_settimeout_ms'][systemLang], 'ms'],
|
||||
[Blockly.Words['timeouts_settimeout_sec'][systemLang], 'sec'],
|
||||
[Blockly.Words['timeouts_settimeout_min'][systemLang], 'min']
|
||||
]), 'UNIT')
|
||||
.appendField(Blockly.Words['timeouts_settimeout_ms'][systemLang]);
|
||||
|
||||
this.appendStatementInput("STATEMENT")
|
||||
.setCheck(null);
|
||||
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(false);
|
||||
this.setColour(Blockly.Timeouts.HUE);
|
||||
this.setTooltip(Blockly.Words['timeouts_settimeout_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('timeouts_settimeout_help'));
|
||||
},
|
||||
isTimeout_: true,
|
||||
getVars: function () {
|
||||
return [this.getFieldValue('NAME')];
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['timeouts_settimeout'] = function(block) {
|
||||
var delay = block.getFieldValue('DELAY');
|
||||
var name = block.getFieldValue('NAME');
|
||||
var unit = block.getFieldValue('UNIT');
|
||||
if (unit === 'min') {
|
||||
delay *= 60000;
|
||||
} else if (unit === 'sec') {
|
||||
delay *= 1000;
|
||||
}
|
||||
var statements_name = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
|
||||
return name + ' = setTimeout(function () {\n' + statements_name + '}, ' + delay + ');\n';
|
||||
};
|
||||
|
||||
// --- clearTimeout -----------------------------------------------------------
|
||||
Blockly.Timeouts.getAllTimeouts = function (workspace) {
|
||||
var blocks = workspace.getAllBlocks();
|
||||
var result = [];
|
||||
|
||||
// Iterate through every block and check the name.
|
||||
for (var i = 0; i < blocks.length; i++) {
|
||||
if (blocks[i].isTimeout_) {
|
||||
result.push([blocks[i].getFieldValue('NAME'), blocks[i].getFieldValue('NAME')]);
|
||||
}
|
||||
}
|
||||
if (!result.length) result.push(['', '']);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
Blockly.Timeouts.blocks['timeouts_cleartimeout'] =
|
||||
'<block type="timeouts_cleartimeout">'
|
||||
+ ' <value name="NAME">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['timeouts_cleartimeout'] = {
|
||||
init: function() {
|
||||
this.appendDummyInput('NAME')
|
||||
.appendField(Blockly.Words['timeouts_cleartimeout'][systemLang])
|
||||
.appendField(new Blockly.FieldDropdown(function () {
|
||||
return Blockly.Timeouts.getAllTimeouts(scripts.blocklyWorkspace);
|
||||
}), 'NAME');
|
||||
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(true);
|
||||
this.setColour(Blockly.Timeouts.HUE);
|
||||
this.setTooltip(Blockly.Words['timeouts_cleartimeout_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('timeouts_cleartimeout_help'));
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['timeouts_cleartimeout'] = function(block) {
|
||||
var name = block.getFieldValue('NAME');
|
||||
return '(function () {if (' + name + ') {clearTimeout(' + name + '); ' + name + ' = null;}})();\n';
|
||||
};
|
||||
|
||||
// --- setInterval -----------------------------------------------------------
|
||||
Blockly.Timeouts.blocks['timeouts_setinterval'] =
|
||||
'<block type="timeouts_setinterval">'
|
||||
+ ' <value name="NAME">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="INTERVAL">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="UNIT">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="STATEMENT">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['timeouts_setinterval'] = {
|
||||
init: function() {
|
||||
var nameField = new Blockly.FieldTextInput(
|
||||
Blockly.Timeouts.findLegalName(Blockly.Words['timeouts_setinterval_name'][systemLang], this),
|
||||
Blockly.Timeouts.rename);
|
||||
|
||||
nameField.setSpellcheck(false);
|
||||
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['timeouts_setinterval'][systemLang])
|
||||
.appendField(nameField, 'NAME')
|
||||
.appendField(Blockly.Words['timeouts_setinterval_in'][systemLang])
|
||||
.appendField(new Blockly.FieldTextInput(1000), "INTERVAL")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Words['timeouts_settimeout_ms'][systemLang], 'ms'],
|
||||
[Blockly.Words['timeouts_settimeout_sec'][systemLang], 'sec'],
|
||||
[Blockly.Words['timeouts_settimeout_min'][systemLang], 'min']
|
||||
]), 'UNIT')
|
||||
.appendField(Blockly.Words['timeouts_setinterval_ms'][systemLang]);
|
||||
|
||||
this.appendStatementInput("STATEMENT")
|
||||
.setCheck(null);
|
||||
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(false);
|
||||
this.setColour(Blockly.Timeouts.HUE);
|
||||
this.setTooltip(Blockly.Words['timeouts_setinterval_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('timeouts_setinterval_help'));
|
||||
},
|
||||
isInterval_: true,
|
||||
getVars: function () {
|
||||
return [this.getFieldValue('NAME')];
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['timeouts_setinterval'] = function(block) {
|
||||
var delay = block.getFieldValue('INTERVAL');
|
||||
var name = block.getFieldValue('NAME');
|
||||
var unit = block.getFieldValue('UNIT');
|
||||
if (unit === 'min') {
|
||||
delay *= 60000;
|
||||
} else if (unit === 'sec') {
|
||||
delay *= 1000;
|
||||
}
|
||||
|
||||
var statements_name = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
|
||||
return name + ' = setInterval(function () {\n' + statements_name + '}, ' + delay + ');\n';
|
||||
};
|
||||
|
||||
// --- clearInterval -----------------------------------------------------------
|
||||
Blockly.Timeouts.blocks['timeouts_clearinterval'] =
|
||||
'<block type="timeouts_clearinterval">'
|
||||
+ ' <value name="NAME">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Timeouts.getAllIntervals = function (workspace) {
|
||||
var blocks = workspace.getAllBlocks();
|
||||
var result = [];
|
||||
|
||||
// Iterate through every block and check the name.
|
||||
for (var i = 0; i < blocks.length; i++) {
|
||||
if (blocks[i].isInterval_) {
|
||||
result.push([blocks[i].getFieldValue('NAME'), blocks[i].getFieldValue('NAME')]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!result.length) result.push(['', '']);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
Blockly.Blocks['timeouts_clearinterval'] = {
|
||||
init: function() {
|
||||
this.appendDummyInput("NAME")
|
||||
.appendField(Blockly.Words['timeouts_clearinterval'][systemLang])
|
||||
.appendField(new Blockly.FieldDropdown(function () {
|
||||
return Blockly.Timeouts.getAllIntervals(scripts.blocklyWorkspace);
|
||||
}), "NAME");
|
||||
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(true);
|
||||
this.setColour(Blockly.Timeouts.HUE);
|
||||
this.setTooltip(Blockly.Words['timeouts_clearinterval_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('timeouts_clearinterval_help'));
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['timeouts_clearinterval'] = function(block) {
|
||||
var name = block.getFieldValue('NAME');
|
||||
return '(function () {if (' + name + ') {clearInterval(' + name + '); ' + name + ' = null;}})();\n';
|
||||
};
|
||||
857
admin/google-blockly/own/blocks_trigger.js
Normal file
857
admin/google-blockly/own/blocks_trigger.js
Normal file
@@ -0,0 +1,857 @@
|
||||
'use strict';
|
||||
|
||||
goog.provide('Blockly.JavaScript.Trigger');
|
||||
|
||||
goog.require('Blockly.JavaScript');
|
||||
|
||||
Blockly.CustomBlocks = Blockly.CustomBlocks || [];
|
||||
Blockly.CustomBlocks.push('Trigger');
|
||||
|
||||
|
||||
Blockly.Trigger = {
|
||||
HUE: 330,
|
||||
blocks: {}
|
||||
};
|
||||
|
||||
// --- ON Extended-----------------------------------------------------------
|
||||
Blockly.Trigger.blocks['on_ext'] =
|
||||
'<block type="on_ext">'
|
||||
+ ' <value name="CONDITION">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="ACK_CONDITION">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="STATEMENT">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['on_ext_oid_container'] = {
|
||||
/**
|
||||
* Mutator block for container.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
init: function() {
|
||||
this.setColour(Blockly.Trigger.HUE);
|
||||
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['on_ext_on'][systemLang]);
|
||||
|
||||
this.appendStatementInput('STACK');
|
||||
this.setTooltip(Blockly.Words['on_ext_on_tooltip'][systemLang]);
|
||||
this.contextMenu = false;
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.Blocks['on_ext_oid'] = {
|
||||
/**
|
||||
* Mutator block for add items.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
init: function() {
|
||||
this.setColour(Blockly.Trigger.HUE);
|
||||
|
||||
this.appendDummyInput('OID')
|
||||
.appendField(Blockly.Words['on_ext_oid'][systemLang]);
|
||||
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
|
||||
this.setTooltip(Blockly.Words['on_ext_oid_tooltip'][systemLang]);
|
||||
|
||||
this.contextMenu = false;
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.Blocks['on_ext'] = {
|
||||
init: function() {
|
||||
this.itemCount_ = 1;
|
||||
this.updateShape_();
|
||||
|
||||
this.setMutator(new Blockly.Mutator(['on_ext_oid']));
|
||||
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(false);
|
||||
this.setColour(Blockly.Trigger.HUE);
|
||||
this.setTooltip(Blockly.Words['on_ext_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('on_help'));
|
||||
},
|
||||
/**
|
||||
* Create XML to represent number of text inputs.
|
||||
* @return {!Element} XML storage element.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
mutationToDom: function () {
|
||||
var container = document.createElement('mutation');
|
||||
container.setAttribute('items', this.itemCount_);
|
||||
return container;
|
||||
},
|
||||
/**
|
||||
* Parse XML to restore the text inputs.
|
||||
* @param {!Element} xmlElement XML storage element.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
domToMutation: function (xmlElement) {
|
||||
this.itemCount_ = parseInt(xmlElement.getAttribute('items'), 10);
|
||||
this.updateShape_();
|
||||
},
|
||||
/**
|
||||
* Populate the mutator's dialog with this block's components.
|
||||
* @param {!Blockly.Workspace} workspace Mutator's workspace.
|
||||
* @return {!Blockly.Block} Root block in mutator.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
decompose: function (workspace) {
|
||||
var containerBlock = workspace.newBlock('on_ext_oid_container');
|
||||
containerBlock.initSvg();
|
||||
var connection = containerBlock.getInput('STACK').connection;
|
||||
for (var i = 0; i < this.itemCount_; i++) {
|
||||
var itemBlock = workspace.newBlock('on_ext_oid');
|
||||
itemBlock.initSvg();
|
||||
connection.connect(itemBlock.previousConnection);
|
||||
connection = itemBlock.nextConnection;
|
||||
}
|
||||
return containerBlock;
|
||||
},
|
||||
/**
|
||||
* Reconfigure this block based on the mutator dialog's components.
|
||||
* @param {!Blockly.Block} containerBlock Root block in mutator.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
compose: function (containerBlock) {
|
||||
var itemBlock = containerBlock.getInputTargetBlock('STACK');
|
||||
// Count number of inputs.
|
||||
var connections = [];
|
||||
while (itemBlock) {
|
||||
connections.push(itemBlock.valueConnection_);
|
||||
itemBlock = itemBlock.nextConnection &&
|
||||
itemBlock.nextConnection.targetBlock();
|
||||
}
|
||||
// Disconnect any children that don't belong.
|
||||
for (var i = 0; i < this.itemCount_; i++) {
|
||||
var connection = this.getInput('OID' + i).connection.targetConnection;
|
||||
if (connection && connections.indexOf(connection) === -1) {
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
this.itemCount_ = connections.length;
|
||||
if (this.itemCount_ < 1) this.itemCount_ = 1;
|
||||
this.updateShape_();
|
||||
// Reconnect any child blocks.
|
||||
for (var i = 0; i < this.itemCount_; i++) {
|
||||
Blockly.Mutator.reconnect(connections[i], this, 'OID' + i);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Store pointers to any connected child blocks.
|
||||
* @param {!Blockly.Block} containerBlock Root block in mutator.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
saveConnections: function(containerBlock) {
|
||||
var itemBlock = containerBlock.getInputTargetBlock('STACK');
|
||||
var i = 0;
|
||||
while (itemBlock) {
|
||||
var input = this.getInput('OID' + i);
|
||||
itemBlock.valueConnection_ = input && input.connection.targetConnection;
|
||||
i++;
|
||||
itemBlock = itemBlock.nextConnection &&
|
||||
itemBlock.nextConnection.targetBlock();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Modify this block to have the correct number of inputs.
|
||||
* @private
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
updateShape_: function() {
|
||||
this.removeInput('CONDITION');
|
||||
this.removeInput('ACK_CONDITION');
|
||||
var input;
|
||||
|
||||
for (var j = 0; input = this.inputList[j]; j++) {
|
||||
if (input.name === 'STATEMENT') {
|
||||
this.inputList.splice(j, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Add new inputs.
|
||||
for (var i = 0; i < this.itemCount_; i++) {
|
||||
var _input = this.getInput('OID' + i);
|
||||
if (!_input) {
|
||||
_input = this.appendValueInput('OID' + i);
|
||||
|
||||
if (i === 0) {
|
||||
_input.appendField(Blockly.Words['on_ext'][systemLang]);
|
||||
}
|
||||
var shadow = this.workspace.newBlock('field_oid');
|
||||
shadow.setShadow(true);
|
||||
shadow.outputConnection.connect(_input.connection);
|
||||
shadow.initSvg();
|
||||
shadow.render();
|
||||
} else {
|
||||
if (!_input.connection.isConnected()) {
|
||||
var shadow = this.workspace.newBlock('field_oid');
|
||||
shadow.setShadow(true);
|
||||
shadow.outputConnection.connect(_input.connection);
|
||||
shadow.initSvg();
|
||||
shadow.render();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Remove deleted inputs.
|
||||
while (this.getInput('OID' + i)) {
|
||||
this.removeInput('OID' + i);
|
||||
i++;
|
||||
}
|
||||
|
||||
this.appendDummyInput('CONDITION')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Words['on_onchange'][systemLang], 'ne'],
|
||||
[Blockly.Words['on_any'][systemLang], 'any'],
|
||||
[Blockly.Words['on_gt'][systemLang], 'gt'],
|
||||
[Blockly.Words['on_ge'][systemLang], 'ge'],
|
||||
[Blockly.Words['on_lt'][systemLang], 'lt'],
|
||||
[Blockly.Words['on_le'][systemLang], 'le'],
|
||||
[Blockly.Words['on_true'][systemLang], 'true'],
|
||||
[Blockly.Words['on_false'][systemLang], 'false']
|
||||
]), 'CONDITION');
|
||||
|
||||
this.appendDummyInput('ACK_CONDITION')
|
||||
.appendField(Blockly.Words['on_ack'][systemLang])
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Words['on_ack_any'][systemLang], ''],
|
||||
[Blockly.Words['on_ack_true'][systemLang], 'true'],
|
||||
[Blockly.Words['on_ack_false'][systemLang], 'false']
|
||||
]), 'ACK_CONDITION');
|
||||
|
||||
if (input) {
|
||||
this.inputList.push(input);
|
||||
}
|
||||
else {
|
||||
this.appendStatementInput('STATEMENT')
|
||||
.setCheck(null)
|
||||
}
|
||||
}
|
||||
};
|
||||
Blockly.JavaScript['on_ext'] = function(block) {
|
||||
var dropdown_condition = block.getFieldValue('CONDITION');
|
||||
var statements_name = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
|
||||
var ack_condition = block.getFieldValue('ACK_CONDITION');
|
||||
var val;
|
||||
if (dropdown_condition === 'true' || dropdown_condition === 'false') {
|
||||
val = 'val: ' + dropdown_condition;
|
||||
} else {
|
||||
val = 'change: "' + dropdown_condition + '"';
|
||||
}
|
||||
|
||||
var oids = [];
|
||||
var firstID;
|
||||
for (var n = 0; n < block.itemCount_; n++) {
|
||||
var id = Blockly.JavaScript.valueToCode(block, 'OID' + n, Blockly.JavaScript.ORDER_COMMA);
|
||||
if (id) {
|
||||
firstID = id;
|
||||
id = id.replace(/\./g, '\\\\.').replace(/\(/g, '\\\\(').replace(/\)/g, '\\\\)').replace(/\[/g, '\\\\[');
|
||||
if (oids.indexOf(id) === -1) oids.push(id);
|
||||
}
|
||||
}
|
||||
var oid;
|
||||
if (oids.length === 1) {
|
||||
oid = firstID;
|
||||
} else {
|
||||
oid = 'new RegExp(' + (oids.join(' + "|" + ') || '') + ')';
|
||||
}
|
||||
|
||||
|
||||
var code = 'on({id: ' + oid + ', ' + val + (ack_condition ? ', ack: ' + ack_condition : '') + '}, function (obj) {\n ' +
|
||||
(oids.length === 1 ? 'var value = obj.state.val;\n var oldValue = obj.oldState.val;\n' : '') +
|
||||
statements_name + '});\n';
|
||||
return code;
|
||||
};
|
||||
|
||||
// --- ON -----------------------------------------------------------
|
||||
Blockly.Trigger.blocks['on'] =
|
||||
'<block type="on">'
|
||||
+ ' <value name="OID">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="CONDITION">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="ACK_CONDITION">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="STATEMENT">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['on'] = {
|
||||
init: function() {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['on'][systemLang]);
|
||||
|
||||
this.appendDummyInput('OID')
|
||||
.appendField(new Blockly.FieldOID('Object ID', main.initSelectId(), main.objects), 'OID');
|
||||
|
||||
this.appendDummyInput('CONDITION')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Words['on_onchange'][systemLang], 'ne'],
|
||||
[Blockly.Words['on_any'][systemLang], 'any'],
|
||||
[Blockly.Words['on_gt'][systemLang], 'gt'],
|
||||
[Blockly.Words['on_ge'][systemLang], 'ge'],
|
||||
[Blockly.Words['on_lt'][systemLang], 'lt'],
|
||||
[Blockly.Words['on_le'][systemLang], 'le'],
|
||||
[Blockly.Words['on_true'][systemLang], 'true'],
|
||||
[Blockly.Words['on_false'][systemLang], 'false']
|
||||
]), 'CONDITION');
|
||||
|
||||
this.appendDummyInput('ACK_CONDITION')
|
||||
.appendField(Blockly.Words['on_ack'][systemLang])
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Words['on_ack_any'][systemLang], ''],
|
||||
[Blockly.Words['on_ack_true'][systemLang], 'true'],
|
||||
[Blockly.Words['on_ack_false'][systemLang], 'false']
|
||||
]), 'ACK_CONDITION');
|
||||
|
||||
this.appendStatementInput('STATEMENT')
|
||||
.setCheck(null);
|
||||
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(false);
|
||||
this.setColour(Blockly.Trigger.HUE);
|
||||
this.setTooltip(Blockly.Words['on_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('on_help'));
|
||||
}
|
||||
};
|
||||
Blockly.JavaScript['on'] = function(block) {
|
||||
var value_objectid = block.getFieldValue('OID');
|
||||
var dropdown_condition = block.getFieldValue('CONDITION');
|
||||
var ack_condition = block.getFieldValue('ACK_CONDITION');
|
||||
var statements_name = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
|
||||
var objectname = main.objects[value_objectid] && main.objects[value_objectid].common && main.objects[value_objectid].common.name ? main.objects[value_objectid].common.name : '';
|
||||
|
||||
Blockly.Msg.VARIABLES_DEFAULT_NAME = 'value';
|
||||
|
||||
var val;
|
||||
if (dropdown_condition === 'true' || dropdown_condition === 'false') {
|
||||
val = 'val: ' + dropdown_condition;
|
||||
} else {
|
||||
val = 'change: "' + dropdown_condition + '"';
|
||||
}
|
||||
|
||||
var code = 'on({id: "' + value_objectid + '"' + (objectname ? '/*' + objectname + '*/' : '') + ', ' + val + (ack_condition ? ', ack: ' + ack_condition : '') + '}, function (obj) {\n var value = obj.state.val;\n var oldValue = obj.oldState.val;\n' + statements_name + '});\n';
|
||||
return code;
|
||||
};
|
||||
|
||||
// --- get info about event -----------------------------------------------------------
|
||||
Blockly.Trigger.blocks['on_source'] =
|
||||
'<block type="on_source">'
|
||||
+ ' <value name="ATTR">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['on_source'] = {
|
||||
/**
|
||||
* Block for conditionally returning a value from a procedure.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
init: function() {
|
||||
this.appendDummyInput('ATTR')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Words['on_source_id'][systemLang], 'id'],
|
||||
[Blockly.Words['on_source_name'][systemLang], 'common.name'],
|
||||
[Blockly.Words['on_source_desc'][systemLang], 'common.desc'],
|
||||
[Blockly.Words['on_source_channel_id'][systemLang], 'channelId'],
|
||||
[Blockly.Words['on_source_channel_name'][systemLang], 'channelName'],
|
||||
[Blockly.Words['on_source_device_id'][systemLang], 'deviceId'],
|
||||
[Blockly.Words['on_source_device_name'][systemLang], 'deviceName'],
|
||||
[Blockly.Words['on_source_state_val'][systemLang], 'state.val'],
|
||||
[Blockly.Words['on_source_state_ts'][systemLang], 'state.ts'],
|
||||
[Blockly.Words['on_source_state_q'][systemLang], 'state.q'],
|
||||
[Blockly.Words['on_source_state_from'][systemLang], 'state.from'],
|
||||
[Blockly.Words['on_source_state_ack'][systemLang], 'state.ack'],
|
||||
[Blockly.Words['on_source_state_lc'][systemLang], 'state.lc'],
|
||||
[Blockly.Words['on_source_oldstate_val'][systemLang], 'oldState.val'],
|
||||
[Blockly.Words['on_source_oldstate_ts'][systemLang], 'oldState.ts'],
|
||||
[Blockly.Words['on_source_oldstate_q'][systemLang], 'oldState.q'],
|
||||
[Blockly.Words['on_source_oldstate_from'][systemLang], 'oldState.from'],
|
||||
[Blockly.Words['on_source_oldstate_ack'][systemLang], 'oldState.ack'],
|
||||
[Blockly.Words['on_source_oldstate_lc'][systemLang], 'oldState.lc']
|
||||
]), 'ATTR');
|
||||
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
this.setColour(Blockly.Trigger.HUE);
|
||||
this.setTooltip(Blockly.Words['on_source_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('on_help'));
|
||||
},
|
||||
/**
|
||||
* Called whenever anything on the workspace changes.
|
||||
* Add warning if this flow block is not nested inside a loop.
|
||||
* @param {!Blockly.Events.Abstract} e Change event.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
onchange: function(e) {
|
||||
var legal = false;
|
||||
// Is the block nested in a trigger?
|
||||
var block = this;
|
||||
do {
|
||||
if (this.FUNCTION_TYPES.indexOf(block.type) !== -1) {
|
||||
legal = true;
|
||||
break;
|
||||
}
|
||||
block = block.getSurroundParent();
|
||||
} while (block);
|
||||
|
||||
if (legal) {
|
||||
this.setWarningText(null);
|
||||
} else {
|
||||
this.setWarningText(Blockly.Words['on_source_warning'][systemLang]);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* List of block types that are functions and thus do not need warnings.
|
||||
* To add a new function type add this to your code:
|
||||
* Blockly.Blocks['procedures_ifreturn'].FUNCTION_TYPES.push('custom_func');
|
||||
*/
|
||||
FUNCTION_TYPES: ['on', 'on_ext']
|
||||
};
|
||||
Blockly.JavaScript['on_source'] = function(block) {
|
||||
var attr = block.getFieldValue('ATTR');
|
||||
var parts = attr.split('.');
|
||||
if (parts.length > 1) {
|
||||
attr = '(obj.' + parts[0] + ' ? obj.' + attr + ' : "")';
|
||||
} else {
|
||||
attr = 'obj.' + attr;
|
||||
}
|
||||
return [attr, Blockly.JavaScript.ORDER_ATOMIC];
|
||||
};
|
||||
|
||||
// --- SCHEDULE -----------------------------------------------------------
|
||||
Blockly.Trigger.blocks['schedule'] =
|
||||
'<block type="schedule">'
|
||||
+ ' <value name="SCHEDULE">'
|
||||
//+ ' <shadow type="text">'
|
||||
//+ ' <field name="TEXT">test</field>'
|
||||
//+ ' </shadow>'
|
||||
+ ' </value>'
|
||||
+ ' <value name="STATEMENT">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['schedule'] = {
|
||||
init: function() {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['schedule'][systemLang]);
|
||||
|
||||
this.appendDummyInput('SCHEDULE')
|
||||
.appendField(new Blockly.FieldCRON('* * * * *'), 'SCHEDULE');
|
||||
|
||||
this.appendStatementInput('STATEMENT')
|
||||
.setCheck(null);
|
||||
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(false);
|
||||
this.setColour(Blockly.Trigger.HUE);
|
||||
this.setTooltip(Blockly.Words['schedule_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('schedule_help'));
|
||||
}
|
||||
};
|
||||
Blockly.JavaScript['schedule'] = function(block) {
|
||||
var schedule = block.getFieldValue('SCHEDULE');
|
||||
var statements_name = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
|
||||
|
||||
return 'schedule("' + schedule +'", function () {\n' + statements_name + '});\n';
|
||||
};
|
||||
|
||||
// --- ASTRO -----------------------------------------------------------
|
||||
Blockly.Trigger.blocks['astro'] =
|
||||
'<block type="astro">'
|
||||
+ ' <value name="TYPE">'
|
||||
//+ ' <shadow type="text">'
|
||||
//+ ' <field name="TEXT">test</field>'
|
||||
//+ ' </shadow>'
|
||||
+ ' </value>'
|
||||
+ ' <value name="OFFSET">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="STATEMENT">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['astro'] = {
|
||||
init: function() {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['astro'][systemLang]);
|
||||
|
||||
this.appendDummyInput("TYPE")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Words['astro_sunriseText'][systemLang], "sunrise"],
|
||||
[Blockly.Words['astro_sunriseEndText'][systemLang], "sunriseEnd"],
|
||||
[Blockly.Words['astro_goldenHourEndText'][systemLang], "goldenHourEnd"],
|
||||
[Blockly.Words['astro_solarNoonText'][systemLang], "solarNoon"],
|
||||
[Blockly.Words['astro_goldenHourText'][systemLang], "goldenHour"],
|
||||
[Blockly.Words['astro_sunsetStartText'][systemLang], "sunsetStart"],
|
||||
[Blockly.Words['astro_sunsetText'][systemLang], "sunset"],
|
||||
[Blockly.Words['astro_duskText'][systemLang], "dusk"],
|
||||
[Blockly.Words['astro_nauticalDuskText'][systemLang], "nauticalDusk"],
|
||||
[Blockly.Words['astro_nightText'][systemLang], "night"],
|
||||
[Blockly.Words['astro_nightEndText'][systemLang], "nightEnd"],
|
||||
[Blockly.Words['astro_nauticalDawnText'][systemLang], "nauticalDawn"],
|
||||
[Blockly.Words['astro_dawnText'][systemLang], "dawn"],
|
||||
[Blockly.Words['astro_nadirText'][systemLang], "nadir"]
|
||||
]), 'TYPE');
|
||||
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['astro_offset'][systemLang]);
|
||||
|
||||
this.appendDummyInput("OFFSET")
|
||||
.appendField(new Blockly.FieldTextInput("0"), "OFFSET");
|
||||
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['astro_minutes'][systemLang]);
|
||||
|
||||
this.appendStatementInput('STATEMENT')
|
||||
.setCheck(null);
|
||||
this.setInputsInline(true);
|
||||
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setColour(Blockly.Trigger.HUE);
|
||||
this.setTooltip(Blockly.Words['astro_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('astro_help'));
|
||||
}
|
||||
};
|
||||
Blockly.JavaScript['astro'] = function(block) {
|
||||
var astrotype = block.getFieldValue('TYPE');
|
||||
var offset = parseInt(block.getFieldValue('OFFSET'), 10);
|
||||
var statements_name = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
|
||||
|
||||
return 'schedule({astro: "' + astrotype + '", shift: ' + offset + '}, function () {\n' + statements_name + '});\n';
|
||||
};
|
||||
|
||||
// --- set named schedule -----------------------------------------------------------
|
||||
Blockly.Trigger.blocks['schedule_create'] =
|
||||
'<block type="schedule_create">'
|
||||
+ ' <value name="NAME">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="SCHEDULE">'
|
||||
+ ' <shadow type="field_cron">'
|
||||
+ ' <field name="CRON">* * * * *</field>'
|
||||
+ ' </shadow>'
|
||||
+ ' </value>'
|
||||
+ ' <value name="STATEMENT">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
/**
|
||||
* Ensure two identically-named procedures don't exist.
|
||||
* @param {string} name Proposed procedure name.
|
||||
* @param {!Blockly.Block} block Block to disambiguate.
|
||||
* @return {string} Non-colliding name.
|
||||
*/
|
||||
Blockly.Trigger.findLegalName = function(name, block) {
|
||||
if (block.isInFlyout) {
|
||||
// Flyouts can have multiple procedures called 'do something'.
|
||||
return name;
|
||||
}
|
||||
while (!Blockly.Trigger.isLegalName_(name, block.workspace, block)) {
|
||||
// Collision with another procedure.
|
||||
var r = name.match(/^(.*?)(\d+)$/);
|
||||
if (!r) {
|
||||
name += '2';
|
||||
} else {
|
||||
name = r[1] + (parseInt(r[2], 10) + 1);
|
||||
}
|
||||
}
|
||||
return name;
|
||||
};
|
||||
|
||||
/**
|
||||
* Does this procedure have a legal name? Illegal names include names of
|
||||
* procedures already defined.
|
||||
* @param {string} name The questionable name.
|
||||
* @param {!Blockly.Workspace} workspace The workspace to scan for collisions.
|
||||
* @param {Blockly.Block=} opt_exclude Optional block to exclude from
|
||||
* comparisons (one doesn't want to collide with oneself).
|
||||
* @return {boolean} True if the name is legal.
|
||||
* @private
|
||||
*/
|
||||
Blockly.Trigger.isLegalName_ = function(name, workspace, opt_exclude) {
|
||||
var blocks = workspace.getAllBlocks();
|
||||
// Iterate through every block and check the name.
|
||||
for (var i = 0; i < blocks.length; i++) {
|
||||
if (blocks[i] == opt_exclude) {
|
||||
continue;
|
||||
}
|
||||
if (blocks[i].isSchedule_) {
|
||||
var blockName = blocks[i].getFieldValue('NAME');
|
||||
if (Blockly.Names.equals(blockName, name)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
* Rename a procedure. Called by the editable field.
|
||||
* @param {string} name The proposed new name.
|
||||
* @return {string} The accepted name.
|
||||
* @this {!Blockly.Field}
|
||||
*/
|
||||
Blockly.Trigger.rename = function (name) {
|
||||
// Strip leading and trailing whitespace. Beyond this, all names are legal.
|
||||
name = name.replace(/^[\s\xa0]+|[\s\xa0]+$/g, '');
|
||||
return Blockly.Trigger.findLegalName(name, this.sourceBlock_);
|
||||
};
|
||||
|
||||
Blockly.Blocks['schedule_create'] = {
|
||||
init: function() {
|
||||
var nameField = new Blockly.FieldTextInput(
|
||||
Blockly.Trigger.findLegalName('schedule', this),
|
||||
Blockly.Trigger.rename);
|
||||
|
||||
nameField.setSpellcheck(false);
|
||||
|
||||
this.appendDummyInput('NAME')
|
||||
.appendField(Blockly.Words['schedule_create'][systemLang])
|
||||
.appendField(nameField, 'NAME');
|
||||
|
||||
this.appendValueInput('SCHEDULE')
|
||||
.appendField(Blockly.Words['schedule_text'][systemLang]);
|
||||
|
||||
this.appendStatementInput('STATEMENT')
|
||||
.setCheck(null);
|
||||
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(false);
|
||||
this.setColour(Blockly.Trigger.HUE);
|
||||
this.setTooltip(Blockly.Words['schedule_create_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('schedule_create_help'));
|
||||
},
|
||||
isSchedule_: true,
|
||||
getVars: function () {
|
||||
return [this.getFieldValue('NAME')];
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['schedule_create'] = function(block) {
|
||||
var name = block.getFieldValue('NAME');
|
||||
var schedule = Blockly.JavaScript.valueToCode(block, 'SCHEDULE', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
var statements_name = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
|
||||
|
||||
return name + ' = schedule(' + schedule + ', function () {\n' + statements_name + '});\n';
|
||||
};
|
||||
|
||||
// --- clearSchedule -----------------------------------------------------------
|
||||
Blockly.Trigger.getAllSchedules = function (workspace) {
|
||||
var blocks = workspace.getAllBlocks();
|
||||
var result = [];
|
||||
|
||||
// Iterate through every block and check the name.
|
||||
for (var i = 0; i < blocks.length; i++) {
|
||||
if (blocks[i].isSchedule_) {
|
||||
result.push([blocks[i].getFieldValue('NAME'), blocks[i].getFieldValue('NAME')]);
|
||||
}
|
||||
}
|
||||
if (!result.length) result.push(['', '']);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
Blockly.Trigger.blocks['schedule_clear'] =
|
||||
'<block type="schedule_clear">'
|
||||
+ ' <value name="NAME">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['schedule_clear'] = {
|
||||
init: function() {
|
||||
this.appendDummyInput('NAME')
|
||||
.appendField(Blockly.Words['schedule_clear'][systemLang])
|
||||
.appendField(new Blockly.FieldDropdown(function () {
|
||||
return Blockly.Trigger.getAllSchedules(scripts.blocklyWorkspace);
|
||||
}), 'NAME');
|
||||
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(true);
|
||||
this.setColour(Blockly.Trigger.HUE);
|
||||
this.setTooltip(Blockly.Words['schedule_clear_tooltip'][systemLang]);
|
||||
this.setHelpUrl(getHelp('schedule_clear_help'));
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['schedule_clear'] = function(block) {
|
||||
var name = block.getFieldValue('NAME');
|
||||
return '(function () {if (' + name + ') {clearSchedule(' + name + '); ' + name + ' = null;}})();\n';
|
||||
};
|
||||
|
||||
// --- CRON dialog --------------------------------------------------
|
||||
Blockly.Trigger.blocks['field_cron'] =
|
||||
'<block type="field_cron">'
|
||||
+ ' <value name="CRON">'
|
||||
+ ' </value>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['field_cron'] = {
|
||||
// Checkbox.
|
||||
init: function() {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['field_cron_CRON'][systemLang]);
|
||||
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldCRON('* * * * *'), 'CRON');
|
||||
|
||||
this.setInputsInline(true);
|
||||
this.setColour(Blockly.Trigger.HUE);
|
||||
this.setOutput(true, 'String');
|
||||
this.setTooltip(Blockly.Words['field_cron_tooltip'][systemLang]);
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.JavaScript['field_cron'] = function(block) {
|
||||
var oid = block.getFieldValue('CRON');
|
||||
return ['\'' + oid + '\'', Blockly.JavaScript.ORDER_ATOMIC]
|
||||
};
|
||||
|
||||
// --- CRON builder --------------------------------------------------
|
||||
Blockly.Trigger.blocks['cron_builder'] =
|
||||
'<block type="cron_builder">'
|
||||
+ ' <value name="LINE">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="MINUTES">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="HOURS">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="DAYS">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="MONTHS">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="WEEKDAYS">'
|
||||
+ ' </value>'
|
||||
+ ' <value name="WITH_SECONDS">'
|
||||
+ ' </value>'
|
||||
+ ' <mutation seconds="false"></mutation>'
|
||||
+ '</block>';
|
||||
|
||||
Blockly.Blocks['cron_builder'] = {
|
||||
// Checkbox.
|
||||
init: function() {
|
||||
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Words['cron_builder_CRON'][systemLang]);
|
||||
|
||||
this.appendDummyInput('LINE')
|
||||
.appendField(Blockly.Words['cron_builder_line'][systemLang])
|
||||
.appendField(new Blockly.FieldCheckbox('FALSE', function (option) {
|
||||
this.sourceBlock_.setInputsInline(option == true);
|
||||
}), 'LINE');
|
||||
|
||||
var _input = this.appendValueInput('DOW')
|
||||
.appendField(Blockly.Words['cron_builder_dow'][systemLang]);
|
||||
var _shadow = this.workspace.newBlock('text');
|
||||
_shadow.setShadow(true);
|
||||
_shadow.setFieldValue('*', 'TEXT');
|
||||
_shadow.outputConnection.connect(_input.connection);
|
||||
|
||||
|
||||
_input = this.appendValueInput('MONTHS')
|
||||
.appendField(Blockly.Words['cron_builder_month'][systemLang]);
|
||||
_shadow = this.workspace.newBlock('text');
|
||||
_shadow.setShadow(true);
|
||||
_shadow.setFieldValue('*', 'TEXT');
|
||||
_shadow.outputConnection.connect(_input.connection);
|
||||
|
||||
_input = this.appendValueInput('DAYS')
|
||||
.appendField(Blockly.Words['cron_builder_day'][systemLang]);
|
||||
_shadow = this.workspace.newBlock('text');
|
||||
_shadow.setShadow(true);
|
||||
_shadow.setFieldValue('*', 'TEXT');
|
||||
_shadow.outputConnection.connect(_input.connection);
|
||||
|
||||
|
||||
_input = this.appendValueInput('HOURS')
|
||||
.appendField(Blockly.Words['cron_builder_hour'][systemLang]);
|
||||
_shadow = this.workspace.newBlock('text');
|
||||
_shadow.setShadow(true);
|
||||
_shadow.setFieldValue('*', 'TEXT');
|
||||
_shadow.outputConnection.connect(_input.connection);
|
||||
|
||||
|
||||
_input = this.appendValueInput('MINUTES')
|
||||
.appendField(Blockly.Words['cron_builder_minutes'][systemLang]);
|
||||
_shadow = this.workspace.newBlock('text');
|
||||
_shadow.setShadow(true);
|
||||
_shadow.setFieldValue('*', 'TEXT');
|
||||
_shadow.outputConnection.connect(_input.connection);
|
||||
|
||||
this.appendDummyInput('WITH_SECONDS')
|
||||
.appendField(Blockly.Words['cron_builder_with_seconds'][systemLang])
|
||||
.appendField(new Blockly.FieldCheckbox('FALSE', function (option) {
|
||||
var withSeconds = (option == true);
|
||||
this.sourceBlock_.updateShape_(withSeconds);
|
||||
}), 'WITH_SECONDS');
|
||||
|
||||
this.seconds_ = false;
|
||||
this.as_line_ = false;
|
||||
this.setInputsInline(this.as_line_);
|
||||
this.setColour(Blockly.Trigger.HUE);
|
||||
this.setOutput(true, 'String');
|
||||
this.setTooltip(Blockly.Words['field_cron_tooltip'][systemLang]);
|
||||
},
|
||||
/**
|
||||
* Create XML to represent number of text inputs.
|
||||
* @return {!Element} XML storage element.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
mutationToDom: function () {
|
||||
var container = document.createElement('mutation');
|
||||
container.setAttribute('seconds', this.seconds_);
|
||||
container.setAttribute('as_line', this.as_line_);
|
||||
return container;
|
||||
},
|
||||
/**
|
||||
* Parse XML to restore the text inputs.
|
||||
* @param {!Element} xmlElement XML storage element.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
domToMutation: function (xmlElement) {
|
||||
this.seconds_ = xmlElement.getAttribute('seconds') === 'true';
|
||||
this.as_line_ = xmlElement.getAttribute('as_line') === 'true';
|
||||
this.setInputsInline(this.as_line_);
|
||||
this.updateShape_(this.seconds_);
|
||||
},
|
||||
updateShape_: function(withSeconds) {
|
||||
this.seconds_ = withSeconds;
|
||||
// Add or remove a statement Input.
|
||||
var inputExists = this.getInput('SECONDS');
|
||||
|
||||
if (withSeconds) {
|
||||
if (!inputExists) {
|
||||
var _input = this.appendValueInput('SECONDS');
|
||||
_input.appendField(Blockly.Words['cron_builder_seconds'][systemLang]);
|
||||
|
||||
var _shadow = this.workspace.newBlock('text');
|
||||
_shadow.setShadow(true);
|
||||
_shadow.setFieldValue('*', 'TEXT');
|
||||
_shadow.outputConnection.connect(_input.connection);
|
||||
_shadow.initSvg();
|
||||
_shadow.render();
|
||||
}
|
||||
} else if (inputExists) {
|
||||
this.removeInput('SECONDS');
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Blockly.JavaScript['cron_builder'] = function(block) {
|
||||
var dow = Blockly.JavaScript.valueToCode(block, 'DOW', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
var months = Blockly.JavaScript.valueToCode(block, 'MONTHS', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
var days = Blockly.JavaScript.valueToCode(block, 'DAYS', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
var hours = Blockly.JavaScript.valueToCode(block, 'HOURS', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
var minutes = Blockly.JavaScript.valueToCode(block, 'MINUTES', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
var seconds = Blockly.JavaScript.valueToCode(block, 'SECONDS', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
var withSeconds = block.getFieldValue('WITH_SECONDS');
|
||||
|
||||
var code = ((withSeconds === 'TRUE') ? seconds + '.trim() + \' \' + ' : '') + minutes + '.trim() + \' \' + ' + hours + '.trim() + \' \' + ' + days + '.trim() + \' \' + ' + months + '.trim() + \' \' + ' + dow + '.trim()';
|
||||
return [code, Blockly.JavaScript.ORDER_ATOMIC]
|
||||
};
|
||||
400
admin/google-blockly/own/blocks_words.js
Normal file
400
admin/google-blockly/own/blocks_words.js
Normal file
@@ -0,0 +1,400 @@
|
||||
if (typeof Blockly === 'undefined') {
|
||||
var Blockly = {};
|
||||
}
|
||||
// translations
|
||||
Blockly.Words = {};
|
||||
|
||||
// --- ACTION --------------------------------------------------
|
||||
Blockly.Words['Action'] = {'en': 'Actions', 'de': 'Aktionen', 'ru': 'Действия', 'pt': 'Ações', 'nl': 'Acties', 'fr': 'Actes', 'it': 'Azioni', 'es': 'Comportamiento'};
|
||||
|
||||
// --- action exec --------------------------------------------------
|
||||
Blockly.Words['exec'] = {'en': 'exec', 'de': 'exec', 'ru': 'exec', 'pt': 'exec', 'nl': 'exec', 'fr': 'exec', 'it': 'exec', 'es': 'ejecutivo'};
|
||||
Blockly.Words['exec_statement'] = {'en': 'with results', 'de': 'mit Ergebnissen', 'ru': 'анализировать результаты', 'pt': 'com resultados', 'nl': 'met resultaten', 'fr': 'avec des résultats', 'it': 'con risultati', 'es': 'con resultados'};
|
||||
Blockly.Words['exec_command'] = {'en': 'command', 'de': 'Befehl', 'ru': 'команда', 'pt': 'comando', 'nl': 'opdracht', 'fr': 'commander', 'it': 'comando', 'es': 'mando'};
|
||||
Blockly.Words['exec_tooltip'] = {'en': 'Execute some command', 'de': 'Einen System-Befehl ausführen', 'ru': 'Выполнить системную команду', 'pt': 'Execute algum comando', 'nl': 'Voer een commando uit', 'fr': 'Exécuter une commande', 'it': 'Esegui un comando', 'es': 'Ejecuta algún comando'};
|
||||
Blockly.Words['exec_help'] = {'en': 'exec---execute-some-os-command-like-cp-file1-file2', 'de': 'exec---execute-some-os-command-like-cp-file1-file2', 'ru': 'exec---execute-some-os-command-like-cp-file1-file2', 'pt': 'exec---execute-some-os-command-like-cp-file1-file2', 'nl': 'exec---execute-some-os-command-like-cp-file1-file2', 'fr': 'exec---execute-some-os-command-like-cp-file1-file2', 'it': 'exec---execute-some-os-command-like-cp-file1-file2', 'es': 'exec---execute-some-os-command-like-cp-file1-file2'};
|
||||
Blockly.Words['exec_log'] = {'en': 'log level', 'de': 'Loglevel', 'ru': 'Протокол', 'pt': 'nível de log', 'nl': 'Log niveau', 'fr': 'niveau de journalisation', 'it': 'livello di registro', 'es': 'nivel de registro'};
|
||||
Blockly.Words['exec_log_none'] = {'en': 'none', 'de': 'keins', 'ru': 'нет', 'pt': 'Nenhum', 'nl': 'geen', 'fr': 'aucun', 'it': 'nessuna', 'es': 'ninguna'};
|
||||
Blockly.Words['exec_log_info'] = {'en': 'info', 'de': 'info', 'ru': 'инфо', 'pt': 'informação', 'nl': 'info', 'fr': 'Info', 'it': 'Informazioni', 'es': 'información'};
|
||||
Blockly.Words['exec_log_debug'] = {'en': 'debug', 'de': 'debug', 'ru': 'debug', 'pt': 'depurar', 'nl': 'debug', 'fr': 'déboguer', 'it': 'mettere a punto', 'es': 'depurar'};
|
||||
Blockly.Words['exec_log_warn'] = {'en': 'warning', 'de': 'warning', 'ru': 'warning', 'pt': 'Atenção', 'nl': 'waarschuwing', 'fr': 'Attention', 'it': 'avvertimento', 'es': 'advertencia'};
|
||||
Blockly.Words['exec_log_error'] = {'en': 'error', 'de': 'error', 'ru': 'ошибка', 'pt': 'erro', 'nl': 'fout', 'fr': 'Erreur', 'it': 'errore', 'es': 'error'};
|
||||
|
||||
// --- action request --------------------------------------------------
|
||||
Blockly.Words['request'] = {'en': 'request', 'de': 'request', 'ru': 'request', 'pt': 'pedido', 'nl': 'verzoek', 'fr': 'demande', 'it': 'richiesta', 'es': 'solicitud'};
|
||||
Blockly.Words['request_url'] = {'en': 'URL', 'de': 'URL', 'ru': 'URL', 'pt': 'URL', 'nl': 'URL', 'fr': 'URL', 'it': 'URL', 'es': 'URL'};
|
||||
Blockly.Words['request_statement'] = {'en': 'with results', 'de': 'mit Ergebnissen', 'ru': 'анализировать результаты', 'pt': 'com resultados', 'nl': 'met resultaten', 'fr': 'avec des résultats', 'it': 'con risultati', 'es': 'con resultados'};
|
||||
Blockly.Words['request_tooltip'] = {'en': 'Request URL', 'de': 'URL abfragen', 'ru': 'Запросить URL', 'pt': 'URL do pedido', 'nl': 'Verzoek om URL', 'fr': 'Demander une URL', 'it': 'URL di richiesta', 'es': 'URL de solicitud'};
|
||||
Blockly.Words['request_help'] = {'en': 'https://git.spacen.net/request/request', 'de': 'https://git.spacen.net/request/request', 'ru': 'https://git.spacen.net/request/request', 'pt': 'https://git.spacen.net/request/request', 'nl': 'https://git.spacen.net/request/request', 'fr': 'https://git.spacen.net/request/request', 'it': 'https://git.spacen.net/request/request', 'es': 'https://git.spacen.net/request/request'};
|
||||
Blockly.Words['request_log'] = {'en': 'log level', 'de': 'Loglevel', 'ru': 'Протокол', 'pt': 'nível de log', 'nl': 'Log niveau', 'fr': 'niveau de journalisation', 'it': 'livello di registro', 'es': 'nivel de registro'};
|
||||
Blockly.Words['request_log_none'] = {'en': 'none', 'de': 'keins', 'ru': 'нет', 'pt': 'Nenhum', 'nl': 'geen', 'fr': 'aucun', 'it': 'nessuna', 'es': 'ninguna'};
|
||||
Blockly.Words['request_log_info'] = {'en': 'info', 'de': 'info', 'ru': 'инфо', 'pt': 'informação', 'nl': 'info', 'fr': 'Info', 'it': 'Informazioni', 'es': 'información'};
|
||||
Blockly.Words['request_log_debug'] = {'en': 'debug', 'de': 'debug', 'ru': 'debug', 'pt': 'depurar', 'nl': 'debug', 'fr': 'déboguer', 'it': 'mettere a punto', 'es': 'depurar'};
|
||||
Blockly.Words['request_log_warn'] = {'en': 'warning', 'de': 'warning', 'ru': 'warning', 'pt': 'Atenção', 'nl': 'waarschuwing', 'fr': 'Attention', 'it': 'avvertimento', 'es': 'advertencia'};
|
||||
Blockly.Words['request_log_error'] = {'en': 'error', 'de': 'error', 'ru': 'ошибка', 'pt': 'erro', 'nl': 'fout', 'fr': 'Erreur', 'it': 'errore', 'es': 'error'};
|
||||
|
||||
// --- CONVERT --------------------------------------------------
|
||||
Blockly.Words['Convert'] = {'en': 'Convert', 'de': 'Konvertierung', 'ru': 'Конвертация', 'pt': 'Converter', 'nl': 'Converteren', 'fr': 'Convertir', 'it': 'Convertire', 'es': 'Convertir'};
|
||||
|
||||
// --- convert convert --------------------------------------------------
|
||||
Blockly.Words['convert_tonumber'] = {'en': 'toNumber', 'de': 'nach Zahl', 'ru': 'в число', 'pt': 'enumerar', 'nl': 'toNumber', 'fr': 'toNumber', 'it': 'ToNumber', 'es': 'Al numero'};
|
||||
Blockly.Words['convert_tonumber_tooltip'] = {'en': 'Cast input to number', 'de': 'Wandle Eingang nach Zahl', 'ru': 'Преобразовать вход в число', 'pt': 'Transmitir entrada para o número', 'nl': 'Cast input naar nummer', 'fr': 'Transmettre l\'entrée au numéro', 'it': 'Trasmetti l\'input al numero', 'es': 'Emitir entrada al número'};
|
||||
Blockly.Words['convert_toboolean'] = {'en': 'toBoolean', 'de': 'nach Logikwert', 'ru': 'в булево значение', 'pt': 'toBoolean', 'nl': 'toBoolean', 'fr': 'toBooléen', 'it': 'toBoolean', 'es': 'toBoolean'};
|
||||
Blockly.Words['convert_toboolean_tooltip'] = {'en': 'Cast input to boolean', 'de': 'Wandle Input nach Logikwert', 'ru': 'Преобразовать вход в булево значение', 'pt': 'Transmitir entrada para booleano', 'nl': 'Cast input naar boolean', 'fr': 'Transmettre l\'entrée au booléen', 'it': 'Trasmetti l\'input a booleano', 'es': 'Enviar entrada a boolean'};
|
||||
Blockly.Words['convert_tostring'] = {'en': 'toString', 'de': 'nach String', 'ru': 'в строку', 'pt': 'para sequenciar', 'nl': 'toString', 'fr': 'toString', 'it': 'accordare', 'es': 'Encadenar'};
|
||||
Blockly.Words['convert_tostring_tooltip'] = {'en': 'Cast input to number', 'de': 'Wandle Input nach String', 'ru': 'Преобразовать вход в строку', 'pt': 'Transmitir entrada para o número', 'nl': 'Cast input naar nummer', 'fr': 'Transmettre l\'entrée au numéro', 'it': 'Trasmetti l\'input al numero', 'es': 'Emitir entrada al número'};
|
||||
Blockly.Words['convert_type'] = {'en': 'type of', 'de': 'Typ von', 'ru': 'взять тип', 'pt': 'tipo de', 'nl': 'soort van', 'fr': 'Type de', 'it': 'tipo di', 'es': 'tipo de'};
|
||||
Blockly.Words['convert_type_tooltip'] = {'en': 'Returns type of input', 'de': 'Typ von Input', 'ru': 'Взять тип входа', 'pt': 'Retorna o tipo de entrada', 'nl': 'Retourneert het type invoer', 'fr': 'Renvoie le type d\'entrée', 'it': 'Restituisce il tipo di input', 'es': 'Devuelve tipo de entrada'};
|
||||
Blockly.Words['convert_to_date'] = {'en': 'to Date/Time', 'de': 'nach Datum/Zeit', 'ru': 'в дату/время', 'pt': 'até a data/hora', 'nl': 'tot datum/tijd', 'fr': 'à date/heure', 'it': 'alla data/ora', 'es': 'hasta la fecha/hora'};
|
||||
Blockly.Words['convert_to_date_tooltip'] = {'en': 'Cast input to date', 'de': 'Wandle Input nach Datum', 'ru': 'Преобразовать вход в дату', 'pt': 'Entrada em destaque até à data', 'nl': 'Cast input tot op heden', 'fr': 'Diffuser l\'entrée à ce jour', 'it': 'Trasmetti l\'input fino alla data', 'es': 'Emitir entrada hasta la fecha'};
|
||||
Blockly.Words['convert_from_date'] = {'en': 'date/time', 'de': 'Datum/Zeit', 'ru': 'дату/время', 'pt': 'data hora', 'nl': 'datum Tijd', 'fr': 'date/heure', 'it': 'appuntamento', 'es': 'fecha y hora'};
|
||||
Blockly.Words['convert_to'] = {'en': 'to', 'de': 'nach', 'ru': 'в', 'pt': 'para', 'nl': 'naar', 'fr': 'à', 'it': 'a', 'es': 'a'};
|
||||
Blockly.Words['convert_from_date_tooltip'] = {'en': 'Cast input from date', 'de': 'erzeuge Input aus Datum', 'ru': 'Преобразовать вход из даты', 'pt': 'Entrada de elenco a partir da data', 'nl': 'Cast-invoer vanaf datum', 'fr': 'Transmettre l\'entrée de la date', 'it': 'Trasmetti input dalla data', 'es': 'Emitir entrada desde la fecha'};
|
||||
Blockly.Words['convert_json2object'] = {'en': 'JSON to object', 'de': 'JSON nach Objekt', 'ru': 'JSON в объект', 'pt': 'JSON para objetar', 'nl': 'JSON om bezwaar aan te tekenen', 'fr': 'JSON à objet', 'it': 'JSON per obiettare', 'es': 'JSON para objetar'};
|
||||
Blockly.Words['convert_json2object_tooltip'] = {'en': 'Parse JSON string', 'de': 'Parse JSON', 'ru': 'Преобразовать JSON в объект', 'pt': 'Parse JSON string', 'nl': 'Ontleed JSON-tekenreeks', 'fr': 'Parse JSON chaîne', 'it': 'Analizza la stringa JSON', 'es': 'Cadena Parson JSON'};
|
||||
Blockly.Words['convert_object2json'] = {'en': 'object to JSON', 'de': 'Objekt nach JSON', 'ru': 'объект в JSON', 'pt': 'Objeto para JSON', 'nl': 'bezwaar tegen JSON', 'fr': 'objet à JSON', 'it': 'oggetto a JSON', 'es': 'objetar a JSON'};
|
||||
Blockly.Words['convert_object2json_tooltip'] = {'en': 'Strinify object', 'de': 'Objekt nach JSON', 'ru': 'Преобразовать объект в JSON', 'pt': 'Strinify objeto', 'nl': 'Strinify-object', 'fr': 'Strinify objet', 'it': 'Strinificare l\'oggetto', 'es': 'Objeto Strinify'};
|
||||
Blockly.Words['convert_object2json_prettify'] = {'en': 'prettify', 'de': 'formatieren', 'ru': 'форматировать', 'pt': 'embelezar', 'nl': 'leuk maken', 'fr': 'enjoliver', 'it': 'abbellire', 'es': 'embellecer'};
|
||||
|
||||
// --- SENDTO --------------------------------------------------
|
||||
Blockly.Words['Sendto'] = {'en': 'Sendto', 'de': 'Sendto', 'ru': 'Sendto', 'pt': 'Enviar para', 'nl': 'Verzenden naar', 'fr': 'Envoyer à', 'it': 'Inviare a', 'es': 'Enviar a'};
|
||||
|
||||
// --- sendto sendto --------------------------------------------------
|
||||
Blockly.Words['sendto_message'] = {'en': 'message', 'de': 'Meldung', 'ru': 'сообщение', 'pt': 'mensagem', 'nl': 'bericht', 'fr': 'message', 'it': 'Messaggio', 'es': 'mensaje'};
|
||||
Blockly.Words['sendto_custom'] = {'en': 'sendTo', 'de': 'sendTo', 'ru': 'sendTo', 'pt': 'enviar para', 'nl': 'verzenden naar', 'fr': 'envoyer à', 'it': 'inviare a', 'es': 'enviar a'};
|
||||
Blockly.Words['sendto_custom_tooltip'] = {'en': 'Text to speech', 'de': 'Text zu Sprache', 'ru': 'Произнести сообщение', 'pt': 'Texto para fala', 'nl': 'Tekst naar spraak', 'fr': 'Texte pour parler', 'it': 'Sintesi vocale', 'es': 'Texto a voz'};
|
||||
Blockly.Words['sendto_custom_help'] = {'en': 'sendto', 'de': 'sendto', 'ru': 'sendto', 'pt': 'enviar para', 'nl': 'verzenden naar', 'fr': 'envoyer à', 'it': 'inviare a', 'es': 'enviar a'};
|
||||
Blockly.Words['sendto_custom_arguments'] = {'en': 'parameters', 'de': 'Parameter', 'ru': 'параметры', 'pt': 'parâmetros', 'nl': 'parameters', 'fr': 'paramètres', 'it': 'parametri', 'es': 'parámetros'};
|
||||
Blockly.Words['sendto_custom_command'] = {'en': 'command', 'de': 'Befehl', 'ru': 'команда', 'pt': 'comando', 'nl': 'opdracht', 'fr': 'commander', 'it': 'comando', 'es': 'mando'};
|
||||
Blockly.Words['sendto_custom_argument'] = {'en': 'parameter', 'de': 'Parameter', 'ru': 'параметр', 'pt': 'parâmetro', 'nl': 'parameter', 'fr': 'paramètre', 'it': 'parametro', 'es': 'parámetro'};
|
||||
Blockly.Words['sendto_custom_arg_tooltip'] = {'en': 'Add parameter to sendTo object.', 'de': 'Parameter zum sendTo-Objekt hinzufügen', 'ru': 'Добавить параметр к sendTo объекту', 'pt': 'Adicione o parâmetro ao objeto sendTo.', 'nl': 'Parameter toevoegen aan het object sendTo.', 'fr': 'Ajouter un paramètre à l\'objet sendTo.', 'it': 'Aggiungi parametro all\'oggetto sendTo.', 'es': 'Agregar parámetro al objeto sendTo.'};
|
||||
Blockly.Words['sendto_log'] = {'en': 'log level', 'de': 'Loglevel', 'ru': 'Протокол', 'pt': 'nível de log', 'nl': 'Log niveau', 'fr': 'niveau de journalisation', 'it': 'livello di registro', 'es': 'nivel de registro'};
|
||||
Blockly.Words['sendto_log_none'] = {'en': 'none', 'de': 'keins', 'ru': 'нет', 'pt': 'Nenhum', 'nl': 'geen', 'fr': 'aucun', 'it': 'nessuna', 'es': 'ninguna'};
|
||||
Blockly.Words['sendto_log_info'] = {'en': 'info', 'de': 'info', 'ru': 'инфо', 'pt': 'informação', 'nl': 'info', 'fr': 'Info', 'it': 'Informazioni', 'es': 'información'};
|
||||
Blockly.Words['sendto_log_debug'] = {'en': 'debug', 'de': 'debug', 'ru': 'debug', 'pt': 'depurar', 'nl': 'debug', 'fr': 'déboguer', 'it': 'mettere a punto', 'es': 'depurar'};
|
||||
Blockly.Words['sendto_log_warn'] = {'en': 'warning', 'de': 'warning', 'ru': 'warning', 'pt': 'Atenção', 'nl': 'waarschuwing', 'fr': 'Attention', 'it': 'avvertimento', 'es': 'advertencia'};
|
||||
Blockly.Words['sendto_log_error'] = {'en': 'error', 'de': 'error', 'ru': 'ошибка', 'pt': 'erro', 'nl': 'fout', 'fr': 'Erreur', 'it': 'errore', 'es': 'error'};
|
||||
|
||||
// --- SYSTEM --------------------------------------------------
|
||||
Blockly.Words['System'] = {'en': 'System', 'de': 'System', 'ru': 'Системные', 'pt': 'Sistema', 'nl': 'Systeem', 'fr': 'Système', 'it': 'Sistema', 'es': 'Sistema'};
|
||||
|
||||
// --- system debug --------------------------------------------------
|
||||
Blockly.Words['debug'] = {'en': 'debug output', 'de': 'debug output', 'ru': 'debug output', 'pt': 'saída de depuração', 'nl': 'debug output', 'fr': 'sortie de débogage', 'it': 'uscita di debug', 'es': 'salida de depuración'};
|
||||
Blockly.Words['debug_tooltip'] = {'en': 'Debug', 'de': 'Debug', 'ru': 'Debug', 'pt': 'Depurar', 'nl': 'debug', 'fr': 'Déboguer', 'it': 'mettere a punto', 'es': 'Depurar'};
|
||||
Blockly.Words['debug_help'] = {'en': 'log---gives-out-the-message-into-log', 'de': 'log---gives-out-the-message-into-log', 'ru': 'log---gives-out-the-message-into-log', 'pt': 'log---gives-out-the-message-into-log', 'nl': 'log---gives-out-the-message-into-log', 'fr': 'log---gives-out-the-message-into-log', 'it': 'log---gives-out-the-message-into-log', 'es': 'log---gives-out-the-message-into-log'};
|
||||
|
||||
// --- system comment --------------------------------------------------
|
||||
Blockly.Words['comment'] = {'en': 'comment', 'de': 'Kommentar', 'ru': 'описание', 'pt': 'Comente', 'nl': 'commentaar', 'fr': 'commentaire', 'it': 'commento', 'es': 'comentario'};
|
||||
Blockly.Words['comment_tooltip'] = {'en': 'Enter comment to explain the code', 'de': 'Debug', 'ru': 'Debug', 'pt': 'Digite o comentário para explicar o código', 'nl': 'Voer een opmerking in om de code uit te leggen', 'fr': 'Entrez un commentaire pour expliquer le code', 'it': 'Inserisci il commento per spiegare il codice', 'es': 'Ingrese un comentario para explicar el código'};
|
||||
|
||||
// --- system control --------------------------------------------------
|
||||
Blockly.Words['control'] = {'en': 'сontrol', 'de': 'steuere', 'ru': 'установить', 'pt': 'controlar', 'nl': 'сontrol', 'fr': 'contrôle', 'it': 'сontrol', 'es': 'ontrol'};
|
||||
Blockly.Words['control_tooltip'] = {'en': 'Control state', 'de': 'Steuere Zustand', 'ru': 'Установить состояние', 'pt': 'Estado de controle', 'nl': 'Controlestatus', 'fr': 'Etat de contrôle', 'it': 'Stato di controllo', 'es': 'Estado de control'};
|
||||
Blockly.Words['control_help'] = {'en': 'setstate', 'de': 'setstate', 'ru': 'setstate', 'pt': 'settate', 'nl': 'setstate', 'fr': 'setstate', 'it': 'setstate', 'es': 'setstate'};
|
||||
Blockly.Words['control_with'] = {'en': 'with', 'de': 'mit', 'ru': 'на', 'pt': 'com', 'nl': 'met', 'fr': 'avec', 'it': 'con', 'es': 'con'};
|
||||
Blockly.Words['control_delay'] = {'en': 'with delay', 'de': 'mit Verzögerung', 'ru': 'с задержкой', 'pt': 'com atraso', 'nl': 'met vertraging', 'fr': 'avec du retard', 'it': 'con ritardo', 'es': 'con retraso'};
|
||||
Blockly.Words['control_ms'] = {'en': 'ms', 'de': 'ms', 'ru': 'мс', 'pt': 'Senhora', 'nl': 'Mevrouw', 'fr': 'Mme', 'it': 'Signorina', 'es': 'Sra'};
|
||||
Blockly.Words['control_sec'] = {'en': 'sec', 'de': 'Sek', 'ru': 'сек.', 'pt': 'seg', 'nl': 'sec', 'fr': 'seconde', 'it': 'secondo', 'es': 'segundo'};
|
||||
Blockly.Words['control_min'] = {'en': 'min', 'de': 'Min', 'ru': 'мин.', 'pt': 'min', 'nl': 'min', 'fr': 'min', 'it': 'min', 'es': 'min'};
|
||||
Blockly.Words['control_clear_running'] = {'en': ', clear running', 'de': ', löschen falls läuft', 'ru': ', остановить уже запущенный', 'pt': ', corrida clara', 'nl': ', helder rennen', 'fr': ', course libre', 'it': ', chiara corsa', 'es': ', claro funcionamiento'};
|
||||
|
||||
// --- system toggle --------------------------------------------------
|
||||
Blockly.Words['toggle'] = {'en': 'toggle', 'de': 'umschalten', 'ru': 'переключить', 'pt': 'alternancia', 'nl': 'toggle', 'fr': 'basculer', 'it': 'ginocchiera', 'es': 'palanca'};
|
||||
Blockly.Words['toggle_tooltip'] = {'en': 'Toggle the state', 'de': 'Schalte Zustand um', 'ru': 'Изменить состояние', 'pt': 'Alternar o estado', 'nl': 'Schakel de staat in', 'fr': 'Basculer l\'état', 'it': 'Attiva/disattiva lo stato', 'es': 'Alternar el estado'};
|
||||
Blockly.Words['toggle_help'] = {'en': 'setstate', 'de': 'setstate', 'ru': 'setstate', 'pt': 'settate', 'nl': 'setstate', 'fr': 'setstate', 'it': 'setstate', 'es': 'setstate'};
|
||||
Blockly.Words['toggle_with'] = {'en': 'with', 'de': 'mit', 'ru': 'на', 'pt': 'com', 'nl': 'met', 'fr': 'avec', 'it': 'con', 'es': 'con'};
|
||||
Blockly.Words['toggle_delay'] = {'en': 'with delay', 'de': 'mit Verzögerung', 'ru': 'с задержкой', 'pt': 'com atraso', 'nl': 'met vertraging', 'fr': 'avec du retard', 'it': 'con ritardo', 'es': 'con retraso'};
|
||||
Blockly.Words['toggle_ms'] = {'en': 'in ms', 'de': 'in ms', 'ru': 'в мс', 'pt': 'em ms', 'nl': 'in ms', 'fr': 'en ms', 'it': 'in ms', 'es': 'en ms'};
|
||||
Blockly.Words['toggle_clear_running'] = {'en': ', clear running', 'de': ', löschen falls läuft', 'ru': ', остановить уже запущенный', 'pt': ', corrida clara', 'nl': ', helder rennen', 'fr': ', course libre', 'it': ', chiara corsa', 'es': ', claro funcionamiento'};
|
||||
|
||||
// --- system update --------------------------------------------------
|
||||
Blockly.Words['update'] = {'en': 'update', 'de': 'aktualisiere', 'ru': 'обновить', 'pt': 'atualizar', 'nl': 'bijwerken', 'fr': 'mettre à jour', 'it': 'aggiornare', 'es': 'actualizar'};
|
||||
Blockly.Words['update_tooltip'] = {'en': 'Update state', 'de': 'Zustand aktualisieren', 'ru': 'Обновить состояние', 'pt': 'Estado de atualização', 'nl': 'Status bijwerken', 'fr': 'Mettre à jour', 'it': 'Stato di aggiornamento', 'es': 'Actualizar estado'};
|
||||
Blockly.Words['update_help'] = {'en': 'setstate', 'de': 'setstate', 'ru': 'setstate', 'pt': 'settate', 'nl': 'setstate', 'fr': 'setstate', 'it': 'setstate', 'es': 'setstate'};
|
||||
Blockly.Words['update_with'] = {'en': 'with', 'de': 'mit', 'ru': 'с', 'pt': 'com', 'nl': 'met', 'fr': 'avec', 'it': 'con', 'es': 'con'};
|
||||
Blockly.Words['update_delay'] = {'en': 'with delay', 'de': 'mit Verzögerung', 'ru': 'с задержкой', 'pt': 'com atraso', 'nl': 'met vertraging', 'fr': 'avec du retard', 'it': 'con ritardo', 'es': 'con retraso'};
|
||||
Blockly.Words['update_ms'] = {'en': 'in ms', 'de': 'in ms', 'ru': 'в мс', 'pt': 'em ms', 'nl': 'in ms', 'fr': 'en ms', 'it': 'in ms', 'es': 'en ms'};
|
||||
|
||||
// --- system direct --------------------------------------------------
|
||||
Blockly.Words['direct'] = {'en': 'bind', 'de': 'binde', 'ru': 'связять', 'pt': 'ligar', 'nl': 'binden', 'fr': 'lier', 'it': 'legare', 'es': 'enlazar'};
|
||||
Blockly.Words['direct_tooltip'] = {'en': 'Bind two states with each other', 'de': 'Binde zwei Zustände miteinander', 'ru': 'Связать два состояния между собой', 'pt': 'Vincule dois estados uns com os outros', 'nl': 'Bind twee toestanden met elkaar', 'fr': 'Liez deux états l\'un à l\'autre', 'it': 'Associare due stati tra loro', 'es': 'Enlazar dos estados entre sí'};
|
||||
Blockly.Words['direct_help'] = {'en': 'setstate', 'de': 'setstate', 'ru': 'setstate', 'pt': 'settate', 'nl': 'setstate', 'fr': 'setstate', 'it': 'setstate', 'es': 'setstate'};
|
||||
Blockly.Words['direct_oid_src'] = {'en': '', 'de': '', 'ru': '', 'pt': '', 'nl': '', 'fr': '', 'it': '', 'es': ''};
|
||||
Blockly.Words['direct_only_changes'] = {'en': 'only changes', 'de': 'nur Änderungen', 'ru': 'только изменения', 'pt': 'apenas muda', 'nl': 'alleen veranderingen', 'fr': 'seulement des changements', 'it': 'solo cambiamenti', 'es': 'solo cambios'};
|
||||
Blockly.Words['direct_oid_dst'] = {'en': 'with', 'de': 'mit', 'ru': 'c', 'pt': 'com', 'nl': 'met', 'fr': 'avec', 'it': 'con', 'es': 'con'};
|
||||
|
||||
// --- system control --------------------------------------------------
|
||||
Blockly.Words['control_ex'] = {'en': 'write', 'de': 'schreibe', 'ru': 'записать', 'pt': 'Escreva', 'nl': 'schrijven', 'fr': 'écrire', 'it': 'Scrivi', 'es': 'escribir'};
|
||||
Blockly.Words['control_ex_tooltip'] = {'en': 'Control state', 'de': 'Steuere Zustand', 'ru': 'Установить состояние', 'pt': 'Estado de controle', 'nl': 'Controlestatus', 'fr': 'Etat de contrôle', 'it': 'Stato di controllo', 'es': 'Estado de control'};
|
||||
Blockly.Words['control_ex_control'] = {'en': 'сontrol', 'de': 'steuere', 'ru': 'установить', 'pt': 'controlar', 'nl': 'сontrol', 'fr': 'contrôle', 'it': 'сontrol', 'es': 'ontrol'};
|
||||
Blockly.Words['control_ex_update'] = {'en': 'update', 'de': 'aktualisiere', 'ru': 'обновить', 'pt': 'atualizar', 'nl': 'bijwerken', 'fr': 'mettre à jour', 'it': 'aggiornare', 'es': 'actualizar'};
|
||||
Blockly.Words['control_ex_delay'] = {'en': 'delay in ms', 'de': 'Verzögerung in ms', 'ru': 'Задержка в мс', 'pt': 'atraso em ms', 'nl': 'vertraging in ms', 'fr': 'retarder en ms', 'it': 'ritardo in ms', 'es': 'retraso en ms'};
|
||||
Blockly.Words['control_ex_value'] = {'en': 'value', 'de': 'Wert', 'ru': 'значение', 'pt': 'valor', 'nl': 'waarde', 'fr': 'valeur', 'it': 'valore', 'es': 'valor'};
|
||||
Blockly.Words['control_ex_clear_running'] = {'en': 'clear running', 'de': 'löschen falls läuft', 'ru': 'остановить уже запущенный', 'pt': 'corrida clara', 'nl': 'vrijlopen', 'fr': 'clair course', 'it': 'corsa libera', 'es': 'funcionamiento claro'};
|
||||
|
||||
// --- system create --------------------------------------------------
|
||||
Blockly.Words['create'] = {'en': 'create state', 'de': 'Zustand erzeugen', 'ru': 'создать состояние', 'pt': 'criar estado', 'nl': 'creëer staat', 'fr': 'créer un état', 'it': 'creare stato', 'es': 'crear estado'};
|
||||
Blockly.Words['create_jsState'] = {'en': 'jsState', 'de': 'jsState', 'ru': 'jsState', 'pt': 'jsState', 'nl': 'jsState', 'fr': 'jsState', 'it': 'jsState', 'es': 'jsState'};
|
||||
Blockly.Words['create_tooltip'] = {'en': 'create state', 'de': 'Zustand erzeugen', 'ru': 'создать состояние', 'pt': 'criar estado', 'nl': 'creëer staat', 'fr': 'créer un état', 'it': 'creare stato', 'es': 'crear estado'};
|
||||
Blockly.Words['create_help'] = {'en': 'createstate', 'de': 'createstate', 'ru': 'createstate', 'pt': 'criar', 'nl': 'createstate', 'fr': 'créature', 'it': 'createstate', 'es': 'crear estado'};
|
||||
|
||||
// --- system get --------------------------------------------------
|
||||
Blockly.Words['get_value'] = {'en': 'Get state value', 'de': 'Zustandswert nehmen', 'ru': 'Взять значение состояния', 'pt': 'Obter valor do estado', 'nl': 'Krijg statuswaarde', 'fr': 'Obtenir la valeur de l\'état', 'it': 'Ottieni valore statale', 'es': 'Obtener valor de estado'};
|
||||
Blockly.Words['get_value_OID'] = {'en': 'of Object ID', 'de': 'vom Objekt ID', 'ru': 'у объекта', 'pt': 'de ID do objeto', 'nl': 'van Object ID', 'fr': 'd\'identifiant d\'objet', 'it': 'di ID oggetto', 'es': 'de Object ID'};
|
||||
Blockly.Words['get_value_tooltip'] = {'en': 'Select object ID with dialog', 'de': 'Objekt ID mit Dialog selektieren', 'ru': 'Выбрать ID объекта', 'pt': 'Selecione ID do objeto com diálogo', 'nl': 'Selecteer object-ID met dialoogvenster', 'fr': 'Sélectionnez l\'ID d\'objet avec la boîte de dialogue', 'it': 'Seleziona ID oggetto con finestra di dialogo', 'es': 'Seleccionar ID de objeto con diálogo'};
|
||||
Blockly.Words['get_value_help'] = {'en': 'getstate', 'de': 'getstate', 'ru': 'getstate', 'pt': 'obter', 'nl': 'getstate', 'fr': 'getstate', 'it': 'GetState', 'es': 'Gettate'};
|
||||
Blockly.Words['get_value_default'] = {'en': 'select ID', 'de': 'ID auswählen', 'ru': 'Выбрать ID', 'pt': 'selecione ID', 'nl': 'selecteer ID', 'fr': 'sélectionnez ID', 'it': 'seleziona ID', 'es': 'seleccionar ID'};
|
||||
Blockly.Words['get_value_val'] = {'en': 'Value', 'de': 'Wert', 'ru': 'Значение', 'pt': 'Valor', 'nl': 'Waarde', 'fr': 'Valeur', 'it': 'Valore', 'es': 'Valor'};
|
||||
Blockly.Words['get_value_ack'] = {'en': 'Acknowledge', 'de': 'anerkannt', 'ru': 'Подтверждение', 'pt': 'Reconhecer', 'nl': 'Erkennen', 'fr': 'Reconnaître', 'it': 'Riconoscere', 'es': 'Reconocer'};
|
||||
Blockly.Words['get_value_ts'] = {'en': 'Timestamp', 'de': 'Zeitstempel', 'ru': 'Время', 'pt': 'Timestamp', 'nl': 'tijdstempel', 'fr': 'Horodatage', 'it': 'timestamp', 'es': 'Marca de tiempo'};
|
||||
Blockly.Words['get_value_lc'] = {'en': 'Last change ', 'de': 'Letze Änderung', 'ru': 'Последнее изменеие', 'pt': 'Última mudança', 'nl': 'Laatste wijziging', 'fr': 'Dernier changement', 'it': 'Ultima modifica', 'es': 'Ultimo cambio'};
|
||||
Blockly.Words['get_value_q'] = {'en': 'Quality', 'de': 'Qualität', 'ru': 'Качество', 'pt': 'Qualidade', 'nl': 'Kwaliteit', 'fr': 'Qualité', 'it': 'Qualità', 'es': 'Calidad'};
|
||||
Blockly.Words['get_value_from'] = {'en': 'Source', 'de': 'Quelle', 'ru': 'Происхождение', 'pt': 'Fonte', 'nl': 'Bron', 'fr': 'La source', 'it': 'fonte', 'es': 'Fuente'};
|
||||
Blockly.Words['get_value_async'] = {'en': 'Get state value', 'de': 'Zustandswert nehmen', 'ru': 'Взять значение состояния', 'pt': 'Obter valor do estado', 'nl': 'Krijg statuswaarde', 'fr': 'Obtenir la valeur de l\'état', 'it': 'Ottieni valore statale', 'es': 'Obtener valor de estado'};
|
||||
|
||||
// --- system field --------------------------------------------------
|
||||
Blockly.Words['field_oid'] = {'en': 'Select OID', 'de': 'Zustand erzeugen', 'ru': 'создать состояние', 'pt': 'Selecione OID', 'nl': 'Selecteer OID', 'fr': 'Sélectionnez OID', 'it': 'Seleziona OID', 'es': 'Seleccionar OID'};
|
||||
Blockly.Words['field_oid_OID'] = {'en': 'Object ID', 'de': 'Objekt ID', 'ru': 'ID объекта', 'pt': 'ID do objeto', 'nl': 'Object ID', 'fr': 'ID de l\'objet', 'it': 'ID oggetto', 'es': 'ID del objeto'};
|
||||
Blockly.Words['field_oid_tooltip'] = {'en': 'Select object ID with dialog', 'de': 'Objekt ID mit Dialog selektieren', 'ru': 'Выбрать ID объекта', 'pt': 'Selecione ID do objeto com diálogo', 'nl': 'Selecteer object-ID met dialoogvenster', 'fr': 'Sélectionnez l\'ID d\'objet avec la boîte de dialogue', 'it': 'Seleziona ID oggetto con finestra di dialogo', 'es': 'Seleccionar ID de objeto con diálogo'};
|
||||
|
||||
// --- get attribute --------------------------------------------------
|
||||
Blockly.Words['get_attr'] = {
|
||||
"en": "Get attribute",
|
||||
"de": "Attribut erhalten",
|
||||
"ru": "Получить атрибут",
|
||||
"pt": "Obter atributo",
|
||||
"nl": "Attribuut ophalen",
|
||||
"fr": "Obtenir l'attribut",
|
||||
"it": "Ottieni attributo",
|
||||
"es": "Obtener atributo",
|
||||
"pl": "Uzyskaj atrybut"
|
||||
};
|
||||
Blockly.Words['get_attr_path'] = {
|
||||
"en": "Attribute",
|
||||
"de": "Attribut",
|
||||
"ru": "Атрибут",
|
||||
"pt": "Atributo",
|
||||
"nl": "Attribuut",
|
||||
"fr": "Attribut",
|
||||
"it": "Attributo",
|
||||
"es": "Atributo",
|
||||
"pl": "Atrybut"
|
||||
};
|
||||
Blockly.Words['get_attr_by'] = {'en': 'of Object', 'de': 'vom Objekt', 'ru': 'у объекта', 'pt': 'do objeto', 'nl': 'van Object', 'fr': 'd\'objet', 'it': 'di oggetto', 'es': 'de Object'};
|
||||
Blockly.Words['get_attr_tooltip'] = {
|
||||
"en": "Get attribute of object or JSON by path, like: 'attr1.attr'",
|
||||
"de": "Erhalte Attribut des Objekts oder JSON nach Pfad, wie: 'attr1.attr'",
|
||||
"ru": "Получить атрибут объекта или JSON по пути, например: 'attr1.attr'",
|
||||
"pt": "Obter atributo de objeto ou JSON por caminho, como: 'attr1.attr'",
|
||||
"nl": "Krijg een attribuut van het object of JSON per pad, zoals: 'attr1.attr'",
|
||||
"fr": "Obtenir l'attribut d'objet ou JSON par chemin, comme: 'attr1.attr'",
|
||||
"it": "Ottieni attributo di oggetto o JSON per percorso, ad esempio: 'attr1.attr'",
|
||||
"es": "Obtenga el atributo de objeto o JSON por ruta, como: 'attr1.attr'",
|
||||
"pl": "Uzyskaj atrybut obiektu lub JSON według ścieżki, na przykład: \"attr1.attr\""
|
||||
};
|
||||
Blockly.Words['get_attr_help'] = {'en': 'getattr', 'de': 'getattr', 'ru': 'getattr', 'pt': 'getattr', 'nl': 'getattr', 'fr': 'getattr', 'it': 'getattr', 'es': 'getattr'};
|
||||
|
||||
// --- text new line --------------------------------------------------
|
||||
Blockly.Words['text_newline'] = {'en': 'New line', 'de': 'Neue Zeile', 'ru': 'Новая строка', 'pt': 'Nova linha', 'nl': 'Nieuwe lijn', 'fr': 'Nouvelle ligne', 'it': 'Nuova linea', 'es': 'Nueva línea', 'pl': 'Nowa linia'};
|
||||
Blockly.Words['text_newline_tooltip'] = {'en': 'Places new line in text', 'de': 'Platziert eine neue Zeile im Text', 'ru': 'Размещение новой строки в тексте', 'pt': 'Coloca nova linha no texto', 'nl': 'Plaatst nieuwe regel in tekst', 'fr': 'Place une nouvelle ligne dans le texte', 'it': 'Inserisce una nuova riga nel testo', 'es': 'Coloca una nueva línea en el texto', 'pl': 'Umieszcza nową linię w tekście'};
|
||||
|
||||
// --- round to n digits ----------------------------------------------
|
||||
Blockly.Words['math_rndfixed_round'] = {'en': 'Round', 'de': 'Runde', 'ru': 'Раунд', 'pt': 'Arredondar', 'nl': 'Afronden', 'fr': 'Arrondir', 'it': 'Arrotondare', 'es': 'Redondea', 'pl': 'Zaokrąglaj'};
|
||||
Blockly.Words['math_rndfixed_to'] = {'en': 'to', 'de': 'auf', 'ru': 'в', 'pt': 'para', 'nl': 'naar', 'fr': 'à', 'it': 'a', 'es': 'a', 'pl': 'do'};
|
||||
Blockly.Words['math_rndfixed_decplcs'] = {'en': 'decimal places', 'de': 'Nachkommastellen', 'ru': 'десятичные знаки', 'pt': 'casas decimais', 'nl': 'plaatsen na de komma', 'fr': 'décimales', 'it': 'decimali', 'es': 'lugares decimales', 'pl': 'miejsca dziesiętne'};
|
||||
Blockly.Words['math_rndfixed_tooltip'] = {'en': 'Rounds value to n decimal places', 'de': 'Rundet den Wert auf n Dezimalstellen', 'ru': 'Значение раундов до n знаков после запятой', 'pt': 'Arredonda o valor para n casas decimais', 'nl': 'Rondt waarde af naar n decimale plaatsen', 'fr': 'Arrondit la valeur à n décimales', 'it': 'Arrotonda il valore in n posizioni decimali', 'es': 'Redondea el valor a n lugares decimales','pl': 'Zaokrągla wartość do n miejsc po przecinku'};
|
||||
|
||||
// --- TIME --------------------------------------------------
|
||||
Blockly.Words['Time'] = {'en': 'Date and Time', 'de': 'Datum und Zeit', 'ru': 'Дата и время', 'pt': 'Data e hora', 'nl': 'Datum en tijd', 'fr': 'Date et l\'heure', 'it': 'Data e ora', 'es': 'Fecha y hora'};
|
||||
|
||||
// --- time time --------------------------------------------------
|
||||
Blockly.Words['time_compare_ex'] = {'en': 'Actual time', 'de': 'Aktuelle Zeit', 'ru': 'Текущее время', 'pt': 'Tempo real', 'nl': 'Werkelijke tijd', 'fr': 'Heure actuelle', 'it': 'Tempo reale', 'es': 'Tiempo actual'};
|
||||
Blockly.Words['time_compare_custom_ex'] = {'en': 'Custom time', 'de': 'Zeit', 'ru': 'Время', 'pt': 'Tempo personalizado', 'nl': 'Aangepaste tijd', 'fr': 'Temps personnalisé', 'it': 'Tempo personalizzato', 'es': 'Hora personalizada'};
|
||||
Blockly.Words['time_compare_is_ex'] = {'en': 'is', 'de': 'ist', 'ru': ' ', 'pt': 'é', 'nl': 'is', 'fr': 'est', 'it': 'è', 'es': 'es'};
|
||||
Blockly.Words['time_compare_ex_custom'] = {'en': 'time', 'de': 'Zeit', 'ru': 'Время', 'pt': 'Tempo', 'nl': 'tijd', 'fr': 'temps', 'it': 'tempo', 'es': 'hora'};
|
||||
Blockly.Words['time_compare_ex_tooltip'] = {'en': 'Compare time', 'de': 'Zeit vergleichen', 'ru': 'Сравнить время', 'pt': 'Compare o tempo', 'nl': 'Vergelijk tijd', 'fr': 'Comparer le temps', 'it': 'Confronta il tempo', 'es': 'Compara el tiempo'};
|
||||
Blockly.Words['time_compare_ex_help'] = {'en': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'de': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'ru': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'pt': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'nl': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'fr': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'it': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'es': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md'};
|
||||
Blockly.Words['time_compare'] = {'en': 'Actual time is', 'de': 'Aktuelle Zeit ist', 'ru': 'Время ', 'pt': 'O horário real é', 'nl': 'De werkelijke tijd is', 'fr': 'L\'heure actuelle est', 'it': 'Il tempo reale è', 'es': 'El tiempo real es'};
|
||||
Blockly.Words['time_compare_tooltip'] = {'en': 'Compare current time', 'de': 'Vergleiche mit aktueller Zeit', 'ru': 'Сравнить текущее время', 'pt': 'Compare a hora atual', 'nl': 'Vergelijk de huidige tijd', 'fr': 'Comparer l\'heure actuelle', 'it': 'Confronta l\'ora corrente', 'es': 'Compara la hora actual'};
|
||||
Blockly.Words['time_compare_help'] = {'en': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'de': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'ru': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'pt': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'nl': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'fr': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'it': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'es': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md'};
|
||||
Blockly.Words['time_compare_lt'] = {'en': 'less than', 'de': 'kleiner als', 'ru': 'меньше чем', 'pt': 'menos que', 'nl': 'minder dan', 'fr': 'moins que', 'it': 'meno di', 'es': 'menos que'};
|
||||
Blockly.Words['time_compare_le'] = {'en': 'equal to or less than', 'de': 'gleich oder kleiner als', 'ru': 'равно или меньше чем', 'pt': 'igual ou inferior a', 'nl': 'gelijk aan of minder dan', 'fr': 'égal ou inférieur à', 'it': 'uguale o inferiore a', 'es': 'igual o menor que'};
|
||||
Blockly.Words['time_compare_gt'] = {'en': 'greater than', 'de': 'größer als', 'ru': 'больше чем', 'pt': 'Melhor que', 'nl': 'groter dan', 'fr': 'plus grand que', 'it': 'più grande di', 'es': 'mas grande que'};
|
||||
Blockly.Words['time_compare_ge'] = {'en': 'equal to or greater than', 'de': 'gleich oder größer als', 'ru': 'равно или больше чем', 'pt': 'igual ou maior do que', 'nl': 'gelijk aan of groter dan', 'fr': 'égal ou supérieur à', 'it': 'uguale o maggiore di', 'es': 'igual o mayor que'};
|
||||
Blockly.Words['time_compare_eq'] = {'en': 'equal to', 'de': 'gleich mit', 'ru': 'равно', 'pt': 'igual a', 'nl': 'gelijk aan', 'fr': 'égal à', 'it': 'uguale a', 'es': 'igual a'};
|
||||
Blockly.Words['time_compare_bw'] = {'en': 'between', 'de': 'zwischen', 'ru': 'между', 'pt': 'entre', 'nl': 'tussen', 'fr': 'entre', 'it': 'fra', 'es': 'Entre'};
|
||||
Blockly.Words['time_compare_nb'] = {'en': 'not between', 'de': 'nicht zwischen', 'ru': 'не между', 'pt': 'não entre', 'nl': 'niet tussen', 'fr': 'pas entre', 'it': 'non in mezzo', 'es': 'no entre'};
|
||||
Blockly.Words['time_compare_and'] = {'en': 'and', 'de': 'und', 'ru': 'и', 'pt': 'e', 'nl': 'en', 'fr': 'et', 'it': 'e', 'es': 'y'};
|
||||
Blockly.Words['time_get'] = {'en': 'Actual time as', 'de': 'Aktuelle Zeit als', 'ru': 'Время ', 'pt': 'Tempo real como', 'nl': 'Werkelijke tijd als', 'fr': 'Heure réelle sous', 'it': 'Tempo reale come', 'es': 'Tiempo real como'};
|
||||
Blockly.Words['time_get_default_format'] = {'en': 'YYYY.MM.DD hh:mm:ss.sss', 'de': 'JJJJ.MM.TT SS:mm:ss.sss', 'ru': 'ГГГГ.ММ.ДД чч:мм:сс.ссс', 'pt': 'AAAA.MM.DD hh: mm: ss.sss', 'nl': 'JJJJ.MM.DD uu: mm: ss.sss', 'fr': 'YYYY.MM.DD hh: mm: ss.sss', 'it': 'YYYY.MM.DD hh: mm: ss.sss', 'es': 'YYYY.MM.DD hh: mm: ss.sss'};
|
||||
Blockly.Words['time_get_anyInstance'] = {'en': 'all instances', 'de': 'Alle Instanzen', 'ru': 'На все драйвера', 'pt': 'todas as instâncias', 'nl': 'alle instanties', 'fr': 'toutes les instances', 'it': 'tutte le istanze', 'es': 'todas las instancias'};
|
||||
Blockly.Words['time_get_tooltip'] = {'en': 'Send message to telegram', 'de': 'Sende eine Meldung über Telegram', 'ru': 'Послать сообщение через Telegram', 'pt': 'Enviar mensagem para telegrama', 'nl': 'Stuur bericht naar telegram', 'fr': 'Envoyer un message au télégramme', 'it': 'Invia un messaggio al telegramma', 'es': 'Enviar mensaje a telegrama'};
|
||||
Blockly.Words['time_get_help'] = {'en': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'de': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'ru': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'pt': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'nl': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'fr': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'it': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'es': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md'};
|
||||
Blockly.Words['time_get_object'] = {'en': 'Date object', 'de': 'Datum-Objekt', 'ru': 'как объект', 'pt': 'Data objeto', 'nl': 'Datum object', 'fr': 'Objet de date', 'it': 'Data oggetto', 'es': 'Objeto de fecha'};
|
||||
Blockly.Words['time_get_ms'] = {'en': 'milliseconds', 'de': 'Millisekunden', 'ru': 'миллисекунды', 'pt': 'milissegundos', 'nl': 'milliseconden', 'fr': 'millisecondes', 'it': 'millisecondi', 'es': 'milisegundos'};
|
||||
Blockly.Words['time_get_s'] = {'en': 'seconds', 'de': 'Sekunden', 'ru': 'секунды', 'pt': 'segundos', 'nl': 'seconden', 'fr': 'secondes', 'it': 'secondi', 'es': 'segundos'};
|
||||
Blockly.Words['time_get_m'] = {'en': 'minutes', 'de': 'Minuten', 'ru': 'минуты', 'pt': 'minutos', 'nl': 'notulen', 'fr': 'minutes', 'it': 'minuti', 'es': 'minutos'};
|
||||
Blockly.Words['time_get_mid'] = {'en': 'minutes in day', 'de': 'Minuten seit Tagsanfang', 'ru': 'кол-во минут с начала дня', 'pt': 'minutos do dia', 'nl': 'minuten in dag', 'fr': 'minutes dans la journée', 'it': 'minuti al giorno', 'es': 'minutos en el día'};
|
||||
Blockly.Words['time_get_sid'] = {'en': 'seconds in day', 'de': 'Sekunden seit Tagsanfang', 'ru': 'кол-во секунд с начала дня', 'pt': 'segundos no dia', 'nl': 'seconden in dag', 'fr': 'secondes dans la journée', 'it': 'secondi nel giorno', 'es': 'segundos en el día'};
|
||||
Blockly.Words['time_get_h'] = {'en': 'hours', 'de': 'Stunden', 'ru': 'часы', 'pt': 'horas', 'nl': 'uur', 'fr': 'heures', 'it': 'ore', 'es': 'horas'};
|
||||
Blockly.Words['time_get_d'] = {'en': 'day of month', 'de': 'Monatsdatum', 'ru': 'день месяца', 'pt': 'dia do mês', 'nl': 'dag van de maand', 'fr': 'jour du mois', 'it': 'giorno del mese', 'es': 'dia del mes'};
|
||||
Blockly.Words['time_get_M'] = {'en': 'month as number', 'de': 'Monat als Nummer', 'ru': 'месяц числом', 'pt': 'mês como número', 'nl': 'maand als nummer', 'fr': 'mois en nombre', 'it': 'mese come numero', 'es': 'mes como número'};
|
||||
Blockly.Words['time_get_Mt'] = {'en': 'month as text', 'de': 'Monat als Text', 'ru': 'месяц словом', 'pt': 'mês como texto', 'nl': 'maand als tekst', 'fr': 'mois comme texte', 'it': 'mese come testo', 'es': 'mes como texto'};
|
||||
Blockly.Words['time_get_Mts'] = {'en': 'month as short text', 'de': 'Monat als Kurztext', 'ru': 'месяц коротким словом', 'pt': 'mês como texto curto', 'nl': 'maand als korte tekst', 'fr': 'mois comme texte court', 'it': 'mese come breve testo', 'es': 'mes como texto corto'};
|
||||
Blockly.Words['time_get_y'] = {'en': 'short year', 'de': 'Jahr, kurz', 'ru': 'короткий год', 'pt': 'ano curto', 'nl': 'kort jaar', 'fr': 'année courte', 'it': 'breve anno', 'es': 'año corto'};
|
||||
Blockly.Words['time_get_fy'] = {'en': 'full year', 'de': 'Jahr, voll', 'ru': 'полный год', 'pt': 'ano completo', 'nl': 'Volledig jaar', 'fr': 'année complète', 'it': 'anno pieno', 'es': 'Año completo'};
|
||||
Blockly.Words['time_get_wdt'] = {'en': 'week day text', 'de': 'Wochentag als Text', 'ru': 'день недели словом', 'pt': 'texto do dia da semana', 'nl': 'weekdag tekst', 'fr': 'texte de la semaine', 'it': 'testo del giorno della settimana', 'es': 'texto del día de la semana'};
|
||||
Blockly.Words['time_get_wdts'] = {'en': 'short week day', 'de': 'Wochentag als Kurztext', 'ru': 'короткий день недели', 'pt': 'dia da semana curto', 'nl': 'korte weekdag', 'fr': 'jour de la semaine courte', 'it': 'breve giorno della settimana', 'es': 'día corto de la semana'};
|
||||
Blockly.Words['time_get_wd'] = {'en': 'week day as number', 'de': 'Wochentag als Nummer', 'ru': 'день недели числом', 'pt': 'dia da semana como número', 'nl': 'weekdag als nummer', 'fr': 'jour de la semaine en nombre', 'it': 'giorno della settimana come numero', 'es': 'día de la semana como número'};
|
||||
Blockly.Words['time_get_custom'] = {'en': 'custom format', 'de': 'anwenderformatiert', 'ru': 'произвольный формат', 'pt': 'formato personalizado', 'nl': 'aangepast formaat', 'fr': 'format personnalisé', 'it': 'formato personalizzato', 'es': 'formato personalizado'};
|
||||
Blockly.Words['time_get_yyyy.mm.dd'] = {'en': 'yyyy.mm.dd', 'de': 'JJJJ.MM.TT', 'ru': 'ГГГГ.ММ.ДД', 'pt': 'aaaa.mm.dd', 'nl': 'jjjj.mm.dd', 'fr': 'aaaa.mm.jj', 'it': 'yyyy.MM.dd', 'es': 'aaaa.mm.dd'};
|
||||
Blockly.Words['time_get_yyyy/mm/dd'] = {'en': 'yyyy/mm/dd', 'de': 'JJJJ/MM/TT', 'ru': 'ГГГГ/ММ/ДД', 'pt': 'aaaa/mm/dd', 'nl': 'yyyy/mm/dd', 'fr': 'aaaa/mm/jj', 'it': 'aaaa/mm/gg', 'es': 'aaaa/mm/dd'};
|
||||
Blockly.Words['time_get_yy.mm.dd'] = {'en': 'yy.mm.dd', 'de': 'JJ.MM.TT', 'ru': 'ГГ.ММ.ДД', 'pt': 'yy.mm.dd', 'nl': 'JJ.MM.DD', 'fr': 'yy.mm.dd', 'it': 'yy.mm.dd', 'es': 'yy.mm.dd'};
|
||||
Blockly.Words['time_get_yy/mm/dd'] = {'en': 'yy/mm/dd', 'de': 'JJ/MM/TT', 'ru': 'ГГ/ММ/ДД', 'pt': 'aa/mm/dd', 'nl': 'yy/mm/dd', 'fr': 'aa/mm/jj', 'it': 'aa/mm/dd', 'es': 'aa/mm/dd'};
|
||||
Blockly.Words['time_get_dd.mm.yyyy'] = {'en': 'dd.mm.yyyy', 'de': 'TT.MM.JJJJ', 'ru': 'ДД.ММ.ГГГГ', 'pt': 'dd.mm.yyyy', 'nl': 'dd.mm.yyyy', 'fr': 'jj.mm.aaaa', 'it': 'gg.mm.aaaa', 'es': 'dd.mm.yyyy'};
|
||||
Blockly.Words['time_get_dd/mm/yyyy'] = {'en': 'dd/mm/yyyy', 'de': 'TT/MM/JJJJ', 'ru': 'ДД/ММ/ГГГГ', 'pt': 'dd/mm/aaaa', 'nl': 'dd/mm/yyyy', 'fr': 'jj/mm/aaaa', 'it': 'gg/mm/aaaa', 'es': 'dd/mm/aaaa'};
|
||||
Blockly.Words['time_get_dd.mm.yy'] = {'en': 'dd.mm.yy', 'de': 'TT.MM.JJ', 'ru': 'ДД.ММ.ГГ', 'pt': 'dd.mm.yy', 'nl': 'dd.mm.jj', 'fr': 'jj.mm.aa', 'it': 'dd.mm.yy', 'es': 'dd.mm.yy'};
|
||||
Blockly.Words['time_get_dd/mm/yy'] = {'en': 'dd/mm/yy', 'de': 'TT/MM/JJ', 'ru': 'ДД/ММ/ГГ', 'pt': 'dd/mm/aa', 'nl': 'dd/mm/jj', 'fr': 'jj/mm/aa', 'it': 'gg/mm/aa', 'es': 'dd/mm/aa'};
|
||||
Blockly.Words['time_get_mm/dd/yyyy'] = {'en': 'mm/dd/yyyy', 'de': 'MM/TT/JJJJ', 'ru': 'ММ/ДД/ГГГГ', 'pt': 'mm/dd/aaaa', 'nl': 'mm/dd/yyyy', 'fr': 'mm/jj/aaaa', 'it': 'mm/gg/aaaa', 'es': 'mm/dd/aaaa'};
|
||||
Blockly.Words['time_get_mm/dd/yy'] = {'en': 'mm/dd/yy', 'de': 'MM/TT/JJ', 'ru': 'ММ/ДД/yy', 'pt': 'mm/dd/aaa', 'nl': 'MM/DD/JJ', 'fr': 'mm/jj/aa', 'it': 'mm/gg/aa', 'es': 'mm/dd/aa'};
|
||||
Blockly.Words['time_get_dd.mm'] = {'en': 'dd.mm.', 'de': 'TT.MM.', 'ru': 'ДД.ММ.', 'pt': 'dd.mm.', 'nl': 'DD.MM.', 'fr': 'jj.mm.', 'it': 'GG.MM.', 'es': 'dd.mm.'};
|
||||
Blockly.Words['time_get_dd/mm'] = {'en': 'dd/mm', 'de': 'TT/MM', 'ru': 'ДД/ММ', 'pt': 'dd/mm', 'nl': 'dd/mm', 'fr': 'jj/mm', 'it': 'gg/mm', 'es': 'dd/mm'};
|
||||
Blockly.Words['time_get_mm.dd'] = {'en': 'mm.dd', 'de': 'MM.TT', 'ru': 'ММ.ДД', 'pt': 'mm.dd', 'nl': 'mm.dd', 'fr': 'mm.dd', 'it': 'mm.dd', 'es': 'mm.dd'};
|
||||
Blockly.Words['time_get_mm/dd'] = {'en': 'mm/dd', 'de': 'MM/TT', 'ru': 'ММ/ДД', 'pt': 'mm/dd', 'nl': 'MM/DD', 'fr': 'mm/jj', 'it': 'mm/gg', 'es': 'mm/dd'};
|
||||
Blockly.Words['time_get_hh_mm'] = {'en': 'hh:mm', 'de': 'SS:mm', 'ru': 'чч:мм', 'pt': 'hh:mm', 'nl': 'hh:mm', 'fr': 'hh:mm', 'it': 'hh:mm', 'es': 'hh: mm'};
|
||||
Blockly.Words['time_get_hh_mm_ss'] = {'en': 'hh:mm:ss', 'de': 'SS:mm:ss', 'ru': 'чч:мм:сс', 'pt': 'hh:mm:ss', 'nl': 'hh:mm:ss', 'fr': 'hh:mm:ss', 'it': 'hh:mm:ss', 'es': 'hh: mm: ss'};
|
||||
Blockly.Words['time_get_hh_mm_ss.sss'] = {'en': 'hh:mm:ss.sss', 'de': 'SS:mm:ss.sss', 'ru': 'чч:мм:сс.ссс', 'pt': 'hh:mm:ss.sss', 'nl': 'hh:mm:ss.sss', 'fr': 'hh:mm:ss.sss', 'it': 'hh:mm:ss.sss', 'es': 'hh: mm: ss.sss'};
|
||||
Blockly.Words['time_astro'] = {'en': 'Actual time of', 'de': 'Aktuelle Zeit von', 'ru': 'Время ', 'pt': 'Tempo real de', 'nl': 'Huidige tijd van', 'fr': 'Heure réelle de', 'it': 'Tempo reale di', 'es': 'Tiempo real de'};
|
||||
Blockly.Words['time_astro_offset'] = {'en': 'Offset (minutes)', 'de': 'Offset (Minuten)', 'ru': 'Сдвиг в минутах ', 'pt': 'Offset (minutos)', 'nl': 'Offset (minuten)', 'fr': 'Décalage (minutes)', 'it': 'Offset (minuti)', 'es': 'Desplazamiento (minutos)'};
|
||||
Blockly.Words['time_astro_default_format'] = {'en': 'YYYY.MM.DD hh:mm:ss.sss', 'de': 'JJJJ.MM.TT SS:mm:ss.sss', 'ru': 'ГГГГ.ММ.ДД чч:мм:сс.ссс', 'pt': 'AAAA.MM.DD hh:mm:ss.sss', 'nl': 'JJJJ.MM.DD uu:mm:ss.sss', 'fr': 'YYYY.MM.DD hh:mm:ss.sss', 'it': 'YYYY.MM.DD hh:mm:ss.sss', 'es': 'YYYY.MM.DD hh: mm: ss.sss'};
|
||||
Blockly.Words['time_astro_tooltip'] = {'en': 'Get actual time or ', 'de': 'Sende eine Meldung über Telegram', 'ru': 'Послать сообщение через Telegram', 'pt': 'Receba o tempo real ou', 'nl': 'Krijg actuele tijd of', 'fr': 'Obtenez le temps réel ou', 'it': 'Ottieni tempo reale o', 'es': 'Obtenga tiempo real o'};
|
||||
Blockly.Words['time_astro_help'] = {'en': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'de': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'ru': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'pt': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'nl': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'fr': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'it': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md', 'es': 'https://git.spacen.net/yunkong2/yunkong2.telegram/blob/master/README.md'};
|
||||
|
||||
// --- TIMEOUTS --------------------------------------------------
|
||||
Blockly.Words['Timeouts'] = {'en': 'Timeouts', 'de': 'Timeouts', 'ru': 'Timeouts', 'pt': 'Tempo limite', 'nl': 'Time-outs', 'fr': 'Délais', 'it': 'Timeout', 'es': 'Tiempos de espera'};
|
||||
|
||||
// --- timeouts timeouts --------------------------------------------------
|
||||
Blockly.Words['timeouts_settimeout'] = {'en': 'Execution', 'de': 'Ausführen', 'ru': 'Выполнить', 'pt': 'Execução', 'nl': 'Executie', 'fr': 'Exécution', 'it': 'Esecuzione', 'es': 'Ejecución'};
|
||||
Blockly.Words['timeouts_settimeout_name'] = {'en': 'timeout', 'de': 'Verzögerung', 'ru': 'Пауза', 'pt': 'tempo esgotado', 'nl': 'time-out', 'fr': 'temps libre', 'it': 'tempo scaduto', 'es': 'se acabó el tiempo'};
|
||||
Blockly.Words['timeouts_settimeout_in'] = {'en': 'in', 'de': 'in', 'ru': 'через', 'pt': 'dentro', 'nl': 'in', 'fr': 'dans', 'it': 'in', 'es': 'en'};
|
||||
Blockly.Words['timeouts_settimeout_ms'] = {'en': 'ms', 'de': 'ms', 'ru': 'мс', 'pt': 'Senhora', 'nl': 'Mevrouw', 'fr': 'Mme', 'it': 'Signorina', 'es': 'Sra'};
|
||||
Blockly.Words['timeouts_settimeout_sec'] = {'en': 'sec', 'de': 'Sek', 'ru': 'сек.', 'pt': 'seg', 'nl': 'sec', 'fr': 'seconde', 'it': 'secondo', 'es': 'segundo'};
|
||||
Blockly.Words['timeouts_settimeout_min'] = {'en': 'min', 'de': 'Min', 'ru': 'мин.', 'pt': 'min', 'nl': 'min', 'fr': 'min', 'it': 'min', 'es': 'min'};
|
||||
Blockly.Words['timeouts_settimeout_tooltip'] = {'en': 'Delay execution', 'de': 'Ausführung verzögern', 'ru': 'Сделать паузу', 'pt': 'Atrasar a execução', 'nl': 'Vertraag uitvoering', 'fr': 'Retarder l\'exécution', 'it': 'Ritardare l\'esecuzione', 'es': 'Demora de ejecución'};
|
||||
Blockly.Words['timeouts_settimeout_help'] = {'en': 'settimeout', 'de': 'settimeout', 'ru': 'settimeout', 'pt': 'settimeout', 'nl': 'setTimeout', 'fr': 'settimeout', 'it': 'setTimeout', 'es': 'settimeout'};
|
||||
Blockly.Words['timeouts_cleartimeout'] = {'en': 'clear', 'de': 'stop', 'ru': 'остановить', 'pt': 'Claro', 'nl': 'duidelijk', 'fr': 'clair', 'it': 'chiaro', 'es': 'claro'};
|
||||
Blockly.Words['timeouts_cleartimeout_tooltip'] = {'en': 'Clear delay execution', 'de': 'Ausführungsverzögerung anhalten', 'ru': 'Отменить выполнение с паузой', 'pt': 'Execução de atraso clara', 'nl': 'Duidelijke uitvoering van vertragingen', 'fr': 'Effacer l\'exécution du délai', 'it': 'Cancella l\'esecuzione del ritardo', 'es': 'Ejecución de retraso claro'};
|
||||
Blockly.Words['timeouts_cleartimeout_help'] = {'en': 'cleartimeout', 'de': 'cleartimeout', 'ru': 'cleartimeout', 'pt': 'cleartimeout', 'nl': 'clearTimeout', 'fr': 'cleartimeout', 'it': 'clearTimeout', 'es': 'cleartimeout'};
|
||||
Blockly.Words['timeouts_setinterval'] = {'en': 'Execution', 'de': 'Ausführen', 'ru': 'Выполнить', 'pt': 'Execução', 'nl': 'Executie', 'fr': 'Exécution', 'it': 'Esecuzione', 'es': 'Ejecución'};
|
||||
Blockly.Words['timeouts_setinterval_name'] = {'en': 'interval', 'de': 'Intervall', 'ru': 'интервал', 'pt': 'intervalo', 'nl': 'interval', 'fr': 'intervalle', 'it': 'intervallo', 'es': 'intervalo'};
|
||||
Blockly.Words['timeouts_setinterval_in'] = {'en': 'every', 'de': 'alle', 'ru': 'каждые', 'pt': 'cada', 'nl': 'elk', 'fr': 'chaque', 'it': 'ogni', 'es': 'cada'};
|
||||
Blockly.Words['timeouts_setinterval_ms'] = {'en': 'ms', 'de': 'ms', 'ru': 'мс', 'pt': 'Senhora', 'nl': 'Mevrouw', 'fr': 'Mme', 'it': 'Signorina', 'es': 'Sra'};
|
||||
Blockly.Words['timeouts_setinterval_tooltip'] = {'en': 'Cyclic execution', 'de': 'Zyklische Ausführung', 'ru': 'Выполнять постоянно через интервал', 'pt': 'Execução cíclica', 'nl': 'Cyclische uitvoering', 'fr': 'Exécution cyclique', 'it': 'Esecuzione ciclica', 'es': 'Ejecución cíclica'};
|
||||
Blockly.Words['timeouts_setinterval_help'] = {'en': 'setinterval', 'de': 'setinterval', 'ru': 'setinterval', 'pt': 'setinterval', 'nl': 'setInterval', 'fr': 'setinterval', 'it': 'setInterval', 'es': 'setinterval'};
|
||||
Blockly.Words['timeouts_clearinterval'] = {'en': 'clear interval', 'de': 'stop zyklische Ausführung', 'ru': 'остановить постоянное выполнение', 'pt': 'intervalo claro', 'nl': 'interval wissen', 'fr': 'intervalle clair', 'it': 'intervallo chiaro', 'es': 'intervalo claro'};
|
||||
Blockly.Words['timeouts_clearinterval_tooltip'] = {'en': 'Clear interval execution', 'de': 'Ausführungsintervall anhalten', 'ru': 'Отменить цикличное выполнение с интервалом', 'pt': 'Execução de intervalo claro', 'nl': 'Interval-uitvoering wissen', 'fr': 'Effacer l\'intervalle d\'exécution', 'it': 'Cancella l\'esecuzione dell\'intervallo', 'es': 'Ejecución de intervalo claro'};
|
||||
Blockly.Words['timeouts_clearinterval_help'] = {'en': 'clearinterval', 'de': 'clearinterval', 'ru': 'clearinterval', 'pt': 'clearinterval', 'nl': 'clearInterval', 'fr': 'clearinterval', 'it': 'clearInterval', 'es': 'clearinterval'};
|
||||
|
||||
// --- TRIGGER --------------------------------------------------
|
||||
Blockly.Words['Trigger'] = {'en': 'Trigger', 'de': 'Trigger', 'ru': 'События', 'pt': 'Desencadear', 'nl': 'In gang zetten', 'fr': 'Déclencheur', 'it': 'Grilletto', 'es': 'Desencadenar'};
|
||||
|
||||
// --- trigger on --------------------------------------------------
|
||||
Blockly.Words['on_onchange'] = {'en': 'was changed', 'de': 'wurde geändert', 'ru': 'изменился', 'pt': 'foi alterado', 'nl': 'was veranderd', 'fr': 'a été changé', 'it': 'era cambiato', 'es': 'fue cambiado'};
|
||||
Blockly.Words['on_any'] = {'en': 'was updated', 'de': 'wurde aktualisiert', 'ru': 'обновился', 'pt': 'foi atualizado', 'nl': 'is geupdated', 'fr': 'a été mis à jour', 'it': 'è stato aggiornato', 'es': 'fue actualizado'};
|
||||
Blockly.Words['on_gt'] = {'en': 'is greater than last', 'de': 'ist größer als letztes', 'ru': 'больше прошлого', 'pt': 'é maior do que o último', 'nl': 'is groter dan de vorige', 'fr': 'est plus grand que le dernier', 'it': 'è più grande dell\'ultimo', 'es': 'es mayor que el último'};
|
||||
Blockly.Words['on_ge'] = {'en': 'is greater or equal than last', 'de': 'ist gleich oder größer als letztes', 'ru': 'больше или равен прошлому', 'pt': 'é maior ou igual que a última', 'nl': 'is groter of gelijk dan de vorige', 'fr': 'est supérieur ou égal à la dernière', 'it': 'è maggiore o uguale alla precedente', 'es': 'es mayor o igual que el último'};
|
||||
Blockly.Words['on_lt'] = {'en': 'is less than last', 'de': 'ist kleiner als letztes', 'ru': 'меньше прошлого', 'pt': 'é menos do que o último', 'nl': 'is minder dan de vorige', 'fr': 'est moins que la dernière', 'it': 'è inferiore all\'ultima', 'es': 'es menos que el último'};
|
||||
Blockly.Words['on_le'] = {'en': 'is less or equal than last', 'de': 'ist gleich oder kleiner als letztes', 'ru': 'меньше или равен прошлому', 'pt': 'é menor ou igual que a última', 'nl': 'is minder of gelijk dan de vorige', 'fr': 'est inférieur ou égal à la dernière', 'it': 'è inferiore o uguale all\'ultima', 'es': 'es menor o igual que el último'};
|
||||
Blockly.Words['on_eq'] = {'en': 'is same as last', 'de': 'ist gleich wie letztes', 'ru': 'равен прошлому', 'pt': 'é o mesmo que o último', 'nl': 'is hetzelfde als het laatst', 'fr': 'est le même que le dernier', 'it': 'è lo stesso dell\'ultimo', 'es': 'es lo mismo que el último'};
|
||||
Blockly.Words['on_true'] = {'en': 'is true', 'de': 'ist wahr', 'ru': 'равен true', 'pt': 'é verdade', 'nl': 'is waar', 'fr': 'est vrai', 'it': 'è vero', 'es': 'es verdad'};
|
||||
Blockly.Words['on_false'] = {'en': 'is false', 'de': 'ist unwahr', 'ru': 'равен false', 'pt': 'é falso', 'nl': 'is fout', 'fr': 'c\'est faux', 'it': 'è falso', 'es': 'Es falso'};
|
||||
Blockly.Words['on_help'] = {'en': 'on---subscribe-on-changes-or-updates-of-some-state', 'de': 'on---subscribe-on-changes-or-updates-of-some-state', 'ru': 'on---subscribe-on-changes-or-updates-of-some-state', 'pt': 'on---subscribe-on-changes-or-updates-of-some-state', 'nl': 'on---subscribe-on-changes-or-updates-of-some-state', 'fr': 'on---subscribe-on-changes-or-updates-of-some-state', 'it': 'on---subscribe-on-changes-or-updates-of-some-state', 'es': 'on---subscribe-on-changes-or-updates-of-some-state'};
|
||||
Blockly.Words['on_ack'] = {'en': 'Ack is', 'de': 'anerkannt ist', 'ru': 'Подтверждение', 'pt': 'Ack é', 'nl': 'Ack is', 'fr': 'Ack est', 'it': 'Ack è', 'es': 'Ack es'};
|
||||
Blockly.Words['on_ack_any'] = {'en': 'any', 'de': 'egal', 'ru': 'не важно', 'pt': 'qualquer', 'nl': 'ieder', 'fr': 'tout', 'it': 'qualunque', 'es': 'alguna'};
|
||||
Blockly.Words['on_ack_true'] = {'en': 'update', 'de': 'Update', 'ru': 'обновление', 'pt': 'atualizar', 'nl': 'bijwerken', 'fr': 'mettre à jour', 'it': 'aggiornare', 'es': 'actualizar'};
|
||||
Blockly.Words['on_ack_false'] = {'en': 'command', 'de': 'Befehl', 'ru': 'команда', 'pt': 'comando', 'nl': 'opdracht', 'fr': 'commander', 'it': 'comando', 'es': 'mando'};
|
||||
Blockly.Words['on_ext'] = {'en': 'Event: if objects', 'de': 'Falls Objekt', 'ru': 'Событие: если объект', 'pt': 'Evento: se objetos', 'nl': 'Evenement: als objecten', 'fr': 'Evénement: si des objets', 'it': 'Evento: se oggetti', 'es': 'Evento: si los objetos'};
|
||||
Blockly.Words['on_ext_tooltip'] = {'en': 'If some state changed or updated', 'de': 'Bei Zustandsänderung', 'ru': 'При изменении или обновлении состояния', 'pt': 'Se algum estado mudou ou atualizou', 'nl': 'Als een bepaalde staat is gewijzigd of bijgewerkt', 'fr': 'Si un état a été modifié ou mis à jour', 'it': 'Se qualche stato è cambiato o aggiornato', 'es': 'Si algún estado cambió o se actualizó'};
|
||||
Blockly.Words['on_ext_oid'] = {'en': 'object ID', 'de': 'Objekt ID', 'ru': 'ID объекта', 'pt': 'ID do objeto', 'nl': 'object-ID', 'fr': 'ID d\'objet', 'it': 'ID oggetto', 'es': 'ID de objeto'};
|
||||
Blockly.Words['on_ext_oid_tooltip'] = {'en': 'Object ID', 'de': 'Objekt ID', 'ru': 'ID объекта', 'pt': 'ID do objeto', 'nl': 'Object ID', 'fr': 'ID de l\'objet', 'it': 'ID oggetto', 'es': 'ID del objeto'};
|
||||
Blockly.Words['on_ext_on'] = {'en': 'trigger on', 'de': 'falls Trigger auf', 'ru': 'если cобытие', 'pt': 'gatilho', 'nl': 'trigger aan', 'fr': 'déclencher', 'it': 'innesco su', 'es': 'desencadenar'};
|
||||
Blockly.Words['on_ext_on_tooltip'] = {'en': 'trigger on', 'de': 'falls Trigger auf', 'ru': 'если cобытие', 'pt': 'gatilho', 'nl': 'trigger aan', 'fr': 'déclencher', 'it': 'innesco su', 'es': 'desencadenar'};
|
||||
Blockly.Words['on'] = {'en': 'Event: if object', 'de': 'falls Objekt', 'ru': 'Событие: если объект', 'pt': 'Evento: se objeto', 'nl': 'Evenement: als object', 'fr': 'Evénement: si objet', 'it': 'Evento: se oggetto', 'es': 'Evento: si el objeto'};
|
||||
Blockly.Words['on_tooltip'] = {'en': 'If some state changed or updated', 'de': 'Bei Zustandsänderung', 'ru': 'При изменении или обновлении состояния', 'pt': 'Se algum estado mudou ou atualizou', 'nl': 'Als een bepaalde staat is gewijzigd of bijgewerkt', 'fr': 'Si un état a été modifié ou mis à jour', 'it': 'Se qualche stato è cambiato o aggiornato', 'es': 'Si algún estado cambió o se actualizó'};
|
||||
Blockly.Words['on_source'] = {'en': 'get', 'de': 'Nehme', 'ru': 'взять', 'pt': 'obter', 'nl': 'krijgen', 'fr': 'obtenir', 'it': 'ottenere', 'es': 'obtener'};
|
||||
Blockly.Words['on_source_of'] = {'en': 'of trigger', 'de': 'von Trigger', 'ru': 'триггера', 'pt': 'de gatilho', 'nl': 'van trigger', 'fr': 'de déclenchement', 'it': 'di innesco', 'es': 'de gatillo'};
|
||||
Blockly.Words['on_source_tooltip'] = {'en': 'Get information about event', 'de': 'Hole die Information über Ereignis', 'ru': 'Получить информацию о событии', 'pt': 'Obter informações sobre o evento', 'nl': 'Krijg informatie over het evenement', 'fr': 'Obtenir des informations sur l\'événement', 'it': 'Ottieni informazioni sull\'evento', 'es': 'Obtener información sobre el evento'};
|
||||
Blockly.Words['on_source_id'] = {'en': 'object ID', 'de': 'Objekt ID', 'ru': 'ID объекта', 'pt': 'ID do objeto', 'nl': 'object-ID', 'fr': 'ID d\'objet', 'it': 'ID oggetto', 'es': 'ID de objeto'};
|
||||
Blockly.Words['on_source_name'] = {'en': 'name', 'de': 'Name', 'ru': 'имя', 'pt': 'nome', 'nl': 'naam', 'fr': 'prénom', 'it': 'nome', 'es': 'nombre'};
|
||||
Blockly.Words['on_source_desc'] = {'en': 'description', 'de': 'Beschreibung', 'ru': 'описание', 'pt': 'descrição', 'nl': 'Beschrijving', 'fr': 'la description', 'it': 'descrizione', 'es': 'descripción'};
|
||||
Blockly.Words['on_source_channel_id'] = {'en': 'channel ID', 'de': 'Kanal ID', 'ru': 'ID канала', 'pt': 'ID do canal', 'nl': 'Kanaal Nr', 'fr': 'Identifiant de la chaine', 'it': 'Canale ID', 'es': 'Canal ID'};
|
||||
Blockly.Words['on_source_channel_name'] = {'en': 'channel name', 'de': 'Kanalname ID', 'ru': 'имя канала', 'pt': 'nome do canal', 'nl': 'kanaal naam', 'fr': 'nom du canal', 'it': 'nome del canale', 'es': 'Nombre del Canal'};
|
||||
Blockly.Words['on_source_device_id'] = {'en': 'device ID', 'de': 'Gerät ID', 'ru': 'ID устройства', 'pt': 'ID de dispositivo', 'nl': 'apparaat ID', 'fr': 'Reference de l\'appareil', 'it': 'ID del dispositivo', 'es': 'ID del dispositivo'};
|
||||
Blockly.Words['on_source_device_name'] = {'en': 'device name', 'de': 'Gerätename', 'ru': 'имя устройства', 'pt': 'nome do dispositivo', 'nl': 'toestelnaam', 'fr': 'nom de l\'appareil', 'it': 'nome del dispositivo', 'es': 'nombre del dispositivo'};
|
||||
Blockly.Words['on_source_state_val'] = {'en': 'state value', 'de': 'Wert', 'ru': 'значение', 'pt': 'valor do estado', 'nl': 'staatswaarde', 'fr': 'valeur d\'état', 'it': 'valore di stato', 'es': 'valor de estado'};
|
||||
Blockly.Words['on_source_state_ts'] = {'en': 'state timestamp', 'de': 'Zeitstempel', 'ru': 'время', 'pt': 'timestamp de estado', 'nl': 'staat tijdstempel', 'fr': 'horodatage de l\'état', 'it': 'timestamp di stato', 'es': 'marca de tiempo del estado'};
|
||||
Blockly.Words['on_source_state_q'] = {'en': 'state quality', 'de': 'Qualität', 'ru': 'качество', 'pt': 'qualidade do estado', 'nl': 'staat kwaliteit', 'fr': 'qualité de l\'état', 'it': 'qualità dello stato', 'es': 'calidad del estado'};
|
||||
Blockly.Words['on_source_state_from'] = {'en': 'origin of value', 'de': 'Ursprung', 'ru': 'происхождение', 'pt': 'origem do valor', 'nl': 'oorsprong van waarde', 'fr': 'origine de la valeur', 'it': 'origine del valore', 'es': 'origen del valor'};
|
||||
Blockly.Words['on_source_state_ack'] = {'en': 'is command or update', 'de': 'Befehl oder Aktualisierung', 'ru': 'команда или обновление', 'pt': 'é comando ou atualização', 'nl': 'is commando of update', 'fr': 'est la commande ou la mise à jour', 'it': 'è comando o aggiornamento', 'es': 'es comando o actualización'};
|
||||
Blockly.Words['on_source_state_lc'] = {'en': 'last change of state', 'de': 'letzte Änderung', 'ru': 'последнее изменение', 'pt': 'última mudança de estado', 'nl': 'laatste verandering van staat', 'fr': 'dernier changement d\'état', 'it': 'ultimo cambio di stato', 'es': 'último cambio de estado'};
|
||||
Blockly.Words['on_source_oldstate_val'] = {'en': 'previous value', 'de': 'vorheriger Wert', 'ru': 'предыдущее значение', 'pt': 'valor anterior', 'nl': 'vorige waarde', 'fr': 'valeur précédente', 'it': 'valore precedente', 'es': 'valor anterior'};
|
||||
Blockly.Words['on_source_oldstate_ts'] = {'en': 'previous timestamp', 'de': 'vorheriger Zeitstempel', 'ru': 'предыдущее время', 'pt': 'timestamp anterior', 'nl': 'vorige timestamp', 'fr': 'Horodatage précédent', 'it': 'timestamp precedente', 'es': 'fecha y hora anterior'};
|
||||
Blockly.Words['on_source_oldstate_q'] = {'en': 'previous quality', 'de': 'vorherige Quialität', 'ru': 'предыдущее качество', 'pt': 'qualidade anterior', 'nl': 'vorige kwaliteit', 'fr': 'qualité précédente', 'it': 'qualità precedente', 'es': 'calidad previa'};
|
||||
Blockly.Words['on_source_oldstate_from'] = {'en': 'previous origin', 'de': 'vorherige Ursprung', 'ru': 'предыдущее происхождение', 'pt': 'origem anterior', 'nl': 'vorige oorsprong', 'fr': 'origine précédente', 'it': 'origine precedente', 'es': 'origen anterior'};
|
||||
Blockly.Words['on_source_oldstate_ack'] = {'en': 'previous command or update', 'de': 'vorheriges Ack', 'ru': 'предыдущее команда или обновление', 'pt': 'comando ou atualização anterior', 'nl': 'vorige opdracht of update', 'fr': 'commande précédente ou mise à jour', 'it': 'comando precedente o aggiornamento', 'es': 'comando anterior o actualización'};
|
||||
Blockly.Words['on_source_oldstate_lc'] = {'en': 'previous last change', 'de': 'vorherige letzte Änderung', 'ru': 'предыдущее последнее изменение', 'pt': 'última mudança anterior', 'nl': 'vorige laatste wijziging', 'fr': 'précédent dernier changement', 'it': 'precedente ultima modifica', 'es': 'último cambio anterior'};
|
||||
Blockly.Words['on_source_warning'] = {'en': 'This block must be used only inside of event block', 'de': 'Dieser Block darf nur innerhalb "Falls Objekt" Block verwendet werden', 'ru': 'Этот блок можно использовать только внутри блока "Событие"', 'pt': 'Este bloco deve ser usado apenas dentro do bloco de eventos', 'nl': 'Dit blok mag alleen binnen het gebeurtenisblok worden gebruikt', 'fr': 'Ce bloc doit être utilisé uniquement à l\'intérieur du bloc d\'événements', 'it': 'Questo blocco deve essere utilizzato solo all\'interno del blocco eventi', 'es': 'Este bloque debe usarse solo dentro del bloque de evento'};
|
||||
|
||||
// --- trigger schedule --------------------------------------------------
|
||||
Blockly.Words['schedule'] = {'en': 'schedule', 'de': 'Zeitplan', 'ru': 'Cron расписание', 'pt': 'cronograma', 'nl': 'planning', 'fr': 'programme', 'it': 'programma', 'es': 'programar'};
|
||||
Blockly.Words['schedule_tooltip'] = {'en': 'Do something on cron schedule', 'de': 'Ausführen nach Zeitplan', 'ru': 'Выполнять по расписанию', 'pt': 'Faça algo no cron schedule', 'nl': 'Doe iets op cron-schema', 'fr': 'Faire quelque chose sur le calendrier cron', 'it': 'Fai qualcosa su cron schedule', 'es': 'Hacer algo en el cronograma cron'};
|
||||
Blockly.Words['schedule_help'] = {'en': 'schedule', 'de': 'schedule', 'ru': 'schedule', 'pt': 'cronograma', 'nl': 'planning', 'fr': 'programme', 'it': 'programma', 'es': 'programar'};
|
||||
|
||||
// --- trigger astro --------------------------------------------------
|
||||
Blockly.Words['astro'] = {'en': 'astro', 'de': 'Astro', 'ru': 'Астро', 'pt': 'astro', 'nl': 'astro', 'fr': 'astro', 'it': 'astro', 'es': 'astro'};
|
||||
Blockly.Words['astro_tooltip'] = {'en': 'Do something on astrological event', 'de': 'Ausführen nach Astro-Ereignis', 'ru': 'Выполнять по астро-событию', 'pt': 'Faça algo no evento astrológico', 'nl': 'Doe iets over astrologische gebeurtenissen', 'fr': 'Faire quelque chose sur l\'événement astrologique', 'it': 'Fai qualcosa sull\'evento astrologico', 'es': 'Haz algo en el evento astrológico'};
|
||||
Blockly.Words['astro_offset'] = {'en': ', offset', 'de': ', Versatz', 'ru': ', сдвиг', 'pt': ', offset', 'nl': ', offset', 'fr': ', décalage', 'it': ', compensare', 'es': ', compensar'};
|
||||
Blockly.Words['astro_minutes'] = {'en': 'minutes', 'de': 'Minuten', 'ru': 'минут', 'pt': 'minutos', 'nl': 'notulen', 'fr': 'minutes', 'it': 'minuti', 'es': 'minutos'};
|
||||
Blockly.Words['astro_sunriseText'] = {'en': 'sunrise', 'de': 'Sonnenaufgang', 'ru': 'восход солнца', 'pt': 'nascer do sol', 'nl': 'zonsopkomst', 'fr': 'lever du soleil', 'it': 'Alba', 'es': 'amanecer'};
|
||||
Blockly.Words['astro_sunriseEndText'] = {'en': 'sunrise end', 'de': 'Sonnenaufgang-Ende', 'ru': 'конец восхода', 'pt': 'fim do nascer do sol', 'nl': 'zonsopgang einde', 'fr': 'fin du lever du soleil', 'it': 'alba fine', 'es': 'salida del sol'};
|
||||
Blockly.Words['astro_goldenHourEndText'] = {'en': 'golden hour end', 'de': '"Golden hour"-Ende', 'ru': 'конец золотого часа', 'pt': 'hora da hora dourada', 'nl': 'gouden uureinde', 'fr': 'fin de l\'heure d\'or', 'it': 'ora d\'oro fine', 'es': 'hora dorada'};
|
||||
Blockly.Words['astro_solarNoonText'] = {'en': 'solar noon', 'de': 'Sonnenmittag', 'ru': 'солнечеый полдень', 'pt': 'meio-dia solar', 'nl': 'zonne middag', 'fr': 'midi solaire', 'it': 'mezzogiorno solare', 'es': 'mediodía solar'};
|
||||
Blockly.Words['astro_goldenHourText'] = {'en': 'golden hour', 'de': '"Golden hour"', 'ru': 'золотой час', 'pt': 'Hora dourada', 'nl': 'gouden uur', 'fr': 'heure d\'or', 'it': 'ora d\'oro', 'es': 'hora dorada'};
|
||||
Blockly.Words['astro_sunsetStartText'] = {'en': 'sunset start', 'de': 'Sonnenuntergang-Anfang', 'ru': 'начало захода солнца', 'pt': 'começo do por do sol', 'nl': 'zonsondergang start', 'fr': 'coucher de soleil début', 'it': 'inizio del tramonto', 'es': 'puesta de sol'};
|
||||
Blockly.Words['astro_sunsetText'] = {'en': 'sunset', 'de': 'Sonnenuntergang', 'ru': 'конец захода солнца', 'pt': 'por do sol', 'nl': 'zonsondergang', 'fr': 'le coucher du soleil', 'it': 'tramonto', 'es': 'puesta de sol'};
|
||||
Blockly.Words['astro_duskText'] = {'en': 'dusk', 'de': 'Abenddämmerung', 'ru': 'сумерки', 'pt': 'crepúsculo', 'nl': 'schemer', 'fr': 'crépuscule', 'it': 'crepuscolo', 'es': 'oscuridad'};
|
||||
Blockly.Words['astro_nauticalDuskText'] = {'en': 'nautical dusk', 'de': 'Nautische Abenddämmerung', 'ru': 'навигационные сумерки', 'pt': 'crepúsculo náutico', 'nl': 'nautische schemering', 'fr': 'crépuscule nautique', 'it': 'crepuscolo nautico', 'es': 'anochecer náutico'};
|
||||
Blockly.Words['astro_nightText'] = {'en': 'night', 'de': 'Nacht', 'ru': 'ночь', 'pt': 'noite', 'nl': 'nacht', 'fr': 'nuit', 'it': 'notte', 'es': 'noche'};
|
||||
Blockly.Words['astro_nightEndText'] = {'en': 'night end', 'de': 'Nachtsende', 'ru': 'конец ночи', 'pt': 'final da noite', 'nl': 'einde van de nacht', 'fr': 'fin de nuit', 'it': 'fine della notte', 'es': 'fin de noche'};
|
||||
Blockly.Words['astro_nauticalDawnText'] = {'en': 'nautical dawn', 'de': 'Nautische Morgendämmerung', 'ru': 'навигационный рассвет', 'pt': 'amanhecer náutico', 'nl': 'nautische dageraad', 'fr': 'aube nautique', 'it': 'alba nautica', 'es': 'amanecer náutico'};
|
||||
Blockly.Words['astro_dawnText'] = {'en': 'dawn', 'de': 'Morgendämmerung', 'ru': 'рассвет', 'pt': 'alvorecer', 'nl': 'dageraad', 'fr': 'Aube', 'it': 'alba', 'es': 'amanecer'};
|
||||
Blockly.Words['astro_nadirText'] = {'en': 'nadir', 'de': 'Nadir', 'ru': 'надир', 'pt': 'nadir', 'nl': 'nadir', 'fr': 'nadir', 'it': 'nadir', 'es': 'nadir'};
|
||||
Blockly.Words['astro_help'] = {'en': 'astro--function', 'de': 'astro--function', 'ru': 'astro--function', 'pt': 'astro--function', 'nl': 'astro--function', 'fr': 'astro--function', 'it': 'astro--function', 'es': 'astro--function'};
|
||||
|
||||
// --- trigger schedule --------------------------------------------------
|
||||
Blockly.Words['schedule_create'] = {'en': 'schedule', 'de': 'Zeitplan', 'ru': 'Расписание', 'pt': 'cronograma', 'nl': 'planning', 'fr': 'programme', 'it': 'programma', 'es': 'programar'};
|
||||
Blockly.Words['schedule_create_name'] = {'en': 'schedule', 'de': 'Zeitplan', 'ru': 'Расписание', 'pt': 'cronograma', 'nl': 'planning', 'fr': 'programme', 'it': 'programma', 'es': 'programar'};
|
||||
Blockly.Words['schedule_text'] = {'en': 'cron rule', 'de': 'CRON Regel', 'ru': 'cron правило', 'pt': 'regra cron', 'nl': 'cron-regel', 'fr': 'règle cron', 'it': 'regola cron', 'es': 'regla cron'};
|
||||
Blockly.Words['schedule_create_tooltip'] = {'en': 'Delay execution', 'de': 'Ausführung verzögern', 'ru': 'Сделать паузу', 'pt': 'Atrasar a execução', 'nl': 'Vertraag uitvoering', 'fr': 'Retarder l\'exécution', 'it': 'Ritardare l\'esecuzione', 'es': 'Demora de ejecución'};
|
||||
Blockly.Words['schedule_create_help'] = {'en': 'settimeout', 'de': 'settimeout', 'ru': 'settimeout', 'pt': 'settimeout', 'nl': 'setTimeout', 'fr': 'settimeout', 'it': 'setTimeout', 'es': 'settimeout'};
|
||||
Blockly.Words['schedule_clear'] = {'en': 'clear', 'de': 'stop', 'ru': 'остановить', 'pt': 'Claro', 'nl': 'duidelijk', 'fr': 'clair', 'it': 'chiaro', 'es': 'claro'};
|
||||
Blockly.Words['schedule_clear_tooltip'] = {'en': 'Clear delay execution', 'de': 'Ausführungsverzögerung anhalten', 'ru': 'Отменить выполнение с паузой', 'pt': 'Execução de atraso clara', 'nl': 'Duidelijke uitvoering van vertragingen', 'fr': 'Effacer l\'exécution du délai', 'it': 'Cancella l\'esecuzione del ritardo', 'es': 'Ejecución de retraso claro'};
|
||||
Blockly.Words['schedule_clear_help'] = {'en': 'cleartimeout', 'de': 'cleartimeout', 'ru': 'cleartimeout', 'pt': 'cleartimeout', 'nl': 'clearTimeout', 'fr': 'cleartimeout', 'it': 'clearTimeout', 'es': 'cleartimeout'};
|
||||
|
||||
// --- trigger field --------------------------------------------------
|
||||
Blockly.Words['field_cron'] = {'en': 'CRON', 'de': 'CRON', 'ru': 'CRON', 'pt': 'CRON', 'nl': 'CRON', 'fr': 'CRON', 'it': 'CRON', 'es': 'CRON'};
|
||||
Blockly.Words['field_cron_CRON'] = {'en': 'CRON', 'de': 'CRON', 'ru': 'CRON', 'pt': 'CRON', 'nl': 'CRON', 'fr': 'CRON', 'it': 'CRON', 'es': 'CRON'};
|
||||
Blockly.Words['field_cron_tooltip'] = {'en': 'Create CRON rule with dialog', 'de': 'Erzeuge CRON Regel mit Dialog', 'ru': 'Создать CRON правило с помощью диалога', 'pt': 'Criar regra CRON com diálogo', 'nl': 'Maak CRON-regel met dialoogvenster', 'fr': 'Créer une règle CRON avec dialogue', 'it': 'Crea una regola CRON con finestra di dialogo', 'es': 'Crear regla CRON con diálogo'};
|
||||
|
||||
// --- trigger cron --------------------------------------------------
|
||||
Blockly.Words['cron_builder'] = {'en': 'CRON', 'de': 'CRON', 'ru': 'CRON', 'pt': 'CRON', 'nl': 'CRON', 'fr': 'CRON', 'it': 'CRON', 'es': 'CRON'};
|
||||
Blockly.Words['cron_builder_CRON'] = {'en': 'CRON', 'de': 'CRON', 'ru': 'CRON', 'pt': 'CRON', 'nl': 'CRON', 'fr': 'CRON', 'it': 'CRON', 'es': 'CRON'};
|
||||
Blockly.Words['cron_builder_tooltip'] = {'en': 'Create CRON rule with dialog', 'de': 'Erzeuge CRON Regel mit Dialog', 'ru': 'Создать CRON правило с помощью диалога', 'pt': 'Criar regra CRON com diálogo', 'nl': 'Maak CRON-regel met dialoogvenster', 'fr': 'Créer une règle CRON avec dialogue', 'it': 'Crea una regola CRON con finestra di dialogo', 'es': 'Crear regla CRON con diálogo'};
|
||||
Blockly.Words['cron_builder_with_seconds'] = {'en': 'with seconds', 'de': 'mit Sekunden', 'ru': 'с секундами', 'pt': 'com segundos', 'nl': 'met seconden', 'fr': 'avec secondes', 'it': 'con secondi', 'es': 'con segundos'};
|
||||
Blockly.Words['cron_builder_dow'] = {'en': 'day of week', 'de': 'Wochentag', 'ru': 'день недели', 'pt': 'dia da semana', 'nl': 'dag van de week', 'fr': 'jour de la semaine', 'it': 'giorno della settimana', 'es': 'día de la semana'};
|
||||
Blockly.Words['cron_builder_month'] = {'en': 'month', 'de': 'Monat', 'ru': 'месяц', 'pt': 'mês', 'nl': 'maand', 'fr': 'mois', 'it': 'mese', 'es': 'mes'};
|
||||
Blockly.Words['cron_builder_day'] = {'en': 'date', 'de': 'Datum', 'ru': 'число', 'pt': 'encontro', 'nl': 'datum', 'fr': 'rendez-vous amoureux', 'it': 'Data', 'es': 'fecha'};
|
||||
Blockly.Words['cron_builder_hour'] = {'en': 'hour', 'de': 'Stunde', 'ru': 'час', 'pt': 'hora', 'nl': 'uur', 'fr': 'heure', 'it': 'ora', 'es': 'hora'};
|
||||
Blockly.Words['cron_builder_minutes'] = {'en': 'minutes', 'de': 'Minuten', 'ru': 'минуты', 'pt': 'minutos', 'nl': 'notulen', 'fr': 'minutes', 'it': 'minuti', 'es': 'minutos'};
|
||||
Blockly.Words['cron_builder_seconds'] = {'en': 'seconds', 'de': 'Sekunden', 'ru': 'секунды', 'pt': 'segundos', 'nl': 'seconden', 'fr': 'secondes', 'it': 'secondi', 'es': 'segundos'};
|
||||
Blockly.Words['cron_builder_line'] = {'en': 'as line', 'de': 'Als Linie', 'ru': 'в линию', 'pt': 'como linha', 'nl': 'als lijn', 'fr': 'en ligne', 'it': 'come linea', 'es': 'como línea'};
|
||||
204
admin/google-blockly/own/field_cron.js
Normal file
204
admin/google-blockly/own/field_cron.js
Normal file
@@ -0,0 +1,204 @@
|
||||
/**
|
||||
* @license
|
||||
* Visual Blocks Editor
|
||||
*
|
||||
* Copyright 2012 Google Inc.
|
||||
* https://developers.google.com/blockly/
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Text input field.
|
||||
* @author fraser@google.com (Neil Fraser)
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
goog.provide('Blockly.FieldCRON');
|
||||
|
||||
goog.require('Blockly.Field');
|
||||
goog.require('Blockly.Msg');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.userAgent');
|
||||
|
||||
|
||||
/**
|
||||
* Class for an editable text field.
|
||||
* @param {string} text The initial content of the field.
|
||||
* @param {Function=} opt_validator An optional function that is called
|
||||
* to validate any constraints on what the user entered. Takes the new
|
||||
* text as an argument and returns either the accepted text, a replacement
|
||||
* text, or null to abort the change.
|
||||
* @extends {Blockly.Field}
|
||||
* @constructor
|
||||
*/
|
||||
Blockly.FieldCRON = function(text) {
|
||||
Blockly.FieldCRON.superClass_.constructor.call(this, text);
|
||||
};
|
||||
goog.inherits(Blockly.FieldCRON, Blockly.Field);
|
||||
|
||||
/**
|
||||
* Point size of text. Should match blocklyText's font-size in CSS.
|
||||
*/
|
||||
Blockly.FieldCRON.FONTSIZE = 11;
|
||||
|
||||
/**
|
||||
* Mouse cursor style when over the hotspot that initiates the editor.
|
||||
*/
|
||||
Blockly.FieldCRON.prototype.CURSOR = 'pointer';
|
||||
|
||||
/**
|
||||
* Allow browser to spellcheck this field.
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldCRON.prototype.spellcheck_ = false;
|
||||
|
||||
/**
|
||||
* Close the input widget if this input is being deleted.
|
||||
*/
|
||||
Blockly.FieldCRON.prototype.dispose = function() {
|
||||
Blockly.WidgetDiv.hideIfOwner(this);
|
||||
Blockly.FieldCRON.superClass_.dispose.call(this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the text in this field.
|
||||
* @param {?string} text New text.
|
||||
* @override
|
||||
*/
|
||||
Blockly.FieldCRON.prototype.setValue = function(text) {
|
||||
if (text === null) {
|
||||
return; // No change if null.
|
||||
}
|
||||
|
||||
Blockly.Field.prototype.setValue.call(this, text);
|
||||
};
|
||||
|
||||
/**
|
||||
* Show the inline free-text editor on top of the text.
|
||||
* @param {boolean=} opt_quietInput True if editor should be created without
|
||||
* focus. Defaults to false.
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldCRON.prototype.showEditor_ = function(opt_quietInput) {
|
||||
this.workspace_ = this.sourceBlock_.workspace;
|
||||
var that = this;
|
||||
scripts.showCronDialog(that.getValue(), function (newId) {
|
||||
if (newId !== undefined && newId !== null) that.setValue(newId);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle a change to the editor.
|
||||
* @param {!Event} e Keyboard event.
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldCRON.prototype.onHtmlInputChange_ = function(e) {
|
||||
var htmlInput = Blockly.FieldCRON.htmlInput_;
|
||||
// Update source block.
|
||||
var text = htmlInput.value;
|
||||
if (text !== htmlInput.oldValue_) {
|
||||
htmlInput.oldValue_ = text;
|
||||
this.setValue(text);
|
||||
this.validate_();
|
||||
} else if (goog.userAgent.WEBKIT) {
|
||||
// Cursor key. Render the source block to show the caret moving.
|
||||
// Chrome only (version 26, OS X).
|
||||
this.sourceBlock_.render();
|
||||
}
|
||||
this.resizeEditor_();
|
||||
Blockly.svgResize(this.sourceBlock_.workspace);
|
||||
};
|
||||
|
||||
/**
|
||||
* Check to see if the contents of the editor validates.
|
||||
* Style the editor accordingly.
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldCRON.prototype.validate_ = function() {
|
||||
var valid = true;
|
||||
|
||||
goog.asserts.assertObject(Blockly.FieldCRON.htmlInput_);
|
||||
|
||||
var htmlInput = Blockly.FieldCRON.htmlInput_;
|
||||
|
||||
if (htmlInput.value) {
|
||||
Blockly.addClass_(htmlInput, 'blocklyInvalidInput');
|
||||
} else {
|
||||
Blockly.removeClass_(htmlInput, 'blocklyInvalidInput');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Resize the editor and the underlying block to fit the text.
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldCRON.prototype.resizeEditor_ = function() {
|
||||
var div = Blockly.WidgetDiv.DIV;
|
||||
var bBox = this.fieldGroup_.getBBox();
|
||||
div.style.width = bBox.width * this.workspace_.scale + 'px';
|
||||
div.style.height = bBox.height * this.workspace_.scale + 'px';
|
||||
var xy = this.getAbsoluteXY_();
|
||||
// In RTL mode block fields and LTR input fields the left edge moves,
|
||||
// whereas the right edge is fixed. Reposition the editor.
|
||||
if (this.sourceBlock_.RTL) {
|
||||
var borderBBox = this.getScaledBBox_();
|
||||
xy.x += borderBBox.width;
|
||||
xy.x -= div.offsetWidth;
|
||||
}
|
||||
// Shift by a few pixels to line up exactly.
|
||||
xy.y += 1;
|
||||
if (goog.userAgent.GECKO && Blockly.WidgetDiv.DIV.style.top) {
|
||||
// Firefox mis-reports the location of the border by a pixel
|
||||
// once the WidgetDiv is moved into position.
|
||||
xy.x -= 1;
|
||||
xy.y -= 1;
|
||||
}
|
||||
if (goog.userAgent.WEBKIT) {
|
||||
xy.y -= 3;
|
||||
}
|
||||
div.style.left = xy.x + 'px';
|
||||
div.style.top = xy.y + 'px';
|
||||
};
|
||||
|
||||
/**
|
||||
* Close the editor, save the results, and dispose of the editable
|
||||
* text field's elements.
|
||||
* @return {!Function} Closure to call on destruction of the WidgetDiv.
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldCRON.prototype.widgetDispose_ = function() {
|
||||
var thisField = this;
|
||||
return function() {
|
||||
var htmlInput = Blockly.FieldCRON.htmlInput_;
|
||||
// Save the edit (if it validates).
|
||||
var text = htmlInput.value;
|
||||
thisField.setValue(text);
|
||||
thisField.sourceBlock_.rendered && thisField.sourceBlock_.render();
|
||||
Blockly.unbindEvent_(htmlInput.onKeyDownWrapper_);
|
||||
Blockly.unbindEvent_(htmlInput.onKeyUpWrapper_);
|
||||
Blockly.unbindEvent_(htmlInput.onKeyPressWrapper_);
|
||||
|
||||
thisField.workspace_.removeChangeListener(
|
||||
htmlInput.onWorkspaceChangeWrapper_);
|
||||
|
||||
Blockly.FieldCRON.htmlInput_ = null;
|
||||
|
||||
// Delete style properties.
|
||||
var style = Blockly.WidgetDiv.DIV.style;
|
||||
style.width = 'auto';
|
||||
style.height = 'auto';
|
||||
style.fontSize = '';
|
||||
};
|
||||
};
|
||||
259
admin/google-blockly/own/field_oid.js
Normal file
259
admin/google-blockly/own/field_oid.js
Normal file
@@ -0,0 +1,259 @@
|
||||
/**
|
||||
* @license
|
||||
* Visual Blocks Editor
|
||||
*
|
||||
* Copyright 2012 Google Inc.
|
||||
* https://developers.google.com/blockly/
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Text input field.
|
||||
* @author fraser@google.com (Neil Fraser)
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
goog.provide('Blockly.FieldOID');
|
||||
|
||||
goog.require('Blockly.Field');
|
||||
goog.require('Blockly.Msg');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.userAgent');
|
||||
|
||||
|
||||
/**
|
||||
* Class for an editable text field.
|
||||
* @param {string} text The initial content of the field.
|
||||
* @param {Function=} opt_validator An optional function that is called
|
||||
* to validate any constraints on what the user entered. Takes the new
|
||||
* text as an argument and returns either the accepted text, a replacement
|
||||
* text, or null to abort the change.
|
||||
* @extends {Blockly.Field}
|
||||
* @constructor
|
||||
*/
|
||||
Blockly.FieldOID = function(text, oid_dialog, objects) {
|
||||
Blockly.FieldOID.superClass_.constructor.call(this, text, oid_dialog);
|
||||
this.oid_dialog = oid_dialog;
|
||||
this.objects = objects;
|
||||
};
|
||||
goog.inherits(Blockly.FieldOID, Blockly.Field);
|
||||
|
||||
/**
|
||||
* Point size of text. Should match blocklyText's font-size in CSS.
|
||||
*/
|
||||
Blockly.FieldOID.FONTSIZE = 11;
|
||||
|
||||
/**
|
||||
* Mouse cursor style when over the hotspot that initiates the editor.
|
||||
*/
|
||||
Blockly.FieldOID.prototype.CURSOR = 'pointer';
|
||||
|
||||
/**
|
||||
* Allow browser to spellcheck this field.
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldOID.prototype.spellcheck_ = false;
|
||||
|
||||
/**
|
||||
* Close the input widget if this input is being deleted.
|
||||
*/
|
||||
Blockly.FieldOID.prototype.dispose = function() {
|
||||
Blockly.WidgetDiv.hideIfOwner(this);
|
||||
Blockly.FieldOID.superClass_.dispose.call(this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the text in this field.
|
||||
* @param {?string} text New text.
|
||||
* @override
|
||||
*/
|
||||
Blockly.FieldOID.prototype.setValue = function(text) {
|
||||
if (text === null) {
|
||||
return; // No change if null.
|
||||
}
|
||||
|
||||
Blockly.Field.prototype.setValue.call(this, text);
|
||||
};
|
||||
|
||||
/**
|
||||
* Show the inline free-text editor on top of the text.
|
||||
* @param {boolean=} opt_quietInput True if editor should be created without
|
||||
* focus. Defaults to false.
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldOID.prototype.showEditor_ = function(opt_quietInput) {
|
||||
this.workspace_ = this.sourceBlock_.workspace;
|
||||
var that = this;
|
||||
this.oid_dialog.selectId('show', that.getValue(), function (newId) {
|
||||
that.setValue(newId);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle key down to the editor.
|
||||
* @param {!Event} e Keyboard event.
|
||||
* @private
|
||||
*/
|
||||
/*Blockly.FieldOID.prototype.onHtmlInputKeyDown_ = function(e) {
|
||||
var htmlInput = Blockly.FieldOID.htmlInput_;
|
||||
var tabKey = 9, enterKey = 13, escKey = 27;
|
||||
if (e.keyCode == enterKey) {
|
||||
Blockly.WidgetDiv.hide();
|
||||
} else if (e.keyCode == escKey) {
|
||||
htmlInput.value = htmlInput.defaultValue;
|
||||
Blockly.WidgetDiv.hide();
|
||||
} else if (e.keyCode == tabKey) {
|
||||
Blockly.WidgetDiv.hide();
|
||||
this.sourceBlock_.tab(this, !e.shiftKey);
|
||||
e.preventDefault();
|
||||
}
|
||||
};*/
|
||||
|
||||
/**
|
||||
* Handle a change to the editor.
|
||||
* @param {!Event} e Keyboard event.
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldOID.prototype.onHtmlInputChange_ = function(e) {
|
||||
var htmlInput = Blockly.FieldOID.htmlInput_;
|
||||
// Update source block.
|
||||
var text = htmlInput.value;
|
||||
if (text !== htmlInput.oldValue_) {
|
||||
htmlInput.oldValue_ = text;
|
||||
this.setValue(text);
|
||||
this.validate_();
|
||||
} else if (goog.userAgent.WEBKIT) {
|
||||
// Cursor key. Render the source block to show the caret moving.
|
||||
// Chrome only (version 26, OS X).
|
||||
this.sourceBlock_.render();
|
||||
}
|
||||
this.resizeEditor_();
|
||||
Blockly.svgResize(this.sourceBlock_.workspace);
|
||||
};
|
||||
|
||||
/**
|
||||
* Update the text node of this field to display the current text.
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldOID.prototype.updateTextNode_ = function() {
|
||||
if (!this.textElement_) {
|
||||
// Not rendered yet.
|
||||
return;
|
||||
}
|
||||
var text = this.objects && this.objects[this.text_] && this.objects[this.text_].common && this.objects[this.text_].common.name ? this.objects[this.text_].common.name : this.text_;
|
||||
if (text.length > this.maxDisplayLength) {
|
||||
// Truncate displayed string and add an ellipsis ('...').
|
||||
text = text.substring(0, this.maxDisplayLength - 2) + '\u2026';
|
||||
}
|
||||
// Empty the text element.
|
||||
goog.dom.removeChildren(/** @type {!Element} */ (this.textElement_));
|
||||
// Replace whitespace with non-breaking spaces so the text doesn't collapse.
|
||||
text = text.replace(/\s/g, Blockly.Field.NBSP);
|
||||
if (this.sourceBlock_.RTL && text) {
|
||||
// The SVG is LTR, force text to be RTL.
|
||||
text += '\u200F';
|
||||
}
|
||||
if (!text) {
|
||||
// Prevent the field from disappearing if empty.
|
||||
text = Blockly.Field.NBSP;
|
||||
}
|
||||
var textNode = document.createTextNode(text);
|
||||
this.textElement_.appendChild(textNode);
|
||||
|
||||
// Cached width is obsolete. Clear it.
|
||||
this.size_.width = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check to see if the contents of the editor validates.
|
||||
* Style the editor accordingly.
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldOID.prototype.validate_ = function() {
|
||||
var valid = true;
|
||||
|
||||
goog.asserts.assertObject(Blockly.FieldOID.htmlInput_);
|
||||
|
||||
var htmlInput = Blockly.FieldOID.htmlInput_;
|
||||
|
||||
if (htmlInput.value) {
|
||||
Blockly.addClass_(htmlInput, 'blocklyInvalidInput');
|
||||
} else {
|
||||
Blockly.removeClass_(htmlInput, 'blocklyInvalidInput');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Resize the editor and the underlying block to fit the text.
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldOID.prototype.resizeEditor_ = function() {
|
||||
var div = Blockly.WidgetDiv.DIV;
|
||||
var bBox = this.fieldGroup_.getBBox();
|
||||
div.style.width = bBox.width * this.workspace_.scale + 'px';
|
||||
div.style.height = bBox.height * this.workspace_.scale + 'px';
|
||||
var xy = this.getAbsoluteXY_();
|
||||
// In RTL mode block fields and LTR input fields the left edge moves,
|
||||
// whereas the right edge is fixed. Reposition the editor.
|
||||
if (this.sourceBlock_.RTL) {
|
||||
var borderBBox = this.getScaledBBox_();
|
||||
xy.x += borderBBox.width;
|
||||
xy.x -= div.offsetWidth;
|
||||
}
|
||||
// Shift by a few pixels to line up exactly.
|
||||
xy.y += 1;
|
||||
if (goog.userAgent.GECKO && Blockly.WidgetDiv.DIV.style.top) {
|
||||
// Firefox mis-reports the location of the border by a pixel
|
||||
// once the WidgetDiv is moved into position.
|
||||
xy.x -= 1;
|
||||
xy.y -= 1;
|
||||
}
|
||||
if (goog.userAgent.WEBKIT) {
|
||||
xy.y -= 3;
|
||||
}
|
||||
div.style.left = xy.x + 'px';
|
||||
div.style.top = xy.y + 'px';
|
||||
};
|
||||
|
||||
/**
|
||||
* Close the editor, save the results, and dispose of the editable
|
||||
* text field's elements.
|
||||
* @return {!Function} Closure to call on destruction of the WidgetDiv.
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldOID.prototype.widgetDispose_ = function() {
|
||||
var thisField = this;
|
||||
return function() {
|
||||
var htmlInput = Blockly.FieldOID.htmlInput_;
|
||||
// Save the edit (if it validates).
|
||||
var text = htmlInput.value;
|
||||
thisField.setValue(text);
|
||||
thisField.sourceBlock_.rendered && thisField.sourceBlock_.render();
|
||||
Blockly.unbindEvent_(htmlInput.onKeyDownWrapper_);
|
||||
Blockly.unbindEvent_(htmlInput.onKeyUpWrapper_);
|
||||
Blockly.unbindEvent_(htmlInput.onKeyPressWrapper_);
|
||||
|
||||
thisField.workspace_.removeChangeListener(
|
||||
htmlInput.onWorkspaceChangeWrapper_);
|
||||
|
||||
Blockly.FieldOID.htmlInput_ = null;
|
||||
|
||||
// Delete style properties.
|
||||
var style = Blockly.WidgetDiv.DIV.style;
|
||||
style.width = 'auto';
|
||||
style.height = 'auto';
|
||||
style.fontSize = '';
|
||||
};
|
||||
};
|
||||
179
admin/google-blockly/own/field_script.js
Normal file
179
admin/google-blockly/own/field_script.js
Normal file
@@ -0,0 +1,179 @@
|
||||
/**
|
||||
* @license
|
||||
* Visual Blocks Editor
|
||||
*
|
||||
* Copyright 2012 Google Inc.
|
||||
* https://developers.google.com/blockly/
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Text input field.
|
||||
* @author fraser@google.com (Neil Fraser)
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
goog.provide('Blockly.FieldScript');
|
||||
|
||||
goog.require('Blockly.Field');
|
||||
goog.require('Blockly.Msg');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.userAgent');
|
||||
|
||||
|
||||
/**
|
||||
* Class for an editable text field.
|
||||
* @param {string} text The initial content of the field.
|
||||
* @param {Function=} opt_validator An optional function that is called
|
||||
* to validate any constraints on what the user entered. Takes the new
|
||||
* text as an argument and returns either the accepted text, a replacement
|
||||
* text, or null to abort the change.
|
||||
* @extends {Blockly.Field}
|
||||
* @constructor
|
||||
*/
|
||||
Blockly.FieldScript = function(text) {
|
||||
Blockly.FieldScript.superClass_.constructor.call(this, text);
|
||||
};
|
||||
goog.inherits(Blockly.FieldScript, Blockly.Field);
|
||||
|
||||
/**
|
||||
* Point size of text. Should match blocklyText's font-size in CSS.
|
||||
*/
|
||||
Blockly.FieldScript.FONTSIZE = 11;
|
||||
|
||||
/**
|
||||
* Mouse cursor style when over the hotspot that initiates the editor.
|
||||
*/
|
||||
Blockly.FieldScript.prototype.CURSOR = 'pointer';
|
||||
|
||||
/**
|
||||
* Allow browser to spellcheck this field.
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldScript.prototype.spellcheck_ = false;
|
||||
|
||||
/**
|
||||
* Close the input widget if this input is being deleted.
|
||||
*/
|
||||
Blockly.FieldScript.prototype.dispose = function() {
|
||||
Blockly.WidgetDiv.hideIfOwner(this);
|
||||
Blockly.FieldScript.superClass_.dispose.call(this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the text in this field.
|
||||
* @param {?string} text New text.
|
||||
* @override
|
||||
*/
|
||||
Blockly.FieldScript.prototype.setValue = function (text) {
|
||||
if (text === null) {
|
||||
return; // No change if null.
|
||||
}
|
||||
|
||||
Blockly.Field.prototype.setValue.call(this, text);
|
||||
};
|
||||
|
||||
/**
|
||||
* Show the inline free-text editor on top of the text.
|
||||
* @param {boolean=} opt_quietInput True if editor should be created without
|
||||
* focus. Defaults to false.
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldScript.prototype.showEditor_ = function(opt_quietInput) {
|
||||
this.workspace_ = this.sourceBlock_.workspace;
|
||||
var that = this;
|
||||
var base64 = that.getValue();
|
||||
var args = null;
|
||||
var isReturn = false;
|
||||
if (this.sourceBlock_ && this.sourceBlock_.arguments_) {
|
||||
args = this.sourceBlock_.arguments_;
|
||||
}
|
||||
if (this.sourceBlock_.getProcedureDef) {
|
||||
var options = this.sourceBlock_.getProcedureDef();
|
||||
isReturn = options[2];
|
||||
}
|
||||
|
||||
scripts.showScriptDialog(atob(base64 || ''), args, isReturn, function (newScript) {
|
||||
if (newScript !== undefined && newScript !== null) that.setValue(btoa(newScript));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Draws the border with the correct width.
|
||||
* Saves the computed width in a property.
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldScript.prototype.render_ = function() {
|
||||
var width = 10;
|
||||
if (this.visible_) {
|
||||
if (this.borderRect_) {
|
||||
this.borderRect_.setAttribute('width', width + Blockly.BlockSvg.SEP_SPACE_X);
|
||||
}
|
||||
} else {
|
||||
width = 0;
|
||||
}
|
||||
this.size_.width = width;
|
||||
};
|
||||
|
||||
/**
|
||||
* Update the text node of this field to display the current text.
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldScript.prototype.updateTextNode_ = function() {
|
||||
if (!this.textElement_) {
|
||||
// Not rendered yet.
|
||||
return;
|
||||
}
|
||||
// Empty the text element.
|
||||
goog.dom.removeChildren(/** @type {!Element} */ (this.textElement_));
|
||||
|
||||
var textNode = document.createTextNode('...');
|
||||
this.textElement_.appendChild(textNode);
|
||||
|
||||
// Cached width is obsolete. Clear it.
|
||||
this.size_.width = 10;
|
||||
};
|
||||
|
||||
/**
|
||||
* Close the editor, save the results, and dispose of the editable
|
||||
* text field's elements.
|
||||
* @return {!Function} Closure to call on destruction of the WidgetDiv.
|
||||
* @private
|
||||
*/
|
||||
/*Blockly.FieldScript.prototype.widgetDispose_ = function() {
|
||||
var thisField = this;
|
||||
return function() {
|
||||
var htmlInput = Blockly.FieldScript.htmlInput_;
|
||||
|
||||
// Save the edit (if it validates).
|
||||
var text = htmlInput.value;
|
||||
thisField.setValue(text);
|
||||
thisField.sourceBlock_.rendered && thisField.sourceBlock_.render();
|
||||
Blockly.unbindEvent_(htmlInput.onKeyDownWrapper_);
|
||||
Blockly.unbindEvent_(htmlInput.onKeyUpWrapper_);
|
||||
Blockly.unbindEvent_(htmlInput.onKeyPressWrapper_);
|
||||
|
||||
thisField.workspace_.removeChangeListener(
|
||||
htmlInput.onWorkspaceChangeWrapper_);
|
||||
|
||||
Blockly.FieldScript.htmlInput_ = null;
|
||||
|
||||
// Delete style properties.
|
||||
var style = Blockly.WidgetDiv.DIV.style;
|
||||
style.width = 'auto';
|
||||
style.height = 'auto';
|
||||
style.fontSize = '';
|
||||
};
|
||||
};*/
|
||||
24
admin/google-blockly/own/msg/de.js
Normal file
24
admin/google-blockly/own/msg/de.js
Normal file
@@ -0,0 +1,24 @@
|
||||
var MSG = {
|
||||
title: "Code",
|
||||
blocks: "Bausteine",
|
||||
linkTooltip: "Speichern und auf Bausteine verlinken.",
|
||||
runTooltip: "Das Programm ausführen, das von den Bausteinen im Arbeitsbereich definiert ist.",
|
||||
badCode: "Programmfehler:\n%1",
|
||||
timeout: "Die maximalen Ausführungswiederholungen wurden überschritten.",
|
||||
trashTooltip: "Alle Bausteine verwerfen.",
|
||||
catLogic: "Logik",
|
||||
catLoops: "Schleifen",
|
||||
catMath: "Mathematik",
|
||||
catText: "Text",
|
||||
catLists: "Listen",
|
||||
catColour: "Farbe",
|
||||
catVariables: "Variablen",
|
||||
catFunctions: "Funktionen",
|
||||
listVariable: "Liste",
|
||||
textVariable: "Text",
|
||||
httpRequestError: "Mit der Anfrage gab es ein Problem.",
|
||||
linkAlert: "Teile deine Bausteine mit diesem Link:\n\n%1",
|
||||
hashError: "„%1“ stimmt leider mit keinem gespeicherten Programm überein.",
|
||||
xmlError: "Deine gespeicherte Datei konnte nicht geladen werden. Vielleicht wurde sie mit einer anderen Version von Blockly erstellt.",
|
||||
badXml: "Fehler beim Parsen von XML:\n%1\n\nWähle 'OK' zum Verwerfen deiner Änderungen oder 'Abbrechen' zum weiteren Bearbeiten des XML."
|
||||
};
|
||||
24
admin/google-blockly/own/msg/en.js
Normal file
24
admin/google-blockly/own/msg/en.js
Normal file
@@ -0,0 +1,24 @@
|
||||
var MSG = {
|
||||
title: "Code",
|
||||
blocks: "Blocks",
|
||||
linkTooltip: "Save and link to blocks.",
|
||||
runTooltip: "Run the program defined by the blocks in the workspace.",
|
||||
badCode: "Program error:\n%1",
|
||||
timeout: "Maximum execution iterations exceeded.",
|
||||
trashTooltip: "Discard all blocks.",
|
||||
catLogic: "Logic",
|
||||
catLoops: "Loops",
|
||||
catMath: "Math",
|
||||
catText: "Text",
|
||||
catLists: "Lists",
|
||||
catColour: "Colour",
|
||||
catVariables: "Variables",
|
||||
catFunctions: "Functions",
|
||||
listVariable: "list",
|
||||
textVariable: "text",
|
||||
httpRequestError: "There was a problem with the request.",
|
||||
linkAlert: "Share your blocks with this link:\n\n%1",
|
||||
hashError: "Sorry, '%1' doesn't correspond with any saved program.",
|
||||
xmlError: "Could not load your saved file. Perhaps it was created with a different version of Blockly?",
|
||||
badXml: "Error parsing XML:\n%1\n\nSelect 'OK' to abandon your changes or 'Cancel' to further edit the XML."
|
||||
};
|
||||
24
admin/google-blockly/own/msg/es.js
Normal file
24
admin/google-blockly/own/msg/es.js
Normal file
@@ -0,0 +1,24 @@
|
||||
var MSG = {
|
||||
title: "Código",
|
||||
blocks: "Bloques",
|
||||
linkTooltip: "Guarda conexión a los bloques.",
|
||||
runTooltip: "Ejecute el programa definido por los bloques en el área de trabajo.",
|
||||
badCode: "Error del programa:\n%1",
|
||||
timeout: "Se excedio el máximo de iteraciones ejecutadas permitidas.",
|
||||
trashTooltip: "Descartar todos los bloques.",
|
||||
catLogic: "Lógica",
|
||||
catLoops: "Secuencias",
|
||||
catMath: "Matemáticas",
|
||||
catText: "Texto",
|
||||
catLists: "Listas",
|
||||
catColour: "Color",
|
||||
catVariables: "Variables",
|
||||
catFunctions: "Funciones",
|
||||
listVariable: "lista",
|
||||
textVariable: "texto",
|
||||
httpRequestError: "Hubo un problema con la petición.",
|
||||
linkAlert: "Comparte tus bloques con este enlace:\n\n%1",
|
||||
hashError: "«%1» no corresponde con ningún programa guardado.",
|
||||
xmlError: "No se pudo cargar el archivo guardado. ¿Quizá fue creado con otra versión de Blockly?",
|
||||
badXml: "Error de análisis XML:\n%1\n\nSelecciona OK para abandonar tus cambios o Cancelar para seguir editando el XML."
|
||||
};
|
||||
24
admin/google-blockly/own/msg/fr.js
Normal file
24
admin/google-blockly/own/msg/fr.js
Normal file
@@ -0,0 +1,24 @@
|
||||
var MSG = {
|
||||
title: "Code",
|
||||
blocks: "Blocs",
|
||||
linkTooltip: "Sauvegarder et lier aux blocs.",
|
||||
runTooltip: "Lancer le programme défini par les blocs dans l’espace de travail.",
|
||||
badCode: "Erreur du programme :\n%1",
|
||||
timeout: "Nombre maximum d’itérations d’exécution dépassé.",
|
||||
trashTooltip: "Jeter tous les blocs.",
|
||||
catLogic: "Logique",
|
||||
catLoops: "Boucles",
|
||||
catMath: "Math",
|
||||
catText: "Texte",
|
||||
catLists: "Listes",
|
||||
catColour: "Couleur",
|
||||
catVariables: "Variables",
|
||||
catFunctions: "Fonctions",
|
||||
listVariable: "liste",
|
||||
textVariable: "texte",
|
||||
httpRequestError: "Il y a eu un problème avec la demande.",
|
||||
linkAlert: "Partagez vos blocs grâce à ce lien:\n\n%1",
|
||||
hashError: "Désolé, '%1' ne correspond à aucun programme sauvegardé.",
|
||||
xmlError: "Impossible de charger le fichier de sauvegarde. Peut être a t-il été créé avec une autre version de Blockly?",
|
||||
badXml: "Erreur d’analyse du XML :\n%1\n\nSélectionner 'OK' pour abandonner vos modifications ou 'Annuler' pour continuer à modifier le XML."
|
||||
};
|
||||
24
admin/google-blockly/own/msg/it.js
Normal file
24
admin/google-blockly/own/msg/it.js
Normal file
@@ -0,0 +1,24 @@
|
||||
var MSG = {
|
||||
title: "Codice",
|
||||
blocks: "Blocchi",
|
||||
linkTooltip: "Salva e collega ai blocchi.",
|
||||
runTooltip: "Esegui il programma definito dai blocchi nell'area di lavoro.",
|
||||
badCode: "Errore programma:\n%1",
|
||||
timeout: "È stato superato il numero massimo consentito di interazioni eseguite.",
|
||||
trashTooltip: "Elimina tutti i blocchi.",
|
||||
catLogic: "Logica",
|
||||
catLoops: "Cicli",
|
||||
catMath: "Matematica",
|
||||
catText: "Testo",
|
||||
catLists: "Elenchi",
|
||||
catColour: "Colore",
|
||||
catVariables: "Variabili",
|
||||
catFunctions: "Funzioni",
|
||||
listVariable: "elenco",
|
||||
textVariable: "testo",
|
||||
httpRequestError: "La richiesta non è stata soddisfatta.",
|
||||
linkAlert: "Condividi i tuoi blocchi con questo collegamento:\n\n%1",
|
||||
hashError: "Mi spiace, '%1' non corrisponde ad alcun programma salvato.",
|
||||
xmlError: "Non è stato possibile caricare il documento. Forse è stato creato con una versione diversa di Blockly?",
|
||||
badXml: "Errore durante l'analisi XML:\n%1\n\nSeleziona 'OK' per abbandonare le modifiche o 'Annulla' per continuare a modificare l'XML."
|
||||
};
|
||||
24
admin/google-blockly/own/msg/nl.js
Normal file
24
admin/google-blockly/own/msg/nl.js
Normal file
@@ -0,0 +1,24 @@
|
||||
var MSG = {
|
||||
title: "Code",
|
||||
blocks: "Blokken",
|
||||
linkTooltip: "Opslaan en koppelen naar blokken.",
|
||||
runTooltip: "Voer het programma uit dat met de blokken in de werkruimte is gemaakt.",
|
||||
badCode: "Programmafout:\n%1",
|
||||
timeout: "Het maximale aantal iteraties is overschreden.",
|
||||
trashTooltip: "Alle blokken verwijderen",
|
||||
catLogic: "Logica",
|
||||
catLoops: "Lussen",
|
||||
catMath: "Formules",
|
||||
catText: "Tekst",
|
||||
catLists: "Lijsten",
|
||||
catColour: "Kleur",
|
||||
catVariables: "Variabelen",
|
||||
catFunctions: "Functies",
|
||||
listVariable: "lijst",
|
||||
textVariable: "tekst",
|
||||
httpRequestError: "Er is een probleem opgetreden tijdens het verwerken van het verzoek.",
|
||||
linkAlert: "Deel uw blokken via deze koppeling:\n\n%1",
|
||||
hashError: "\"%1\" komt helaas niet overeen met een opgeslagen bestand.",
|
||||
xmlError: "Uw opgeslagen bestand kan niet geladen worden. Is het misschien gemaakt met een andere versie van Blockly?",
|
||||
badXml: "Fout tijdens het verwerken van de XML:\n%1\n\nSelecteer \"OK\" om uw wijzigingen te negeren of \"Annuleren\" om de XML verder te bewerken."
|
||||
};
|
||||
24
admin/google-blockly/own/msg/pt.js
Normal file
24
admin/google-blockly/own/msg/pt.js
Normal file
@@ -0,0 +1,24 @@
|
||||
var MSG = {
|
||||
title: "Código",
|
||||
blocks: "Blocos",
|
||||
linkTooltip: "Salvar e ligar aos blocos.",
|
||||
runTooltip: "Execute o programa definido pelos blocos na área de trabalho.",
|
||||
badCode: "Erro no programa:\n%1",
|
||||
timeout: "Máximo de iterações de execução excedido.",
|
||||
trashTooltip: "Descartar todos os blocos.",
|
||||
catLogic: "Lógica",
|
||||
catLoops: "Laços",
|
||||
catMath: "Matemática",
|
||||
catText: "Texto",
|
||||
catLists: "Listas",
|
||||
catColour: "Cor",
|
||||
catVariables: "Variáveis",
|
||||
catFunctions: "Funções",
|
||||
listVariable: "lista",
|
||||
textVariable: "texto",
|
||||
httpRequestError: "Houve um problema com a requisição.",
|
||||
linkAlert: "Compartilhe seus blocos com este link:\n\n%1",
|
||||
hashError: "Desculpe, '%1' não corresponde a um programa salvo.",
|
||||
xmlError: "Não foi possível carregar seu arquivo salvo. Talvez ele tenha sido criado com uma versão diferente do Blockly?",
|
||||
badXml: "Erro de análise XML:\n%1\n\nSelecione 'OK' para abandonar suas mudanças ou 'Cancelar' para editar o XML."
|
||||
};
|
||||
24
admin/google-blockly/own/msg/ru.js
Normal file
24
admin/google-blockly/own/msg/ru.js
Normal file
@@ -0,0 +1,24 @@
|
||||
var MSG = {
|
||||
title: "Код",
|
||||
blocks: "Блоки",
|
||||
linkTooltip: "Сохранить и показать ссылку на блоки.",
|
||||
runTooltip: "Запустить программу, заданную блоками в рабочей области.",
|
||||
badCode: "Ошибка программы:\n%1",
|
||||
timeout: "Превышено максимальное количество итераций.",
|
||||
trashTooltip: "Удалить все блоки.",
|
||||
catLogic: "Логические",
|
||||
catLoops: "Циклы",
|
||||
catMath: "Математика",
|
||||
catText: "Текст",
|
||||
catLists: "Списки",
|
||||
catColour: "Цвет",
|
||||
catVariables: "Переменные",
|
||||
catFunctions: "Функции",
|
||||
listVariable: "список",
|
||||
textVariable: "текст",
|
||||
httpRequestError: "Произошла проблема при запросе.",
|
||||
linkAlert: "Поделитесь своими блоками по этой ссылке:\n\n%1",
|
||||
hashError: "К сожалению, «%1» не соответствует ни одному сохраненному файлу Блокли.",
|
||||
xmlError: "Не удалось загрузить ваш сохраненный файл. Возможно, он был создан в другой версии Блокли?",
|
||||
badXml: "Ошибка синтаксического анализа XML:\n%1\n\nВыберите 'ОК', чтобы отказаться от изменений или 'Cancel' для дальнейшего редактирования XML."
|
||||
};
|
||||
Reference in New Issue
Block a user