贞德去广告特供版

贞德去广告特供版.

// ==UserScript==
// @name         贞德去广告特供版
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  贞德去广告特供版.
// @author       空白
// @match        *://*.hvhbbs.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Function to remove specific elements
    const removeElements = () => {
        // Remove style elements
        document.querySelectorAll('div.p-body-inner.margin-add style').forEach(styleElement => styleElement.remove());

        // Remove swiper-wrapper div elements
        document.querySelectorAll('div.swiper-wrapper').forEach(swiperElement => swiperElement.remove());
    };

    // Initial removal in case elements are already present
    removeElements();

    // Create a MutationObserver to observe the document for any changes
    const observer = new MutationObserver(removeElements);

    // Start observing the document for changes in the entire tree and subtree
    observer.observe(document.body, {
        childList: true,
        subtree: true
    });
})();