您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Instantly redirects any x.com page to xcancel.com in a new tab, including homepage and direct links (SPA-safe).
// ==UserScript== // @name X → XCancel Redirect // @namespace http://tampermonkey.net/ // @version v2 // @license MIT // @description Instantly redirects any x.com page to xcancel.com in a new tab, including homepage and direct links (SPA-safe). // @author 83 // @match https://x.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=x.com // @grant none // ==/UserScript== (function() { 'use strict'; const redirectToXCancel = (url) => { const newUrl = url.replace("https://x.com", "https://xcancel.com"); // Avoid infinite opening if (newUrl !== url) { console.log(`[Tampermonkey] Redirecting to: ${newUrl}`); window.open(newUrl, "_blank"); } }; let lastUrl = location.href; const checkUrlChange = () => { const currentUrl = location.href; if (currentUrl !== lastUrl) { lastUrl = currentUrl; redirectToXCancel(currentUrl); } }; // Check regularly for SPA changes setInterval(checkUrlChange, 500); // Redirect immediately on initial page load redirectToXCancel(location.href); })();