Remove All Holiday Elements from macserialjunkie.com

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

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 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();
})();