Chiphell 隐藏勋章

隐藏 Chiphell 网站上的用户勋章

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Chiphell 隐藏勋章
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  隐藏 Chiphell 网站上的用户勋章
// @author       YourName
// @match        https://www.chiphell.com/*
// @grant        none
// @license      MIT
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    // 使用 CSS 样式插入的方法隐藏所有 'md_ctrl' 类的元素
    var style = document.createElement('style');
    style.type = 'text/css';
    style.innerHTML = 'p.md_ctrl { display: none; }';
    document.head.appendChild(style);

    console.log('初始加载完成,已隐藏元素');

    // 监测 DOM 变化以隐藏动态加载的元素
    var observer = new MutationObserver(function(mutations) {
        mutations.forEach(function(mutation) {
            mutation.addedNodes.forEach(function(node) {
                if (node.nodeType === 1 && node.matches('p.md_ctrl')) {
                    node.style.display = 'none';
                    console.log('隐藏新的勋章元素');
                }
            });
        });
    });

    observer.observe(document.body, { childList: true, subtree: true });
})();