Remove All Holiday Elements from macserialjunkie.com

Removes snow animation, santa hat, Christmas lights, and other holiday theme elements from macserialjunkie.com

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Remove All Holiday Elements from macserialjunkie.com
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  Removes snow animation, santa hat, Christmas lights, and other holiday theme elements from macserialjunkie.com
// @author       sharmanhall
// @match        *://*.macserialjunkie.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=macserialjunkie.com
// @grant        GM_addStyle
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Function to remove the snowflake CSS
    function removeSnowflakeCSS() {
        const cssLink = document.querySelector('link[href*="snowflakes.css"]');
        if (cssLink) {
            cssLink.remove();
        }
    }

    // Function to remove santa hat
    function removeSantaHat() {
        const hatDiv = document.getElementById('santahat');
        if (hatDiv) {
            hatDiv.remove();
        }
    }

    // Function to remove specific snowflake elements and set their display to none
    function removeSpecificSnowElements() {
        const lightsDiv = document.getElementById('lights');
        if (lightsDiv) {
            lightsDiv.remove();
        }

        const snowflakeContainer = document.querySelector('.snowflakes');
        if (snowflakeContainer) {
            snowflakeContainer.remove();
        }

        GM_addStyle('.snowflake { display: none !important; }');
    }

    // Function to remove dynamically loaded snowflake elements
    function removeDynamicSnowflakes() {
        const snowflakes = document.querySelectorAll('div[style*="position: absolute"]');
        snowflakes.forEach(flake => {
            if (flake.textContent.trim() === '❄') {
                flake.remove();
            }
        });
    }

    // MutationObserver to handle dynamic loading of snowflakes and other elements
    const observer = new MutationObserver(mutations => {
        mutations.forEach(mutation => {
            if (mutation.addedNodes.length) {
                removeSpecificSnowElements();
                removeDynamicSnowflakes();
            }
        });
    });

    // Start observing the body for added nodes
    observer.observe(document.body, { childList: true, subtree: true });

    // Execute removal functions
    removeSnowflakeCSS();
    removeSantaHat();
    removeSpecificSnowElements();
    removeDynamicSnowflakes();
})();