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

Function menu_customAutoSwitch

DarkMode.user.js:129–145  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

127
128 // 晚上自动切换模式
129 function menu_customAutoSwitch() {
130 let newAutoSwitch = prompt('白天、晚上使用不同模式,修改后立即生效~\n格式:白天模式|晚上模式\n例如:1|3(即白天模式 1 晚上模式 3)\n默认:留空(即关闭该功能)', GM_getValue('menu_autoSwitch'));
131 if (newAutoSwitch === '') {
132 GM_setValue('menu_autoSwitch', '');
133 } else if (newAutoSwitch != null) {
134 if (newAutoSwitch.split('|').length == 2) {
135 GM_setValue('menu_autoSwitch', newAutoSwitch);
136 } else {
137 alert(`填入内容格式错误...`);
138 }
139 }
140 registerMenuCommand(); // 重新注册脚本菜单
141 if (document.getElementById('XIU2DarkMode')) {
142 document.getElementById('XIU2DarkMode').remove(); // 即时修改样式
143 addStyle();
144 }
145 }
146 // 获取当前模式
147 function getAutoSwitch() {
148 let darkModeType = GM_getValue('menu_darkModeType'), hours = new Date().getHours(), time = GM_getValue('menu_customTime').split('|').map(Number);

Callers 1

registerMenuCommandFunction · 0.85

Calls 2

registerMenuCommandFunction · 0.70
addStyleFunction · 0.70

Tested by

no test coverage detected