沉重哀悼

2022/12/1 16:48:00

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        沉重哀悼
// @match       *://*/*
// @grant       none
// @version     1.0
// @author      Helix
// @description 2022/12/1 16:48:00
// @namespace   http://qusu.info
// @license     MIT
// ==/UserScript==


(function() {
    'use strict';
    document.body.style.filter='grayscale(100%)';
    document.body.style['-webkit-filter']='grayscale(100%)';
    document.getElementsByTagName('html')[0].style.filter = 'grayscale(100%)';
    document.getElementsByTagName('html')[0].style['-webkit-filter'] = 'grayscale(100%)';
    document.body.classList.remove("big-event-gray");
    function resetColor(parent) {
        // 如果当前节点是元素节点,输出当前元素
        parent.nodeType === 1 && console.log(parent);
        // 获得父节点的所有直接子节点
        let children = parent.childNodes
        // 遍历 children 中每个节点
        for(let i = 0, len = children.length; i<len; i++) {
            // 对当前子节点递归
            if (children[i].style) {
                children[i].style.filter='grayscale(100%)';
                children[i].style['-webkit-filter']='grayscale(100%)';
            }
            resetColor(children[i])
            console.info(children[i])
        }
    }
    resetColor(document.body)
})();