diff --git a/libs/actions.js b/libs/actions.js index caf962ca..f49cbd67 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -2029,7 +2029,7 @@ actions.prototype._clickSL_favorite = function (page, offset) { } else if (value) { alert("无效的输入!"); } - }); + }, () => { }); } else { var v = core.saves.favorite.indexOf(index); core.playSound('确定'); @@ -2591,7 +2591,7 @@ actions.prototype._clickNotes_new = function () { } else { core.ui.closePanel(); } - }); + }, () => { }); } actions.prototype._clickNotes_show = function () { @@ -2630,7 +2630,7 @@ actions.prototype._clickNotes_edit = function () { } }); } - }) + }, () => { }) } } @@ -2662,7 +2662,7 @@ actions.prototype._clickNotes_delete = function () { core.drawText("已删除 " + data.sort().join(",") + " 号笔记"); } } - }) + }, () => { }); } } diff --git a/libs/control.js b/libs/control.js index 0297ecff..a4a221bc 100644 --- a/libs/control.js +++ b/libs/control.js @@ -2316,7 +2316,7 @@ control.prototype.syncLoad = function () { } else { core.control._syncLoad_http(idpassword.substring(0, 6), idpassword.substring(6)); } - }); + }, () => { }); } control.prototype._syncLoad_http = function (id, password) { diff --git a/libs/utils.js b/libs/utils.js index 2f2511c3..042f7f1b 100644 --- a/libs/utils.js +++ b/libs/utils.js @@ -1202,7 +1202,7 @@ utils.prototype.myconfirm = function (hint, yesCallback, noCallback) { } ////// 让用户输入一段文字 ////// -utils.prototype.myprompt = function (hint, value, callback) { +utils.prototype.myprompt = function (hint, value, callback, failCallback) { main.dom.inputDiv.style.display = 'block'; main.dom.inputMessage.innerHTML = hint.replace(/\n/g, '
'); main.dom.inputBox.style.display = 'block'; @@ -1214,7 +1214,7 @@ utils.prototype.myprompt = function (hint, value, callback) { }); core.status.holdingKeys = []; core.platform.successCallback = callback; - core.platform.errorCallback = () => { }; + core.platform.errorCallback = failCallback || callback; } ////// 动画显示某对象 ////// diff --git a/project/plugins.js b/project/plugins.js index 985ff635..73aefc57 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -3014,7 +3014,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } core.closePanel(); batchUse(id, value); - }); + }, () => { }); } addUIEventListener(x, y, w, h, todo); } @@ -3823,7 +3823,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = * 本插件的修改方法:如果您了解样板的绘制API,基础的JS和面向对象,您可以轻松读懂和修改本插件。 * 以下给出一些快速修改的参考 * 1.如何了解选项的效果,及修改已有的选项:找到下方如下代码段: - const settingMap = new Map([ + const settingMap = new Map([ ['autoGet', new Setting( () => '自动拾取:' + (core.getFlag('autoGet', false) ? '开' : '关'), // 此项填一个函数,返回一个字符串,为该选项显示的文字内容 () => invertFlag('autoGet'), // 此项填一个函数,为点击该选项执行的效果 @@ -4329,7 +4329,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = else core.drawFailTip('错误:找不到该名称的物品!'); } else core.drawFailTip('未知错误:core.material.items不存在!'); - }); + }, () => { }); }, '给选定的数字键绑定一个可快捷使用的物品。', false, @@ -4427,7 +4427,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = else { core.drawFailTip('错误:不合法的名称!'); } - }); + }, () => { }); }, '', false, @@ -4451,7 +4451,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = else { core.drawFailTip('错误:不合法的值!'); } - }); + }, () => { }); }, '', false, @@ -4499,7 +4499,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } } core.drawFailTip('错误:不合法的名称!'); - }); + }, () => { }); }, '', false, @@ -4520,7 +4520,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = else { core.drawFailTip('错误:不合法的值!'); } - }); + }, () => { }); }, '', false, @@ -4576,7 +4576,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = else { core.drawFailTip('错误:不合法的名称!'); } - }); + }, () => { }); }, '', false, @@ -4599,7 +4599,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } core.setFlag('debug_flagValue', newValue); this.menu.drawContent(); - }); + }, () => { }); }, '', false, diff --git a/runtime.d.ts b/runtime.d.ts index f703954a..28f350de 100644 --- a/runtime.d.ts +++ b/runtime.d.ts @@ -2848,8 +2848,13 @@ interface utils { /** 是否满足正则表达式 */ matchRegex(pattern: string, string: string): string - /** 让用户输入一段文字 */ - myprompt(hint: string, value: string, callback?: (data?: string) => any): void + /** 让用户输入一段文字 + * @param hint 输入框的提示语 + * @param value 输入值为null时的默认值 + * @param callback 确认时的回调 + * @param failCallback 取消时的回调,不填则默认与确认时的回调相同 + */ + myprompt(hint: string, value: string, callback?: (data?: string) => any, failCallback?: (data?: string) => any): void /** 动画显示某对象 */ showWithAnimate(obj?: any, speed?: number, callback?: () => any): void