xfree.com Adblocker

Blocks simply every ad on xfree.com

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

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

})();