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

Function menu_switch

Lanzou-Enhanced.user.js:121–138  ·  view source on GitHub ↗
(menu_status, Name, Tips)

Source from the content-addressed store, hash-verified

119
120 // 菜单开关
121 function menu_switch(menu_status, Name, Tips) {
122 if (menu_status == 'true') {
123 GM_setValue(`${Name}`, false);
124 if (Name == 'menu_refreshCorrection') {
125 GM_notification({text: `已关闭 [${Tips}] 功能`, timeout: 3500});
126 } else {
127 GM_notification({text: `已关闭 [${Tips}] 功能\n(点击刷新网页后生效)`, timeout: 3500, onclick: function(){location.reload();}});
128 }
129 } else {
130 GM_setValue(`${Name}`, true);
131 if (Name == 'menu_refreshCorrection') {
132 GM_notification({text: `已开启 [${Tips}] 功能`, timeout: 3500});
133 } else {
134 GM_notification({text: `已开启 [${Tips}] 功能\n(点击刷新网页后生效)`, timeout: 3500, onclick: function(){location.reload();}});
135 }
136 }
137 registerMenuCommand(); // 重新注册脚本菜单
138 };
139
140 // 返回菜单值
141 function menu_value(menuName) {

Callers 1

registerMenuCommandFunction · 0.70

Calls 1

registerMenuCommandFunction · 0.70

Tested by

no test coverage detected