XARGH: mám dokonce starší verzi (6.5.3206.50 (Stable channel) (64-bit) )
problém může být právě v uBlock kvůli window.location.replace()
zkus tohle (opět nemám jak nasimulovat selhání, mělo by ti to dát vědět)
// ==UserScript==
// @name Cancel_X_Robust
// @namespace http://tampermonkey.net/
// @version 0.3
// @description Redirect x.com to xcancel.com with fallback methods
// @author You
// @match https://x.com/*
// @match https://www.x.com/*
// @run-at document-start
// @grant none
// ==/UserScript==
(function() {
'use strict';
const currentUrl = window.location.href;
const newUrl = currentUrl.replace(/^https?:\/\/(www\.)?x\.com/, 'https://xcancel.com');
if (newUrl === currentUrl) return;
// Multiple redirect methods in order of preference
const redirectMethods = [
() => window.location.replace(newUrl),
() => window.location.assign(newUrl),
() => window.location.href = newUrl,
() => window.top.location.href = newUrl
];
let redirectAttempted = false;
for (const method of redirectMethods) {
try {
method();
redirectAttempted = true;
break;
} catch (error) {
console.warn('Cancel_X: Method failed:', error.message);
}
}
// Last resort: show manual link if all methods fail
if (!redirectAttempted) {
setTimeout(() => {
if (window.location.href === currentUrl) {
const link = document.createElement('div');
link.innerHTML = `
<div style="position:fixed;top:10px;left:10px;z-index:99999;background:red;color:white;padding:10px;border-radius:5px;">
<strong>Auto-redirect failed!</strong><br>
<a href="${newUrl}" style="color:yellow;text-decoration:underline;">Click here for xcancel.com</a>
</div>
`;
document.body?.appendChild(link) || document.documentElement.appendChild(link);
}
}, 500);
}
})();
BTW manuální přepsání URL z
x na
xcancel ti funguje? xcancel má automatické ověřování uživatele