Greasy Fork is available in English.
黑白网页恢复彩色,匹配所有网页,即装即用。
当前为
// ==UserScript==
// @name 黑白网页恢复彩色
// @namespace http://tampermonkey.net/
// @version 1.6.5
// @license MIT
// @description 黑白网页恢复彩色,匹配所有网页,即装即用。
// @author http://greasyfork.icu/users/574395-frammolz-amanda
// @match *://*/*
// @exclude *://www.douyin.com*
// @exclude *://www.bilibili.com/bangumi/*
// @exclude *://www.bilibili.com/video/*
// @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\/\?.*/)){
var banner=["//i0.hdslb.com/bfs/archive/0ac04c23af3b3297bf02dca163474326898d211d.png","//i0.hdslb.com/bfs/archive/583e5db0ffa0c4de4fc88de35e802767a9c93b63.png","//i0.hdslb.com/bfs/archive/ab6b34468bcc179b601541193eda668f2aa6106b.jpg","//i0.hdslb.com/bfs/archive/a421773e566a623fca26e12ae3921bda4a3fd856.png","//i0.hdslb.com/bfs/archive/3329c9f0abfb925ae30441f24d924ad3c19775df.png","//i0.hdslb.com/bfs/archive/57c5ced363be9f08b4cacf1745e221d3bb99d7c5.png"]
var logo=["//i0.hdslb.com/bfs/archive/bdb288021ff854d3ac618ac8c1eafd300ec9ed9b.png","//i0.hdslb.com/bfs/archive/5d49497b6b7f30950f37c4aff205e7dd1494f3b9.png","//i0.hdslb.com/bfs/archive/bd90aa68aaaaddb1b5421b84298c51f5b90210e0.png","//i0.hdslb.com/bfs/archive/3d30de7942ed74d2515f28ae04eb1444e8d57f40.png","//i0.hdslb.com/bfs/archive/6592e92861e6248205af17702d06ea3f97d81de6.png","//i0.hdslb.com/bfs/archive/58d322146cb4b1685a5775478b9753f96a0c2ff6.png"]
var index=Math.floor(Math.random()*6)
document.getElementsByClassName("v-img banner-img")[0].getElementsByTagName("source")[0].setAttribute("srcset",banner[index]);
document.getElementsByClassName("logo-img")[0].setAttribute("src",logo[index]);
}
if( windowUrl.match(/https:\/\/weibo.com/)){
var body = document.body;
if(body.classList.length){
rev();
function rev() {
document.getElementById("plc_frame").getElementsByTagName("style")[0].remove();
}
window.onload = function (){
const targetNode = body;
const config = { childList: true,};
const callback = function(mutationsList, observer) {
console.log(mutationsList,observer)
for(let mutation of mutationsList) {
if (mutation.type === 'childList') rev();
}
};
const observer = new MutationObserver(callback);
observer.observe(targetNode, config);
}
};
}
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");
}
})();