SimpCity Redirect Bypass

Decode base64 redirect links and go directly to target

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

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

})();