Swordz.io box hider

Hides junk in the homescreen

// ==UserScript==
// @name         Swordz.io box hider
// @namespace    intuxs
// @version      1
// @description  Hides junk in the homescreen
// @author       YourName
// @match        *.swordz.io
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Function to hide ads
    function hideAds() {
        // Target ads based on their structure or other attributes
        const ads = document.querySelectorAll('div[style*="background-color"], iframe, img[src*="ads"]');
        
        ads.forEach(ad => {
            // Check if the ad is visible and matches certain criteria
            if (ad.offsetWidth > 0 && ad.offsetHeight > 0) { // Ensure the ad is visible
                ad.style.display = 'none'; // Hide the ad
                console.log('Ad hidden:', ad);
            }
        });
    }

    // Run the function when the page loads
    window.addEventListener('load', hideAds);

    // Use MutationObserver to handle dynamically loaded ads
    const observer = new MutationObserver(function(mutations) {
        mutations.forEach(function(mutation) {
            if (mutation.addedNodes.length) {
                hideAds(); // Check for new ads and hide them
            }
        });
    });

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

QingJ © 2025

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