Greasy Fork

Greasy Fork is available in English.

黑白网页恢复彩色

黑白网页恢复彩色,匹配所有网页,即装即用。

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         黑白网页恢复彩色
// @namespace    http://tampermonkey.net/
// @version      1.6
// @license      MIT
// @description  黑白网页恢复彩色,匹配所有网页,即装即用。
// @author       http://greasyfork.icu/users/574395-frammolz-amanda
// @match        *://*/*
// @exclude      *://www.douyin.com*
// @exclude      *://www.bilibili.com/bangumi/media/*
// @grant        none
// ==/UserScript==

(function() {
    var filter = document.createElement('style');
    filter.type = 'text/css';
    document.getElementsByTagName('head')[0].appendChild(filter);
    filter.appendChild(document.createTextNode("*{-webkit-filter:none !important;}"));
    var windowUrl = window.location.href;
    if( windowUrl.match(/https:\/\/www.baidu.com\/$/)){
        document.getElementById("s_lg_img").setAttribute("src","https://www.baidu.com/img/flexible/logo/pc/index.png");
        document.getElementById("s_lg_img_new").setAttribute("src","https://www.baidu.com/img/flexible/logo/pc/index.png");
        document.getElementById("su").style.setProperty("background-color","#4e6ef2","important");
        if (document.getElementsByClassName("index-logo-src").length==1){
            document.getElementsByClassName("index-logo-src")[0].setAttribute("src","https://www.baidu.com/img/flexible/logo/pc/result.png");
            document.getElementsByClassName("index-logo-peak")[0].setAttribute("src","https://www.baidu.com/img/flexible/logo/pc/result.png");
            document.getElementsByClassName("index-logo-srcnew")[0].setAttribute("src","https://www.baidu.com/img/flexible/logo/pc/result.png");
        }
    }
    if( windowUrl.match(/https:\/\/m.baidu.com\/$/)){
        document.getElementById("logo").getElementsByTagName("a")[0].getElementsByTagName("img")[0].setAttribute("src","https://www.baidu.com/img/flexible/logo/logo_web.png");
        document.getElementById("index-bn").style.setProperty("background-color","#4e6ef2","important");
    }
    if( windowUrl.match(/https:\/\/115.com/)){
        filter.appendChild(document.createTextNode(".container-ceiling, .container-main, .dialog-box, .feature-float, .article-reader{-webkit-filter:none !important;}"));
    }
    if( windowUrl.match(/https:\/\/www.bilibili.com\/$|https:\/\/www.bilibili.com\/\?.*/)){
        document.getElementsByClassName("v-img banner-img")[0].getElementsByTagName("source")[0].setAttribute("srcset","//i0.hdslb.com/bfs/archive/0ac04c23af3b3297bf02dca163474326898d211d.png")
    }
    if( windowUrl.match(/https:\/\/weibo.com/)){
        var body = document.body;
        console.log(body.classList.length);
        if(body.classList.length){
            rev();
            function rev() {
                console.log("123655")
                var styles_body = {"background-color": "#b4daf0 !important","background-image": "url(images/body_repeat.png?id=1414052827385) !important","background-repeat": "repeat-x !important","background-position": "center 0 !important",};
                Object.entries(styles_body).forEach(([prop, val]) => {
                    var [value, pri = ""] = val.split("!");
                    body.style.setProperty(prop, value, pri);
                });
                document.getElementsByClassName("WB_frame")[0].style.setProperty("background-color", "#93c5e3", "important");
                document.getElementsByClassName("WB_frame")[0].style.setProperty("background-color", "rgba(70,149,194,0.3)", "important");
            }
            document.getElementsByClassName("WB_global_nav")[0].addEventListener("click", function() {
                setTimeout(function(){
                    rev();
                },2000);
            }, false);
        };
    }
    if( windowUrl.match(/https:\/\/bbs.kafan.cn\/$/)){
        document.getElementById("nv_forum").style.setProperty("background-blend-mode","normal");
    }
    if( windowUrl.match(/https:\/\/www.58pic.com\/$/)){
        document.documentElement.style.setProperty("-webkit-filter","none","important");
    }
})();