CW AdBlocker

Removes pause ads, hides ad iframes, redirects alternative domains to .tv

Terá de instalar uma extensão como Tampermonkey, Greasemonkey ou Violentmonkey para instalar este script.

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

Terá de instalar uma extensão como Tampermonkey ou Violentmonkey para instalar este script.

Terá de instalar uma extensão como Tampermonkey ou Userscripts para instalar este script.

Terá de instalar uma extensão como Tampermonkey para instalar este script.

Terá de instalar uma extensão de gestão de scripts de utilizador para instalar este script.

(Já tenho um gestor de scripts de utilizador, deixe-me instalá-lo!)

Terá de instalar uma extensão como Stylus para instalar este estilo.

Terá de instalar uma extensão como Stylus para instalar este estilo.

Terá de instalar uma extensão como Stylus para instalar este estilo.

Terá de instalar uma extensão de gestão de estilos de utilizador para instalar este estilo.

Terá de instalar uma extensão de gestão de estilos de utilizador para instalar este estilo.

Terá de instalar uma extensão de gestão de estilos de utilizador para instalar este estilo.

(Já tenho um gestor de estilos de utilizador, deixe-me instalá-lo!)

// ==UserScript==
// @name         CW AdBlocker
// @namespace    http://tampermonkey.net/
// @version      3.7
// @description  Removes pause ads, hides ad iframes, redirects alternative 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/*
// @match        *://*.camwhores4.tv/*
// @match        *://*.camwhores4.com/*
// @match        *://*.camwhores5.tv/*
// @match        *://*.camwhores5.com/*
// @match        *://*.camwhores6.tv/*
// @match        *://*.camwhores6.com/*
// @match        *://*.camwhores7.tv/*
// @match        *://*.camwhores7.com/*
// @match        *://*.camwhores8.tv/*
// @match        *://*.camwhores8.com/*
// @match        *://*.camwhores9.tv/*
// @match        *://*.camwhores9.com/*
// @match        *://*.camlovers.tv/*
// @match        *://*.allcamsex.com/*
// @match        *://*.wild-match.com/*
// @match        *://*.pc161021.com/*
// @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 isIframe = window.top !== window.self;

    if (!isIframe) {
        const altDomains = [
            'camwhores.in', 'camwhores.porn', 'camwhores.video', 'camwhores.rip', 'camwhores.cool',
            'camwhores.film', 'camwhores.lol', 'camwhores.wtf', 'camwhores.biz', 'camwhores.tube',
            'camwhores.dance', 'camwhores.com.co', 'camwhores.exposed', 'camwhores.camera',
            'camwhores.works', 'camwhores.guru', 'camwhores.company', 'camwhores.media',
            'camwhores.today', 'camwhores.fans', 'camwhores.club', 'camwhores.click',
            'camwhores.digital', 'camwhores.studio', 'camwhores.pub', 'camwhores.ws',
            'camwhores.boo', 'camwhores.art', 'camwhores.online',
            'camwhores4.tv', 'camwhores4.com', 'camwhores5.tv', 'camwhores5.com',
            'camwhores6.tv', 'camwhores6.com', 'camwhores7.tv', 'camwhores7.com',
            'camwhores8.tv', 'camwhores8.com', 'camwhores9.tv', 'camwhores9.com',
            'camlovers.tv'
        ];

        const currentHost = window.location.hostname;
        for (let domain of altDomains) {
            if (currentHost.includes(domain)) {
                const newURL = window.location.href.replace(domain, 'camwhores.tv');
                window.location.replace(newURL);
                return;
            }
        }
    }

    const injectCSS = () => {
        const style = document.createElement('style');
        style.textContent = `
            iframe[src*="cam4pays"], iframe[src*="clickadu"],
            iframe[src*="allcamsex.com"], iframe[src*="pc161021.com"],
            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"],
            a#overlay, a[href*="allcamsex.com"], a[style*="wild-match.com"] {
                display: none !important;
                opacity: 0 !important;
                pointer-events: none !important;
                visibility: hidden !important;
                z-index: -2147483648 !important;
                height: 0 !important;
                min-height: 0 !important;
                width: 0 !important;
                margin: 0 !important;
                padding: 0 !important;
            }
        `;
        if (document.head) document.head.appendChild(style);
        else document.addEventListener('DOMContentLoaded', () => document.head.appendChild(style));
    };
    injectCSS();

    const nukeAds = () => {
        if (isIframe) {
            if (document.querySelector('#hostWrapper') || document.querySelector('a#overlay') || window.location.href.includes('pc161021')) {
                document.body.innerHTML = '';
                document.body.style.display = 'none';
                return;
            }
        }

        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"], script[src*="pc161021"], a#overlay, a[href*="allcamsex.com"], a[style*="wild-match.com"]').forEach(el => el.remove());

        document.querySelectorAll('#hostWrapper').forEach(el => {
            const bgContainer = el.closest('.bg');
            if (bgContainer) bgContainer.remove();
            else el.remove();
        });

        if (!isIframe) {
            document.querySelectorAll('iframe').forEach(iframe => {
                const src = iframe.src.toLowerCase();

                if (src.includes('cam4pays') || src.includes('clickadu') ||
                    src.includes('allcamsex') || src.includes('wild-match') ||
                    src.includes('pc161021') || src.includes('awm') ||
                    src.includes('bongacams') || src.includes('chaturbate')) {
                    iframe.remove();
                }
                else if (src === '' || src === 'about:blank') {
                    const rect = iframe.getBoundingClientRect();
                    if (rect.height === 300 || rect.height === 250) {
                        iframe.style.display = 'none';
                    }
                }
            });
        }
    };

    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, iframe, a#overlay, #hostWrapper, .bg')) {
                            shouldNuke = true;
                        } else if (node.querySelector && node.querySelector('.fp-ui-skip-ad, .is-ad-visible, iframe, a#overlay, #hostWrapper')) {
                            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);
})();