SimpCity Redirect Bypass

Automatically bypasses the "not trusted external site" redirect confirmation page

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.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

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.

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

// ==UserScript==
// @name         SimpCity Redirect Bypass
// @namespace    
// @license MIT
// @version      1.0
// @description  Automatically bypasses the "not trusted external site" redirect confirmation page
// @match        *://simpcity.cr/redirect/*
// @match        *://simpcity.su/redirect/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    // Method 1: Parse the destination URL from the page URL's 'to' parameter (fastest, runs at document-start)
    try {
        const params = new URLSearchParams(window.location.search);
        const encodedUrl = params.get('to');
        if (encodedUrl) {
            const destination = atob(encodedUrl);
            if (destination.startsWith('http')) {
                window.location.replace(destination);
                return;
            }
        }
    } catch (e) {
        // Fall through to Method 2
    }

    // Method 2: Fallback - wait for the DOM and click the destination link
    function clickDestination() {
        const link = document.querySelector('.contentRow-main a[href^="http"]') ||
                     document.querySelector('a.link--external[href^="http"]') ||
                     document.querySelector('.p-body-main a[href^="http"]:not([href*="simpcity"])');
        if (link) {
            window.location.replace(link.href);
        }
    }

    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', clickDestination);
    } else {
        clickDestination();
    }
})();