您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
调整网页亮度,护眼
当前为
// ==UserScript== // @name 调整网页亮度 // @namespace http://tampermonkey.net/ // @version 0.3 // @description 调整网页亮度,护眼 // @description:en Adjust page brightness,eyeshield // @author wodexianghua // @match http://*/* // @match https://*/* // @match file:///* // @grant GM_setValue // @grant GM_getValue // ==/UserScript== (function() { 'use strict'; //保证iframe不起作用 if (self == top) { function insertHTML(lv) { if (self == top) { document.body.insertAdjacentHTML("beforebegin", '<div id="__nightingale_view_cover" style="width: 100%; height: 100%; transition: -webkit-transform 10s ease-in-out 0s; position: fixed !important; left: 0px !important; bottom: 0px !important; overflow: hidden !important; background: rgb(0, 0, 0) !important; pointer-events: none !important; z-index: 2147483647; opacity: ' + lv + ';"></div>'); } } if (GM_getValue("lv") == undefined) { GM_setValue("lv", '0.35'); } document.addEventListener('keydown', function (event) { if (event.altKey && event.which == 40) { var lv = parseFloat(GM_getValue("lv")); lv += 0.1; GM_setValue('lv', lv); document.querySelector("#__nightingale_view_cover").style.opacity = lv; } else if (event.altKey && event.which == 38) { var lv = parseFloat(GM_getValue("lv")); lv -= 0.1; GM_setValue("lv", lv); document.querySelector("#__nightingale_view_cover").style.opacity = lv; } }); document.addEventListener('visibilitychange', function() { if (document.visibilityState == 'hidden') { //状态判断 } else { var lv = parseFloat(GM_getValue("lv")); if (document.querySelector("#__nightingale_view_cover") == null) { insertHTML(GM_getValue("lv")); } GM_setValue("lv", lv); document.querySelector("#__nightingale_view_cover").style.opacity = lv } }); // window.addEventListener("storage", function(event) { // console.log(event.key + '=' +event.newValue); // }); setTimeout(insertHTML(GM_getValue("lv")), 300); } // Your code here... })();