Decode base64 redirect links and go directly to target
// ==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
});
})();