Chiphell 灰度模式

将 www.chiphell.com 的所有页面呈现为灰色调

// ==UserScript==
// @name         Chiphell 灰度模式
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  将 www.chiphell.com 的所有页面呈现为灰色调
// @author       wosell
// @match        *://www.chiphell.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // 创建样式元素
    const style = document.createElement('style');
    style.type = 'text/css';

    // 添加灰度效果样式
    style.innerHTML = `
        html {
            filter: grayscale(100%);
            -webkit-filter: grayscale(100%);
            -moz-filter: grayscale(100%);
            -ms-filter: grayscale(100%);
            -o-filter: grayscale(100%);
            filter: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg'><filter id='grayscale'><feColorMatrix type='matrix' values='0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0'/></filter></svg>#grayscale");
            filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
        }
    `;

    // 将样式添加到文档头部
    document.head.appendChild(style);
})();