xfree.com Adblocker

Blocks simply every ad on xfree.com

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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         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);

})();