Sword Master.io Basic Ad Hider

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

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل 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);
})();