GoBattle.io Adblocker

A Google Ads adblocker. Join us! - https://discord.gg/yEweYTxFFD

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         GoBattle.io Adblocker
// @namespace    http://tampermonkey.net/
// @version      1.0.2
// @description  A Google Ads adblocker. Join us! - https://discord.gg/yEweYTxFFD
// @author       GoBattle Hacks Official
// @match        *://gobattle.io/*
// @match        *://alpha.gobattle.io/*
// @run-at       document-start
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    const SELECTOR = 'ins.adsbygoogle';

    function removeAds(root = document) {
        root.querySelectorAll(SELECTOR).forEach(el => el.remove());
    }

    removeAds();

    const observer = new MutationObserver((mutations) => {
        for (const mutation of mutations) {

            if (mutation.type === 'childList') {
                for (const node of mutation.addedNodes) {
                    if (node.nodeType !== Node.ELEMENT_NODE) continue;

                    if (node.matches?.(SELECTOR)) {
                        node.remove();
                        continue;
                    }

                    node.querySelectorAll?.(SELECTOR)
                        .forEach(el => el.remove());
                }
            }

            if (mutation.type === 'attributes') {
                const el = mutation.target;
                if (el.matches?.(SELECTOR)) {
                    el.remove();
                }
            }
        }
    });

    observer.observe(document.documentElement, {
        childList: true,
        subtree: true,
        attributes: true,
        attributeFilter: ['class']
    });

    setInterval(() => {
        removeAds();
    }, 1000);

    const style = document.createElement('style');
    style.textContent = `
        ins.adsbygoogle {
            display: none !important;
            visibility: hidden !important;
        }
    `;
    document.documentElement.appendChild(style);

})();