From db406e7a64454c0db05ec6f49fcc61268fb3bfd4 Mon Sep 17 00:00:00 2001 From: harveyshao Date: Wed, 23 Nov 2022 00:13:03 +0800 Subject: [PATCH] opt some --- lib/user.js | 7 ++++++- panel/action.js | 4 +++- plugin/local/code/inner/syntax.js | 2 +- plugin/state.js | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/user.js b/lib/user.js index 9757e606..851e3eb5 100644 --- a/lib/user.js +++ b/lib/user.js @@ -93,7 +93,12 @@ Volcanos("user", {info: {}, agent: { return can._toast && (can._toast.close(), delete(can._toast)), can._toast = action }, share: function(can, msg, cmd) { can.run(msg, cmd||[ctx.ACTION, chat.SHARE], function(msg) { can.user.copy(msg._event, can, msg.Append(mdb.NAME)) - can.user.toast(can, {title: msg.Append(mdb.NAME), duration: -1, content: msg.Append(mdb.TEXT), action: [cli.CLOSE, cli.OPEN]}) + var toast = can.user.toast(can, {title: msg.Append(mdb.NAME), duration: -1, content: msg.Append(mdb.TEXT), action: [cli.CLOSE, cli.OPEN]}) + can.onmotion.delay(can, function() { + can.page.Select(can, toast._target, html.IMG, function(target) { + can.page.style(can, toast._target, html.WIDTH, target.offsetWidth, html.LEFT, (window.innerWidth-target.offsetWidth)/2) + }) + }) }) }, copy: function(event, can, text) { if (!text) { return } if (navigator.clipboard) { var ok = false; navigator.clipboard.writeText(text).then(function() { ok = true }) diff --git a/panel/action.js b/panel/action.js index e9f3cab6..c829847d 100644 --- a/panel/action.js +++ b/panel/action.js @@ -14,7 +14,9 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.onmotion.clear(can) }) }, _cmd: function(can, item, next) { can.base.Copy(item, {type: chat.PLUGIN, mode: chat.CMD, opts: can.misc.Search(can)}), can.onengine.signal(can, chat.ONACTION_CMD) can.onappend.plugin(can, item, function(sub, meta, skip) { can.onimport._run(can, sub, function(event, cmds, cb) { - return can.runActionCommand(event, sub._index, cmds, cb) + return can.runActionCommand(event, sub._index, cmds, cb||function(msg) { + sub.onimport._process(sub, msg) + }) }), can.user.title(meta.name), skip || next() }), can.onlayout._init(can) }, _run: function(can, sub, cbs) { can._plugins = can.misc.concat(can, can._plugins, [sub]) diff --git a/plugin/local/code/inner/syntax.js b/plugin/local/code/inner/syntax.js index ea4b331f..fdccba08 100644 --- a/plugin/local/code/inner/syntax.js +++ b/plugin/local/code/inner/syntax.js @@ -173,7 +173,7 @@ Volcanos(chat.ONSYNTAX, { }, go: { split: { - operator: "{([-+:.,*])}", + operator: "{([-+:!.,*])}", }, regexp: { "[0-9]+": code.CONSTANT, diff --git a/plugin/state.js b/plugin/state.js index 86c57861..82835b9f 100644 --- a/plugin/state.js +++ b/plugin/state.js @@ -160,7 +160,7 @@ Volcanos(chat.ONACTION, {list: [ "查看文档": function(event, can) { can.runAction(event, ctx.CONFIG, [ice.HELP]) }, "查看脚本": function(event, can) { can.runAction(event, ctx.CONFIG, [nfs.SCRIPT]) }, "查看源码": function(event, can) { can.runAction(event, ctx.CONFIG, [nfs.SOURCE]) }, - "查看配置": function(event, can) { can.runAction(event, ctx.CONFIG, [mdb.SELECT], function(msg) { can.onappend.board(can, msg) }) }, + "查看配置": function(event, can) { can.runAction(event, ctx.CONFIG, [mdb.SELECT]) }, "删除配置": function(event, can) { can.runAction(event, ctx.CONFIG, [mdb.REMOVE]) }, "删除工具": function(event, can) { can.page.Remove(can, can._target) },