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