mirror of
https://github.com/fofolee/uTools-ProcessKiller.git
synced 2025-06-18 05:26:56 +08:00
改善UI
This commit is contained in:
parent
e7f154b59d
commit
ccae084082
116
index.html
116
index.html
@ -1,59 +1,59 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
|
||||
<head>
|
||||
<meta charset="utf8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<link rel="stylesheet" href="assets/style.css">
|
||||
<script src="assets/jquery-3.3.1.min.js"></script>
|
||||
<title>taskkill</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="tasklist"></div>
|
||||
<div id="infopannel"></div>
|
||||
<script>
|
||||
kill = taskname => {
|
||||
window.taskkill(taskname, err => {
|
||||
if (err) {
|
||||
$("#infopannel").css({ "background": "#EF5350" });
|
||||
$("#infopannel").html(err).fadeIn(300).delay(4000).fadeOut(300);
|
||||
} else {
|
||||
$("[name='" + taskname + "']").fadeOut(300).remove()
|
||||
let tasknum = $(".taskinfo").length
|
||||
utools.setExpendHeight(tasknum > 10 ? 500 : 50 * tasknum);
|
||||
window.tasklist((task) => {
|
||||
window.tasks = task
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
utools.onPluginEnter(({ code, type, payload }) => {
|
||||
utools.setExpendHeight(0);
|
||||
window.tasklist((task) => {
|
||||
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(e => {
|
||||
if (e.keyCode === 13) {
|
||||
kill($(".taskinfo").attr('name'));
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
|
||||
<head>
|
||||
<meta charset="utf8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<link rel="stylesheet" href="assets/style.css">
|
||||
<script src="assets/jquery-3.3.1.min.js"></script>
|
||||
<title>taskkill</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="tasklist"></div>
|
||||
<div id="infopannel"></div>
|
||||
<script>
|
||||
kill = taskname => {
|
||||
window.taskkill(taskname, err => {
|
||||
if (err) {
|
||||
$("#infopannel").css({ "background": "#EF5350" });
|
||||
$("#infopannel").html(err).fadeIn(300).delay(4000).fadeOut(300);
|
||||
} else {
|
||||
$("[name='" + taskname + "']").fadeOut(300).remove()
|
||||
let tasknum = $(".taskinfo").length
|
||||
utools.setExpendHeight(tasknum > 10 ? 500 : 50 * tasknum);
|
||||
window.tasklist((task) => {
|
||||
window.tasks = task
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
utools.onPluginEnter(({ code, type, payload }) => {
|
||||
utools.setExpendHeight(0);
|
||||
window.tasklist((task) => {
|
||||
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(e => {
|
||||
if (e.keyCode === 13) {
|
||||
kill($(".taskinfo").attr('name'));
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user