mirror of
https://github.com/ocogeclub/ocoge.git
synced 2024-11-25 00:49:48 +00:00
[update] updated custom-dialog.js
This commit is contained in:
parent
024d0c4506
commit
d82c228b51
@ -1034,9 +1034,9 @@
|
||||
<script src="./node_modules/blockly/python_compressed.js"></script>
|
||||
<script src="./node_modules/blockly/blocks_compressed.js"></script>
|
||||
<script src="./node_modules/blockly/msg/ja.js"></script>
|
||||
<script src="./blocks/custom-dialog.js"></script>
|
||||
<script src="./ugj_blocks.js"></script>
|
||||
<script src="./index_elutil.js"></script>
|
||||
<script src="./lib/custom-dialog.js"></script>
|
||||
<script src="./blocks.js"></script>
|
||||
<script src="./elutil.js"></script>
|
||||
<script src="./index.js"></script>
|
||||
<script src="./lib/beautify.min.js"></script>
|
||||
<!-- <script src="./lib/prettify.js"></script> -->
|
||||
|
@ -13,7 +13,7 @@
|
||||
*/
|
||||
CustomDialog = {};
|
||||
|
||||
/** Override Blockly.dialog.alert() with custom implementation. */
|
||||
/** Override Blockly.dialog.setAlert() with custom implementation. */
|
||||
Blockly.dialog.setAlert(function(message, callback) {
|
||||
console.log('Alert: ' + message);
|
||||
CustomDialog.show('Alert', message, {
|
||||
@ -21,7 +21,7 @@ Blockly.dialog.setAlert(function(message, callback) {
|
||||
});
|
||||
});
|
||||
|
||||
/** Override Blockly.dialog.confirm() with custom implementation. */
|
||||
/** Override Blockly.dialog.setConfirm() with custom implementation. */
|
||||
Blockly.dialog.setConfirm(function(message, callback) {
|
||||
console.log('Confirm: ' + message);
|
||||
CustomDialog.show('Confirm', message, {
|
||||
@ -36,7 +36,7 @@ Blockly.dialog.setConfirm(function(message, callback) {
|
||||
});
|
||||
});
|
||||
|
||||
/** Override Blockly.dialog.prompt() with custom implementation. */
|
||||
/** Override Blockly.dialog.setPrompt() with custom implementation. */
|
||||
Blockly.dialog.setPrompt(function(message, defaultValue, callback) {
|
||||
console.log('Prompt: ' + message);
|
||||
CustomDialog.show('Prompt', message, {
|
||||
@ -48,7 +48,7 @@ Blockly.dialog.setPrompt(function(message, defaultValue, callback) {
|
||||
showCancel: true,
|
||||
onCancel: function() {
|
||||
callback(null);
|
||||
}
|
||||
},
|
||||
});
|
||||
CustomDialog.inputField.value = defaultValue;
|
||||
});
|
||||
@ -133,11 +133,11 @@ CustomDialog.show = function(title, message, options) {
|
||||
dialogInput.focus();
|
||||
|
||||
dialogInput.onkeyup = function(event) {
|
||||
if (event.keyCode === 13) {
|
||||
if (event.keyCode == 13) {
|
||||
// Process as OK when user hits enter.
|
||||
onOkay();
|
||||
return false;
|
||||
} else if (event.keyCode === 27) {
|
||||
} else if (event.keyCode == 27) {
|
||||
// Process as cancel when user hits esc.
|
||||
onCancel();
|
||||
return false;
|
Loading…
Reference in New Issue
Block a user