CW AdBlocker

Instantly nukes pause ads, redirects alt domains to .tv

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         CW AdBlocker
// @namespace    http://tampermonkey.net/
// @version      3.3
// @description  Instantly nukes pause ads, redirects alt domains to .tv
// @author       BlueAnivia
// @match        *://*.camwhores.tv/*
// @match        *://*.camwhores.in/*
// @match        *://*.camwhores.porn/*
// @match        *://*.camwhores.video/*
// @match        *://*.camwhores.rip/*
// @match        *://*.camwhores.cool/*
// @match        *://*.camwhores.film/*
// @match        *://*.camwhores.lol/*
// @match        *://*.camwhores.wtf/*
// @match        *://*.camwhores.biz/*
// @match        *://*.camwhores.tube/*
// @match        *://*.camwhores.dance/*
// @match        *://*.camwhores.com.co/*
// @match        *://*.camwhores.exposed/*
// @match        *://*.camwhores.camera/*
// @match        *://*.camwhores.works/*
// @match        *://*.camwhores.guru/*
// @match        *://*.camwhores.company/*
// @match        *://*.camwhores.media/*
// @match        *://*.camwhores.today/*
// @match        *://*.camwhores.fans/*
// @match        *://*.camwhores.club/*
// @match        *://*.camwhores.click/*
// @match        *://*.camwhores.digital/*
// @match        *://*.camwhores.studio/*
// @match        *://*.camwhores.pub/*
// @match        *://*.camwhores.ws/*
// @match        *://*.camwhores.boo/*
// @match        *://*.camwhores.art/*
// @match        *://*.camwhores.online/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=camwhores.tv
// @license      MIT
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    const tldsToRedirect = [
        'in', 'porn', 'video', 'rip', 'cool', 'film', 'lol', 'wtf', 'biz', 'tube',
        'dance', 'com.co', 'exposed', 'camera', 'works', 'guru', 'company', 'media',
        'today', 'fans', 'club', 'click', 'digital', 'studio', 'pub', 'ws',
        'boo', 'art', 'online'
    ];

    const currentHost = window.location.hostname;

    for (let tld of tldsToRedirect) {
        if (currentHost.includes(`camwhores.${tld}`)) {
            const newURL = window.location.href.replace(`camwhores.${tld}`, 'camwhores.tv');
            window.location.replace(newURL);
            return;
        }
    }

    const injectCSS = () => {
        const style = document.createElement('style');
        style.textContent = `
            iframe[src*="cam4pays"], iframe[src*="clickadu"],
            a.fh-line, .fh-line1, .fh-line2, .fh-line3, .sponsor,
            .fp-ui-block, .fp-timeline-ad, .fp-time-left, .fp-ui-skip-ad,
            a[href*="vlmai1"], a[href*="clickadu"] {
                display: none !important;
                opacity: 0 !important;
                pointer-events: none !important;
                visibility: hidden !important;
                z-index: -2147483648 !important;
            }
        `;
        if (document.head) document.head.appendChild(style);
        else document.addEventListener('DOMContentLoaded', () => document.head.appendChild(style));
    };
    injectCSS();

    const nukeAds = () => {
        const skipButton = document.querySelector('.fp-ui-skip-ad');
        if (skipButton) skipButton.click();

        const stuckPlayer = document.querySelector('.is-ad-visible, .is-ad-paused');
        if (stuckPlayer) {
            const mainVideo = stuckPlayer.querySelector('video.fp-engine');
            if (mainVideo && mainVideo.paused) mainVideo.play().catch(() => {});
            stuckPlayer.classList.remove('is-ad-visible', 'is-ad-playing', 'is-ad-paused');
        }

        document.querySelectorAll('a[href*="vlmai1"], a[href*="clickadu"], script[src*="clickadu"]').forEach(el => el.remove());
    };

    const observer = new MutationObserver((mutations) => {
        let shouldNuke = false;

        for (let mutation of mutations) {
            if (mutation.addedNodes.length) {
                mutation.addedNodes.forEach(node => {
                    if (node.nodeType === 1) {
                        if (node.matches && node.matches('.fp-ui-block, .fp-ui-skip-ad, a[href*="vlmai1"]')) {
                            shouldNuke = true;
                        } else if (node.querySelector && node.querySelector('.fp-ui-skip-ad, .is-ad-visible')) {
                            shouldNuke = true;
                        }
                    }
                });
            }

            if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
                if (mutation.target.classList && mutation.target.classList.contains('is-ad-visible')) {
                    shouldNuke = true;
                }
            }
        }

        if (shouldNuke) nukeAds();
    });

    const startObserver = () => {
        if (document.body) {
            observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['class'] });
        } else {
            requestAnimationFrame(startObserver);
        }
    };
    startObserver();

    setInterval(nukeAds, 1000);
})();