()
| 344 | |
| 345 | // 添加样式 |
| 346 | function addStyle() { |
| 347 | let remove = false, style_Add = document.createElement('style'), |
| 348 | hours = new Date().getHours(), |
| 349 | style_10 = menu_value('menu_customMode1').split('|'), |
| 350 | style_20 = menu_value('menu_customMode2').split('|'), |
| 351 | style_30 = menu_value('menu_customMode3').split('|'), |
| 352 | style = ``, |
| 353 | style_00 = `html, body {background-color: #ffffff !important;}`, |
| 354 | style_11 = `html {filter: brightness(${style_10[0]}%) !important;}`, |
| 355 | style_11_firefox = `html {filter: brightness(${style_10[0]}%) !important; background-image: url();}`, |
| 356 | style_12 = `html {filter: brightness(${style_10[1]}%) !important;}`, |
| 357 | style_12_firefox = `html {filter: brightness(${style_10[1]}%) !important; background-image: url();}`, |
| 358 | style_21 = `html {filter: brightness(${style_20[0]}%) sepia(${style_20[1]}%) !important;}`, |
| 359 | style_21_firefox = `html {filter: brightness(${style_20[0]}%) sepia(${style_20[1]}%) !important; background-image: url();}`, |
| 360 | style_22 = `html {filter: brightness(${style_20[2]}%) sepia(${style_20[3]}%) !important;}`, |
| 361 | style_22_firefox = `html {filter: brightness(${style_20[2]}%) sepia(${style_20[3]}%) !important; background-image: url();}`, |
| 362 | style_31 = `html {filter: invert(${style_30[0]}%) !important; text-shadow: 0 0 0 !important;} |
| 363 | ${menu_value('menu_customMode3_exclude')} {filter: invert(1) !important;} |
| 364 | img[alt="[公式]"] {filter: none !important;}`, |
| 365 | style_31_firefox = `html {filter: invert(${style_30[0]}%) !important; background-image: url(); text-shadow: 0 0 0 !important;} |
| 366 | ${menu_value('menu_customMode3_exclude')} {filter: invert(1) !important;} |
| 367 | img[alt="[公式]"] {filter: none !important;}`, |
| 368 | style_31_scrollbar = `::-webkit-scrollbar {height: 12px !important;} |
| 369 | ::-webkit-scrollbar-thumb {border-radius: 0;border-color: transparent;border-style: dashed;background-color: #3f4752 !important;background-clip: padding-box;transition: background-color .32s ease-in-out;} |
| 370 | ::-webkit-scrollbar-corner {background: #202020 !important;} |
| 371 | ::-webkit-scrollbar-track {background-color: #22272e !important;} |
| 372 | ::-webkit-scrollbar-thumb:hover {background: #3f4752 !important;}`; |
| 373 | |
| 374 | |
| 375 | // Firefox 浏览器需要特殊对待 |
| 376 | if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { |
| 377 | style_11 = style_11_firefox |
| 378 | style_12 = style_12_firefox |
| 379 | style_21 = style_21_firefox |
| 380 | style_22 = style_22_firefox |
| 381 | style_31 = style_31_firefox |
| 382 | } |
| 383 | |
| 384 | // 白天 |
| 385 | if (isDaytime()) { |
| 386 | if (menu_value('menu_runDuringTheDay')) { |
| 387 | style_12 = style_11 |
| 388 | style_22 = style_21 |
| 389 | } else { |
| 390 | style_12 = style_22 = '' |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | |
| 395 | let darkModeType = getAutoSwitch(); |
| 396 | |
| 397 | switch(darkModeType) { |
| 398 | case 1: |
| 399 | style += style_12; |
| 400 | break; |
| 401 | case 2: |
| 402 | style += style_22; |
| 403 | break; |
no test coverage detected