Created
March 31, 2024 12:29
-
-
Save johannesrld/a3b530cc39a4028abfce26cb8da6ec44 to your computer and use it in GitHub Desktop.
Redirect To Compact Reddit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Reddit Mobile Compact Redirector | |
// @match https://*.reddit.com/* | |
// @description Unfuck Reddit on mobile by linking to the old "compact" site | |
// @version 0.0.1 | |
// @author Johannes Richard Levi Dickenson | |
// @license GPLv3 | |
// @grant none | |
// @run-at document-start | |
// ==/UserScript== | |
"use strict"; | |
const redditRegex = /^(https?:\/\/)?(\w+\.)?(reddit\.com|redd\.it)\b\/?/; | |
const redditURL = window.location.href; | |
(() => { | |
"use strict"; | |
if (redditURL.endsWith("/.compact") || redditURL.endsWith("/.compact/")) { | |
window.location.replace(redditURL.replace(/\/\.compact\/?$/, "/.i")) // Thanks for fucking your compact website reddit, you lazy cunts! | |
return; | |
} | |
if (redditURL.endsWith("/")) { | |
window.location.replace(redditURL + ".i"); | |
return; | |
} | |
if (redditURL.endsWith("/.i")) return; | |
if (redditURL.endsWith("/.i/")) { | |
window.location.replace(redditURL.slice(0, -1)); | |
return; | |
} | |
window.location.replace(redditURL + "/.i"); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment