iobroker.javascript 8.5.0 → 8.5.1

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.
Files changed (36) hide show
  1. package/README.md +5 -10
  2. package/admin/asset-manifest.json +7 -7
  3. package/admin/google-blockly/own/blocks_action.js +29 -30
  4. package/admin/google-blockly/own/blocks_convert.js +6 -7
  5. package/admin/google-blockly/own/blocks_logic.js +16 -16
  6. package/admin/google-blockly/own/blocks_number.js +2 -2
  7. package/admin/google-blockly/own/blocks_object.js +14 -15
  8. package/admin/google-blockly/own/blocks_procedures.js +10 -10
  9. package/admin/google-blockly/own/blocks_sendto.js +104 -119
  10. package/admin/google-blockly/own/blocks_switch.js +8 -8
  11. package/admin/google-blockly/own/blocks_system.js +66 -67
  12. package/admin/google-blockly/own/blocks_text.js +2 -2
  13. package/admin/google-blockly/own/blocks_time.js +36 -37
  14. package/admin/google-blockly/own/blocks_timeout.js +20 -21
  15. package/admin/google-blockly/own/blocks_trigger.js +67 -68
  16. package/admin/google-blockly/own/field_cron.js +0 -1
  17. package/admin/google-blockly/own/field_oid.js +0 -1
  18. package/admin/google-blockly/own/field_script.js +4 -9
  19. package/admin/static/js/373.50668df1.chunk.js +2 -0
  20. package/admin/static/js/373.50668df1.chunk.js.map +1 -0
  21. package/admin/static/js/373.bf884cc8.chunk.js +2 -0
  22. package/admin/static/js/373.bf884cc8.chunk.js.map +1 -0
  23. package/admin/static/js/{974.3b53607f.chunk.js → 974.5c28e487.chunk.js} +3 -3
  24. package/admin/static/js/{974.3b53607f.chunk.js.map → 974.5c28e487.chunk.js.map} +1 -1
  25. package/admin/static/js/{main.63c641fd.js → main.524b166f.js} +2 -2
  26. package/admin/static/js/{main.63c641fd.js.map → main.524b166f.js.map} +1 -1
  27. package/admin/static/js/main.720010c8.js +2 -0
  28. package/admin/static/js/main.720010c8.js.map +1 -0
  29. package/admin/static/js/{main.d6499dc8.js → main.c18bdbeb.js} +2 -2
  30. package/admin/static/js/{main.d6499dc8.js.map → main.c18bdbeb.js.map} +1 -1
  31. package/admin/tab.html +1 -1
  32. package/io-package.json +14 -14
  33. package/package.json +1 -1
  34. package/admin/static/js/373.242b04f6.chunk.js +0 -2
  35. package/admin/static/js/373.242b04f6.chunk.js.map +0 -1
  36. /package/admin/static/js/{974.3b53607f.chunk.js.LICENSE.txt → 974.5c28e487.chunk.js.LICENSE.txt} +0 -0
