()
| 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); |
no test coverage detected