diff --git a/assets/index.js b/assets/index.js index 4548b3e5..b1c34f89 100644 --- a/assets/index.js +++ b/assets/index.js @@ -196,15 +196,15 @@ utools.onPluginEnter( async ({ code, type, payload }) => { var index = utools.db.get(code).data; } if (type == 'over') { - showList(payload, index, 500) + showList(payload, index, 300) } else { - showList('', index, 500) + showList('', index, 300) } // 子输入框 utools.setSubInput(({ text }) => { // 列表搜索 if ($('#manual').is(':hidden')) { - showList(text.toUpperCase(), index, 500); + showList(text.toUpperCase(), index, 300); // 高亮结果 text.split(' ').forEach(keyword => { keyword && $(".name,.description").highlight(keyword, 'listFounds'); @@ -214,6 +214,12 @@ utools.onPluginEnter( async ({ code, type, payload }) => { highlightManual("#manual", text); } }, '输入名称或功能进行查询'); + if (type == 'window') { + utools.hideMainWindow(); + copy(); + utools.showMainWindow(); + paste(); + } } catch(e) { $("#mainlist").html(e); } @@ -221,9 +227,10 @@ utools.onPluginEnter( async ({ code, type, payload }) => { }); utools.onPluginOut(() => { - $("#mainlist").html(''); - $("#options").html(''); - $("#manual").html(''); + $("#mainlist").html('').hide(); + $("#options").html('').hide(); + $("#manual").html('').hide(); + $(".load").html('').hide(); $('link[name="manual"]').remove(); }) @@ -269,7 +276,7 @@ $("#manual").on('mousedown', 'a', function (e) { // 滚动到边界加载列表 $(document).scroll(() => { - loadList(500); + loadList(300); }) // 按键监听 @@ -337,7 +344,7 @@ $(document).keydown(e => { if(next.offset().top >= $(window).scrollTop() + 550){ $("html").animate({ scrollTop: "+=50" }, 0); } - loadList(500); + loadList(300); next.addClass("select"); $(".select:first").removeClass("select"); // 到达边界闪烁移动选择条 diff --git a/assets/options.js b/assets/options.js index 3d9c6042..61891163 100644 --- a/assets/options.js +++ b/assets/options.js @@ -49,7 +49,7 @@ showOptions = async () => { if (c.code == features.code) { isChecked1 = 'checked'; isDisabled2 = ''; - if (typeof(c.cmds[c.cmds.length - 1]) != 'string') isChecked2 = 'checked'; + if (c.cmds[c.cmds.length - 1].type == 'over') isChecked2 = 'checked'; break; } } @@ -237,7 +237,7 @@ $("#options").on('click', '.saveBtn', async function () { "code": code, "explain": desc, "cmds": kw, - "icon": `${p}/${code}.png` + "icon": `logo/${code}.png` }, path: p, type: 'custom' diff --git a/preload.js b/preload.js index ab554860..c873182c 100644 --- a/preload.js +++ b/preload.js @@ -1,6 +1,6 @@ const { clipboard } = require('electron'); const { exec } = require('child_process'); -const robot = require('./robotjs') +const robot = utools.robot //-------checkUpdate------ const fs = require('fs'); @@ -62,6 +62,11 @@ copyTo = text => { clipboard.writeText(text) } +copy = () => { + var ctlKey = isWin ? 'control' : 'command'; + robot.keyTap('c', ctlKey); +} + paste = () => { var ctlKey = isWin ? 'control' : 'command'; robot.keyTap('v', ctlKey); diff --git a/robotjs/darwin/robotjs.node b/robotjs/darwin/robotjs.node deleted file mode 100644 index a8fdedcc..00000000 Binary files a/robotjs/darwin/robotjs.node and /dev/null differ diff --git a/robotjs/index.js b/robotjs/index.js deleted file mode 100644 index 0f4dfadf..00000000 --- a/robotjs/index.js +++ /dev/null @@ -1,5 +0,0 @@ -if(process.platform==='darwin'){ - module.exports = require('./darwin/robotjs.node') -}else if(process.platform==='win32'){ - module.exports = require(`./win32/${process.arch}/robotjs.node`) -} \ No newline at end of file diff --git a/robotjs/win32/ia32/robotjs.node b/robotjs/win32/ia32/robotjs.node deleted file mode 100644 index 2b185a32..00000000 Binary files a/robotjs/win32/ia32/robotjs.node and /dev/null differ diff --git a/robotjs/win32/x64/robotjs.node b/robotjs/win32/x64/robotjs.node deleted file mode 100644 index 9cb97271..00000000 Binary files a/robotjs/win32/x64/robotjs.node and /dev/null differ