Created
December 29, 2021 03:42
-
-
Save IzumiGoshi/97ebec8aec48afb4e47c2e57609f46cf to your computer and use it in GitHub Desktop.
Redirect to old.reddit.com for tampermonkey/greasemonkey
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 old reddit | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description redirect to old.reddit.com | |
// @author You | |
// @match https://www.reddit.com/* | |
// @icon https://www.google.com/s2/favicons?domain=reddit.com | |
// @grant none | |
// ==/UserScript== | |
window.addEventListener('load', function() { | |
//window.location.href = "https://old.reddit.com/"; | |
var loc = "" + window.location; | |
var parts = loc.split('/'); | |
if (parts.includes("r")) { | |
parts.forEach(function(item, i) { if (item == "www.reddit.com") parts[i] = "old.reddit.com"; }); | |
loc = parts.join('/'); | |
} | |
else { | |
loc = "old.reddit.com"; | |
} | |
window.location.href = loc; | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment