Sword Master.io Basic Ad Hider

Ẩn banner và pop-up quảng cáo mà không hack/cheat

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Sword Master.io Basic Ad Hider
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Ẩn banner và pop-up quảng cáo mà không hack/cheat
// @author       You
// @match        *://*/* 
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Danh sách các class và ID thường dùng để chứa quảng cáo
    const adSelectors = [
        '#ad-container', 
        '.ad-box', 
        '.aip-ad', 
        '#game-ad', 
        '.preroll-ad-container',
        'iframe[src*="doubleclick"]', 
        'iframe[src*="ads"]',
        'iframe[src*="adsystem"]'
    ];

    // Hàm tìm và ẩn quảng cáo
    const hideAds = () => {
        adSelectors.forEach(selector => {
            const adElements = document.querySelectorAll(selector);
            adElements.forEach(el => {
                // Ẩn phần tử đi thay vì xóa hoàn toàn để tránh lỗi web
                if (el.style.display !== 'none') {
                    el.style.display = 'none';
                }
            });
        });
    };

    // Chạy hàm khi trang vừa tải xong
    window.addEventListener('load', hideAds);

    // Chạy lặp lại mỗi 2 giây để bắt các quảng cáo hiện ra sau
    setInterval(hideAds, 2000);
})();