// ==UserScript== // @name 黑白网页恢复彩色 // @namespace http://tampermonkey.net/ // @version 1.11.5 // @license MIT // @description 黑白网页恢复彩色,匹配所有网页,即装即用。 // @author https://greasyfork.org/users/574395-frammolz-amanda // @match *://*/* // @grant GM_xmlhttpRequest // @run-at document-start // @downloadURL https://update.greasyfork.icu/scripts/455684/%E9%BB%91%E7%99%BD%E7%BD%91%E9%A1%B5%E6%81%A2%E5%A4%8D%E5%BD%A9%E8%89%B2.user.js // @updateURL https://update.greasyfork.icu/scripts/455684/%E9%BB%91%E7%99%BD%E7%BD%91%E9%A1%B5%E6%81%A2%E5%A4%8D%E5%BD%A9%E8%89%B2.meta.js // ==/UserScript== var temp = document.createElement('style');//先添加一个临时的,减少延迟,最后会remove掉 temp.type = 'text/css'; temp.appendChild(document.createTextNode("*{-webkit-filter:none !important;}")); var tmitv = setInterval(function() { try{ document.head.appendChild(temp); document.body.appendChild(temp); clearInterval(tmitv); }catch{} },30); window.addEventListener("load", function () { var filter = document.createElement('style'); filter.type = 'text/css'; document.head.appendChild(filter); var windowUrl = window.location.href; if(document.getElementById("nv_forum"))document.getElementById("nv_forum").style.setProperty("background-blend-mode","normal");//Discuz论坛通用 if( windowUrl.match(/https:\/\/www.58pic.com\/($|\?)/))filter.appendChild(document.createTextNode("*{-webkit-filter:none !important;}")); 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:\/\/www.bilibili.com\/($|\?)/)){ var source=[["//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"],["//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); if(document.getElementsByClassName("v-img banner-img").length){document.getElementsByClassName("v-img banner-img")[0].getElementsByTagName("source")[0].setAttribute("srcset",source[0][index]);document.getElementsByClassName("logo-img")[0].setAttribute("src",source[1][index]);} else setTimeout(function(){document.getElementsByClassName("bili-banner")[0].style.setProperty("background-image","url(\""+source[0][index]+"\")");document.getElementsByClassName("logo-img")[0].setAttribute("src",source[1][index]);},500); } if( windowUrl.match(/https:\/\/weibo.com/)){ var body = document.body; if(body.classList.length){ document.getElementById("plc_frame").getElementsByTagName("style")[0].remove(); const callback = function(mutationsList, observer) { for(let mutation of mutationsList){ if (mutation.type === "childList") document.getElementById("plc_frame").getElementsByTagName("style")[0].remove(); } } new MutationObserver(callback).observe(body, { childList: true,}); return; } } if( windowUrl.match(/https:\/\/www.ixigua.com/)){ var chd = 0; replace(); if( windowUrl.match(/https:\/\/www.ixigua.com\/[0-9]+/))obs("projection_recommentWrapper"); else obs("v3-app-layout__content"); function obs(clsname){ const callback = function(mutationsList, observer) { for(let mutation of mutationsList){ if (mutation.type === 'childList') replace(); } } new MutationObserver(callback).observe(document.getElementsByClassName(clsname)[0],{ childList: true, subtree: true}); } function replace(){ var ob=document.getElementsByClassName("HorizontalFeedCard__coverWrapper disableZoomAnimation"); for( var index=chd;index]*?filter[^<>]*?grayscale[^<>]*?>/g);//行内样式修改 if(inner){ for(let i=0;i