Skip to content

Commit 88178b8

Browse files
committed
### 4.6.5 (2020-05-16)
* (bluefox) Fixed blockly blocks because of deprecated functions
1 parent 92c428c commit 88178b8

21 files changed

+175
-105
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ And then call "npm run build".
3333
- ...
3434

3535
## Changelog
36+
### 4.6.5 (2020-05-16)
37+
* (bluefox) Fixed blockly blocks because of deprecated functions
3638

3739
### 4.6.4 (2020-05-15)
3840
* (bluefox) Corrected block: request, exec

admin/asset-manifest.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
{
22
"files": {
33
"main.css": "/static/css/main.ec63fb86.chunk.css",
4-
"main.js": "/static/js/main.b4b5f2df.chunk.js",
5-
"main.js.map": "/static/js/main.b4b5f2df.chunk.js.map",
4+
"main.js": "/static/js/main.3c6b3448.chunk.js",
5+
"main.js.map": "/static/js/main.3c6b3448.chunk.js.map",
66
"runtime-main.js": "/static/js/runtime-main.a500de04.js",
77
"runtime-main.js.map": "/static/js/runtime-main.a500de04.js.map",
88
"static/css/2.93e5c0a0.chunk.css": "/static/css/2.93e5c0a0.chunk.css",
99
"static/js/2.2e4ba0c3.chunk.js": "/static/js/2.2e4ba0c3.chunk.js",
1010
"static/js/2.2e4ba0c3.chunk.js.map": "/static/js/2.2e4ba0c3.chunk.js.map",
1111
"index.html": "/index.html",
12-
"precache-manifest.529e7bd99291585d441fb061e53a8478.js": "/precache-manifest.529e7bd99291585d441fb061e53a8478.js",
12+
"precache-manifest.b3d257e35e338db06675b3fe51497924.js": "/precache-manifest.b3d257e35e338db06675b3fe51497924.js",
1313
"service-worker.js": "/service-worker.js",
1414
"static/css/2.93e5c0a0.chunk.css.map": "/static/css/2.93e5c0a0.chunk.css.map",
1515
"static/css/main.ec63fb86.chunk.css.map": "/static/css/main.ec63fb86.chunk.css.map",
1616
"static/js/2.2e4ba0c3.chunk.js.LICENSE.txt": "/static/js/2.2e4ba0c3.chunk.js.LICENSE.txt",
17-
"static/js/main.b4b5f2df.chunk.js.LICENSE.txt": "/static/js/main.b4b5f2df.chunk.js.LICENSE.txt",
17+
"static/js/main.3c6b3448.chunk.js.LICENSE.txt": "/static/js/main.3c6b3448.chunk.js.LICENSE.txt",
1818
"static/media/copy-content.svg": "/static/media/copy-content.6fe0b363.svg"
1919
},
2020
"entrypoints": [
2121
"static/js/runtime-main.a500de04.js",
2222
"static/css/2.93e5c0a0.chunk.css",
2323
"static/js/2.2e4ba0c3.chunk.js",
2424
"static/css/main.ec63fb86.chunk.css",
25-
"static/js/main.b4b5f2df.chunk.js"
25+
"static/js/main.3c6b3448.chunk.js"
2626
]
2727
}

