文章摘要
油猴脚本“还我彩色网页”旨在移除网页上的灰度滤镜,恢复彩色显示。由于原脚本作者删除了源码,作者自行编写此脚本以应对网页被迫切换为黑白模式的情况。脚本通过向页面插入CSS样式,将滤镜设为“none”实现目标。发布信息显示,脚本由“dai.ge”创作,版本0.1,匹配所有网页并利用MutationObserver监测页面变化,确保滤镜被及时清除。
— 文章部分摘要由DeepSeek深度思考而成
之前发过一个别人写的,但是作者删源了,这里自己搞了一个
// ==UserScript==
// @name 还我彩色网页
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 移除网页上的灰度滤镜
// @author dai.ge
// @match *://*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
function removeGrayscale() {
const style = document.createElement('style');
style.innerHTML = `
html {
filter: none !important;
-webkit-filter: none !important;
}
`;
document.head.appendChild(style);
}
const observer = new MutationObserver(removeGrayscale);
observer.observe(document.body, { childList: true, subtree: true });
removeGrayscale();
})();
本站文章部分内容可能来源于网络,仅供大家学习参考,如有侵权,请联系站长📧cutwork@qq.com进行删除处理!
THE END