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

Function menu_customMode

DarkMode.user.js:161–205  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

159
160 // 自定义当前模式
161 function menu_customMode() {
162 let newMods, tip, defaults, name;
163 switch(getAutoSwitch()) {
164 case 1:
165 tip = '自定义 [模式 1],修改后立即生效 (部分网页可能需要刷新)~\n格式:亮度 (白天)|亮度 (晚上)\n默认:60|50(均为百分比 1~100,不需要 % 符号)';
166 defaults = '60|50';
167 name = 'menu_customMode1';
168 break;
169 case 2:
170 tip = '自定义 [模式 2],修改后立即生效 (部分网页可能需要刷新)~\n格式:亮度 (白天)|暖色 (白天)|亮度 (晚上)|暖色 (晚上)\n默认:60|40|50|50(均为百分比 1~100,不需要 % 符号)';
171 defaults = '60|40|50|50';
172 name = 'menu_customMode2';
173 break;
174 case 3:
175 tip = '自定义 [模式 3],修改后立即生效 (部分网页可能需要刷新)~\n格式:反色\n默认:90(均为百分比 50~100,不需要 % 符号)';
176 defaults = '90';
177 name = 'menu_customMode3';
178 break;
179 }
180 newMods = prompt(tip, GM_getValue(`${name}`));
181 if (newMods === '') {
182 GM_setValue(`${name}`, defaults);
183 registerMenuCommand(); // 重新注册脚本菜单
184 } else if (newMods != null) {
185 GM_setValue(`${name}`, newMods);
186 registerMenuCommand(); // 重新注册脚本菜单
187 }
188 if (getAutoSwitch() == 3) {
189 tip = '自定义 [模式 3] 排除目标,修改后立即生效 (部分网页可能需要刷新)~\n格式:CSS 选择器 (如果不会写可以找我)\n默认:img, .img, video, [style*="background"][style*="url"], svg\n (使用英文逗号间隔,末尾不要有逗号)';
190 defaults = 'img, .img, video, [style*="background"][style*="url"], svg';
191 name = 'menu_customMode3_exclude';
192 newMods = prompt(tip, GM_getValue(`${name}`));
193 if (newMods === '') {
194 GM_setValue(`${name}`, defaults);
195 registerMenuCommand(); // 重新注册脚本菜单
196 } else if (newMods != null) {
197 GM_setValue(`${name}`, newMods);
198 registerMenuCommand(); // 重新注册脚本菜单
199 }
200 }
201 if (document.getElementById('XIU2DarkMode')) {
202 document.getElementById('XIU2DarkMode').remove(); // 即时修改样式
203 addStyle();
204 }
205 }
206
207
208 // 自定义昼夜时间

Callers 1

registerMenuCommandFunction · 0.85

Calls 3

getAutoSwitchFunction · 0.85
registerMenuCommandFunction · 0.70
addStyleFunction · 0.70

Tested by

no test coverage detected