forked from scriptscat/scriptcat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcat_bg_input_menu.js
More file actions
73 lines (68 loc) · 1.51 KB
/
Copy pathcat_bg_input_menu.js
File metadata and controls
73 lines (68 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// ==UserScript==
// @name bg cat input menu
// @namespace https://bbs.tampermonkey.net.cn/
// @version 0.1.0
// @description 在后台脚本中带交互输入的快捷菜单
// @author You
// @background
// @grant CAT_registerMenuInput
// @grant CAT_unregisterMenuInput
// @grant GM_notification
// ==/UserScript==
return new Promise((resolve) => {
const id = CAT_registerMenuInput(
"测试菜单",
() => {
console.log(id);
CAT_unregisterMenuInput(id);
},
"z"
);
CAT_registerMenuInput(
"测试菜单boolean",
(inputValue) => {
GM_notification({
title: "测试菜单boolean",
text: "" + inputValue,
});
},
{
inputType: "boolean",
inputLabel: "是否通知",
inputDefaultValue: true,
autoClose: false,
}
);
CAT_registerMenuInput(
"测试菜单text",
(inputValue) => {
GM_notification({
title: "测试菜单text",
text: "" + inputValue,
});
},
{
inputType: "text",
inputLabel: "通知内容",
inputValue: "text",
autoClose: false,
}
);
CAT_registerMenuInput(
"测试菜单number",
(inputValue) => {
setTimeout(() => {
GM_notification({
title: "测试菜单number",
text: "" + (1000 + inputValue),
});
}, 1000 + inputValue);
},
{
inputType: "number",
inputLabel: "延迟ms",
inputPlaceholder: "最低1000ms",
}
);
resolve();
});