-
-
Save nero-dv/a63447734f825a0990ecc182e94abc45 to your computer and use it in GitHub Desktop.
Seamlessly redirect to old.reddit.com, tampermonkey script
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.6 | |
// @description seamlessly redirect to old.reddit.com | |
// @author Tavi | |
// @match https://www.reddit.com/* | |
// @icon https://www.google.com/s2/favicons?domain=reddit.com | |
// @grant none | |
// @run-at document-start | |
// @license BSD0 | |
// ==/UserScript== | |
(function() { | |
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 if (parts.length == 3 || (parts.length == 4 && parts[3] == "")) { | |
loc = window.location.protocol + "//old.reddit.com"; | |
} else { | |
return | |
} | |
window.location.replace(loc); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment