Greasy Fork

SHEIN Universal Ad Nuker

Ultimate solution for SHEIN ads, popups, CAPTCHAs and white page issues

当前为 2025-06-14 提交的版本,查看 最新版本

// ==UserScript==
// @name         SHEIN Universal Ad Nuker
// @namespace    http://tampermonkey.net/
// @version      1.4
// @description  Ultimate solution for SHEIN ads, popups, CAPTCHAs and white page issues
// @author       HYPERR.
// @license      MIT
// @match        *://*.shein.com/*
// @match        *://*.sheingroup.com/*
// @match        *://*.shein-*.com/*
// @grant        GM_xmlhttpRequest
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    // ======================
    // 1. WHITE PAGE FIXER
    // ======================
    const WHITE_PAGE_INDICATORS = [
        'captcha_type=',
        'dachtein.com',
        'Phoenix',
        'Logging',
        'rtai/chatlengs',
        'dc_them.com',
        'pdbearch/gat',
        'Texiums',
        'Texius',
        'UNVULUNT IMAGIN'
    ];

    function isWhitePage() {
        try {
            // Check URL
            const currentUrl = window.location.href.toLowerCase();
            if (WHITE_PAGE_INDICATORS.some(indicator => currentUrl.includes(indicator.toLowerCase()))) {
                return true;
            }

            // Check body content
            const bodyText = document.body?.innerText || '';
            if (WHITE_PAGE_INDICATORS.some(indicator => bodyText.includes(indicator))) {
                return true;
            }

            // Check for completely white page
            if (document.body && document.children.length === 1 && 
                document.body.children.length === 0 && 
                window.getComputedStyle(document.body).backgroundColor === 'rgba(0, 0, 0, 0)') {
                return true;
            }

            return false;
        } catch (e) {
            return false;
        }
    }

    if (isWhitePage()) {
        window.stop(); // Stop all loading
        document.documentElement.innerHTML = ''; // Clear broken page
        window.location.replace('https://www.shein.com'); // Redirect to homepage
        return; // Stop script execution
    }

    // ======================
    // 2. NETWORK BLOCKER
    // ======================
    const BLOCKED_DOMAINS = [
        '*://*.dachtein.com/*',
        '*://*.srmdata-eur.com/*',
        '*://adservice.google.com/*',
        '*://*.adsense.com/*',
        '*://*.doubleclick.net/*',
        '*://*.facebook.com/tr/*',
        '*://*.snapchat.com/*',
        '*://*.tiktok.com/api/ad/*',
        '*://*.shein.com/*/ad_*',
        '*://*.shein.com/*/ads/*',
        '*://*.shein.com/*/popup*',
        '*://*.shein.com/*/game*',
        '*://*.shein.com/*/giveaway*',
        '*://*.shein.com/*/promotion*',
        '*://*.shein.com/*/lottery*'
    ];

    // XMLHttpRequest blocking
    const originalOpen = XMLHttpRequest.prototype.open;
    XMLHttpRequest.prototype.open = function() {
        const url = arguments[1];
        if (url && BLOCKED_DOMAINS.some(pattern => url.match(new RegExp(pattern.replace(/\*/g, '.*'))))) {
            return;
        }
        originalOpen.apply(this, arguments);
    };

    // Fetch API blocking
    const originalFetch = window.fetch;
    window.fetch = function(input, init) {
        const url = typeof input === 'string' ? input : input.url;
        if (url && BLOCKED_DOMAINS.some(pattern => url.match(new RegExp(pattern.replace(/\*/g, '.*'))))) {
            return Promise.reject(new Error('Blocked by SHEIN Ad Nuker'));
        }
        return originalFetch.call(this, input, init);
    };

    // ======================
    // 3. CAPTCHA DESTROYER
    // ======================
    const CAPTCHA_PHRASES = [
        // English
        "select all images", "please select", "verify you are human", 
        "not a robot", "security check", "CAPTCHA", "subscribe",
        "trend alert", "new styles", "exclusive offers",
        
        // German
        "bitte wähle", "grafiken auswählen", "überprüfen sie", 
        "sicherheitsüberprüfung", "abonnieren", "trend alarm", 
        "neue trends", "exklusive angebote",
        
        // French
        "sélectionnez toutes les images", "vérifiez que vous êtes humain", 
        "vérification de sécurité", "abonnez-vous", "alertes tendance", 
        "nouveaux styles", "offres exclusives",
        
        // Spanish
        "seleccione todas las imágenes", "verifique que es humano", 
        "comprobación de seguridad", "suscribirse", "alertas de tendencias", 
        "nuevos estilos", "ofertas exclusivas",
        
        // Other languages
        "selecione todas as imagens", "seleziona tutte le immagini",
        "выберите все изображения", "tüm resimleri seçin",
        "حدد جميع الصور", "すべての画像を選択",
        "모든 이미지 선택", "选择所有图像"
    ];

    function killCaptchas() {
        try {
            document.querySelectorAll('body > *').forEach(element => {
                try {
                    const elementText = (element.textContent || element.innerText || '').toLowerCase();
                    if (CAPTCHA_PHRASES.some(phrase => elementText.includes(phrase.toLowerCase()))) {
                        element.style.display = 'none';
                        element.style.visibility = 'hidden';
                        element.style.height = '0';
                        element.style.width = '0';
                        element.style.opacity = '0';
                        element.style.pointerEvents = 'none';
                    }
                } catch (e) {}
            });
        } catch (e) {}
    }

    // ======================
    // 4. AD ANNIHILATOR
    // ======================
    const AD_SELECTORS = [
        // Popups and overlays
        'div[class*="popup"]', 'div[class*="modal"]', 'div[class*="overlay"]',
        'div[class*="mask"]', 'div[class*="dialog"]', 'div[class*="notification"]',
        'div[class*="prompt"]',
        
        // Games and gambling
        '[class*="game"]', '[class*="casino"]', '[class*="slot"]',
        '[class*="gambling"]', '[class*="lottery"]', '[class*="spin"]',
        '[class*="scratch"]', '[class*="roulette"]',
        
        // Giveaways and promotions
        '[class*="giveaway"]', '[class*="promotion"]', '[class*="coupon"]',
        '[class*="reward"]', '[class*="deal"]', '[class*="special-offer"]',
        '[class*="voucher"]',
        
        // Tracking elements
        'iframe[src*="ad"]', 'div[class*="tracking"]', 'div[class*="analytics"]',
        'div[id*="google_ads"]', 'div[class*="ad_"]', 'div[data-ad]'
    ];

    function nukeAds() {
        try {
            AD_SELECTORS.forEach(selector => {
                try {
                    document.querySelectorAll(selector).forEach(element => {
                        try {
                            if (element && (element.offsetHeight > 0 || element.offsetWidth > 0)) {
                                element.remove();
                            }
                        } catch (e) {}
                    });
                } catch (e) {}
            });

            // Restore scrolling
            try {
                document.body.style.overflow = 'auto';
                document.body.style.position = 'static';
                document.body.classList.remove('no-scroll', 'popup-open', 'modal-open');
            } catch (e) {}
        } catch (e) {}
    }

    // ======================
    // 5. MAIN EXECUTION
    // ======================
    function cleanPage() {
        killCaptchas();
        nukeAds();
    }

    // Run immediately
    cleanPage();

    // Set up mutation observer
    const observer = new MutationObserver(cleanPage);
    observer.observe(document, {
        childList: true,
        subtree: true,
        attributes: true,
        characterData: true
    });

    // Periodic cleanup
    setInterval(cleanPage, 2000);

    // Block scroll locking
    Object.defineProperty(document.body.style, 'overflow', {
        set: () => 'auto',
        configurable: true
    });

    // Block overlay creation
    const originalCreateElement = document.createElement;
    document.createElement = function(tagName) {
        const element = originalCreateElement.call(this, tagName);
        if (tagName.toLowerCase() === 'div') {
            Object.defineProperty(element, 'className', {
                set: function(value) {
                    if (/popup|modal|overlay|mask/.test(value)) {
                        return;
                    }
                    this.setAttribute('class', value);
                },
                configurable: true
            });
        }
        return element;
    };

    console.log('SHEIN Universal Ad Nuker v1.5.0 activated - Happy shopping!');
})();