mirror of
https://github.com/fofolee/uTools-ProcessKiller.git
synced 2025-06-08 14:24:05 +08:00
改善UI
This commit is contained in:
parent
79ab0912e4
commit
e7f154b59d
43
index.html
43
index.html
@ -14,40 +14,45 @@
|
||||
<div id="tasklist"></div>
|
||||
<div id="infopannel"></div>
|
||||
<script>
|
||||
function kill(taskname) {
|
||||
window.taskkill(taskname, (info) => {
|
||||
if (info.search('错误') != -1) {
|
||||
kill = taskname => {
|
||||
window.taskkill(taskname, err => {
|
||||
if (err) {
|
||||
$("#infopannel").css({ "background": "#EF5350" });
|
||||
$("#infopannel").html(err).fadeIn(300).delay(4000).fadeOut(300);
|
||||
} else {
|
||||
$("#infopannel").css({ "background": "#4CAF50" });
|
||||
$(".taskinfo").filter(function () {
|
||||
return $(this).text() === taskname;
|
||||
}).fadeOut(300);
|
||||
$("[name='" + taskname + "']").fadeOut(300).remove()
|
||||
let tasknum = $(".taskinfo").length
|
||||
utools.setExpendHeight(tasknum > 10 ? 500 : 50 * tasknum);
|
||||
window.tasklist((task) => {
|
||||
window.tasks = task
|
||||
});
|
||||
}
|
||||
$("#infopannel").html(info.replace(/\n/g,'<br>')).fadeIn(300).delay(4000).fadeOut(300);
|
||||
});
|
||||
}
|
||||
utools.onPluginEnter(({ code, type, payload }) => {
|
||||
utools.setExpendHeight(0);
|
||||
utools.setSubInput(({ text }) => {
|
||||
window.tasklist((task) => {
|
||||
utools.setExpendHeight(500);
|
||||
let taskinfo = '';
|
||||
for (var t of task) {
|
||||
taskname = t[0].replace(/"/g, '');
|
||||
if (taskname.toLowerCase().search(text.toLowerCase()) != -1) {
|
||||
taskinfo += '<div class="taskinfo" onclick=\'kill("' + taskname + '")\'>' + taskname + '</div><br>';
|
||||
window.tasks = task
|
||||
utools.setSubInput(({ text }) => {
|
||||
var taskinfo = '';
|
||||
for (var t of window.tasks) {
|
||||
if (t.ProcessName.toUpperCase().search(text.toUpperCase()) != -1 || t.Description.toUpperCase().search(text.toUpperCase()) != -1) {
|
||||
let title = t.Description ? t.Description : t.ProcessName;
|
||||
taskinfo += '<div class="taskinfo" name="' + t.ProcessName + '" onclick=\'kill("' + t.ProcessName + '")\'><img src="file:///' + t.Icon + '">';
|
||||
taskinfo += '<div class="description">' + title + '</div><div class="path">' + t.Path + '</div></div>';
|
||||
}
|
||||
}
|
||||
$("#tasklist").html(taskinfo);
|
||||
});
|
||||
let tasknum = $(".taskinfo").length
|
||||
utools.setExpendHeight(tasknum > 10 ? 500 : 50 * tasknum);
|
||||
}, '输入进程名,回车关闭,或点击关闭');
|
||||
});
|
||||
$(document).keydown(function (e) {
|
||||
});
|
||||
$(document).keydown(e => {
|
||||
if (e.keyCode === 13) {
|
||||
kill($(".taskinfo").html());
|
||||
kill($(".taskinfo").attr('name'));
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user