This commit is contained in:
fofolee 2019-09-04 22:25:55 +08:00
parent 02bc5e4bf0
commit de8f546032
7 changed files with 23 additions and 16 deletions

View File

@ -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");
// 到达边界闪烁移动选择条

View File

@ -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'

View File

@ -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);

Binary file not shown.

View File

@ -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`)
}

Binary file not shown.

Binary file not shown.