R34 AgeVerif Block

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

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.

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

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

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

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

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

// ==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
    });
})();