Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
40 lines (37 loc) · 1016 Bytes

File metadata and controls

40 lines (37 loc) · 1016 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
// ==UserScript==
// @name gm menu
// @namespace https://bbs.tampermonkey.net.cn/
// @version 0.1.0
// @description 创建菜单, 可以显示在右上角的插件弹出页和浏览器右键菜单中
// @author You
// @match https://bbs.tampermonkey.net.cn/
// @grant GM_registerMenuCommand
// @grant GM_unregisterMenuCommand
// ==/UserScript==
const id = GM_registerMenuCommand(
"测试菜单",
() => {
console.log(id);
GM_unregisterMenuCommand(id);
},
{ accessKey: "k", title: "测试菜单标题", autoClose: false }
);
const id2 = GM_registerMenuCommand(
"测试菜单2",
() => {
console.log(id2);
GM_unregisterMenuCommand(id2);
},
"j"
);
setTimeout(() => {
// 修改名字
GM_registerMenuCommand(
"修改后的测试菜单",
() => {
console.log("修改后的", id);
GM_unregisterMenuCommand(id);
},
{ id: id, accessKey: "k", title: "修改后的测试菜单标题", autoClose: false }
);
}, 5000);
Morty Proxy This is a proxified and sanitized view of the page, visit original site.