iobroker.javascript 7.0.10 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/admin/asset-manifest.json +5 -5
- package/admin/google-blockly/blockly-9.3.3.tgz +0 -0
- package/admin/google-blockly/blockly_compressed.js +1704 -1469
- package/admin/google-blockly/blocks_compressed.js +218 -164
- package/admin/google-blockly/javascript_compressed.js +328 -100
- package/admin/google-blockly/msg/js/de.js +70 -64
- package/admin/google-blockly/msg/js/en.js +20 -14
- package/admin/google-blockly/msg/js/es.js +45 -39
- package/admin/google-blockly/msg/js/fr.js +65 -59
- package/admin/google-blockly/msg/js/it.js +25 -19
- package/admin/google-blockly/msg/js/nl.js +61 -55
- package/admin/google-blockly/msg/js/pl.js +52 -46
- package/admin/google-blockly/msg/js/pt.js +36 -30
- package/admin/google-blockly/msg/js/ru.js +47 -41
- package/admin/google-blockly/msg/js/uk.js +17 -13
- package/admin/google-blockly/msg/js/zh-cn.js +92 -86
- package/admin/google-blockly/own/blocks_action.js +4 -4
- package/admin/google-blockly/own/blocks_number.js +4 -3
- package/admin/google-blockly/own/blocks_procedures.js +106 -75
- package/admin/google-blockly/own/blocks_sendto.js +2 -2
- package/admin/google-blockly/own/blocks_switch.js +8 -19
- package/admin/google-blockly/own/blocks_system.js +171 -113
- package/admin/google-blockly/own/blocks_text.js +1 -1
- package/admin/google-blockly/own/blocks_time.js +2 -1
- package/admin/google-blockly/own/blocks_timeout.js +31 -27
- package/admin/google-blockly/own/blocks_trigger.js +62 -44
- package/admin/google-blockly/own/blocks_words.js +3 -3
- package/admin/google-blockly/own/field_cron.js +138 -189
- package/admin/google-blockly/own/field_oid.js +167 -249
- package/admin/google-blockly/own/field_script.js +124 -170
- package/admin/static/js/98.7af6b699.chunk.js +2 -0
- package/admin/static/js/98.7af6b699.chunk.js.map +1 -0
- package/admin/static/js/{main.d5dc2784.js → main.bf8794f5.js} +2 -2
- package/admin/static/js/{main.d5dc2784.js.map → main.bf8794f5.js.map} +1 -1
- package/admin/tab.html +1 -1
- package/io-package.json +13 -13
- package/main.js +9 -10
- package/package.json +1 -1
- package/admin/blockly-9.0.1.tgz +0 -0
- package/admin/static/js/98.eee0c52f.chunk.js +0 -2
- package/admin/static/js/98.eee0c52f.chunk.js.map +0 -1
|
@@ -13,35 +13,42 @@ if (Blockly.Blocks['procedures_ifreturn'].FUNCTION_TYPES.indexOf('procedures_def
|
|
|
13
13
|
* Each procedure is defined by a three-element list of name, parameter
|
|
14
14
|
* list, and return value boolean.
|
|
15
15
|
*/
|
|
16
|
-
Blockly.Procedures.
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
} else {
|
|
33
|
-
if (tuple[2]) {
|
|
34
|
-
proceduresReturn.push(tuple);
|
|
35
|
-
} else {
|
|
36
|
-
proceduresNoReturn.push(tuple);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
16
|
+
Blockly.Procedures.allProceduresNew = function(root) {
|
|
17
|
+
const result = Blockly.Procedures.allProcedures(root);
|
|
18
|
+
|
|
19
|
+
const proceduresCustomNoReturn = root
|
|
20
|
+
.getProcedureMap()
|
|
21
|
+
.getProcedures()
|
|
22
|
+
.filter((p) => !!p.getReturnTypes())
|
|
23
|
+
.map((p) => [
|
|
24
|
+
p.getName(),
|
|
25
|
+
p.getParameters().map((pa) => pa.getName()),
|
|
26
|
+
true,
|
|
27
|
+
]);
|
|
28
|
+
|
|
29
|
+
root.getBlocksByType('procedures_defcustomnoreturn', false).forEach((b) => {
|
|
30
|
+
if (!Blockly.Procedures.isProcedureBlock(b)) {
|
|
31
|
+
proceduresCustomNoReturn.push(b.getProcedureDef());
|
|
40
32
|
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const proceduresCustomReturn = root
|
|
36
|
+
.getProcedureMap()
|
|
37
|
+
.getProcedures()
|
|
38
|
+
.filter((p) => !!p.getReturnTypes())
|
|
39
|
+
.map((p) => [
|
|
40
|
+
p.getName(),
|
|
41
|
+
p.getParameters().map((pa) => pa.getName()),
|
|
42
|
+
true,
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
root.getBlocksByType('procedures_defcustomreturn', false).forEach((b) => {
|
|
46
|
+
if (!Blockly.Procedures.isProcedureBlock(b)) {
|
|
47
|
+
proceduresCustomReturn.push(b.getProcedureDef());
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
return result.concat([proceduresCustomNoReturn, proceduresCustomReturn]);
|
|
45
52
|
};
|
|
46
53
|
|
|
47
54
|
/**
|
|
@@ -49,7 +56,7 @@ Blockly.Procedures.allProcedures = function(root) {
|
|
|
49
56
|
* @param {!Blockly.Workspace} workspace The workspace containing procedures.
|
|
50
57
|
* @return {!Array.<!Element>} Array of XML block elements.
|
|
51
58
|
*/
|
|
52
|
-
Blockly.Procedures.
|
|
59
|
+
Blockly.Procedures.flyoutCategoryNew = function(workspace) {
|
|
53
60
|
const xmlList = [];
|
|
54
61
|
const utils = (Blockly.Xml.utils ? Blockly.Xml.utils : Blockly.utils.xml);
|
|
55
62
|
if (Blockly.Blocks['procedures_defnoreturn']) {
|
|
@@ -58,11 +65,11 @@ Blockly.Procedures.flyoutCategory = function(workspace) {
|
|
|
58
65
|
// </block>
|
|
59
66
|
const block = utils.createElement('block');
|
|
60
67
|
block.setAttribute('type', 'procedures_defnoreturn');
|
|
61
|
-
block.setAttribute('gap', 16);
|
|
68
|
+
block.setAttribute('gap', '16');
|
|
62
69
|
const nameField = utils.createElement('field');
|
|
63
70
|
nameField.setAttribute('name', 'NAME');
|
|
64
|
-
nameField.appendChild(
|
|
65
|
-
Blockly.Msg['PROCEDURES_DEFNORETURN_PROCEDURE']));
|
|
71
|
+
nameField.appendChild(
|
|
72
|
+
utils.createTextNode(Blockly.Msg['PROCEDURES_DEFNORETURN_PROCEDURE']));
|
|
66
73
|
block.appendChild(nameField);
|
|
67
74
|
xmlList.push(block);
|
|
68
75
|
}
|
|
@@ -72,11 +79,11 @@ Blockly.Procedures.flyoutCategory = function(workspace) {
|
|
|
72
79
|
// </block>
|
|
73
80
|
const block = utils.createElement('block');
|
|
74
81
|
block.setAttribute('type', 'procedures_defreturn');
|
|
75
|
-
block.setAttribute('gap', 16);
|
|
82
|
+
block.setAttribute('gap', '16');
|
|
76
83
|
const nameField = utils.createElement('field');
|
|
77
84
|
nameField.setAttribute('name', 'NAME');
|
|
78
|
-
nameField.appendChild(
|
|
79
|
-
Blockly.Msg['PROCEDURES_DEFRETURN_PROCEDURE']));
|
|
85
|
+
nameField.appendChild(
|
|
86
|
+
utils.createTextNode(Blockly.Msg['PROCEDURES_DEFRETURN_PROCEDURE']));
|
|
80
87
|
block.appendChild(nameField);
|
|
81
88
|
xmlList.push(block);
|
|
82
89
|
}
|
|
@@ -84,7 +91,8 @@ Blockly.Procedures.flyoutCategory = function(workspace) {
|
|
|
84
91
|
// <block type="procedures_ifreturn" gap="16"></block>
|
|
85
92
|
const block = utils.createElement('block');
|
|
86
93
|
block.setAttribute('type', 'procedures_ifreturn');
|
|
87
|
-
block.setAttribute('gap', 16);
|
|
94
|
+
block.setAttribute('gap', '16');
|
|
95
|
+
|
|
88
96
|
xmlList.push(block);
|
|
89
97
|
}
|
|
90
98
|
if (Blockly.Blocks['procedures_defcustomnoreturn']) {
|
|
@@ -93,10 +101,10 @@ Blockly.Procedures.flyoutCategory = function(workspace) {
|
|
|
93
101
|
// </block>
|
|
94
102
|
const block = utils.createElement('block');
|
|
95
103
|
block.setAttribute('type', 'procedures_defcustomnoreturn');
|
|
96
|
-
block.setAttribute('gap', 16);
|
|
104
|
+
block.setAttribute('gap', '16');
|
|
97
105
|
const nameField = utils.createElement('field');
|
|
98
106
|
nameField.setAttribute('name', 'NAME');
|
|
99
|
-
nameField.appendChild(
|
|
107
|
+
nameField.appendChild(utils.createTextNode(
|
|
100
108
|
Blockly.Msg['PROCEDURES_DEFNORETURN_PROCEDURE']));
|
|
101
109
|
block.appendChild(nameField);
|
|
102
110
|
xmlList.push(block);
|
|
@@ -107,19 +115,26 @@ Blockly.Procedures.flyoutCategory = function(workspace) {
|
|
|
107
115
|
// </block>
|
|
108
116
|
const block = utils.createElement('block');
|
|
109
117
|
block.setAttribute('type', 'procedures_defcustomreturn');
|
|
110
|
-
block.setAttribute('gap', 16);
|
|
118
|
+
block.setAttribute('gap', '16');
|
|
111
119
|
const nameField = utils.createElement('field');
|
|
112
120
|
nameField.setAttribute('name', 'NAME');
|
|
113
|
-
nameField.appendChild(
|
|
121
|
+
nameField.appendChild(utils.createTextNode(
|
|
114
122
|
Blockly.Msg['PROCEDURES_DEFRETURN_PROCEDURE']));
|
|
115
123
|
block.appendChild(nameField);
|
|
116
124
|
xmlList.push(block);
|
|
117
125
|
}
|
|
118
126
|
if (xmlList.length) {
|
|
119
127
|
// Add slightly larger gap between system blocks and user calls.
|
|
120
|
-
xmlList[xmlList.length - 1].setAttribute('gap', 24);
|
|
128
|
+
xmlList[xmlList.length - 1].setAttribute('gap', '24');
|
|
121
129
|
}
|
|
122
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Add items to xmlList for each listed procedure.
|
|
133
|
+
*
|
|
134
|
+
* @param procedureList A list of procedures, each of which is defined by a
|
|
135
|
+
* three-element list of name, parameter list, and return value boolean.
|
|
136
|
+
* @param templateName The type of the block to generate.
|
|
137
|
+
*/
|
|
123
138
|
function populateProcedures(procedureList, templateName) {
|
|
124
139
|
const utils = (Blockly.Xml.utils ? Blockly.Xml.utils : Blockly.utils.xml);
|
|
125
140
|
for (let i = 0; i < procedureList.length; i++) {
|
|
@@ -132,7 +147,7 @@ Blockly.Procedures.flyoutCategory = function(workspace) {
|
|
|
132
147
|
// </block>
|
|
133
148
|
const block = utils.createElement('block');
|
|
134
149
|
block.setAttribute('type', templateName);
|
|
135
|
-
block.setAttribute('gap', 16);
|
|
150
|
+
block.setAttribute('gap', '16');
|
|
136
151
|
const mutation = utils.createElement('mutation');
|
|
137
152
|
mutation.setAttribute('name', name);
|
|
138
153
|
block.appendChild(mutation);
|
|
@@ -145,28 +160,27 @@ Blockly.Procedures.flyoutCategory = function(workspace) {
|
|
|
145
160
|
}
|
|
146
161
|
}
|
|
147
162
|
|
|
148
|
-
const tuple = Blockly.Procedures.
|
|
163
|
+
const tuple = Blockly.Procedures.allProceduresNew(workspace);
|
|
149
164
|
populateProcedures(tuple[0], 'procedures_callnoreturn');
|
|
150
165
|
populateProcedures(tuple[1], 'procedures_callreturn');
|
|
151
166
|
populateProcedures(tuple[2], 'procedures_callcustomnoreturn');
|
|
152
167
|
populateProcedures(tuple[3], 'procedures_callcustomreturn');
|
|
168
|
+
|
|
153
169
|
return xmlList;
|
|
154
170
|
};
|
|
155
171
|
|
|
156
172
|
// ---------------------- patch for async functions ------------------------------
|
|
157
|
-
// taken from javascript/procedures.js
|
|
173
|
+
// taken from javascript/procedures.js https://github.com/google/blockly/blob/blockly-v9.3.3/generators/javascript/procedures.js
|
|
158
174
|
Blockly.JavaScript['procedures_defreturn'] = function(block) {
|
|
159
175
|
// Define a procedure with a return value.
|
|
160
|
-
const funcName = Blockly.JavaScript.
|
|
176
|
+
const funcName = Blockly.JavaScript.nameDB_.getName(
|
|
161
177
|
block.getFieldValue('NAME'), Blockly.PROCEDURE_CATEGORY_NAME);
|
|
162
178
|
let xfix1 = '';
|
|
163
179
|
if (Blockly.JavaScript.STATEMENT_PREFIX) {
|
|
164
|
-
xfix1 += Blockly.JavaScript.injectId(Blockly.JavaScript.STATEMENT_PREFIX,
|
|
165
|
-
block);
|
|
180
|
+
xfix1 += Blockly.JavaScript.injectId(Blockly.JavaScript.STATEMENT_PREFIX, block);
|
|
166
181
|
}
|
|
167
182
|
if (Blockly.JavaScript.STATEMENT_SUFFIX) {
|
|
168
|
-
xfix1 += Blockly.JavaScript.injectId(Blockly.JavaScript.STATEMENT_SUFFIX,
|
|
169
|
-
block);
|
|
183
|
+
xfix1 += Blockly.JavaScript.injectId(Blockly.JavaScript.STATEMENT_SUFFIX, block);
|
|
170
184
|
}
|
|
171
185
|
if (xfix1) {
|
|
172
186
|
xfix1 = Blockly.JavaScript.prefixLines(xfix1, Blockly.JavaScript.INDENT);
|
|
@@ -174,53 +188,59 @@ Blockly.JavaScript['procedures_defreturn'] = function(block) {
|
|
|
174
188
|
let loopTrap = '';
|
|
175
189
|
if (Blockly.JavaScript.INFINITE_LOOP_TRAP) {
|
|
176
190
|
loopTrap = Blockly.JavaScript.prefixLines(
|
|
177
|
-
Blockly.JavaScript.injectId(Blockly.JavaScript.INFINITE_LOOP_TRAP,
|
|
178
|
-
|
|
191
|
+
Blockly.JavaScript.injectId(Blockly.JavaScript.INFINITE_LOOP_TRAP, block),
|
|
192
|
+
Blockly.JavaScript.INDENT);
|
|
179
193
|
}
|
|
180
194
|
const branch = Blockly.JavaScript.statementToCode(block, 'STACK');
|
|
181
|
-
let returnValue =
|
|
182
|
-
Blockly.JavaScript.ORDER_NONE) || '';
|
|
195
|
+
let returnValue =
|
|
196
|
+
Blockly.JavaScript.valueToCode(block, 'RETURN', Blockly.JavaScript.ORDER_NONE) || '';
|
|
183
197
|
let xfix2 = '';
|
|
184
198
|
if (branch && returnValue) {
|
|
185
|
-
|
|
186
|
-
|
|
199
|
+
// After executing the function body, revisit this block for the return.
|
|
200
|
+
xfix2 = xfix1;
|
|
187
201
|
}
|
|
188
202
|
if (returnValue) {
|
|
189
|
-
|
|
203
|
+
returnValue = Blockly.JavaScript.INDENT + 'return ' + returnValue + ';\n';
|
|
190
204
|
}
|
|
191
205
|
const args = [];
|
|
192
206
|
const variables = block.getVars();
|
|
193
207
|
for (let i = 0; i < variables.length; i++) {
|
|
194
|
-
|
|
195
|
-
Blockly.VARIABLE_CATEGORY_NAME);
|
|
208
|
+
args[i] = Blockly.JavaScript.nameDB_.getName(variables[i], Blockly.VARIABLE_CATEGORY_NAME);
|
|
196
209
|
}
|
|
197
|
-
let code = 'async function ' + funcName + '(' + args.join(', ') + ') {\n' +
|
|
198
|
-
|
|
210
|
+
let code = 'async function ' + funcName + '(' + args.join(', ') + ') {\n' + xfix1 +
|
|
211
|
+
loopTrap + branch + xfix2 + returnValue + '}';
|
|
199
212
|
code = Blockly.JavaScript.scrub_(block, code);
|
|
200
213
|
// Add % so as not to collide with helper functions in definitions list.
|
|
201
214
|
Blockly.JavaScript.definitions_['%' + funcName] = code;
|
|
202
215
|
return null;
|
|
203
216
|
};
|
|
204
217
|
|
|
218
|
+
Blockly.JavaScript['procedures_defnoreturn'] = Blockly.JavaScript['procedures_defreturn'];
|
|
219
|
+
|
|
205
220
|
Blockly.JavaScript['procedures_callreturn'] = function(block) {
|
|
206
221
|
// Call a procedure with a return value.
|
|
207
|
-
const funcName = Blockly.JavaScript.
|
|
222
|
+
const funcName = Blockly.JavaScript.nameDB_.getName(
|
|
208
223
|
block.getFieldValue('NAME'), Blockly.PROCEDURE_CATEGORY_NAME);
|
|
209
224
|
const args = [];
|
|
210
|
-
const variables = block.
|
|
225
|
+
const variables = block.getVars();
|
|
211
226
|
for (let i = 0; i < variables.length; i++) {
|
|
212
|
-
|
|
213
|
-
|
|
227
|
+
args[i] = Blockly.JavaScript.valueToCode(block, 'ARG' + i, Blockly.JavaScript.ORDER_NONE) ||
|
|
228
|
+
'null';
|
|
214
229
|
}
|
|
215
230
|
const code = 'await ' + funcName + '(' + args.join(', ') + ')';
|
|
216
231
|
return [code, Blockly.JavaScript.ORDER_FUNCTION_CALL];
|
|
217
|
-
};
|
|
232
|
+
};
|
|
233
|
+
|
|
218
234
|
|
|
219
|
-
Blockly.JavaScript['procedures_defnoreturn'] =
|
|
220
|
-
Blockly.JavaScript['procedures_defreturn'];
|
|
221
235
|
// ---------------------- custom function with return ------------------------------
|
|
222
236
|
|
|
223
237
|
Blockly.Blocks['procedures_defcustomreturn'] = {
|
|
238
|
+
getProcedureModel() {
|
|
239
|
+
return this.model;
|
|
240
|
+
},
|
|
241
|
+
isProcedureDef() {
|
|
242
|
+
return true;
|
|
243
|
+
},
|
|
224
244
|
/**
|
|
225
245
|
* Block for defining a procedure with a return value.
|
|
226
246
|
* @this Blockly.Block
|
|
@@ -255,6 +275,7 @@ Blockly.Blocks['procedures_defcustomreturn'] = {
|
|
|
255
275
|
|
|
256
276
|
this.appendDummyInput('SCRIPT')
|
|
257
277
|
.appendField(new Blockly.FieldScript(btoa('return 0;')), 'SCRIPT');
|
|
278
|
+
|
|
258
279
|
this.setInputsInline(true);
|
|
259
280
|
this.setStatements_(false);
|
|
260
281
|
},
|
|
@@ -373,13 +394,12 @@ Blockly.Blocks['procedures_defcustomreturn'] = {
|
|
|
373
394
|
|
|
374
395
|
Blockly.JavaScript['procedures_defcustomreturn'] = function(block) {
|
|
375
396
|
// Define a procedure with a return value.
|
|
376
|
-
const funcName = Blockly.JavaScript.
|
|
377
|
-
block.getFieldValue('NAME'), Blockly.
|
|
397
|
+
const funcName = Blockly.JavaScript.nameDB_.getName(
|
|
398
|
+
block.getFieldValue('NAME'), Blockly.PROCEDURE_CATEGORY_NAME);
|
|
378
399
|
|
|
379
400
|
const args = [];
|
|
380
401
|
for (let i = 0; i < block.arguments_.length; i++) {
|
|
381
|
-
args[i] = Blockly.JavaScript.
|
|
382
|
-
Blockly.Variables.NAME_TYPE);
|
|
402
|
+
args[i] = Blockly.JavaScript.nameDB_.getName(block.arguments_[i], Blockly.VARIABLE_CATEGORY_NAME);
|
|
383
403
|
}
|
|
384
404
|
|
|
385
405
|
const script = Blockly.b64DecodeUnicode(block.getFieldValue('SCRIPT') || '');
|
|
@@ -394,6 +414,7 @@ Blockly.JavaScript['procedures_defcustomreturn'] = function(block) {
|
|
|
394
414
|
code = Blockly.JavaScript.scrub_(block, code);
|
|
395
415
|
// Add % so as not to collide with helper functions in definitions list.
|
|
396
416
|
Blockly.JavaScript.definitions_['%' + funcName] = code;
|
|
417
|
+
|
|
397
418
|
return null;
|
|
398
419
|
};
|
|
399
420
|
|
|
@@ -417,33 +438,43 @@ Blockly.JavaScript['procedures_callcustomreturn'] = Blockly.JavaScript['procedur
|
|
|
417
438
|
// ---------------------- custom function with no return ------------------------------
|
|
418
439
|
|
|
419
440
|
Blockly.Blocks['procedures_defcustomnoreturn'] = {
|
|
441
|
+
getProcedureModel() {
|
|
442
|
+
return this.model;
|
|
443
|
+
},
|
|
444
|
+
isProcedureDef() {
|
|
445
|
+
return true;
|
|
446
|
+
},
|
|
420
447
|
init: function() {
|
|
421
|
-
const nameField = new Blockly.FieldTextInput('',
|
|
422
|
-
Blockly.Procedures.rename);
|
|
448
|
+
const nameField = new Blockly.FieldTextInput('', Blockly.Procedures.rename);
|
|
423
449
|
nameField.setSpellcheck(false);
|
|
424
450
|
|
|
425
451
|
this.appendDummyInput()
|
|
426
452
|
.appendField(Blockly.Translate('procedures_defcustomnoreturn_name'))
|
|
427
453
|
.appendField(nameField, 'NAME')
|
|
428
454
|
.appendField('', 'PARAMS');
|
|
455
|
+
|
|
429
456
|
this.setMutator(new Blockly.Mutator(['procedures_mutatorarg']));
|
|
457
|
+
|
|
430
458
|
if ((this.workspace.options.comments ||
|
|
431
|
-
(this.workspace.options.parentWorkspace &&
|
|
432
|
-
this.workspace.options.parentWorkspace.options.comments)) &&
|
|
459
|
+
(this.workspace.options.parentWorkspace && this.workspace.options.parentWorkspace.options.comments)) &&
|
|
433
460
|
Blockly.Msg['PROCEDURES_DEFNORETURN_COMMENT']) {
|
|
434
461
|
this.setCommentText(Blockly.Msg['PROCEDURES_DEFNORETURN_COMMENT']);
|
|
435
462
|
}
|
|
463
|
+
|
|
436
464
|
this.setStyle('procedure_blocks');
|
|
437
465
|
this.setColour(Blockly.Msg['PROCEDURES_HUE']);
|
|
438
466
|
this.setTooltip(Blockly.Msg['PROCEDURES_DEFNORETURN_TOOLTIP']);
|
|
439
467
|
this.setHelpUrl(Blockly.Msg['PROCEDURES_DEFNORETURN_HELPURL']);
|
|
468
|
+
|
|
440
469
|
this.arguments_ = [];
|
|
441
470
|
this.argumentVarModels_ = [];
|
|
471
|
+
|
|
442
472
|
this.setStatements_(true);
|
|
443
473
|
this.statementConnection_ = null;
|
|
444
474
|
|
|
445
475
|
this.appendDummyInput('SCRIPT')
|
|
446
476
|
.appendField(new Blockly.FieldScript(''), 'SCRIPT');
|
|
477
|
+
|
|
447
478
|
this.setInputsInline(true);
|
|
448
479
|
this.setStatements_(false);
|
|
449
480
|
},
|
|
@@ -438,5 +438,5 @@ Blockly.JavaScript['sendto_otherscript'] = function(block) {
|
|
|
438
438
|
|
|
439
439
|
text += '}';
|
|
440
440
|
|
|
441
|
-
return
|
|
442
|
-
};
|
|
441
|
+
return `sendTo('javascript${dropdown_instance}', 'toScript', ${text});\n`;
|
|
442
|
+
};
|
|
@@ -2,20 +2,9 @@
|
|
|
2
2
|
// I really tried to get the license conditions from authors, but no luck :(
|
|
3
3
|
// Many thanks to Florian Pechwitz <florian.Pechwitz@itizzimo.com> for the code
|
|
4
4
|
|
|
5
|
-
Blockly.System.blocks['logic_switch_case'] =
|
|
6
|
-
'<block type="logic_switch_case">'
|
|
7
|
-
+ ' <value name="CONDITION">'
|
|
8
|
-
+ ' </value>'
|
|
9
|
-
+ ' <value name="CASECONDITION0">'
|
|
10
|
-
+ ' </value>'
|
|
11
|
-
+ ' <value name="CASE0">'
|
|
12
|
-
+ ' </value>'
|
|
13
|
-
+ ' <mutation with_statement="false" items="parameter1"></mutation>'
|
|
14
|
-
+ '</block>';
|
|
15
|
-
|
|
16
5
|
Blockly.Blocks['logic_switch_case'] = {
|
|
17
6
|
init: function() {
|
|
18
|
-
this.setColour(
|
|
7
|
+
this.setColour('%{BKY_LOGIC_HUE}');
|
|
19
8
|
this.setPreviousStatement(true);
|
|
20
9
|
this.setNextStatement(true);
|
|
21
10
|
this.appendValueInput('CONDITION')
|
|
@@ -25,7 +14,7 @@ Blockly.Blocks['logic_switch_case'] = {
|
|
|
25
14
|
this.appendStatementInput('CASE0')
|
|
26
15
|
.appendField(Blockly.Translate('logic_switch_do'));
|
|
27
16
|
this.setMutator(new Blockly.Mutator(['case_incaseof', 'case_default']));
|
|
28
|
-
this.setTooltip(Blockly.Translate('
|
|
17
|
+
this.setTooltip(Blockly.Translate('logic_switch_tooltip'));
|
|
29
18
|
this.caseCount_ = 0;
|
|
30
19
|
this.defaultCount_ = 0;
|
|
31
20
|
},
|
|
@@ -167,35 +156,35 @@ Blockly.Blocks['logic_switch_case'] = {
|
|
|
167
156
|
|
|
168
157
|
Blockly.Blocks['control_case'] = {
|
|
169
158
|
init: function() {
|
|
170
|
-
this.setColour(
|
|
159
|
+
this.setColour('%{BKY_LOGIC_HUE}');
|
|
171
160
|
this.appendDummyInput()
|
|
172
161
|
.appendField(Blockly.Translate('logic_switch_case_is'));
|
|
173
162
|
this.appendStatementInput('STACK');
|
|
174
|
-
this.setTooltip(Blockly.Translate('
|
|
163
|
+
this.setTooltip(Blockly.Translate('logic_switch_control_case_tooltip'));
|
|
175
164
|
this.contextMenu = false;
|
|
176
165
|
}
|
|
177
166
|
};
|
|
178
167
|
|
|
179
168
|
Blockly.Blocks['case_incaseof'] = {
|
|
180
169
|
init: function() {
|
|
181
|
-
this.setColour(
|
|
170
|
+
this.setColour('%{BKY_LOGIC_HUE}');
|
|
182
171
|
this.appendDummyInput()
|
|
183
172
|
.appendField(Blockly.Translate('logic_switch_case_of'));
|
|
184
173
|
this.setPreviousStatement(true);
|
|
185
174
|
this.setNextStatement(true);
|
|
186
|
-
this.setTooltip(Blockly.Translate('
|
|
175
|
+
this.setTooltip(Blockly.Translate('logic_switch_case_incaseof_tooltip'));
|
|
187
176
|
this.contextMenu = false;
|
|
188
177
|
}
|
|
189
178
|
};
|
|
190
179
|
|
|
191
180
|
Blockly.Blocks['case_default'] = {
|
|
192
181
|
init: function() {
|
|
193
|
-
this.setColour(
|
|
182
|
+
this.setColour('%{BKY_LOGIC_HUE}');
|
|
194
183
|
this.appendDummyInput()
|
|
195
184
|
.appendField('default');
|
|
196
185
|
this.setPreviousStatement(true);
|
|
197
186
|
this.setNextStatement(false);
|
|
198
|
-
this.setTooltip(Blockly.Translate('
|
|
187
|
+
this.setTooltip(Blockly.Translate('logic_switch_default_tooltip'));
|
|
199
188
|
this.contextMenu = false;
|
|
200
189
|
}
|
|
201
190
|
};
|