Greasy Fork

Greasy Fork is available in English.

关闭网站黑白显示

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         关闭网站黑白显示
// @namespace    http://tampermonkey.net/
// @version      0.5
// @license      WTFPL
// @description  部分网站变灰看得很累,所以随便写了个脚本
// @author       scientificworld
// @match        *://*/*
// @run-at       document-body
// @require      http://greasyfork.icu/scripts/455875-akilib/code/AkiLib.js?version=1123973
// @grant        GM_registerMenuCommand
// @grant        GM_setValue
// @grant        GM_getValue
// ==/UserScript==

(function() {
    "use strict";
    var regex = /grayscale\\(.*?\\)/gi;
    var config = [aki.createCheckboxMenu("修改所有标签的样式"), aki.createCheckboxMenu("对特定网站进行优化", true)];
    if (aki.getMenuValue(config[1])) {
        var url = location.href;
        if (/^https:\/\/www.baidu.com\/$/.test(url)) {
            document.getElementById("su").style.backgroundColor = "#4e6ef2";
        }
    }
    if (aki.getMenuValue(config[0])) {
        for (var node of document.getElementsByTagName("*")) {
            node.style.filter = node.style.filter.replace(regex, "") + "grayscale(0)";
        }
    } else {
        document.documentElement.style.filter = document.documentElement.style.filter.replace(regex, "") + "grayscale(0)";
        document.body.style.filter = document.body.style.filter.replace(regex, "") + "grayscale(0)";
    }
})();