userscripts/xcancel-culture.js

23 lines
765 B
JavaScript
Raw Normal View History

2024-10-19 09:23:13 -07:00
// ==UserScript==
// @name Xcancel Culture
// @namespace https://github.com/boogah/userscripts
// @version 2024.10.19
// @description Automatically redirects x.com to xcancel.com.
// @author boogah
2024-10-19 09:32:50 -07:00
// @include https://x.com/*
2024-10-19 09:23:13 -07:00
// @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;
}
2024-10-19 09:23:13 -07:00
// 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);