|
3 | 3 | // @name:zh-CN 护眼模式 |
4 | 4 | // @name:zh-TW 護眼模式 |
5 | 5 | // @name:en Dark Mode |
6 | | -// @version 1.3.8 |
| 6 | +// @version 1.3.9 |
7 | 7 | // @author X.I.U |
8 | 8 | // @description 简单有效的全网通用护眼模式(夜间模式、暗黑模式、深色模式) |
9 | 9 | // @description:zh-CN 简单有效的全网通用护眼模式(夜间模式、暗黑模式、深色模式) |
|
34 | 34 | ['menu_autoRecognition', '智能排除自带暗黑模式的网页 (beta)', '智能排除自带暗黑模式的网页 (beta)', true], |
35 | 35 | ['menu_forcedToEnable', '✅ 已强制当前网站启用护眼模式 (👆)', '❌ 未强制当前网站启用护眼模式 (👆)', []], |
36 | 36 | ['menu_darkModeType', '点击切换模式', '点击切换模式', 2], |
37 | | - ['menu_customMode', '自定义当前模式', '自定义当前模式', true], ['menu_customMode1',,,'80|70'], ['menu_customMode2',,,'80|20|70|30'], ['menu_customMode3',,,'90'], |
| 37 | + ['menu_customMode', '自定义当前模式', '自定义当前模式', true], ['menu_customMode1',,,'80|70'], ['menu_customMode2',,,'80|20|70|30'], ['menu_customMode3',,,'90'], ['menu_customMode3_exclude',,,'img, .img, video, [style*="background"][style*="url"], svg'], |
38 | 38 | ['menu_customTime', '自定义昼夜时间', '自定义昼夜时间', '6|18'], |
39 | 39 | ['menu_autoSwitch', '晚上自动切换模式', '晚上自动切换模式', ''], |
40 | 40 | ], menu_ID = []; |
|
86 | 86 | GM_setValue(menu_ALL[i][0], menu_ALL[i][3]); |
87 | 87 | menu_ID[i] = GM_registerMenuCommand(`#️⃣ ${menu_ALL[i][1]}`, function(){menu_customTime()}); |
88 | 88 | } |
89 | | - else if (menu_ALL[i][0] === 'menu_customMode1' || menu_ALL[i][0] === 'menu_customMode2' || menu_ALL[i][0] === 'menu_customMode3') |
| 89 | + else if (menu_ALL[i][0] === 'menu_customMode1' || menu_ALL[i][0] === 'menu_customMode2' || menu_ALL[i][0] === 'menu_customMode3' || menu_ALL[i][0] === 'menu_customMode3_exclude') |
90 | 90 | { // 当前模式值 |
91 | 91 | GM_setValue(menu_ALL[i][0], menu_ALL[i][3]); |
92 | 92 | } |
|
179 | 179 | GM_setValue(`${name}`, newMods); |
180 | 180 | registerMenuCommand(); // 重新注册脚本菜单 |
181 | 181 | } |
| 182 | + if (getAutoSwitch() == 3) { |
| 183 | + tip = '自定义 [模式 3] 排除目标,修改后立即生效 (部分网页可能需要刷新)~\n格式:CSS 选择器 (如果不会写可以找我)\n默认:img, .img, video, [style*="background"][style*="url"], svg\n (使用英文逗号间隔,末尾不要有逗号)'; |
| 184 | + defaults = 'img, .img, video, [style*="background"][style*="url"], svg'; |
| 185 | + name = 'menu_customMode3_exclude'; |
| 186 | + newMods = prompt(tip, GM_getValue(`${name}`)); |
| 187 | + if (newMods === '') { |
| 188 | + GM_setValue(`${name}`, defaults); |
| 189 | + registerMenuCommand(); // 重新注册脚本菜单 |
| 190 | + } else if (newMods != null) { |
| 191 | + GM_setValue(`${name}`, newMods); |
| 192 | + registerMenuCommand(); // 重新注册脚本菜单 |
| 193 | + } |
| 194 | + } |
182 | 195 | if (document.getElementById('XIU2DarkMode')) { |
183 | 196 | document.getElementById('XIU2DarkMode').remove(); // 即时修改样式 |
184 | 197 | addStyle(); |
|
341 | 354 | style_21_firefox = `html {filter: brightness(${style_20[0]}%) sepia(${style_20[1]}%) !important; background-image: url();}`, |
342 | 355 | style_22 = `html {filter: brightness(${style_20[2]}%) sepia(${style_20[3]}%) !important;}`, |
343 | 356 | style_22_firefox = `html {filter: brightness(${style_20[2]}%) sepia(${style_20[3]}%) !important; background-image: url();}`, |
344 | | - style_31 = `html {filter: invert(${style_30[0]}%) !important; text-shadow: 0 0 0 !important;} img, video, [style*="background"][style*="url"], svg {filter: invert(1) !important;} img[alt="[公式]"] {filter: none !important;}`, |
345 | | - style_31_firefox = `html {filter: invert(${style_30[0]}%) !important; background-image: url(); text-shadow: 0 0 0 !important;} img, video, [style*="background"][style*="url"], svg {filter: invert(1) !important;} img[alt="[公式]"] {filter: none !important;}`; |
| 357 | + style_31 = `html {filter: invert(${style_30[0]}%) !important; text-shadow: 0 0 0 !important;} |
| 358 | + ${menu_value('menu_customMode3_exclude')} {filter: invert(1) !important;} |
| 359 | + img[alt="[公式]"] {filter: none !important;}`, |
| 360 | + style_31_firefox = `html {filter: invert(${style_30[0]}%) !important; background-image: url(); text-shadow: 0 0 0 !important;} |
| 361 | + ${menu_value('menu_customMode3_exclude')} {filter: invert(1) !important;} |
| 362 | + img[alt="[公式]"] {filter: none !important;}`; |
346 | 363 |
|
347 | 364 | // Firefox 浏览器需要特殊对待 |
348 | 365 | if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { |
|
0 commit comments