SimpCity Redirect Bypass

Decode base64 redirect links and go directly to target

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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

})();