Redirect Blocker

Sites that uses known popup urls will immdiately get blocked. A Custom button to completely prevent popups. Use the badDomains list to list more popups you encounter.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey, Greasemonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Userscripts.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een gebruikersscriptbeheerder nodig.

(Ik heb al een user script manager, laat me het downloaden!)

Advertisement:

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

(Ik heb al een beheerder - laat me doorgaan met de installatie!)

Advertisement:

// ==UserScript==
// @name         Redirect Blocker
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Sites that uses known popup urls will immdiately get blocked. A Custom button to completely prevent popups. Use the badDomains list to list more popups you encounter.
// @author       Accro
// @match        *://*/*
// @grant        window.close
// @grant        GM_openInTab
// @run-at       document-start
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    const currentHost = window.location.hostname;

    const badDomains = [
        'host10q.cfd',
        'host11q.cfd',
        'file148002.storage',
        'storage07x.cfd'
    ];

    if (badDomains.some(domain => currentHost.includes(domain))) {
        window.stop();
        try { window.close(); } catch(e) {}

        if (document.documentElement) document.documentElement.innerHTML = '';
        window.location.replace("about:blank");
        return;
    }

    const injectStyles = () => {
        if (document.getElementById('tm-premium-styles')) return;

        const style = document.createElement('style');
        style.id = 'tm-premium-styles';
        style.innerHTML = `
            .tm-premium-menu {
                position: absolute;
                display: none;
                align-items: center;
                gap: 8px;
                padding: 8px 16px;
                background: linear-gradient(145deg, #1a1c23, #242730);
                border: 1px solid #3a3f50;
                border-radius: 8px;
                color: #00ffcc;
                font-family: 'Segoe UI', system-ui, sans-serif;
                font-size: 13px;
                font-weight: 600;
                letter-spacing: 0.5px;
                cursor: pointer;
                z-index: 2147483647;
                user-select: none;
                box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 255, 204, 0.1);
                transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
                backdrop-filter: blur(10px);
            }
            .tm-premium-menu:hover {
                box-shadow: 0 6px 25px rgba(0, 255, 204, 0.35), 0 0 12px rgba(0, 255, 204, 0.6), inset 0 0 10px rgba(0, 255, 204, 0.1);
                transform: translateY(-2px);
                background: linear-gradient(145deg, #20232b, #2c303b);
                color: #ffffff;
                border-color: #00ffcc;
            }
            .tm-premium-menu:active {
                transform: translateY(1px);
                box-shadow: 0 2px 8px rgba(0, 255, 204, 0.2);
                transition: all 0.05s ease;
            }
            .tm-premium-menu svg {
                transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            }
            .tm-premium-menu:hover svg {
                transform: scale(1.15) translateX(1px) translateY(-1px);
            }
        `;
        document.head.appendChild(style);
    };

    const menu = document.createElement('div');
    menu.className = 'tm-premium-menu';

    menu.innerHTML = `
        <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
            <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>
            <polyline points="15 3 21 3 21 9"></polyline>
            <line x1="10" y1="14" x2="21" y2="3"></line>
        </svg>
        <span>OPEN LINK</span>
    `;

    const initMenu = () => {
        if (!document.body || !document.head) {
            requestAnimationFrame(initMenu);
            return;
        }
        injectStyles();
        document.body.appendChild(menu);
    };
    initMenu();

    let activeUrl = "";
    let currentHoveredLink = null;
    let hideTimeout;
    document.addEventListener('mouseover', (e) => {
        if (e.target === menu || menu.contains(e.target)) {
            clearTimeout(hideTimeout);
            return;
        }

        const link = e.target.closest('a[href]');

        if (link) {
            const targetUrl = link.getAttribute('href');

            if (!targetUrl || targetUrl.startsWith('javascript:') || targetUrl.startsWith('#')) {
                triggerHide();
                return;
            }

            clearTimeout(hideTimeout);

            if (link !== currentHoveredLink) {
                activeUrl = targetUrl;
                currentHoveredLink = link;

                menu.style.display = 'flex'; // Changed to flex for icon/text alignment

                menu.style.left = (e.pageX + 12) + 'px';
                menu.style.top = (e.pageY + 12) + 'px';
            }
        } else {
            triggerHide();
        }
    });

    function triggerHide() {
        clearTimeout(hideTimeout);
        hideTimeout = setTimeout(() => {
            menu.style.display = 'none';
            currentHoveredLink = null;
        }, 300);
    }

    menu.addEventListener('mousedown', (e) => {
        e.stopPropagation();
        e.preventDefault();

        if (activeUrl) {
            GM_openInTab(activeUrl, { active: true, insert: true });

            menu.style.display = 'none';
            currentHoveredLink = null;
        }
    });

})();