AGE动漫

优化显示内容

目前为 2025-02-25 提交的版本。查看 最新版本

// ==UserScript==
// @name         AGE动漫
// @icon         https://acgwy.cc/wp-content/uploads/2023/01/1c5a0-www.agemys.net.png
// @namespace    http://github.com/Emokui/Sukuna
// @version      1.2
// @description  优化显示内容
// @author       Musashi
// @match        https://www.agedm.org/*
// @match        https://web.agespa-01.com:8443/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    const selectors = [
        'div.global_notice_box',
        'div.global_notice_wrapper',
        'a.nav-download-link[href="https://www.agedm.app?ref=www.agedm.org"]',
        'div.container.xcontainer.py-2',
        'div.text_list_box.links',
        'div.foot_content_wrapper.pb-3'
    ];

    function removeElements() {
        selectors.forEach(selector => {
            const elements = document.querySelectorAll(selector);
            if (elements.length) {
                elements.forEach(el => el.remove());
            }
        });

        // 通过域名匹配广告图片
        document.querySelectorAll('img').forEach(img => {
            const src = img.src;
            if (src.includes('xcdn.rltdxt.com') || src.includes('g52j7.com') || src.includes('p3.toutiaoimg.com') || src.includes('p1.bdxiguaimg.com/origin/1386b0000fc487ec8b2ec')) {
                img.remove();
            }
        });
    }

    function observeDOMChanges() {
        const observer = new MutationObserver(() => {
            removeElements();
        });

        const targetNode = document.body || document.documentElement;
        if (targetNode) {
            observer.observe(targetNode, { childList: true, subtree: true });
        }
    }

    if (document.body) {
        removeElements();
        observeDOMChanges();
    } else {
        document.addEventListener("DOMContentLoaded", () => {
            removeElements();
            observeDOMChanges();
        });
    }
})();

QingJ © 2025

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