CW AdBlocker

Instantly nukes pause ads, redirects alt domains to .tv

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey, Greasemonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да инсталирате разширение, като например Tampermonkey .

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Userscripts.

За да инсталирате скрипта, трябва да инсталирате разширение като Tampermonkey.

За да инсталирате този скрипт, трябва да имате инсталиран скриптов мениджър.

(Вече имам скриптов мениджър, искам да го инсталирам!)

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

(Вече имам инсталиран мениджър на стиловете, искам да го инсталирам!)

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