admin/google-blockly/own/blocks_action.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ Blockly.Blocks['exec'] = {
4141
this.appendDummyInput('WITH_STATEMENT')
4242
.appendField(Blockly.Translate('exec_statement'))
4343
.appendField(new Blockly.FieldCheckbox('FALSE', function (option) {
44-
var delayInput = option === true || option === 'true' || option === 'TRUE';
45-
this.sourceBlock_.updateShape_(delayInput);
44+
this.sourceBlock_.updateShape_(option === true || option === 'true' || option === 'TRUE');
4645
}), 'WITH_STATEMENT');
4746

4847
this.appendDummyInput('LOG')
@@ -65,11 +64,13 @@ Blockly.Blocks['exec'] = {
6564
},
6665
mutationToDom: function() {
6766
var container = document.createElement('mutation');
68-
container.setAttribute('with_statement', this.getFieldValue('WITH_STATEMENT') === 'TRUE');
67+
var option = this.getFieldValue('WITH_STATEMENT');
68+
container.setAttribute('with_statement', option === true || option === 'true' || option === 'TRUE');
6969
return container;
7070
},
7171
domToMutation: function(xmlElement) {
72-
this.updateShape_(xmlElement.getAttribute('with_statement') === 'true');
72+
var option = xmlElement.getAttribute('with_statement');
73+
this.updateShape_(option === true || option === 'true' || option === 'TRUE');
7374
},
7475
updateShape_: function(withStatement) {
7576
// Add or remove a statement Input.
@@ -97,7 +98,7 @@ Blockly.JavaScript['exec'] = function(block) {
9798
logText = '';
9899
}
99100

100-
if (withStatement === 'TRUE') {
101+
if (withStatement === 'TRUE' || withStatement === 'true' || withStatement === true) {
101102
var statement = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
102103
if (statement) {
103104
return 'exec(' + value_command + ', function (error, result, stderr) {\n ' + statement + '});\n' +
@@ -138,8 +139,7 @@ Blockly.Blocks['request'] = {
138139
this.appendDummyInput('WITH_STATEMENT')
139140
.appendField(Blockly.Translate('request_statement'))
140141
.appendField(new Blockly.FieldCheckbox('FALSE', function (option) {
141-
var delayInput = option === true || option === 'true' || option === 'TRUE';
142-
this.sourceBlock_.updateShape_(delayInput);
142+
this.sourceBlock_.updateShape_(option === true || option === 'true' || option === 'TRUE');
143143
}), 'WITH_STATEMENT');
144144

145145
this.appendDummyInput('LOG')
@@ -166,7 +166,8 @@ Blockly.Blocks['request'] = {
166166
return container;
167167
},
168168
domToMutation: function(xmlElement) {
169-
this.updateShape_(xmlElement.getAttribute('with_statement') == 'true');
169+
var option = xmlElement.getAttribute('with_statement');
170+
this.updateShape_(option === true || option === 'true' || option === 'TRUE');
170171
},
171172
updateShape_: function(withStatement) {
172173
// Add or remove a statement Input.
@@ -194,7 +195,7 @@ Blockly.JavaScript['request'] = function(block) {
194195
logText = '';
195196
}
196197

197-
if (withStatement === 'TRUE') {
198+
if (withStatement === 'TRUE' || withStatement === 'true' || withStatement === true) {
198199
var statement = Blockly.JavaScript.statementToCode(block, 'STATEMENT');
199200
if (statement) {
200201
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' +

admin/google-blockly/own/blocks_convert.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,10 @@ Blockly.Blocks.convert_from_date = {
197197
return container;
198198
},
199199
domToMutation: function(xmlElement) {
200-
this.updateShape_(xmlElement.getAttribute('format') === 'true', xmlElement.getAttribute('language') === 'true');
200+
var format = xmlElement.getAttribute('format');
201+
var language = xmlElement.getAttribute('language');
202+
203+
this.updateShape_(format === true || format === 'true' || format === 'TRUE', language === true || language === 'true' || language === 'TRUE');
201204
},
202205
updateShape_: function(isFormat, isLanguage) {
203206
// Add or remove a delay Input.
@@ -332,8 +335,8 @@ Blockly.Blocks.convert_object2json = {
332335
};
333336
Blockly.JavaScript.convert_object2json = function (block) {
334337
var prettify = block.getFieldValue('PRETTIFY');
335-
336-
return ['JSON.stringify(' + Blockly.JavaScript.valueToCode(block, 'VALUE', Blockly.JavaScript.ORDER_ATOMIC) + (prettify == 'TRUE' ? ', null, 2' : '') + ')', Blockly.JavaScript.ORDER_ATOMIC];
338+
prettify = prettify === 'TRUE' || prettify === 'true' || prettify === true;
339+
return ['JSON.stringify(' + Blockly.JavaScript.valueToCode(block, 'VALUE', Blockly.JavaScript.ORDER_ATOMIC) + (prettify ? ', null, 2' : '') + ')', Blockly.JavaScript.ORDER_ATOMIC];
337340
};
338341

339342
// --- to single value -------------------------------------------

admin/google-blockly/own/blocks_system.js

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ Blockly.Blocks['control'] = {
110110
this.appendDummyInput('WITH_DELAY')
111111
.appendField(Blockly.Translate('control_delay'))
112112
.appendField(new Blockly.FieldCheckbox('FALSE', function(option) {
113-
var delayInput = (option == true);
114-
this.sourceBlock_.updateShape_(delayInput);
113+
this.sourceBlock_.updateShape_(option === true || option === 'true' || option === 'TRUE');
115114
}), 'WITH_DELAY');
116115

117116

@@ -124,11 +123,13 @@ Blockly.Blocks['control'] = {
124123
},
125124
mutationToDom: function() {
126125
var container = document.createElement('mutation');
127-
container.setAttribute('delay_input', this.getFieldValue('WITH_DELAY') === 'TRUE');
126+
var option = this.getFieldValue('WITH_DELAY');
127+
container.setAttribute('delay_input', option === true || option === 'true' || option === 'TRUE');
128128
return container;
129129
},
130130
domToMutation: function(xmlElement) {
131-
this.updateShape_(xmlElement.getAttribute('delay_input') == 'true');
131+
var option = xmlElement.getAttribute('delay_input');
132+
this.updateShape_(option === true || option === 'true' || option === 'TRUE');
132133
},
133134
updateShape_: function(delayInput) {
134135
// Add or remove a delay Input.
@@ -176,12 +177,15 @@ Blockly.JavaScript['control'] = function(block) {
176177
} else if (unit === 'sec') {
177178
valueDelay *= 1000;
178179
}
179-
var clearRunning = block.getFieldValue('CLEAR_RUNNING') === 'TRUE';
180+
var clearRunning = block.getFieldValue('CLEAR_RUNNING');
180181
var valueValue = Blockly.JavaScript.valueToCode(block, 'VALUE', Blockly.JavaScript.ORDER_ATOMIC);
181182
var objectName = main.objects[valueObjectID] && main.objects[valueObjectID].common && main.objects[valueObjectID].common.name ? main.objects[valueObjectID].common.name : '';
182183
var code;
183184

184-
if (this.getFieldValue('WITH_DELAY') === 'TRUE') {
185+
clearRunning = clearRunning === 'true' || clearRunning === true || clearRunning === 'true';
186+
var withDelay = this.getFieldValue('WITH_DELAY');
187+
188+
if (withDelay === 'true' || withDelay === true || withDelay === 'TRUE') {
185189
code = 'setStateDelayed("' + valueObjectID + '"' + (objectName ? '/*' + objectName + '*/' : '') + ', ' + valueValue + ', ' + valueDelay + ', ' + clearRunning + ');\n';
186190
} else {
187191
code = 'setState("' + valueObjectID + '"' + (objectName ? '/*' + objectName + '*/' : '') + ', ' + valueValue + ');\n';
@@ -217,8 +221,7 @@ Blockly.Blocks['toggle'] = {
217221
this.appendDummyInput('WITH_DELAY')
218222
.appendField(Blockly.Translate('toggle_delay'))
219223
.appendField(new Blockly.FieldCheckbox('FALSE', function(option) {
220-
var delayInput = (option == true);
221-
this.sourceBlock_.updateShape_(delayInput);
224+
this.sourceBlock_.updateShape_(option === true || option === 'true' || option === 'TRUE');
222225
}), 'WITH_DELAY');
223226

224227
this.setInputsInline(true);
@@ -230,11 +233,13 @@ Blockly.Blocks['toggle'] = {
230233
},
231234
mutationToDom: function() {
232235
var container = document.createElement('mutation');
233-
container.setAttribute('delay_input', this.getFieldValue('WITH_DELAY') === 'TRUE');
236+
var option = this.getFieldValue('WITH_DELAY');
237+
container.setAttribute('delay_input', option === true || option === 'true' || option === 'TRUE');
234238
return container;
235239
},
236240
domToMutation: function(xmlElement) {
237-
this.updateShape_(xmlElement.getAttribute('delay_input') == 'true');
241+
var option = xmlElement.getAttribute('delay_input');
242+
this.updateShape_(option === true || option === 'true' || option === 'TRUE');
238243
},
239244
updateShape_: function(delayInput) {
240245
// Add or remove a delay Input.
@@ -282,11 +287,14 @@ Blockly.JavaScript['toggle'] = function(block) {
282287
} else if (unit === 'sec') {
283288
valueDelay *= 1000;
284289
}
285-
var clearRunning = block.getFieldValue('CLEAR_RUNNING') === 'TRUE';
290+
var clearRunning = block.getFieldValue('CLEAR_RUNNING');
286291
var objectName = main.objects[valueObjectID] && main.objects[valueObjectID].common && main.objects[valueObjectID].common.name ? main.objects[valueObjectID].common.name : '';
287292
var objectType = main.objects[valueObjectID] && main.objects[valueObjectID].common && main.objects[valueObjectID].common.type ? main.objects[valueObjectID].common.type : 'boolean';
288293
var code;
289294
var setCommand;
295+
296+
clearRunning = clearRunning === 'TRUE' || clearRunning === 'true' || clearRunning === true;
297+
290298
if (objectType === 'number') {
291299
var max = 100;
292300
var min = 0;
@@ -300,8 +308,9 @@ Blockly.JavaScript['toggle'] = function(block) {
300308
} else {
301309
setCommand = ' setState("' + valueObjectID + '"' + (objectName ? '/*' + objectName + '*/' : '') + ', state ? !state.val : true);\n';
302310
}
311+
var withDelay = block.getFieldValue('WITH_DELAY');
303312

304-
if (this.getFieldValue('WITH_DELAY') === 'TRUE') {
313+
if (withDelay === 'TRUE' || withDelay === 'true' || withDelay === true) {
305314
code =
306315
'getState("' + valueObjectID + '", function (err, state) {\n' +
307316
' setStateDelayed("' + valueObjectID + '"' + (objectName ? '/*' + objectName + '*/' : '') + ', state ? !state.val : true, ' + valueDelay + ', ' + clearRunning + ');\n' +
@@ -350,7 +359,7 @@ Blockly.Blocks['update'] = {
350359
this.appendDummyInput('WITH_DELAY')
351360
.appendField(Blockly.Translate('update_delay'))
352361
.appendField(new Blockly.FieldCheckbox('FALSE', function(option) {
353-
this.sourceBlock_.updateShape_(option == true);
362+
this.sourceBlock_.updateShape_(option === true || option === 'true' || option === 'TRUE');
354363
}), 'WITH_DELAY');
355364

356365
this.setInputsInline(true);
@@ -362,11 +371,13 @@ Blockly.Blocks['update'] = {
362371
},
363372
mutationToDom: function() {
364373
var container = document.createElement('mutation');
365-
container.setAttribute('delay_input', this.getFieldValue('WITH_DELAY') === 'TRUE');
374+
var option = this.getFieldValue('WITH_DELAY');
375+
container.setAttribute('delay_input', option === true || option === 'true' || option === 'TRUE');
366376
return container;
367377
},
368378
domToMutation: function(xmlElement) {
369-
this.updateShape_(xmlElement.getAttribute('delay_input') == 'true');
379+
var option = xmlElement.getAttribute('delay_input');
380+
this.updateShape_(option === true || option === 'true' || option === 'TRUE');
370381
},
371382
updateShape_: function(delayInput) {
372383
// Add or remove a delay Input.
@@ -409,16 +420,21 @@ Blockly.JavaScript['update'] = function(block) {
409420

410421
var value_value = Blockly.JavaScript.valueToCode(block, 'VALUE', Blockly.JavaScript.ORDER_ATOMIC);
411422
var value_delay = parseInt(block.getFieldValue('DELAY_MS'), 10);
412-
var clearRunning = block.getFieldValue('CLEAR_RUNNING') === 'TRUE';
423+
var clearRunning = block.getFieldValue('CLEAR_RUNNING');
413424
var unit = block.getFieldValue('UNIT');
414425
if (unit === 'min') {
415426
value_delay *= 60000;
416427
} else if (unit === 'sec') {
417428
value_delay *= 1000;
418429
}
430+
431+
clearRunning = clearRunning === true || clearRunning === 'true' || clearRunning === 'TRUE';
432+
419433
var objectname = main.objects[value_objectid] && main.objects[value_objectid].common && main.objects[value_objectid].common.name ? main.objects[value_objectid].common.name : '';
420434
var code;
421-
if (this.getFieldValue('WITH_DELAY') === 'TRUE') {
435+
var withDelay = this.getFieldValue('WITH_DELAY');
436+
437+
if (withDelay === true || withDelay === 'true' || withDelay === 'TRUE') {
422438
code = 'setStateDelayed("' + value_objectid + '"' + (objectname ? '/*' + objectname + '*/' : '') + ', ' + value_value + ', true, ' + value_delay + ', ' + clearRunning + ');\n';
423439
} else {
424440
code = 'setState("' + value_objectid + '"' + (objectname ? '/*' + objectname + '*/' : '') + ', ' + value_value + ', true);\n';
@@ -473,8 +489,8 @@ Blockly.JavaScript['direct'] = function(block) {
473489
var oidSrc = Blockly.JavaScript.valueToCode(block, 'OID_SRC', Blockly.JavaScript.ORDER_ATOMIC);
474490
var onlyChanges = block.getFieldValue('ONLY_CHANGES');
475491
var oidDest = Blockly.JavaScript.valueToCode(block, 'OID_DST', Blockly.JavaScript.ORDER_ATOMIC);
476-
477-
return 'on({id: ' + oidSrc + ', change: "' + (onlyChanges == 'TRUE' ? 'ne' : 'any') + '"}, function (obj) {\n setState(' + oidDest + ', obj.state.val);\n});';
492+
onlyChanges = onlyChanges === true || onlyChanges === 'true' || onlyChanges === 'TRUE';
493+
return 'on({id: ' + oidSrc + ', change: "' + (onlyChanges ? 'ne' : 'any') + '"}, function (obj) {\n setState(' + oidDest + ', obj.state.val);\n});';
478494
};
479495

480496
// --- control ex -----------------------------------------------------------
@@ -541,8 +557,10 @@ Blockly.JavaScript['control_ex'] = function(block) {
541557
var valueObjectID = Blockly.JavaScript.valueToCode(block, 'OID', Blockly.JavaScript.ORDER_ATOMIC);
542558
var value = Blockly.JavaScript.valueToCode(block, 'VALUE', Blockly.JavaScript.ORDER_ATOMIC);
543559
var valueDelay = Blockly.JavaScript.valueToCode(block, 'DELAY_MS', Blockly.JavaScript.ORDER_ATOMIC);
544-
var clearRunning = block.getFieldValue('CLEAR_RUNNING') === 'TRUE';
545-
var type = block.getFieldValue('TYPE') === 'true';
560+
var clearRunning = block.getFieldValue('CLEAR_RUNNING');
561+
var type = block.getFieldValue('TYPE');
562+
type = type === true || type === 'true' || type === 'TRUE';
563+
clearRunning = clearRunning === true || clearRunning === 'true' || clearRunning === 'TRUE';
546564
return 'setStateDelayed(' + valueObjectID + ', ' + value + ', ' + type + ', parseInt(' + valueDelay + ', 10), ' + clearRunning + ');\n';
547565
};
548566

admin/google-blockly/own/blocks_time.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,13 @@ Blockly.Blocks['time_compare_ex'] = {
8787
var option = this.getFieldValue('OPTION');
8888
var use_actual_time = this.getFieldValue('USE_ACTUAL_TIME');
8989
container.setAttribute('end_time', (option === 'between' || option === 'not between') ? 'true' : 'false');
90-
container.setAttribute('actual_time', (use_actual_time === 'TRUE') ? 'true' : 'false');
90+
container.setAttribute('actual_time', use_actual_time === 'TRUE' || use_actual_time === 'true' || use_actual_time === true ? 'true' : 'false');
9191
return container;
9292
},
9393
domToMutation: function(xmlElement) {
94-
this.updateShape_(xmlElement.getAttribute('end_time') === 'true', xmlElement.getAttribute('actual_time') === 'true');
94+
var end_time = xmlElement.getAttribute('end_time');
95+
var actual_time = xmlElement.getAttribute('actual_time');
96+
this.updateShape_(end_time === true || end_time === 'true' || end_time === 'TRUE', actual_time === true || actual_time === 'true' || actual_time === 'TRUE');
9597
},
9698
updateShape_: function(isBetween, useActualTime) {
9799
if (isBetween === undefined) {
@@ -133,12 +135,13 @@ Blockly.Blocks['time_compare_ex'] = {
133135
}
134136

135137
if (useActualTime === undefined) {
136-
useActualTime = this.getFieldValue('USE_ACTUAL_TIME') === 'TRUE';
138+
useActualTime = this.getFieldValue('USE_ACTUAL_TIME');
139+
useActualTime = useActualTime === 'true' || useActualTime === 'TRUE' || useActualTime === true;
137140
}
138141
inputExists = this.getInput('CUSTOM_TIME');
139142

140143
if (!useActualTime) {
141-
this.getInput('TIME_TEXT').fieldRow[0].setText(Blockly.Translate('time_compare_custom_ex'));
144+
this.getInput('TIME_TEXT').fieldRow[0].setValue(Blockly.Translate('time_compare_custom_ex'));
142145

143146
if (!inputExists) {
144147
this.appendDummyInput('CUSTOM_TEXT')
@@ -147,7 +150,7 @@ Blockly.Blocks['time_compare_ex'] = {
147150
this.appendValueInput('CUSTOM_TIME');
148151
}
149152
} else if (inputExists) {
150-
this.getInput('TIME_TEXT').fieldRow[0].setText(Blockly.Translate('time_compare_ex'));
153+
this.getInput('TIME_TEXT').fieldRow[0].setValue(Blockly.Translate('time_compare_ex'));
151154
this.removeInput('CUSTOM_TIME');
152155
this.removeInput('CUSTOM_TEXT');
153156
}
@@ -219,7 +222,8 @@ Blockly.Blocks['time_compare'] = {
219222
return container;
220223
},
221224
domToMutation: function(xmlElement) {
222-
this.updateShape_(xmlElement.getAttribute('end_time') === 'true');
225+
var option = xmlElement.getAttribute('end_time');
226+
this.updateShape_(option === true || option === 'true' || option === 'TRUE');
223227
},
224228
updateShape_: function(isBetween) {
225229
// Add or remove a delay Input.
@@ -340,7 +344,9 @@ Blockly.Blocks['time_get'] = {
340344
return container;
341345
},
342346
domToMutation: function(xmlElement) {
343-
this.updateShape_(xmlElement.getAttribute('format') === 'true', xmlElement.getAttribute('language') === 'true');
347+
var format = xmlElement.getAttribute('format');
348+
var language = xmlElement.getAttribute('language');
349+
this.updateShape_(format === true || format === 'true' || format === 'TRUE', language === true || language === 'true' || language === 'TRUE');
344350
},
345351
updateShape_: function(isFormat, isLanguage) {
346352
// Add or remove a delay Input.

0 commit comments

Comments
 (0)