iobroker.javascript 7.0.7 → 7.0.10
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 +6 -12
- package/admin/asset-manifest.json +7 -7
- package/admin/google-blockly/blockly_compressed.js +1469 -1704
- package/admin/google-blockly/blocks_compressed.js +164 -218
- package/admin/google-blockly/javascript_compressed.js +100 -328
- package/admin/google-blockly/msg/js/de.js +64 -70
- package/admin/google-blockly/msg/js/en.js +14 -20
- package/admin/google-blockly/msg/js/es.js +39 -45
- package/admin/google-blockly/msg/js/fr.js +59 -65
- package/admin/google-blockly/msg/js/it.js +19 -25
- package/admin/google-blockly/msg/js/nl.js +55 -61
- package/admin/google-blockly/msg/js/pl.js +46 -52
- package/admin/google-blockly/msg/js/pt.js +30 -36
- package/admin/google-blockly/msg/js/ru.js +41 -47
- package/admin/google-blockly/msg/js/uk.js +13 -17
- package/admin/google-blockly/msg/js/zh-cn.js +86 -92
- package/admin/google-blockly/own/blocks_action.js +4 -4
- package/admin/google-blockly/own/blocks_logic.js +2 -2
- package/admin/google-blockly/own/blocks_procedures.js +63 -62
- package/admin/google-blockly/own/blocks_sendto.js +62 -60
- package/admin/google-blockly/own/blocks_switch.js +40 -29
- package/admin/google-blockly/own/blocks_system.js +109 -170
- package/admin/google-blockly/own/blocks_time.js +35 -35
- package/admin/google-blockly/own/blocks_timeout.js +42 -42
- package/admin/google-blockly/own/blocks_trigger.js +51 -68
- package/admin/google-blockly/own/blocks_words.js +12 -8
- package/admin/google-blockly/own/field_cron.js +189 -139
- package/admin/google-blockly/own/field_oid.js +250 -170
- package/admin/google-blockly/own/field_script.js +168 -122
- package/admin/static/js/{565.643198c0.chunk.js → 569.e2b427a7.chunk.js} +2 -2
- package/admin/static/js/569.e2b427a7.chunk.js.map +1 -0
- package/admin/static/js/759.7f25ba6c.chunk.js.map +1 -1
- package/admin/static/js/98.eee0c52f.chunk.js +2 -0
- package/admin/static/js/98.eee0c52f.chunk.js.map +1 -0
- package/admin/static/js/{main.d86fb9de.js → main.d5dc2784.js} +2 -2
- package/admin/static/js/{main.d86fb9de.js.map → main.d5dc2784.js.map} +1 -1
- package/admin/tab.html +1 -1
- package/io-package.json +27 -27
- package/package.json +1 -1
- package/admin/static/js/565.643198c0.chunk.js.map +0 -1
- package/admin/static/js/98.f78be4fc.chunk.js +0 -2
- package/admin/static/js/98.f78be4fc.chunk.js.map +0 -1
|
@@ -2,9 +2,20 @@
|
|
|
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
|
+
|
|
5
16
|
Blockly.Blocks['logic_switch_case'] = {
|
|
6
17
|
init: function() {
|
|
7
|
-
this.setColour(
|
|
18
|
+
this.setColour(Blockly.Constants.Logic.HUE);
|
|
8
19
|
this.setPreviousStatement(true);
|
|
9
20
|
this.setNextStatement(true);
|
|
10
21
|
this.appendValueInput('CONDITION')
|
|
@@ -24,7 +35,7 @@ Blockly.Blocks['logic_switch_case'] = {
|
|
|
24
35
|
return null;
|
|
25
36
|
}
|
|
26
37
|
|
|
27
|
-
|
|
38
|
+
const container = document.createElement('mutation');
|
|
28
39
|
|
|
29
40
|
if (this.caseCount_) {
|
|
30
41
|
container.setAttribute('case', this.caseCount_);
|
|
@@ -40,7 +51,7 @@ Blockly.Blocks['logic_switch_case'] = {
|
|
|
40
51
|
this.caseCount_ = parseInt(xmlElement.getAttribute('case'), 10);
|
|
41
52
|
this.defaultCount_ = parseInt(xmlElement.getAttribute('default'), 10);
|
|
42
53
|
|
|
43
|
-
for (
|
|
54
|
+
for (let x = 1; x <= this.caseCount_; x++) {
|
|
44
55
|
this.appendValueInput('CASECONDITION' + x)
|
|
45
56
|
.appendField(Blockly.Translate('logic_switch_case_of'));
|
|
46
57
|
this.appendStatementInput('CASE' + x)
|
|
@@ -54,20 +65,20 @@ Blockly.Blocks['logic_switch_case'] = {
|
|
|
54
65
|
},
|
|
55
66
|
|
|
56
67
|
decompose: function(workspace) {
|
|
57
|
-
|
|
68
|
+
const containerBlock = workspace.newBlock('control_case');//Blockly.Block.obtain(workspace, 'control_case');
|
|
58
69
|
containerBlock.initSvg();
|
|
59
70
|
|
|
60
|
-
|
|
71
|
+
let connection = containerBlock.getInput('STACK').connection;
|
|
61
72
|
|
|
62
|
-
for (
|
|
63
|
-
|
|
73
|
+
for (let x = 1; x <= this.caseCount_; x++) {
|
|
74
|
+
const caseBlock = workspace.newBlock('case_incaseof');//Blockly.Block.obtain(workspace, 'case_incaseof');
|
|
64
75
|
caseBlock.initSvg();
|
|
65
76
|
connection.connect(caseBlock.previousConnection);
|
|
66
77
|
connection = caseBlock.nextConnection;
|
|
67
78
|
}
|
|
68
79
|
|
|
69
80
|
if (this.defaultCount_) {
|
|
70
|
-
|
|
81
|
+
const defaultBlock = workspace.newBlock('case_default');//Blockly.Block.obtain(workspace, 'case_default');
|
|
71
82
|
defaultBlock.initSvg();
|
|
72
83
|
connection.connect(defaultBlock.previousConnection);
|
|
73
84
|
}
|
|
@@ -83,23 +94,23 @@ Blockly.Blocks['logic_switch_case'] = {
|
|
|
83
94
|
|
|
84
95
|
this.defaultCount_ = 0;
|
|
85
96
|
|
|
86
|
-
for (
|
|
97
|
+
for (let x = this.caseCount_; x > 0; x--) {
|
|
87
98
|
this.removeInput('CASECONDITION' + x);
|
|
88
99
|
this.removeInput('CASE' + x);
|
|
89
100
|
}
|
|
90
101
|
|
|
91
102
|
this.caseCount_ = 0;
|
|
92
103
|
|
|
93
|
-
|
|
104
|
+
let caseBlock = containerBlock.getInputTargetBlock('STACK');
|
|
94
105
|
|
|
95
106
|
while (caseBlock) {
|
|
96
107
|
switch(caseBlock.type) {
|
|
97
108
|
case 'case_incaseof':
|
|
98
109
|
this.caseCount_++;
|
|
99
|
-
|
|
110
|
+
const caseconditionInput = this.appendValueInput('CASECONDITION' + this.caseCount_)
|
|
100
111
|
.appendField(Blockly.Translate('logic_switch_case_of'));
|
|
101
112
|
|
|
102
|
-
|
|
113
|
+
const caseInput = this.appendStatementInput('CASE' + this.caseCount_)
|
|
103
114
|
.appendField(Blockly.Translate('logic_switch_do'));
|
|
104
115
|
|
|
105
116
|
if (caseBlock.valueConnection_) {
|
|
@@ -113,7 +124,7 @@ Blockly.Blocks['logic_switch_case'] = {
|
|
|
113
124
|
|
|
114
125
|
case 'case_default':
|
|
115
126
|
this.defaultCount_++;
|
|
116
|
-
|
|
127
|
+
const defaultInput = this.appendStatementInput('ONDEFAULT')
|
|
117
128
|
.appendField('default');
|
|
118
129
|
|
|
119
130
|
if (caseBlock.statementConnection_) {
|
|
@@ -130,19 +141,19 @@ Blockly.Blocks['logic_switch_case'] = {
|
|
|
130
141
|
},
|
|
131
142
|
|
|
132
143
|
saveConnections: function(containerBlock) {
|
|
133
|
-
|
|
134
|
-
|
|
144
|
+
let caseBlock = containerBlock.getInputTargetBlock('STACK');
|
|
145
|
+
let x = 1;
|
|
135
146
|
while (caseBlock) {
|
|
136
147
|
switch (caseBlock.type) {
|
|
137
148
|
case'case_incaseof':
|
|
138
|
-
|
|
139
|
-
|
|
149
|
+
const caseconditionInput = this.getInput('CASECONDITION' + x);
|
|
150
|
+
const caseInput = this.getInput('CASE' + x);
|
|
140
151
|
caseBlock.valueConnection_ = caseconditionInput && caseconditionInput.connection.targetConnection;
|
|
141
152
|
caseBlock.statementConnection_ = caseInput && caseInput.connection.targetConnection;
|
|
142
153
|
x++;
|
|
143
154
|
break;
|
|
144
155
|
case'case_default':
|
|
145
|
-
|
|
156
|
+
const defaultInput = this.getInput('ONDEFAULT');
|
|
146
157
|
caseBlock.satementConnection_ = defaultInput && defaultInput.connection.targetConnection;
|
|
147
158
|
break;
|
|
148
159
|
default:
|
|
@@ -156,7 +167,7 @@ Blockly.Blocks['logic_switch_case'] = {
|
|
|
156
167
|
|
|
157
168
|
Blockly.Blocks['control_case'] = {
|
|
158
169
|
init: function() {
|
|
159
|
-
this.setColour(
|
|
170
|
+
this.setColour(180);
|
|
160
171
|
this.appendDummyInput()
|
|
161
172
|
.appendField(Blockly.Translate('logic_switch_case_is'));
|
|
162
173
|
this.appendStatementInput('STACK');
|
|
@@ -167,7 +178,7 @@ Blockly.Blocks['control_case'] = {
|
|
|
167
178
|
|
|
168
179
|
Blockly.Blocks['case_incaseof'] = {
|
|
169
180
|
init: function() {
|
|
170
|
-
this.setColour(
|
|
181
|
+
this.setColour(180);
|
|
171
182
|
this.appendDummyInput()
|
|
172
183
|
.appendField(Blockly.Translate('logic_switch_case_of'));
|
|
173
184
|
this.setPreviousStatement(true);
|
|
@@ -179,7 +190,7 @@ Blockly.Blocks['case_incaseof'] = {
|
|
|
179
190
|
|
|
180
191
|
Blockly.Blocks['case_default'] = {
|
|
181
192
|
init: function() {
|
|
182
|
-
this.setColour(
|
|
193
|
+
this.setColour(180);
|
|
183
194
|
this.appendDummyInput()
|
|
184
195
|
.appendField('default');
|
|
185
196
|
this.setPreviousStatement(true);
|
|
@@ -190,21 +201,21 @@ Blockly.Blocks['case_default'] = {
|
|
|
190
201
|
};
|
|
191
202
|
|
|
192
203
|
Blockly.JavaScript['logic_switch_case'] = function (block) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
204
|
+
let code = '';
|
|
205
|
+
let do_n;
|
|
206
|
+
let case_n;
|
|
207
|
+
const switchVariable = Blockly.JavaScript.valueToCode(block, 'CONDITION', Blockly.JavaScript.ORDER_NONE) || null;
|
|
197
208
|
|
|
198
209
|
if (switchVariable){
|
|
199
|
-
|
|
210
|
+
const pattern = /^\(?([._$\d\w"?: \(\)])*\)?$/g;
|
|
200
211
|
|
|
201
212
|
if (pattern.test(switchVariable)) { // Check to see if the switch is a kind of variable type
|
|
202
213
|
code = '\nswitch (' + switchVariable + ') {\n';
|
|
203
|
-
|
|
204
|
-
|
|
214
|
+
const case_0 = Blockly.JavaScript.valueToCode(block, 'CASECONDITION0', Blockly.JavaScript.ORDER_NONE) || null;
|
|
215
|
+
const do_0 = Blockly.JavaScript.statementToCode(block, 'CASE0');
|
|
205
216
|
code += '\tcase ' + case_0 + ':\n' + do_0 + '\n\t\tbreak;\n';
|
|
206
217
|
|
|
207
|
-
for (
|
|
218
|
+
for (let n = 1; n <= block.caseCount_; n++) {
|
|
208
219
|
case_n = Blockly.JavaScript.valueToCode(block, 'CASECONDITION' + n,
|
|
209
220
|
Blockly.JavaScript.ORDER_NONE) || null;
|
|
210
221
|
|