xfree.com Adblocker

Blocks simply every ad on xfree.com

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         xfree.com Adblocker
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Blocks simply every ad on xfree.com
// @author       jj251
// @match        https://*.xfree.com/*
// @grant        none
// @run-at       document-start
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Erweiterte Liste für den Netzwerk-Blocker
    const blacklistedKeywords = [
        'r51.com',
        'horrorporn.com',
        'czechmassage.com',
        'recomb_id=banner',
        '/xfpro',
        'prbn',
        'hqmediago.com',
        'lifepornstories.com',
        'czechcasting.com'
    ];

    // Funktion zur Überprüfung, ob eine URL Werbung ist
    function isAdUrl(url) {
        if (!url) return false;
        const urlString = String(url).toLowerCase();
        return blacklistedKeywords.some(keyword => urlString.includes(keyword.toLowerCase()));
    }

    // 1. FETCH API BLOCKER
    if (window.fetch) {
        const originalFetch = window.fetch;
        window.fetch = function(input, init) {
            const url = (typeof input === 'string') ? input : (input && input.url);

            if (isAdUrl(url)) {
                console.log('%c[Ad-Blocker] Fetch blockiert:', 'color: red;', url);
                return Promise.resolve(new Response(JSON.stringify({}), { status: 200 }));
            }
            return originalFetch.apply(this, arguments);
        };
    }

    // 2. XHR (XMLHttpRequest) BLOCKER
    const originalOpen = XMLHttpRequest.prototype.open;
    XMLHttpRequest.prototype.open = function(method, url, async, user, password) {
        if (isAdUrl(url)) {
            console.log('%c[Ad-Blocker] XHR blockiert:', 'color: red;', url);
            this.send = function() { };
            return;
        }
        return originalOpen.apply(this, arguments);
    };

    // 3. TIMER BYPASS (Für die 5-Sekunden-Sperren)
    const originalTimeout = window.setTimeout;
    window.setTimeout = function(callback, delay, ...args) {
        if (delay >= 2000 && delay <= 6000) {
            return originalTimeout(callback, 0, ...args);
        }
        return originalTimeout(callback, delay, ...args);
    };

    // 4. HTML-ENTFERNUNG (Für die Seitenelemente)
    function removeSidebarAndHtmlAds() {
        // Sucht nach den neuen Werbe-Klassen aus deinem HTML
        const adElements = document.querySelectorAll('.prbn__media, .czavbanner, .prbn');

        adElements.forEach(el => {
            // Wir prüfen, ob im Element (oder Video-Src) eine der Blacklist-Webseiten steckt
            const htmlString = el.innerHTML || '';
            const videoSrc = el.src || '';

            const isTargetAd = blacklistedKeywords.some(keyword =>
                htmlString.includes(keyword) || videoSrc.includes(keyword)
            );

            // Wenn es ein Treffer ist oder die Klasse exakt matcht, komplett zerstören
            if (isTargetAd || el.classList.contains('czavbanner')) {
                // Wir löschen das Element komplett, damit die Seite sauber aussieht
                el.remove();
            }
        });
    }

    // Läuft alle 100ms, um neu reingeladene Seitenbanner sofort wegzubrennen
    setInterval(removeSidebarAndHtmlAds, 100);

    // Zusätzlicher CSS-Injektor, um das Anzeigen im Keim zu ersticken
    const style = document.createElement('style');
    style.innerHTML = `
        .czavbanner, .prbn__media, [class*="prbn"] {
            display: none !important;
            visibility: hidden !important;
            opacity: 0 !important;
            pointer-events: none !important;
        }
    `;
    document.documentElement.appendChild(style);

})();