@@ -13,7 +13,7 @@ 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.allProceduresNew = function(root) {
16
+ Blockly.Procedures.allProceduresNew = function (root) {
17
17
  const result = Blockly.Procedures.allProcedures(root);
18
18
 
19
19
  const proceduresCustomNoReturn = root
@@ -56,7 +56,7 @@ Blockly.Procedures.allProceduresNew = function(root) {
56
56
  * @param {!Blockly.Workspace} workspace The workspace containing procedures.
57
57
  * @return {!Array.<!Element>} Array of XML block elements.
58
58
  */
59
- Blockly.Procedures.flyoutCategoryNew = function(workspace) {
59
+ Blockly.Procedures.flyoutCategoryNew = function (workspace) {
60
60
  const xmlList = [];
61
61
  const utils = (Blockly.Xml.utils ? Blockly.Xml.utils : Blockly.utils.xml);
62
62
  if (Blockly.Blocks['procedures_defnoreturn']) {
@@ -171,7 +171,7 @@ Blockly.Procedures.flyoutCategoryNew = function(workspace) {
171
171
 
172
172
  // ---------------------- patch for async functions ------------------------------
173
173
  // taken from javascript/procedures.js https://github.com/google/blockly/blob/blockly-v9.3.3/generators/javascript/procedures.js
174
- Blockly.JavaScript.forBlock['procedures_defreturn'] = function(block) {
174
+ Blockly.JavaScript.forBlock['procedures_defreturn'] = function (block) {
175
175
  // Define a procedure with a return value.
176
176
  const funcName = Blockly.JavaScript.nameDB_.getName(
177
177
  block.getFieldValue('NAME'), Blockly.PROCEDURE_CATEGORY_NAME);
@@ -217,7 +217,7 @@ Blockly.JavaScript.forBlock['procedures_defreturn'] = function(block) {
217
217
 
218
218
  Blockly.JavaScript.forBlock['procedures_defnoreturn'] = Blockly.JavaScript.forBlock['procedures_defreturn'];
219
219
 
220
- Blockly.JavaScript.forBlock['procedures_callreturn'] = function(block) {
220
+ Blockly.JavaScript.forBlock['procedures_callreturn'] = function (block) {
221
221
  // Call a procedure with a return value.
222
222
  const funcName = Blockly.JavaScript.nameDB_.getName(
223
223
  block.getFieldValue('NAME'), Blockly.PROCEDURE_CATEGORY_NAME);
@@ -245,7 +245,7 @@ Blockly.Blocks['procedures_defcustomreturn'] = {
245
245
  * Block for defining a procedure with a return value.
246
246
  * @this Blockly.Block
247
247
  */
248
- init: function() {
248
+ init: function () {
249
249
  const nameField = new Blockly.FieldTextInput('',
250
250
  Blockly.Procedures.rename);
251
251
 
@@ -380,7 +380,7 @@ Blockly.Blocks['procedures_defcustomreturn'] = {
380
380
  * - that it DOES NOT have a return value.
381
381
  * @this Blockly.Block
382
382
  */
383
- getProcedureDef: function() {
383
+ getProcedureDef: function () {
384
384
  return [this.getFieldValue('NAME'), this.arguments_, true, true];
385
385
  },
386
386
  getVars: Blockly.Blocks['procedures_defreturn'].getVars,
@@ -392,7 +392,7 @@ Blockly.Blocks['procedures_defcustomreturn'] = {
392
392
  callType_: 'procedures_callcustomreturn'
393
393
  };
394
394
 
395
- Blockly.JavaScript.forBlock['procedures_defcustomreturn'] = function(block) {
395
+ Blockly.JavaScript.forBlock['procedures_defcustomreturn'] = function (block) {
396
396
  // Define a procedure with a return value.
397
397
  const funcName = Blockly.JavaScript.nameDB_.getName(
398
398
  block.getFieldValue('NAME'), Blockly.PROCEDURE_CATEGORY_NAME);
@@ -444,7 +444,7 @@ Blockly.Blocks['procedures_defcustomnoreturn'] = {
444
444
  isProcedureDef() {
445
445
  return true;
446
446
  },
447
- init: function() {
447
+ init: function () {
448
448
  const nameField = new Blockly.FieldTextInput('', Blockly.Procedures.rename);
449
449
  nameField.setSpellcheck(false);
450
450
 
@@ -484,7 +484,7 @@ Blockly.Blocks['procedures_defcustomnoreturn'] = {
484
484
  domToMutation: Blockly.Blocks['procedures_defnoreturn'].domToMutation,
485
485
  decompose: Blockly.Blocks['procedures_defcustomreturn'].decompose,
486
486
  compose: Blockly.Blocks['procedures_defcustomreturn'].compose,
487
- getProcedureDef: function() {
487
+ getProcedureDef: function () {
488
488
  return [this.getFieldValue('NAME'), this.arguments_, false, true];
489
489
  },
490
490
  getVars: Blockly.Blocks['procedures_defnoreturn'].getVars,
@@ -513,7 +513,7 @@ Blockly.Blocks['procedures_callcustomnoreturn'] = {
513
513
  defType_: 'procedures_defcustomnoreturn'
514
514
  };
515
515
 
516
- Blockly.JavaScript.forBlock['procedures_callcustomnoreturn'] = function(block) {
516
+ Blockly.JavaScript.forBlock['procedures_callcustomnoreturn'] = function (block) {
517
517
  // Call a procedure with no return value.
518
518
  // Generated code is for a function call as a statement is the same as a
519
519
  // function call as a value, with the addition of line ending.
@@ -2,7 +2,6 @@
2
2
 
3
3
  if (typeof goog !== 'undefined') {
4
4
  goog.provide('Blockly.JavaScript.Sendto');
5
-
6
5
  goog.require('Blockly.JavaScript');
7
6
  }
8
7
 
@@ -11,13 +10,13 @@ Blockly.CustomBlocks.push('Sendto');
11
10
 
12
11
  Blockly.Sendto = {
13
12
  HUE: 310,
14
- blocks: {}
13
+ blocks: {},
15
14
  };
16
15
 
17
16
  // --- sendTo Custom --------------------------------------------------
18
17
  Blockly.Sendto.blocks['sendto_custom'] =
19
18
  '<block type="sendto_custom">' +
20
- ' <mutation items="parameter1" with_statement="false"></mutation>' +
19
+ ' <mutation xmlns="http://www.w3.org/1999/xhtml" items="parameter"></mutation>' +
21
20
  ' <field name="INSTANCE">admin.0</field>' +
22
21
  ' <field name="COMMAND">send</field>' +
23
22
  ' <field name="LOG"></field>' +
@@ -46,7 +45,7 @@ Blockly.Blocks['sendto_custom_container'] = {
46
45
  },
47
46
  };
48
47
 
49
- Blockly.Blocks['sendto_custom_item'] = {
48
+ Blockly.Blocks['sendto_custom_mutator'] = {
50
49
  /**
51
50
  * Mutator block for add items.
52
51
  * @this Blockly.Block
@@ -54,8 +53,9 @@ Blockly.Blocks['sendto_custom_item'] = {
54
53
  init: function () {
55
54
  this.setColour(Blockly.Sendto.HUE);
56
55
 
57
- this.appendDummyInput('NAME')
58
- .appendField(Blockly.Translate('sendto_custom_argument'));
56
+ this.appendDummyInput('ATTR')
57
+ .appendField(Blockly.Translate('sendto_custom_argument'))
58
+ .appendField(new Blockly.FieldTextInput('parameter'), 'ATTR');
59
59
 
60
60
  this.setPreviousStatement(true);
61
61
  this.setNextStatement(true);
@@ -81,9 +81,7 @@ Blockly.Blocks['sendto_custom'] = {
81
81
  if (!options.length) {
82
82
  options.push([Blockly.Translate('sendto_no_instances'), '']);
83
83
  }
84
- /*for (let h = 0; h < scripts.hosts.length; h++) {
85
- options.push([scripts.hosts[h], scripts.hosts[h]]);
86
- }*/
84
+
87
85
  this.appendDummyInput('INSTANCE')
88
86
  .appendField(Blockly.Translate('sendto_custom'))
89
87
  .appendField(new Blockly.FieldDropdown(options), 'INSTANCE');
@@ -113,15 +111,19 @@ Blockly.Blocks['sendto_custom'] = {
113
111
  .appendField(Blockly.Translate('request_statement'))
114
112
  .appendField(new Blockly.FieldCheckbox('FALSE', function (option) {
115
113
  const withStatement = option === true || option === 'true' || option === 'TRUE';
116
- this.sourceBlock_.updateShape_(this.sourceBlock_.getArgNames_(), withStatement);
114
+ this.sourceBlock_.updateShape_(withStatement);
117
115
  }), 'WITH_STATEMENT');
118
116
 
119
- this.itemCount_ = 1;
117
+ this.attributes_ = [];
118
+ this.itemCount_ = 0;
119
+
120
+ this.setMutator(new Blockly.icons.MutatorIcon(['sendto_custom_mutator'], this));
121
+
120
122
  this.updateShape_();
121
123
  this.setInputsInline(false);
122
124
  this.setPreviousStatement(true, null);
123
125
  this.setNextStatement(true, null);
124
- this.setMutator(new Blockly.icons.MutatorIcon(['sendto_custom_item'], this));
126
+
125
127
  this.setTooltip(Blockly.Translate('sendto_custom_tooltip'));
126
128
  this.setHelpUrl(getHelp('sendto_custom_help'));
127
129
  },
@@ -132,15 +134,9 @@ Blockly.Blocks['sendto_custom'] = {
132
134
  */
133
135
  mutationToDom: function () {
134
136
  const container = document.createElement('mutation');
135
- const names = [];
136
- for (let i = 0; i < this.itemCount_; i++) {
137
- const input = this.getInput('ARG' + i);
138
- names[i] = input.fieldRow[0].getValue();
139
- }
140
137
 
141
- container.setAttribute('items', names.join(','));
142
- const withStatement = this.getFieldValue('WITH_STATEMENT');
143
- container.setAttribute('with_statement', withStatement === 'TRUE' || withStatement === 'true' || withStatement === true);
138
+ container.setAttribute('items', this.attributes_.join(','));
139
+
144
140
  return container;
145
141
  },
146
142
  /**
@@ -149,10 +145,17 @@ Blockly.Blocks['sendto_custom'] = {
149
145
  * @this Blockly.Block
150
146
  */
151
147
  domToMutation: function (xmlElement) {
152
- const names = xmlElement.getAttribute('items').split(',');
153
- this.itemCount_ = names.length;
154
- const withStatement = xmlElement.getAttribute('with_statement');
155
- this.updateShape_(names, withStatement === true || withStatement === 'true' || withStatement === 'TRUE');
148
+ this.attributes_ = [];
149
+
150
+ const names = xmlElement.getAttribute('items');
151
+ if (names) {
152
+ for (const name of names.split(',')) {
153
+ this.attributes_.push(name);
154
+ }
155
+ }
156
+
157
+ this.itemCount_ = this.attributes_.length;
158
+ this.updateShape_();
156
159
  },
157
160
  /**
158
161
  * Populate the mutator's dialog with this block's components.
@@ -163,9 +166,11 @@ Blockly.Blocks['sendto_custom'] = {
163
166
  decompose: function (workspace) {
164
167
  const containerBlock = workspace.newBlock('sendto_custom_container');
165
168
  containerBlock.initSvg();
169
+
166
170
  let connection = containerBlock.getInput('STACK').connection;
167
171
  for (let i = 0; i < this.itemCount_; i++) {
168
- const itemBlock = workspace.newBlock('sendto_custom_item');
172
+ const itemBlock = workspace.newBlock('sendto_custom_mutator');
173
+ itemBlock.setFieldValue(this.attributes_[i], 'ATTR');
169
174
  itemBlock.initSvg();
170
175
  connection.connect(itemBlock.previousConnection);
171
176
  connection = itemBlock.nextConnection;
@@ -178,41 +183,38 @@ Blockly.Blocks['sendto_custom'] = {
178
183
  * @this Blockly.Block
179
184
  */
180
185
  compose: function (containerBlock) {
186
+ this.attributes_ = [];
187
+
181
188
  let itemBlock = containerBlock.getInputTargetBlock('STACK');
182
189
  // Count number of inputs.
183
190
  const connections = [];
184
- const names = [];
185
191
  while (itemBlock) {
192
+ const attrName = itemBlock.getFieldValue('ATTR');
193
+ this.attributes_.push(attrName);
194
+
186
195
  connections.push(itemBlock.valueConnection_);
187
196
  itemBlock = itemBlock.nextConnection &&
188
197
  itemBlock.nextConnection.targetBlock();
189
198
  }
199
+
190
200
  // Disconnect any children that don't belong.
191
- for (let i = 0; i < this.itemCount_; i++) {
192
- const input = this.getInput('ARG' + i);
193
- const connection = input.connection.targetConnection;
194
- names[i] = input.fieldRow[0].getValue();
201
+ for (let k = 0; k < this.itemCount_; k++) {
202
+ const connection = this.getInput('ARG' + k).connection.targetConnection;
195
203
  if (connection && !connections.includes(connection)) {
196
204
  connection.disconnect();
197
205
  }
198
206
  }
207
+
199
208
  this.itemCount_ = connections.length;
200
- if (this.itemCount_ < 1) {
201
- this.itemCount_ = 1;
209
+ if (this.itemCount_ < 0) {
210
+ this.itemCount_ = 0;
202
211
  }
203
- this.updateShape_(names);
212
+ this.updateShape_();
213
+
204
214
  // Reconnect any child blocks.
205
- for (let j = 0; j < this.itemCount_; j++) {
206
- Blockly.icons.MutatorIcon.reconnect(connections[j], this, 'ARG' + j);
207
- }
208
- },
209
- getArgNames_: function () {
210
- const names = [];
211
- for (let n = 0; n < this.itemCount_; n++) {
212
- const input = this.getInput('ARG' + n);
213
- names.push(input.fieldRow[0].getValue());
215
+ for (let i = 0; i < this.itemCount_; i++) {
216
+ Blockly.icons.MutatorIcon.reconnect(connections[i], this, 'ARG' + i);
214
217
  }
215
- return names;
216
218
  },
217
219
  /**
218
220
  * Store pointers to any connected child blocks.
@@ -234,71 +236,42 @@ Blockly.Blocks['sendto_custom'] = {
234
236
  * @private
235
237
  * @this Blockly.Block
236
238
  */
237
- updateShape_: function (names, withStatement) {
238
- names = names || [];
239
- let _input;
240
- const wp = this.workspace;
241
- if (withStatement === undefined) {
242
- withStatement = this.getFieldValue('WITH_STATEMENT');
243
- withStatement = withStatement === true || withStatement === 'true' || withStatement === 'TRUE';
244
- }
245
-
246
- this.getInput('STATEMENT') && this.removeInput('STATEMENT');
239
+ updateShape_: function (withStatement) {
240
+ const workspace = this.workspace;
247
241
 
248
242
  // Add new inputs.
249
- let i;
250
- for (i = 0; i < this.itemCount_; i++) {
251
- _input = this.getInput('ARG' + i);
252
-
253
- if (!_input) {
254
- _input = this.appendValueInput('ARG' + i);
255
- if (!names[i]) {
256
- names[i] = Blockly.Translate('sendto_custom_argument') + (i + 1);
257
- }
258
- _input.appendField(new Blockly.FieldTextInput(names[i]));
259
- setTimeout(__input => {
260
- if (!__input.connection.isConnected()) {
261
- const _shadow = wp.newBlock('text');
262
- _shadow.setShadow(true);
263
- _shadow.initSvg();
264
- _shadow.render();
265
- _shadow.outputConnection.connect(__input.connection);
266
- }
267
- }, 100, _input);
243
+ for (let i = 0; i < this.itemCount_; i++) {
244
+ let input = this.getInput('ARG' + i);
245
+
246
+ if (!input) {
247
+ input = this.appendValueInput('ARG' + i).setAlign(Blockly.ALIGN_RIGHT);
248
+ input.appendField(this.attributes_[i]);
268
249
  } else {
269
- _input.fieldRow[0].setValue(names[i]);
270
- setTimeout(__input => {
271
- if (!__input.connection.isConnected()) {
272
- const shadow = wp.newBlock('text');
273
- shadow.setShadow(true);
274
- shadow.initSvg();
275
- shadow.render();
276
- shadow.outputConnection.connect(__input.connection);
277
- }
278
- }, 100, _input);
250
+ input.fieldRow[0].setValue(this.attributes_[i]);
279
251
  }
280
- }
281
252
 
253
+ setTimeout(__input => {
254
+ if (!__input.connection.isConnected()) {
255
+ const _shadow = workspace.newBlock('text');
256
+ _shadow.setShadow(true);
257
+ _shadow.initSvg();
258
+ _shadow.render();
259
+ _shadow.outputConnection.connect(__input.connection);
260
+ }
261
+ }, 100, input);
262
+ }
282
263
  // Remove deleted inputs.
283
- const blocks = [];
284
- while (_input = this.getInput('ARG' + i)) {
285
- const b = _input.connection.targetBlock();
286
- if (b && b.isShadow()) {
287
- blocks.push(b);
288
- }
264
+ for (let i = this.itemCount_; this.getInput('ARG' + i); i++) {
289
265
  this.removeInput('ARG' + i);
290
- i++;
291
266
  }
292
267
 
293
- if (blocks.length) {
294
- const ws = this.workspace;
295
- setTimeout(() => {
296
- for (let b = 0; b < blocks.length; b++) {
297
- ws.removeTopBlock(blocks[b]);
298
- }
299
- }, 100);
268
+ if (withStatement === undefined) {
269
+ withStatement = this.getFieldValue('WITH_STATEMENT');
270
+ withStatement = withStatement === true || withStatement === 'true' || withStatement === 'TRUE';
300
271
  }
301
272
 
273
+ this.getInput('STATEMENT') && this.removeInput('STATEMENT');
274
+
302
275
  // Add or remove a statement Input.
303
276
  if (withStatement) {
304
277
  this.appendStatementInput('STATEMENT');
@@ -312,44 +285,56 @@ Blockly.JavaScript.forBlock['sendto_custom'] = function (block) {
312
285
  const command = block.getFieldValue('COMMAND');
313
286
  const withStatement = block.getFieldValue('WITH_STATEMENT');
314
287
  const args = [];
315
- let logText;
316
- if (logLevel) {
317
- logText = 'console.' + logLevel + '("' + instance + ': " + "' + (args.length ? args.join(',') + '\n' : '') + '");\n'
318
- } else {
319
- logText = '';
320
- }
288
+
289
+ let logText = '';
290
+
321
291
  let statement;
322
292
  if (withStatement === true || withStatement === 'true' || withStatement === 'TRUE') {
323
293
  statement = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
324
294
  }
325
295
 
326
296
  for (let n = 0; n < block.itemCount_; n++) {
327
- const input = this.getInput('ARG' + n);
297
+ const name = String(block.attributes_[n]);
328
298
  let val = Blockly.JavaScript.valueToCode(block, 'ARG' + n, Blockly.JavaScript.ORDER_COMMA);
329
- // if JSON
330
- if (val && val[0] === "'" && val[1] === '{') {
299
+
300
+ // if JSON (or object), remove quotes '{ bla: true }' -> { bla: true }
301
+ if (val && val.startsWith(`'{`) && val.endsWith(`}'`)) {
331
302
  val = val.substring(1, val.length - 1);
332
303
  }
333
- args.push(`'${input.fieldRow[0].getValue()}': ${val}`);
334
304
 
335
- if (block.itemCount_ === 1 && !input.fieldRow[0].getValue()) {
305
+ if (block.itemCount_ === 1 && !name) {
306
+ if (logLevel) {
307
+ logText = `console.${logLevel}('sendTo[custom] ${instance}: ' + ${val});\n`;
308
+ }
309
+
336
310
  if (statement) {
337
311
  return `sendTo('${instance}', '${command}', ${val}, async (result) => {\n` +
338
312
  statement +
339
- '});\n' + logText;
340
- } else {
341
- return `sendTo('${instance}', '${command}', ${val});\n` + logText;
313
+ `});\n${logText}`;
342
314
  }
315
+
316
+ return `sendTo('${instance}', '${command}', ${val});\n${logText}`;
317
+ } else {
318
+ args.push({
319
+ attr: name.replaceAll(`'`, `\\'`),
320
+ val,
321
+ });
343
322
  }
344
323
  }
345
324
 
325
+ const argStr = (args.length ? args.map(a => Blockly.JavaScript.prefixLines(`'${a.attr}': ${a.val},`, Blockly.JavaScript.INDENT)).join('\n') : '');
326
+
327
+ if (logLevel) {
328
+ logText = `console.${logLevel}('sendTo[custom] ${instance}: ${args.length ? args.map(a => `${a.attr}: ' + ${a.val} + '`).join(', ') : '[no args]'}');\n`;
329
+ }
330
+
346
331
  if (statement) {
347
- return `sendTo('${instance}', '${command}', { ${args.length ? args.join(', ') : ''} }, async (result) => {\n` +
332
+ return `sendTo('${instance}', '${command}', {\n${argStr}\n}, async (result) => {\n` +
348
333
  statement +
349
- '});\n' + logText;
350
- } else {
351
- return `sendTo('${instance}', '${command}', { ${args.length ? args.join(', ') : ''} });\n` + logText;
334
+ `});\n${logText}`;
352
335
  }
336
+
337
+ return `sendTo('${instance}', '${command}', {\n${argStr}\n});\n${logText}`;
353
338
  };
354
339
 
355
340
  // --- sendTo JavaScript --------------------------------------------------
@@ -367,7 +352,7 @@ Blockly.Sendto.blocks['sendto_otherscript'] =
367
352
  '</block>';
368
353
 
369
354
  Blockly.Blocks['sendto_otherscript'] = {
370
- init: function() {
355
+ init: function () {
371
356
  const options = [];
372
357
  if (typeof main !== 'undefined' && main.instances) {
373
358
  for (let i = 0; i < main.instances.length; i++) {
@@ -422,7 +407,7 @@ Blockly.Blocks['sendto_otherscript'] = {
422
407
  },
423
408
  };
424
409
 
425
- Blockly.JavaScript.forBlock['sendto_otherscript'] = function(block) {
410
+ Blockly.JavaScript.forBlock['sendto_otherscript'] = function (block) {
426
411
  const dropdown_instance = block.getFieldValue('INSTANCE');
427
412
  const value_objectid = Blockly.JavaScript.valueToCode(block, 'OID', Blockly.JavaScript.ORDER_ATOMIC);
428
413
  const message = block.getFieldValue('MESSAGE');
@@ -478,7 +463,7 @@ Blockly.Sendto.blocks['sendto_gethistory'] =
478
463
  '</block>';
479
464
 
480
465
  Blockly.Blocks['sendto_gethistory'] = {
481
- init: function() {
466
+ init: function () {
482
467
  const options = [
483
468
  ['default', 'default']
484
469
  ];
@@ -551,7 +536,7 @@ Blockly.Blocks['sendto_gethistory'] = {
551
536
  },
552
537
  };
553
538
 
554
- Blockly.JavaScript.forBlock['sendto_gethistory'] = function(block) {
539
+ Blockly.JavaScript.forBlock['sendto_gethistory'] = function (block) {
555
540
  const dropdown_instance = block.getFieldValue('INSTANCE');
556
541
  const value_objectid = Blockly.JavaScript.valueToCode(block, 'OID', Blockly.JavaScript.ORDER_ATOMIC);
557
542
  const start = Blockly.JavaScript.valueToCode(block, 'START', Blockly.JavaScript.ORDER_ATOMIC);
@@ -3,7 +3,7 @@
3
3
  // Many thanks to Florian Pechwitz <florian.Pechwitz@itizzimo.com> for the code
4
4
 
5
5
  Blockly.Blocks['logic_switch_case'] = {
6
- init: function() {
6
+ init: function () {
7
7
  this.setColour('%{BKY_LOGIC_HUE}');
8
8
  this.setPreviousStatement(true);
9
9
  this.setNextStatement(true);
@@ -36,7 +36,7 @@ Blockly.Blocks['logic_switch_case'] = {
36
36
  return container;
37
37
  },
38
38
 
39
- domToMutation: function(xmlElement) {
39
+ domToMutation: function (xmlElement) {
40
40
  this.caseCount_ = parseInt(xmlElement.getAttribute('case'), 10);
41
41
  this.defaultCount_ = parseInt(xmlElement.getAttribute('default'), 10);
42
42
 
@@ -53,7 +53,7 @@ Blockly.Blocks['logic_switch_case'] = {
53
53
  }
54
54
  },
55
55
 
56
- decompose: function(workspace) {
56
+ decompose: function (workspace) {
57
57
  const containerBlock = workspace.newBlock('control_case');//Blockly.Block.obtain(workspace, 'control_case');
58
58
  containerBlock.initSvg();
59
59
 
@@ -75,7 +75,7 @@ Blockly.Blocks['logic_switch_case'] = {
75
75
  return containerBlock;
76
76
  },
77
77
 
78
- compose: function(containerBlock) {
78
+ compose: function (containerBlock) {
79
79
  //Disconnect all input blocks and remove all inputs.
80
80
  if (this.defaultCount_) {
81
81
  this.removeInput('ONDEFAULT');
@@ -129,7 +129,7 @@ Blockly.Blocks['logic_switch_case'] = {
129
129
  }
130
130
  },
131
131
 
132
- saveConnections: function(containerBlock) {
132
+ saveConnections: function (containerBlock) {
133
133
  let caseBlock = containerBlock.getInputTargetBlock('STACK');
134
134
  let x = 1;
135
135
  while (caseBlock) {
@@ -155,7 +155,7 @@ Blockly.Blocks['logic_switch_case'] = {
155
155
  };
156
156
 
157
157
  Blockly.Blocks['control_case'] = {
158
- init: function() {
158
+ init: function () {
159
159
  this.setColour('%{BKY_LOGIC_HUE}');
160
160
  this.appendDummyInput()
161
161
  .appendField(Blockly.Translate('logic_switch_case_is'));
@@ -166,7 +166,7 @@ Blockly.Blocks['control_case'] = {
166
166
  };
167
167
 
168
168
  Blockly.Blocks['case_incaseof'] = {
169
- init: function() {
169
+ init: function () {
170
170
  this.setColour('%{BKY_LOGIC_HUE}');
171
171
  this.appendDummyInput()
172
172
  .appendField(Blockly.Translate('logic_switch_case_of'));
@@ -178,7 +178,7 @@ Blockly.Blocks['case_incaseof'] = {
178
178
  };
179
179
 
180
180
  Blockly.Blocks['case_default'] = {
181
- init: function() {
181
+ init: function () {
182
182
  this.setColour('%{BKY_LOGIC_HUE}');
183
183
  this.appendDummyInput()
184
184
  .appendField('default');