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.
- package/README.md +5 -10
- package/admin/asset-manifest.json +7 -7
- package/admin/google-blockly/own/blocks_action.js +29 -30
- package/admin/google-blockly/own/blocks_convert.js +6 -7
- package/admin/google-blockly/own/blocks_logic.js +16 -16
- package/admin/google-blockly/own/blocks_number.js +2 -2
- package/admin/google-blockly/own/blocks_object.js +14 -15
- package/admin/google-blockly/own/blocks_procedures.js +10 -10
- package/admin/google-blockly/own/blocks_sendto.js +104 -119
- package/admin/google-blockly/own/blocks_switch.js +8 -8
- package/admin/google-blockly/own/blocks_system.js +66 -67
- package/admin/google-blockly/own/blocks_text.js +2 -2
- package/admin/google-blockly/own/blocks_time.js +36 -37
- package/admin/google-blockly/own/blocks_timeout.js +20 -21
- package/admin/google-blockly/own/blocks_trigger.js +67 -68
- package/admin/google-blockly/own/field_cron.js +0 -1
- package/admin/google-blockly/own/field_oid.js +0 -1
- package/admin/google-blockly/own/field_script.js +4 -9
- package/admin/static/js/373.50668df1.chunk.js +2 -0
- package/admin/static/js/373.50668df1.chunk.js.map +1 -0
- package/admin/static/js/373.bf884cc8.chunk.js +2 -0
- package/admin/static/js/373.bf884cc8.chunk.js.map +1 -0
- package/admin/static/js/{974.3b53607f.chunk.js → 974.5c28e487.chunk.js} +3 -3
- package/admin/static/js/{974.3b53607f.chunk.js.map → 974.5c28e487.chunk.js.map} +1 -1
- package/admin/static/js/{main.63c641fd.js → main.524b166f.js} +2 -2
- package/admin/static/js/{main.63c641fd.js.map → main.524b166f.js.map} +1 -1
- package/admin/static/js/main.720010c8.js +2 -0
- package/admin/static/js/main.720010c8.js.map +1 -0
- package/admin/static/js/{main.d6499dc8.js → main.c18bdbeb.js} +2 -2
- package/admin/static/js/{main.d6499dc8.js.map → main.c18bdbeb.js.map} +1 -1
- package/admin/tab.html +1 -1
- package/io-package.json +14 -14
- package/package.json +1 -1
- package/admin/static/js/373.242b04f6.chunk.js +0 -2
- package/admin/static/js/373.242b04f6.chunk.js.map +0 -1
- /package/admin/static/js/{974.3b53607f.chunk.js.LICENSE.txt → 974.5c28e487.chunk.js.LICENSE.txt} +0 -0
package/README.md
CHANGED
|
@@ -26,6 +26,11 @@ Executes Javascript, Typescript Scripts.
|
|
|
26
26
|
<!--
|
|
27
27
|
### **WORK IN PROGRESS**
|
|
28
28
|
-->
|
|
29
|
+
### 8.5.1 (2024-06-10)
|
|
30
|
+
|
|
31
|
+
* (klein0r) Added Blockly dark theme
|
|
32
|
+
* (klein0r) Fixed sendTo custom parameters with special chars
|
|
33
|
+
|
|
29
34
|
### 8.5.0 (2024-06-07)
|
|
30
35
|
|
|
31
36
|
* (klein0r) Ack flag on state object has priorty (in setState/setStateDelayed)
|
|
@@ -48,16 +53,6 @@ Executes Javascript, Typescript Scripts.
|
|
|
48
53
|
* (klein0r) Fixed httpPost block
|
|
49
54
|
* (klein0r) Just raise deprecated warnings once per script start/usage
|
|
50
55
|
|
|
51
|
-
### 8.4.0 (2024-05-25)
|
|
52
|
-
|
|
53
|
-
* (klein0r) Added checks/warnings for more incorrect blockly connections
|
|
54
|
-
* (klein0r) Added option to disable certificate validation in httpGet
|
|
55
|
-
* (klein0r) Added expire option to Blockly block
|
|
56
|
-
* (klein0r) Fixed variables.astro times when date is not available
|
|
57
|
-
* (klein0r) Fixed jsonConfig for libraries and library typings
|
|
58
|
-
* (klein0r) Implemented new js-controller 6.x functions for package handling
|
|
59
|
-
* (klein0r) Updated to ChatGPT-4o
|
|
60
|
-
|
|
61
56
|
## License
|
|
62
57
|
The MIT License (MIT)
|
|
63
58
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": {
|
|
3
|
-
"main.js": "/static/js/main.
|
|
3
|
+
"main.js": "/static/js/main.524b166f.js",
|
|
4
4
|
"static/css/373.d5afd7f9.chunk.css": "/static/css/373.d5afd7f9.chunk.css",
|
|
5
|
-
"static/js/373.
|
|
5
|
+
"static/js/373.bf884cc8.chunk.js": "/static/js/373.bf884cc8.chunk.js",
|
|
6
6
|
"static/js/498.660757a3.chunk.js": "/static/js/498.660757a3.chunk.js",
|
|
7
7
|
"static/js/30.0d37e3aa.chunk.js": "/static/js/30.0d37e3aa.chunk.js",
|
|
8
8
|
"static/js/704.6e463396.chunk.js": "/static/js/704.6e463396.chunk.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"static/js/26.b29c3dcd.chunk.js": "/static/js/26.b29c3dcd.chunk.js",
|
|
31
31
|
"static/js/625.917d372e.chunk.js": "/static/js/625.917d372e.chunk.js",
|
|
32
32
|
"static/js/9.1974e3b5.chunk.js": "/static/js/9.1974e3b5.chunk.js",
|
|
33
|
-
"static/js/974.
|
|
33
|
+
"static/js/974.5c28e487.chunk.js": "/static/js/974.5c28e487.chunk.js",
|
|
34
34
|
"static/media/tileRules.png": "/static/media/tileRules.7ed5885a66686cc288b1.png",
|
|
35
35
|
"static/media/docs.md": "/static/media/docs.c82b29d10f8276da4eeb.md",
|
|
36
36
|
"static/media/back.jpg": "/static/media/back.bda2bbe51be338a0f657.jpg",
|
|
@@ -160,9 +160,9 @@
|
|
|
160
160
|
"static/media/Garage Doors.svg": "/static/media/Garage Doors.0c2a1cfca7ad1ea59625.svg",
|
|
161
161
|
"static/media/Outdoor Blinds.svg": "/static/media/Outdoor Blinds.37b85a9c060a4af48da9.svg",
|
|
162
162
|
"static/media/Upstairs.svg": "/static/media/Upstairs.441813e54e0daca0882d.svg",
|
|
163
|
-
"main.
|
|
163
|
+
"main.524b166f.js.map": "/static/js/main.524b166f.js.map",
|
|
164
164
|
"373.d5afd7f9.chunk.css.map": "/static/css/373.d5afd7f9.chunk.css.map",
|
|
165
|
-
"373.
|
|
165
|
+
"373.bf884cc8.chunk.js.map": "/static/js/373.bf884cc8.chunk.js.map",
|
|
166
166
|
"498.660757a3.chunk.js.map": "/static/js/498.660757a3.chunk.js.map",
|
|
167
167
|
"30.0d37e3aa.chunk.js.map": "/static/js/30.0d37e3aa.chunk.js.map",
|
|
168
168
|
"704.6e463396.chunk.js.map": "/static/js/704.6e463396.chunk.js.map",
|
|
@@ -190,9 +190,9 @@
|
|
|
190
190
|
"26.b29c3dcd.chunk.js.map": "/static/js/26.b29c3dcd.chunk.js.map",
|
|
191
191
|
"625.917d372e.chunk.js.map": "/static/js/625.917d372e.chunk.js.map",
|
|
192
192
|
"9.1974e3b5.chunk.js.map": "/static/js/9.1974e3b5.chunk.js.map",
|
|
193
|
-
"974.
|
|
193
|
+
"974.5c28e487.chunk.js.map": "/static/js/974.5c28e487.chunk.js.map"
|
|
194
194
|
},
|
|
195
195
|
"entrypoints": [
|
|
196
|
-
"static/js/main.
|
|
196
|
+
"static/js/main.524b166f.js"
|
|
197
197
|
]
|
|
198
198
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
if (typeof goog !== 'undefined') {
|
|
4
4
|
goog.provide('Blockly.JavaScript.Action');
|
|
5
|
-
|
|
6
5
|
goog.require('Blockly.JavaScript');
|
|
7
6
|
}
|
|
8
7
|
|
|
@@ -29,7 +28,7 @@ Blockly.Action.blocks['exec'] =
|
|
|
29
28
|
'</block>';
|
|
30
29
|
|
|
31
30
|
Blockly.Blocks['exec'] = {
|
|
32
|
-
init: function() {
|
|
31
|
+
init: function () {
|
|
33
32
|
this.appendDummyInput('TEXT')
|
|
34
33
|
.appendField('» ' + Blockly.Translate('exec'));
|
|
35
34
|
|
|
@@ -60,7 +59,7 @@ Blockly.Blocks['exec'] = {
|
|
|
60
59
|
this.setTooltip(Blockly.Translate('exec_tooltip'));
|
|
61
60
|
this.setHelpUrl(getHelp('exec_help'));
|
|
62
61
|
},
|
|
63
|
-
mutationToDom: function() {
|
|
62
|
+
mutationToDom: function () {
|
|
64
63
|
const container = document.createElement('mutation');
|
|
65
64
|
const option = this.getFieldValue('WITH_STATEMENT');
|
|
66
65
|
|
|
@@ -68,12 +67,12 @@ Blockly.Blocks['exec'] = {
|
|
|
68
67
|
|
|
69
68
|
return container;
|
|
70
69
|
},
|
|
71
|
-
domToMutation: function(xmlElement) {
|
|
70
|
+
domToMutation: function (xmlElement) {
|
|
72
71
|
const option = xmlElement.getAttribute('with_statement');
|
|
73
72
|
|
|
74
73
|
this.updateShape_(option === true || option === 'true' || option === 'TRUE');
|
|
75
74
|
},
|
|
76
|
-
updateShape_: function(withStatement) {
|
|
75
|
+
updateShape_: function (withStatement) {
|
|
77
76
|
// Add or remove a statement Input.
|
|
78
77
|
const inputExists = this.getInput('STATEMENT');
|
|
79
78
|
|
|
@@ -87,7 +86,7 @@ Blockly.Blocks['exec'] = {
|
|
|
87
86
|
},
|
|
88
87
|
};
|
|
89
88
|
|
|
90
|
-
Blockly.JavaScript.forBlock['exec'] = function(block) {
|
|
89
|
+
Blockly.JavaScript.forBlock['exec'] = function (block) {
|
|
91
90
|
const value_command = Blockly.JavaScript.valueToCode(block, 'COMMAND', Blockly.JavaScript.ORDER_ATOMIC);
|
|
92
91
|
const logLevel = block.getFieldValue('LOG');
|
|
93
92
|
const withStatement = block.getFieldValue('WITH_STATEMENT');
|
|
@@ -120,7 +119,7 @@ Blockly.Blocks['exec_result'] = {
|
|
|
120
119
|
* Block for conditionally returning a value from a procedure.
|
|
121
120
|
* @this Blockly.Block
|
|
122
121
|
*/
|
|
123
|
-
init: function() {
|
|
122
|
+
init: function () {
|
|
124
123
|
this.appendDummyInput()
|
|
125
124
|
.appendField('»');
|
|
126
125
|
|
|
@@ -143,7 +142,7 @@ Blockly.Blocks['exec_result'] = {
|
|
|
143
142
|
* @param {!Blockly.Events.Abstract} e Change event.
|
|
144
143
|
* @this Blockly.Block
|
|
145
144
|
*/
|
|
146
|
-
onchange: function(e) {
|
|
145
|
+
onchange: function (e) {
|
|
147
146
|
let legal = false;
|
|
148
147
|
// Is the block nested in an exec?
|
|
149
148
|
let block = this;
|
|
@@ -168,7 +167,7 @@ Blockly.Blocks['exec_result'] = {
|
|
|
168
167
|
*/
|
|
169
168
|
FUNCTION_TYPES: ['exec'],
|
|
170
169
|
};
|
|
171
|
-
Blockly.JavaScript.forBlock['exec_result'] = function(block) {
|
|
170
|
+
Blockly.JavaScript.forBlock['exec_result'] = function (block) {
|
|
172
171
|
const attr = block.getFieldValue('ATTR');
|
|
173
172
|
|
|
174
173
|
return [attr, Blockly.JavaScript.ORDER_ATOMIC];
|
|
@@ -188,7 +187,7 @@ Blockly.Action.blocks['http_get'] =
|
|
|
188
187
|
'</block>';
|
|
189
188
|
|
|
190
189
|
Blockly.Blocks['http_get'] = {
|
|
191
|
-
init: function() {
|
|
190
|
+
init: function () {
|
|
192
191
|
this.appendValueInput('URL')
|
|
193
192
|
.appendField('🌐 ' + Blockly.Translate('http_get'));
|
|
194
193
|
|
|
@@ -203,7 +202,7 @@ Blockly.Blocks['http_get'] = {
|
|
|
203
202
|
this.appendDummyInput('TYPE')
|
|
204
203
|
.appendField(Blockly.Translate('http_type'))
|
|
205
204
|
.appendField(new Blockly.FieldDropdown([
|
|
206
|
-
[Blockly.Translate('http_type_text'),
|
|
205
|
+
[Blockly.Translate('http_type_text'), 'text'],
|
|
207
206
|
[Blockly.Translate('http_type_arraybuffer'), 'arraybuffer'],
|
|
208
207
|
]), 'TYPE');
|
|
209
208
|
|
|
@@ -220,7 +219,7 @@ Blockly.Blocks['http_get'] = {
|
|
|
220
219
|
},
|
|
221
220
|
};
|
|
222
221
|
|
|
223
|
-
Blockly.JavaScript.forBlock['http_get'] = function(block) {
|
|
222
|
+
Blockly.JavaScript.forBlock['http_get'] = function (block) {
|
|
224
223
|
const URL = Blockly.JavaScript.valueToCode(block, 'URL', Blockly.JavaScript.ORDER_ATOMIC);
|
|
225
224
|
const statement = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
|
|
226
225
|
const unit = block.getFieldValue('UNIT');
|
|
@@ -259,7 +258,7 @@ Blockly.Action.blocks['http_post'] =
|
|
|
259
258
|
'</block>';
|
|
260
259
|
|
|
261
260
|
Blockly.Blocks['http_post'] = {
|
|
262
|
-
init: function() {
|
|
261
|
+
init: function () {
|
|
263
262
|
this.appendValueInput('URL')
|
|
264
263
|
.appendField('🌐 ' + Blockly.Translate('http_post'));
|
|
265
264
|
|
|
@@ -274,7 +273,7 @@ Blockly.Blocks['http_post'] = {
|
|
|
274
273
|
this.appendDummyInput('TYPE')
|
|
275
274
|
.appendField(Blockly.Translate('http_type'))
|
|
276
275
|
.appendField(new Blockly.FieldDropdown([
|
|
277
|
-
[Blockly.Translate('http_type_text'),
|
|
276
|
+
[Blockly.Translate('http_type_text'), 'text'],
|
|
278
277
|
[Blockly.Translate('http_type_arraybuffer'), 'arraybuffer'],
|
|
279
278
|
]), 'TYPE');
|
|
280
279
|
|
|
@@ -294,7 +293,7 @@ Blockly.Blocks['http_post'] = {
|
|
|
294
293
|
},
|
|
295
294
|
};
|
|
296
295
|
|
|
297
|
-
Blockly.JavaScript.forBlock['http_post'] = function(block) {
|
|
296
|
+
Blockly.JavaScript.forBlock['http_post'] = function (block) {
|
|
298
297
|
const URL = Blockly.JavaScript.valueToCode(block, 'URL', Blockly.JavaScript.ORDER_ATOMIC);
|
|
299
298
|
const statement = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
|
|
300
299
|
const unit = block.getFieldValue('UNIT');
|
|
@@ -333,7 +332,7 @@ Blockly.Blocks['http_response'] = {
|
|
|
333
332
|
* Block for conditionally returning a value from a procedure.
|
|
334
333
|
* @this Blockly.Block
|
|
335
334
|
*/
|
|
336
|
-
init: function() {
|
|
335
|
+
init: function () {
|
|
337
336
|
this.appendDummyInput()
|
|
338
337
|
.appendField('🌐');
|
|
339
338
|
|
|
@@ -357,7 +356,7 @@ Blockly.Blocks['http_response'] = {
|
|
|
357
356
|
* @param {!Blockly.Events.Abstract} e Change event.
|
|
358
357
|
* @this Blockly.Block
|
|
359
358
|
*/
|
|
360
|
-
onchange: function(e) {
|
|
359
|
+
onchange: function (e) {
|
|
361
360
|
let legal = false;
|
|
362
361
|
// Is the block nested in a trigger?
|
|
363
362
|
let block = this;
|
|
@@ -382,7 +381,7 @@ Blockly.Blocks['http_response'] = {
|
|
|
382
381
|
*/
|
|
383
382
|
FUNCTION_TYPES: ['http_get', 'http_post'],
|
|
384
383
|
};
|
|
385
|
-
Blockly.JavaScript.forBlock['http_response'] = function(block) {
|
|
384
|
+
Blockly.JavaScript.forBlock['http_response'] = function (block) {
|
|
386
385
|
const attr = block.getFieldValue('ATTR');
|
|
387
386
|
|
|
388
387
|
return [attr, Blockly.JavaScript.ORDER_ATOMIC];
|
|
@@ -404,7 +403,7 @@ Blockly.Action.blocks['file_write'] =
|
|
|
404
403
|
'</block>';
|
|
405
404
|
|
|
406
405
|
Blockly.Blocks['file_write'] = {
|
|
407
|
-
init: function() {
|
|
406
|
+
init: function () {
|
|
408
407
|
this.appendValueInput('OID')
|
|
409
408
|
.appendField('📁 ' + Blockly.Translate('file_write'));
|
|
410
409
|
|
|
@@ -425,7 +424,7 @@ Blockly.Blocks['file_write'] = {
|
|
|
425
424
|
},
|
|
426
425
|
};
|
|
427
426
|
|
|
428
|
-
Blockly.JavaScript.forBlock['file_write'] = function(block) {
|
|
427
|
+
Blockly.JavaScript.forBlock['file_write'] = function (block) {
|
|
429
428
|
const value_objectid = Blockly.JavaScript.valueToCode(block, 'OID', Blockly.JavaScript.ORDER_ATOMIC);
|
|
430
429
|
const file = Blockly.JavaScript.valueToCode(block, 'FILE', Blockly.JavaScript.ORDER_ATOMIC);
|
|
431
430
|
const data = Blockly.JavaScript.valueToCode(block, 'DATA', Blockly.JavaScript.ORDER_ATOMIC);
|
|
@@ -464,7 +463,7 @@ Blockly.Action.blocks['file_read'] =
|
|
|
464
463
|
'</block>';
|
|
465
464
|
|
|
466
465
|
Blockly.Blocks['file_read'] = {
|
|
467
|
-
init: function() {
|
|
466
|
+
init: function () {
|
|
468
467
|
this.appendValueInput('OID')
|
|
469
468
|
.appendField('📁 ' + Blockly.Translate('file_read'));
|
|
470
469
|
|
|
@@ -485,7 +484,7 @@ Blockly.Blocks['file_read'] = {
|
|
|
485
484
|
},
|
|
486
485
|
};
|
|
487
486
|
|
|
488
|
-
Blockly.JavaScript.forBlock['file_read'] = function(block) {
|
|
487
|
+
Blockly.JavaScript.forBlock['file_read'] = function (block) {
|
|
489
488
|
const value_objectid = Blockly.JavaScript.valueToCode(block, 'OID', Blockly.JavaScript.ORDER_ATOMIC);
|
|
490
489
|
const file = Blockly.JavaScript.valueToCode(block, 'FILE', Blockly.JavaScript.ORDER_ATOMIC);
|
|
491
490
|
const statement = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
|
|
@@ -520,7 +519,7 @@ Blockly.Blocks['file_data'] = {
|
|
|
520
519
|
* Block for conditionally returning a value from a procedure.
|
|
521
520
|
* @this Blockly.Block
|
|
522
521
|
*/
|
|
523
|
-
init: function() {
|
|
522
|
+
init: function () {
|
|
524
523
|
this.appendDummyInput()
|
|
525
524
|
.appendField('📁');
|
|
526
525
|
|
|
@@ -542,7 +541,7 @@ Blockly.Blocks['file_data'] = {
|
|
|
542
541
|
* @param {!Blockly.Events.Abstract} e Change event.
|
|
543
542
|
* @this Blockly.Block
|
|
544
543
|
*/
|
|
545
|
-
onchange: function(e) {
|
|
544
|
+
onchange: function (e) {
|
|
546
545
|
let legal = false;
|
|
547
546
|
// Is the block nested in a trigger?
|
|
548
547
|
let block = this;
|
|
@@ -567,7 +566,7 @@ Blockly.Blocks['file_data'] = {
|
|
|
567
566
|
*/
|
|
568
567
|
FUNCTION_TYPES: ['file_read'],
|
|
569
568
|
};
|
|
570
|
-
Blockly.JavaScript.forBlock['file_data'] = function(block) {
|
|
569
|
+
Blockly.JavaScript.forBlock['file_data'] = function (block) {
|
|
571
570
|
const attr = block.getFieldValue('ATTR');
|
|
572
571
|
|
|
573
572
|
return [attr, Blockly.JavaScript.ORDER_ATOMIC];
|
|
@@ -587,7 +586,7 @@ Blockly.Action.blocks['request'] =
|
|
|
587
586
|
'</block>';
|
|
588
587
|
|
|
589
588
|
Blockly.Blocks['request'] = {
|
|
590
|
-
init: function() {
|
|
589
|
+
init: function () {
|
|
591
590
|
this.appendDummyInput('TEXT')
|
|
592
591
|
.appendField(Blockly.Translate('request'));
|
|
593
592
|
|
|
@@ -618,7 +617,7 @@ Blockly.Blocks['request'] = {
|
|
|
618
617
|
this.setTooltip(Blockly.Translate('request_tooltip'));
|
|
619
618
|
this.setHelpUrl(Blockly.Translate('request_help'));
|
|
620
619
|
},
|
|
621
|
-
mutationToDom: function() {
|
|
620
|
+
mutationToDom: function () {
|
|
622
621
|
const container = document.createElement('mutation');
|
|
623
622
|
const withStatement = this.getFieldValue('WITH_STATEMENT');
|
|
624
623
|
|
|
@@ -626,12 +625,12 @@ Blockly.Blocks['request'] = {
|
|
|
626
625
|
|
|
627
626
|
return container;
|
|
628
627
|
},
|
|
629
|
-
domToMutation: function(xmlElement) {
|
|
628
|
+
domToMutation: function (xmlElement) {
|
|
630
629
|
const option = xmlElement.getAttribute('with_statement');
|
|
631
630
|
|
|
632
631
|
this.updateShape_(option === true || option === 'true' || option === 'TRUE');
|
|
633
632
|
},
|
|
634
|
-
updateShape_: function(withStatement) {
|
|
633
|
+
updateShape_: function (withStatement) {
|
|
635
634
|
// Add or remove a statement Input.
|
|
636
635
|
const inputExists = this.getInput('STATEMENT');
|
|
637
636
|
|
|
@@ -645,7 +644,7 @@ Blockly.Blocks['request'] = {
|
|
|
645
644
|
},
|
|
646
645
|
};
|
|
647
646
|
|
|
648
|
-
Blockly.JavaScript.forBlock['request'] = function(block) {
|
|
647
|
+
Blockly.JavaScript.forBlock['request'] = function (block) {
|
|
649
648
|
const logLevel = block.getFieldValue('LOG');
|
|
650
649
|
const URL = Blockly.JavaScript.valueToCode(block, 'URL', Blockly.JavaScript.ORDER_ATOMIC);
|
|
651
650
|
const withStatement = block.getFieldValue('WITH_STATEMENT');
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
if (typeof goog !== 'undefined') {
|
|
4
4
|
goog.provide('Blockly.JavaScript.Convert');
|
|
5
|
-
|
|
6
5
|
goog.require('Blockly.JavaScript');
|
|
7
6
|
}
|
|
8
7
|
|
|
@@ -181,7 +180,7 @@ Blockly.Blocks.convert_from_date = {
|
|
|
181
180
|
this.setOutput(true);
|
|
182
181
|
this.setTooltip(Blockly.Translate('convert_from_date_tooltip'));
|
|
183
182
|
},
|
|
184
|
-
mutationToDom: function() {
|
|
183
|
+
mutationToDom: function () {
|
|
185
184
|
const container = document.createElement('mutation');
|
|
186
185
|
const option = this.getFieldValue('OPTION');
|
|
187
186
|
|
|
@@ -190,13 +189,13 @@ Blockly.Blocks.convert_from_date = {
|
|
|
190
189
|
|
|
191
190
|
return container;
|
|
192
191
|
},
|
|
193
|
-
domToMutation: function(xmlElement) {
|
|
192
|
+
domToMutation: function (xmlElement) {
|
|
194
193
|
const format = xmlElement.getAttribute('format');
|
|
195
194
|
const language = xmlElement.getAttribute('language');
|
|
196
195
|
|
|
197
196
|
this.updateShape_(format === true || format === 'true' || format === 'TRUE', language === true || language === 'true' || language === 'TRUE');
|
|
198
197
|
},
|
|
199
|
-
updateShape_: function(isFormat, isLanguage) {
|
|
198
|
+
updateShape_: function (isFormat, isLanguage) {
|
|
200
199
|
// Add or remove a delay Input.
|
|
201
200
|
let inputExists = this.getInput('FORMAT');
|
|
202
201
|
|
|
@@ -315,7 +314,7 @@ Blockly.Blocks.convert_time_difference = {
|
|
|
315
314
|
this.setOutput(true);
|
|
316
315
|
this.setTooltip(Blockly.Translate('convert_time_difference_tooltip'));
|
|
317
316
|
},
|
|
318
|
-
mutationToDom: function() {
|
|
317
|
+
mutationToDom: function () {
|
|
319
318
|
const container = document.createElement('mutation');
|
|
320
319
|
const option = this.getFieldValue('OPTION');
|
|
321
320
|
|
|
@@ -323,12 +322,12 @@ Blockly.Blocks.convert_time_difference = {
|
|
|
323
322
|
|
|
324
323
|
return container;
|
|
325
324
|
},
|
|
326
|
-
domToMutation: function(xmlElement) {
|
|
325
|
+
domToMutation: function (xmlElement) {
|
|
327
326
|
const format = xmlElement.getAttribute('format');
|
|
328
327
|
|
|
329
328
|
this.updateShape_(format === true || format === 'true' || format === 'TRUE');
|
|
330
329
|
},
|
|
331
|
-
updateShape_: function(isFormat, isLanguage) {
|
|
330
|
+
updateShape_: function (isFormat, isLanguage) {
|
|
332
331
|
let inputExists = this.getInput('FORMAT');
|
|
333
332
|
|
|
334
333
|
if (isFormat) {
|
|
@@ -11,7 +11,7 @@ Blockly.Blocks['logic_multi_and_container'] = {
|
|
|
11
11
|
* Mutator block for container.
|
|
12
12
|
* @this Blockly.Block
|
|
13
13
|
*/
|
|
14
|
-
init: function() {
|
|
14
|
+
init: function () {
|
|
15
15
|
this.setColour("%{BKY_LOGIC_HUE}");
|
|
16
16
|
|
|
17
17
|
this.appendDummyInput()
|
|
@@ -29,7 +29,7 @@ Blockly.Blocks['logic_multi_and_mutator'] = {
|
|
|
29
29
|
* Mutator block for add items.
|
|
30
30
|
* @this Blockly.Block
|
|
31
31
|
*/
|
|
32
|
-
init: function() {
|
|
32
|
+
init: function () {
|
|
33
33
|
this.setColour("%{BKY_LOGIC_HUE}");
|
|
34
34
|
|
|
35
35
|
this.appendDummyInput('AND')
|
|
@@ -45,7 +45,7 @@ Blockly.Blocks['logic_multi_and_mutator'] = {
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
Blockly.Blocks['logic_multi_and'] = {
|
|
48
|
-
init: function() {
|
|
48
|
+
init: function () {
|
|
49
49
|
this.itemCount_ = 2;
|
|
50
50
|
this.setMutator(new Blockly.icons.MutatorIcon(['logic_multi_and_mutator'], this));
|
|
51
51
|
|
|
@@ -135,7 +135,7 @@ Blockly.Blocks['logic_multi_and'] = {
|
|
|
135
135
|
* @param {!Blockly.Block} containerBlock Root block in mutator.
|
|
136
136
|
* @this Blockly.Block
|
|
137
137
|
*/
|
|
138
|
-
saveConnections: function(containerBlock) {
|
|
138
|
+
saveConnections: function (containerBlock) {
|
|
139
139
|
let itemBlock = containerBlock.getInputTargetBlock('STACK');
|
|
140
140
|
let i = 0;
|
|
141
141
|
|
|
@@ -152,7 +152,7 @@ Blockly.Blocks['logic_multi_and'] = {
|
|
|
152
152
|
* @private
|
|
153
153
|
* @this Blockly.Block
|
|
154
154
|
*/
|
|
155
|
-
updateShape_: function() {
|
|
155
|
+
updateShape_: function () {
|
|
156
156
|
// Add new inputs.
|
|
157
157
|
for (let i = 0; i < this.itemCount_; i++) {
|
|
158
158
|
if (!this.getInput('AND' + i)) {
|
|
@@ -169,7 +169,7 @@ Blockly.Blocks['logic_multi_and'] = {
|
|
|
169
169
|
},
|
|
170
170
|
};
|
|
171
171
|
|
|
172
|
-
Blockly.JavaScript.forBlock['logic_multi_and'] = function(block) {
|
|
172
|
+
Blockly.JavaScript.forBlock['logic_multi_and'] = function (block) {
|
|
173
173
|
const ands = [];
|
|
174
174
|
for (let n = 0; n < block.itemCount_; n++) {
|
|
175
175
|
const condition = Blockly.JavaScript.valueToCode(block, 'AND' + n, Blockly.JavaScript.ORDER_ATOMIC);
|
|
@@ -188,7 +188,7 @@ Blockly.Blocks['logic_multi_or_container'] = {
|
|
|
188
188
|
* Mutator block for container.
|
|
189
189
|
* @this Blockly.Block
|
|
190
190
|
*/
|
|
191
|
-
init: function() {
|
|
191
|
+
init: function () {
|
|
192
192
|
this.setColour("%{BKY_LOGIC_HUE}");
|
|
193
193
|
|
|
194
194
|
this.appendDummyInput()
|
|
@@ -206,7 +206,7 @@ Blockly.Blocks['logic_multi_or_mutator'] = {
|
|
|
206
206
|
* Mutator block for add items.
|
|
207
207
|
* @this Blockly.Block
|
|
208
208
|
*/
|
|
209
|
-
init: function() {
|
|
209
|
+
init: function () {
|
|
210
210
|
this.setColour("%{BKY_LOGIC_HUE}");
|
|
211
211
|
|
|
212
212
|
this.appendDummyInput('OR')
|
|
@@ -222,7 +222,7 @@ Blockly.Blocks['logic_multi_or_mutator'] = {
|
|
|
222
222
|
};
|
|
223
223
|
|
|
224
224
|
Blockly.Blocks['logic_multi_or'] = {
|
|
225
|
-
init: function() {
|
|
225
|
+
init: function () {
|
|
226
226
|
this.itemCount_ = 2;
|
|
227
227
|
this.setMutator(new Blockly.icons.MutatorIcon(['logic_multi_or_mutator'], this));
|
|
228
228
|
|
|
@@ -312,7 +312,7 @@ Blockly.Blocks['logic_multi_or'] = {
|
|
|
312
312
|
* @param {!Blockly.Block} containerBlock Root block in mutator.
|
|
313
313
|
* @this Blockly.Block
|
|
314
314
|
*/
|
|
315
|
-
saveConnections: function(containerBlock) {
|
|
315
|
+
saveConnections: function (containerBlock) {
|
|
316
316
|
let itemBlock = containerBlock.getInputTargetBlock('STACK');
|
|
317
317
|
let i = 0;
|
|
318
318
|
|
|
@@ -329,7 +329,7 @@ Blockly.Blocks['logic_multi_or'] = {
|
|
|
329
329
|
* @private
|
|
330
330
|
* @this Blockly.Block
|
|
331
331
|
*/
|
|
332
|
-
updateShape_: function() {
|
|
332
|
+
updateShape_: function () {
|
|
333
333
|
// Add new inputs.
|
|
334
334
|
for (let i = 0; i < this.itemCount_; i++) {
|
|
335
335
|
if (!this.getInput('OR' + i)) {
|
|
@@ -346,7 +346,7 @@ Blockly.Blocks['logic_multi_or'] = {
|
|
|
346
346
|
},
|
|
347
347
|
};
|
|
348
348
|
|
|
349
|
-
Blockly.JavaScript.forBlock['logic_multi_or'] = function(block) {
|
|
349
|
+
Blockly.JavaScript.forBlock['logic_multi_or'] = function (block) {
|
|
350
350
|
const ors = [];
|
|
351
351
|
for (let n = 0; n < block.itemCount_; n++) {
|
|
352
352
|
const condition = Blockly.JavaScript.valueToCode(block, 'OR' + n, Blockly.JavaScript.ORDER_ATOMIC);
|
|
@@ -361,7 +361,7 @@ Blockly.JavaScript.forBlock['logic_multi_or'] = function(block) {
|
|
|
361
361
|
// --- logic between --------------------------------------------------
|
|
362
362
|
|
|
363
363
|
Blockly.Blocks['logic_between'] = {
|
|
364
|
-
init: function() {
|
|
364
|
+
init: function () {
|
|
365
365
|
this.appendValueInput('MIN')
|
|
366
366
|
.setCheck('Number');
|
|
367
367
|
this.appendValueInput('VALUE')
|
|
@@ -379,7 +379,7 @@ Blockly.Blocks['logic_between'] = {
|
|
|
379
379
|
},
|
|
380
380
|
};
|
|
381
381
|
|
|
382
|
-
Blockly.JavaScript.forBlock['logic_between'] = function(block) {
|
|
382
|
+
Blockly.JavaScript.forBlock['logic_between'] = function (block) {
|
|
383
383
|
const min = Blockly.JavaScript.valueToCode(block, 'MIN', Blockly.JavaScript.ORDER_RELATIONAL) || 0;
|
|
384
384
|
const value = Blockly.JavaScript.valueToCode(block, 'VALUE', Blockly.JavaScript.ORDER_RELATIONAL) || 0;
|
|
385
385
|
const max = Blockly.JavaScript.valueToCode(block, 'MAX', Blockly.JavaScript.ORDER_RELATIONAL) || 0;
|
|
@@ -392,7 +392,7 @@ Blockly.JavaScript.forBlock['logic_between'] = function(block) {
|
|
|
392
392
|
// --- logic ifempty --------------------------------------------------
|
|
393
393
|
|
|
394
394
|
Blockly.Blocks['logic_ifempty'] = {
|
|
395
|
-
init: function() {
|
|
395
|
+
init: function () {
|
|
396
396
|
this.appendValueInput('VALUE')
|
|
397
397
|
.setCheck(null)
|
|
398
398
|
.setAlign(Blockly.ALIGN_RIGHT)
|
|
@@ -410,7 +410,7 @@ Blockly.Blocks['logic_ifempty'] = {
|
|
|
410
410
|
},
|
|
411
411
|
};
|
|
412
412
|
|
|
413
|
-
Blockly.JavaScript.forBlock['logic_ifempty'] = function(block) {
|
|
413
|
+
Blockly.JavaScript.forBlock['logic_ifempty'] = function (block) {
|
|
414
414
|
const value = Blockly.JavaScript.valueToCode(block, 'VALUE', Blockly.JavaScript.ORDER_LOGICAL_OR) || null;
|
|
415
415
|
const deflt = Blockly.JavaScript.valueToCode(block, 'DEFLT', Blockly.JavaScript.ORDER_LOGICAL_OR) || null;
|
|
416
416
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// --- Round Number to n decimal places -------------------------------
|
|
4
4
|
|
|
5
5
|
Blockly.Blocks['math_rndfixed'] = {
|
|
6
|
-
init: function() {
|
|
6
|
+
init: function () {
|
|
7
7
|
this.appendValueInput('x')
|
|
8
8
|
.setCheck('Number')
|
|
9
9
|
.appendField(Blockly.Translate('math_rndfixed_round'));
|
|
@@ -18,7 +18,7 @@ Blockly.Blocks['math_rndfixed'] = {
|
|
|
18
18
|
},
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
Blockly.JavaScript.forBlock['math_rndfixed'] = function(block) {
|
|
21
|
+
Blockly.JavaScript.forBlock['math_rndfixed'] = function (block) {
|
|
22
22
|
const x = Blockly.JavaScript.valueToCode(block, 'x', Blockly.JavaScript.ORDER_ATOMIC);
|
|
23
23
|
const exp = Math.pow(10, block.getFieldValue('n'));
|
|
24
24
|
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
if (typeof goog !== 'undefined') {
|
|
4
4
|
goog.provide('Blockly.JavaScript.Object');
|
|
5
|
-
|
|
6
5
|
goog.require('Blockly.JavaScript');
|
|
7
6
|
}
|
|
8
7
|
|
|
@@ -24,7 +23,7 @@ Blockly.Blocks['object_new_container'] = {
|
|
|
24
23
|
* Mutator block for container.
|
|
25
24
|
* @this Blockly.Block
|
|
26
25
|
*/
|
|
27
|
-
init: function() {
|
|
26
|
+
init: function () {
|
|
28
27
|
this.setColour(Blockly.Object.HUE);
|
|
29
28
|
|
|
30
29
|
this.appendDummyInput()
|
|
@@ -42,7 +41,7 @@ Blockly.Blocks['object_new_mutator'] = {
|
|
|
42
41
|
* Mutator block for add items.
|
|
43
42
|
* @this Blockly.Block
|
|
44
43
|
*/
|
|
45
|
-
init: function() {
|
|
44
|
+
init: function () {
|
|
46
45
|
this.setColour(Blockly.Object.HUE);
|
|
47
46
|
|
|
48
47
|
this.appendDummyInput('ATTR')
|
|
@@ -59,7 +58,7 @@ Blockly.Blocks['object_new_mutator'] = {
|
|
|
59
58
|
};
|
|
60
59
|
|
|
61
60
|
Blockly.Blocks['object_new'] = {
|
|
62
|
-
init: function() {
|
|
61
|
+
init: function () {
|
|
63
62
|
this.appendDummyInput('NAME')
|
|
64
63
|
.appendField(Blockly.Translate('object_new'));
|
|
65
64
|
|
|
@@ -174,7 +173,7 @@ Blockly.Blocks['object_new'] = {
|
|
|
174
173
|
* @param {!Blockly.Block} containerBlock Root block in mutator.
|
|
175
174
|
* @this Blockly.Block
|
|
176
175
|
*/
|
|
177
|
-
saveConnections: function(containerBlock) {
|
|
176
|
+
saveConnections: function (containerBlock) {
|
|
178
177
|
let itemBlock = containerBlock.getInputTargetBlock('STACK');
|
|
179
178
|
let i = 0;
|
|
180
179
|
|
|
@@ -191,7 +190,7 @@ Blockly.Blocks['object_new'] = {
|
|
|
191
190
|
* @private
|
|
192
191
|
* @this Blockly.Block
|
|
193
192
|
*/
|
|
194
|
-
updateShape_: function() {
|
|
193
|
+
updateShape_: function () {
|
|
195
194
|
const workspace = this.workspace;
|
|
196
195
|
|
|
197
196
|
// Add new inputs.
|
|
@@ -222,7 +221,7 @@ Blockly.Blocks['object_new'] = {
|
|
|
222
221
|
},
|
|
223
222
|
};
|
|
224
223
|
|
|
225
|
-
Blockly.JavaScript.forBlock['object_new'] = function(block) {
|
|
224
|
+
Blockly.JavaScript.forBlock['object_new'] = function (block) {
|
|
226
225
|
const attributes = [];
|
|
227
226
|
for (let n = 0; n < block.itemCount_; n++) {
|
|
228
227
|
const val = Blockly.JavaScript.valueToCode(block, 'ATTR_' + n, Blockly.JavaScript.ORDER_COMMA);
|
|
@@ -246,7 +245,7 @@ Blockly.Object.blocks['object_set_attr'] =
|
|
|
246
245
|
'</block>';
|
|
247
246
|
|
|
248
247
|
Blockly.Blocks['object_set_attr'] = {
|
|
249
|
-
init: function() {
|
|
248
|
+
init: function () {
|
|
250
249
|
this.appendDummyInput('ATTR')
|
|
251
250
|
.appendField(Blockly.Translate('object_set_attr'))
|
|
252
251
|
.appendField(new Blockly.FieldTextInput('attribute1'), 'ATTR');
|
|
@@ -268,7 +267,7 @@ Blockly.Blocks['object_set_attr'] = {
|
|
|
268
267
|
},
|
|
269
268
|
};
|
|
270
269
|
|
|
271
|
-
Blockly.JavaScript.forBlock['object_set_attr'] = function(block) {
|
|
270
|
+
Blockly.JavaScript.forBlock['object_set_attr'] = function (block) {
|
|
272
271
|
let obj = Blockly.JavaScript.valueToCode(block, 'OBJECT', Blockly.JavaScript.ORDER_ATOMIC);
|
|
273
272
|
const attr = block.getFieldValue('ATTR');
|
|
274
273
|
const value = Blockly.JavaScript.valueToCode(block, 'VALUE', Blockly.JavaScript.ORDER_ATOMIC);
|
|
@@ -287,7 +286,7 @@ Blockly.Object.blocks['object_del_attr'] =
|
|
|
287
286
|
'</block>';
|
|
288
287
|
|
|
289
288
|
Blockly.Blocks['object_del_attr'] = {
|
|
290
|
-
init: function() {
|
|
289
|
+
init: function () {
|
|
291
290
|
this.appendDummyInput('ATTR')
|
|
292
291
|
.appendField(Blockly.Translate('object_del_attr'))
|
|
293
292
|
.appendField(new Blockly.FieldTextInput('attribute1'), 'ATTR');
|
|
@@ -305,7 +304,7 @@ Blockly.Blocks['object_del_attr'] = {
|
|
|
305
304
|
},
|
|
306
305
|
};
|
|
307
306
|
|
|
308
|
-
Blockly.JavaScript.forBlock['object_del_attr'] = function(block) {
|
|
307
|
+
Blockly.JavaScript.forBlock['object_del_attr'] = function (block) {
|
|
309
308
|
let obj = Blockly.JavaScript.valueToCode(block, 'OBJECT', Blockly.JavaScript.ORDER_ATOMIC);
|
|
310
309
|
const attr = block.getFieldValue('ATTR');
|
|
311
310
|
|
|
@@ -328,7 +327,7 @@ Blockly.Object.blocks['object_has_attr'] =
|
|
|
328
327
|
'</block>';
|
|
329
328
|
|
|
330
329
|
Blockly.Blocks['object_has_attr'] = {
|
|
331
|
-
init: function() {
|
|
330
|
+
init: function () {
|
|
332
331
|
this.appendValueInput('OBJECT')
|
|
333
332
|
.appendField(Blockly.Translate('object_has_attr'));
|
|
334
333
|
|
|
@@ -345,7 +344,7 @@ Blockly.Blocks['object_has_attr'] = {
|
|
|
345
344
|
}
|
|
346
345
|
};
|
|
347
346
|
|
|
348
|
-
Blockly.JavaScript.forBlock['object_has_attr'] = function(block) {
|
|
347
|
+
Blockly.JavaScript.forBlock['object_has_attr'] = function (block) {
|
|
349
348
|
const obj = Blockly.JavaScript.valueToCode(block, 'OBJECT', Blockly.JavaScript.ORDER_ATOMIC);
|
|
350
349
|
const attr = block.getFieldValue('ATTR');
|
|
351
350
|
|
|
@@ -363,7 +362,7 @@ Blockly.Object.blocks['object_keys'] =
|
|
|
363
362
|
'</block>';
|
|
364
363
|
|
|
365
364
|
Blockly.Blocks['object_keys'] = {
|
|
366
|
-
init: function() {
|
|
365
|
+
init: function () {
|
|
367
366
|
this.appendValueInput('OBJECT')
|
|
368
367
|
.appendField(Blockly.Translate('object_keys'));
|
|
369
368
|
|
|
@@ -376,7 +375,7 @@ Blockly.Blocks['object_keys'] = {
|
|
|
376
375
|
},
|
|
377
376
|
};
|
|
378
377
|
|
|
379
|
-
Blockly.JavaScript.forBlock['object_keys'] = function(block) {
|
|
378
|
+
Blockly.JavaScript.forBlock['object_keys'] = function (block) {
|
|
380
379
|
let obj = Blockly.JavaScript.valueToCode(block, 'OBJECT', Blockly.JavaScript.ORDER_ATOMIC);
|
|
381
380
|
|
|
382
381
|
if (!obj) {
|