SimpCity Redirect Bypass

Decode base64 redirect links and go directly to target

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         SimpCity Redirect Bypass
// @namespace    sleazyfork.org
// @version      1.0
// @description  Decode base64 redirect links and go directly to target
// @match        *://simpcity.cr/*
// @grant        none
// @license MIT
// ==/UserScript==

(function () {
    'use strict';

    function decodeBase64Url(b64) {
        try {
            return atob(b64);
        } catch (e) {
            return null;
        }
    }

    function processLinks(root = document) {
        const links = root.querySelectorAll('a[href*="/redirect/?to="]');

        links.forEach(link => {
            try {
                const url = new URL(link.href);
                const encoded = url.searchParams.get('to');

                if (!encoded) return;

                const decoded = decodeBase64Url(encoded);
                if (!decoded || !decoded.startsWith('http')) return;

                // Replace the link target
                link.href = decoded;

                // Optional: remove tracking junk
                link.removeAttribute('rel');
                link.removeAttribute('target');

            } catch (e) {
                // ignore malformed URLs
            }
        });
    }

    // Initial run
    processLinks();

    // Watch for dynamically added content (AJAX, infinite scroll, etc.)
    const observer = new MutationObserver(mutations => {
        for (const m of mutations) {
            for (const node of m.addedNodes) {
                if (node.nodeType === 1) {
                    processLinks(node);
                }
            }
        }
    });

    observer.observe(document.body, {
        childList: true,
        subtree: true
    });

})();