R34 AgeVerif Block

Блокировка загрузки скриптов ageverif.com

スクリプトをインストールするには、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         R34 AgeVerif Block
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Блокировка загрузки скриптов ageverif.com
// @match        https://rule34video.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=rule34video.com
// @run-at       document-start
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    const TARGET_DOMAIN = 'ageverif.com';

    // Перехват динамического создания тегов script
    const originalCreateElement = document.createElement;
    document.createElement = function (tagName, options) {
        const element = originalCreateElement.call(document, tagName, options);
        if (tagName && tagName.toLowerCase() === 'script') {
            const originalSetAttribute = element.setAttribute;
            element.setAttribute = function (name, value) {
                if (name && name.toLowerCase() === 'src' && typeof value === 'string' && value.includes(TARGET_DOMAIN)) {
                    return;
                }
                return originalSetAttribute.call(this, name, value);
            };

            Object.defineProperty(element, 'src', {
                set(url) {
                    if (typeof url === 'string' && url.includes(TARGET_DOMAIN)) {
                        return;
                    }
                    element.setAttribute('src', url);
                },
                get() {
                    return element.getAttribute('src') || '';
                },
                configurable: true
            });
        }
        return element;
    };

    // Блокировка тегов script в HTML-дереве
    const observer = new MutationObserver((mutations) => {
        for (const mutation of mutations) {
            for (const node of mutation.addedNodes) {
                if (node.nodeType === 1 && node.tagName === 'SCRIPT') {
                    if (node.src && node.src.includes(TARGET_DOMAIN)) {
                        node.type = 'javascript/blocked';
                        node.remove();
                    }
                }
            }
        }
    });

    observer.observe(document.documentElement || document, {
        childList: true,
        subtree: true
    });
})();