LINUX.DO Discourse页面加载动画去除

彻底移除Discourse网页中 id 为 "d-splash" 的 section 元素

// ==UserScript==
// @name         LINUX.DO Discourse页面加载动画去除
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  彻底移除Discourse网页中 id 为 "d-splash" 的 section 元素
// @author       Dahi
// @match        https://linux.do/*
// @grant        none
// @run-at       document-start
// @license      GPL-3.0-or-later
// ==/UserScript==

(function() {
    'use strict';

    function removeSplashElement() {
        const splashElement = document.getElementById('d-splash');
        if (splashElement) {
            splashElement.remove();
        }
    }

    function initRemove() {
        removeSplashElement();
    }

    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', initRemove);
    } else {
        initRemove();
    }

    const observer = new MutationObserver(function(mutations) {
        mutations.forEach(function(mutation) {
            if (mutation.type === 'childList' && mutation.addedNodes) {
                removeSplashElement();
            }
        });
    });

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

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址