Greasy Fork

Greasy Fork is available in English.

关闭网站黑白显示

部分网站变灰看得很累,所以随便写了个脚本

当前为 2022-12-01 提交的版本,查看 最新版本

// ==UserScript==
// @name         关闭网站黑白显示
// @namespace    http://tampermonkey.net/
// @version      0.1
// @license      WTFPL
// @description  部分网站变灰看得很累,所以随便写了个脚本
// @author       scientificworld
// @match        *://*/*
// @run-at       document-idle
// @grant        GM_registerMenuCommand
// @grant        GM_setValue
// @grant        GM_getValue
// ==/UserScript==

(function() {
    'use strict';
    GM_registerMenuCommand(
        (GM_getValue('global', false) ? "✅" : "❎") + " 全部添加样式",
        function() { GM_setValue('global', !GM_getValue('global', false)); }
    );
    if (GM_getValue('global', false)) {
        for (var node of document.all) {
            node.style.filter += "grayscale(0)";
        }
    } else {
        document.getElementsByTagName('html')[0].style.filter += "grayscale(0)";
        document.getElementsByTagName('body')[0].style.filter += "grayscale(0)";
    }
})();