1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
;(function () { 'use strict' var menuArr = [ ['menu_eye', '✅护眼模式已开启', '⬜护眼模式已关闭'], ['menu_color', '✅颜色拾取器已显示', '⬜颜色拾取器已隐藏'], ] function getColorValue(e) { var rgbValueArry = window .getComputedStyle(e) .backgroundColor.replace(/rgba|rgb|\(|\)| /g, '') .split(',') return parseInt(rgbValueArry[0] + rgbValueArry[1] + rgbValueArry[2]) } function handle(key) { if (key === 'menu_color') { $('body').append( `<input type="color" style=" position: fixed;z-index:99999; bottom: 20px;right: 20px;"/>` ) } else if (key === 'menu_eye') { if ( window.getComputedStyle(document.body).backgroundColor === 'rgba(0, 0, 0, 0)' && window.getComputedStyle(document.lastElementChild).backgroundColor === 'rgba(0, 0, 0, 0)' ) { $('html').append(`<style type="text/css">html,body{background-color: #fff;}</style>`) } else if ( window.getComputedStyle(document.body).backgroundColor === 'rgb(0, 0, 0)' || (getColorValue(document.body) > 0 && getColorValue(document.body) < 898989) || (getColorValue(document.lastElementChild) > 0 && getColorValue(document.lastElementChild) < 898989) || (window.getComputedStyle(document.body).backgroundColor === 'rgba(0, 0, 0, 0)' && window.getComputedStyle(document.lastElementChild).backgroundColor === 'rgb(0, 0, 0)') ) { return }
$('html').append( `<style type="text/css">html {filter: brightness(90%) sepia(20%) !important;}</style>` ) } } menuArr.forEach(e => { if (GM_getValue(e[0])) { if (document.lastElementChild && document.body) { handle(e[0]) } else { var timer1 = setInterval(function () { if (document.lastElementChild && document.body) { clearInterval(timer1) handle(e[0]) } }, 5) } GM_registerMenuCommand(e[1], function () { GM_setValue(e[0], false) location.reload() }) } else { GM_registerMenuCommand(e[2], function () { GM_setValue(e[0], true) location.reload() }) } }) })()
|