Furry34 Ad Blocker

Blocks aggressive ads and redirects on furry34.com

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला 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         Furry34 Ad Blocker
// @name:ru      Furry34 Блокировщик рекламы
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Blocks aggressive ads and redirects on furry34.com
// @description:ru  Блокирует агрессивную рекламу и редиректы на furry34.com
// @author       scody
// @license      MIT
// @match        *://*.furry34.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    console.log("Furry34 Ad Blocker started");

    const originalOpen = window.open;
    window.open = function(url) {
        if (url && !url.includes("furry34.com")) {
            console.log("Blocked window.open: " + url);
            return null;
        }
        return originalOpen.apply(this, arguments);
    };

    let currentLocation = window.location.href;
    Object.defineProperty(window, "location", {
        set: function(value) {
            if (value && !value.includes("furry34.com")) {
                console.log("Blocked redirect: " + value);
                return;
            }
            currentLocation = value;
            window.location.href = value;
        },
        get: function() {
            return { href: currentLocation };
        }
    });

    document.addEventListener("click", function(e) {
        const target = e.target.closest("a");
        if (target && target.href && !target.href.includes("furry34.com")) {
            console.log("Blocked click: " + target.href);
            e.preventDefault();
            e.stopPropagation();
        }
    }, true);

    function protectLinks() {
        document.querySelectorAll('a[href]').forEach(link => {
            const href = link.getAttribute('href');
            if (href && !href.includes('furry34.com') && !href.startsWith('#') && !href.startsWith('javascript:')) {
                link.addEventListener('click', function(e) {
                    console.log("Blocked link: " + this.href);
                    e.preventDefault();
                    e.stopPropagation();
                }, true);
            }
        });
    }

    const linkObserver = new MutationObserver(protectLinks);
    linkObserver.observe(document.body, { childList: true, subtree: true });
    protectLinks();

    console.log("Furry34 Ad Blocker ready");
})();