userscripts/xcancel-culture.js
Jason Cosper 3cf65f526a
Update xcancel-culture.js
Added redirect for `x.com/home` to the appropriate place on `xcancel.com`
2024-10-19 09:36:40 -07:00

23 lines
765 B
JavaScript

// ==UserScript==
// @name Xcancel Culture
// @namespace https://github.com/boogah/userscripts
// @version 2024.10.19
// @description Automatically redirects x.com to xcancel.com.
// @author boogah
// @include https://x.com/*
// @license GPL-2.0
// @grant none
// ==/UserScript==
window.addEventListener('load', function() {
// Redirect /home to xcancel.com directly
if (window.location.pathname === '/home') {
window.location.href = 'https://xcancel.com';
return;
}
// Redirect to xcancel.com with the current path and query params
var xcancelURL = window.location.href.replace(/https:\/\/([^.]+\.)?x\.com/, 'https://xcancel.com');
window.location.href = xcancelURL;
}, false);