Greasy Fork

Greasy Fork is available in English.

灰色网页变彩色

取消各网站首页变灰

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         灰色网页变彩色
// @version      0.1
// @description  取消各网站首页变灰
// @author       AyaSono
// @match        http://*/*
// @match        https://*/*
// @icon         https://img1.baidu.com/it/u=3816024841,1982428002&fm=253&fmt=auto&app=138&f=JPEG?w=444&h=444
// @grant        none
// @namespace http://greasyfork.icu/users/992881
// ==/UserScript==

(function() {
    'use strict';
/*/
    const html = document.querySelector('html')
    if (window.getComputedStyle(html).filter === 'grayscale(1)' || window.getComputedStyle(html).filter === 'grayscale(100%)') {
        html.style.filter = 'none'
        console.log('grayscale reset')
    }
    console.log('grayscale undetected')
/*/

    function grayKiller(dom) {
        const filter = window.getComputedStyle(dom, null).getPropertyValue('filter')
        filter.includes('grayscale') && dom.style.setProperty('filter', 'none')
    }
    grayKiller(document.documentElement)
    grayKiller(document.body)

})();