MCPcopy Create free account
hub / github.com/XIU2/UserScript / registerMenuCommand

Function registerMenuCommand

3dm-Enhanced.user.js:36–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34
35 // 注册脚本菜单
36 function registerMenuCommand() {
37 if (menu_ID.length > menu_ALL.length){ // 如果菜单ID数组多于菜单数组,说明不是首次添加菜单,需要卸载所有脚本菜单
38 for (let i=0;i<menu_ID.length;i++){
39 GM_unregisterMenuCommand(menu_ID[i]);
40 }
41 }
42 for (let i=0;i<menu_ALL.length;i++){ // 循环注册脚本菜单
43 menu_ALL[i][3] = GM_getValue(menu_ALL[i][0]);
44 menu_ID[i] = GM_registerMenuCommand(`${menu_ALL[i][3]?'✅':'❌'} ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)});
45 }
46 menu_ID[menu_ID.length] = GM_registerMenuCommand('💬 反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://greasyfork.org/zh-CN/scripts/412890/feedback', {active: true,insert: true,setParent: true});});
47 }
48
49 // 菜单开关
50 function menu_switch(menu_status, Name, Tips) {

Callers 2

menu_switchFunction · 0.70

Calls 1

menu_switchFunction · 0.70

Tested by

no test coverage detected