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