Skip to content

Commit

Permalink
Update javascript.js
Browse files Browse the repository at this point in the history
  • Loading branch information
fustyles authored Oct 9, 2023
1 parent 87deb2e commit fc0aab3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions GameElements_20190131/blockly/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -2331,3 +2331,18 @@ Blockly.JavaScript['music_delete'] = function (block) {
var code = 'clearInterval(musicTimer);\nmusic_delete();\n';
return code;
};

Blockly.JavaScript['element_select'] = function (block) {
var value_source_ = block.getFieldValue('source_');
var value_id_ = Blockly.JavaScript.valueToCode(block, 'id_', Blockly.JavaScript.ORDER_ATOMIC);
if ((value_id_.indexOf("'")==0)&&(value_id_.lastIndexOf("'")==value_id_.length-1))
value_id_ = value_id_.substring(1,value_id_.length-1);
var source_id;
if (value_source_=="text")
source_id = 'gametext_'+value_id_;
else if (value_source_=="textarea")
source_id = 'gametextarea_'+value_id_;

var code = 'element_select("' + source_id + '");\n';
return code;
};

0 comments on commit fc0aab3

Please sign in to comment.