Skip to content

Instantly share code, notes, and snippets.

@nero-dv
Forked from tavi-vi/Old Reddit redirect
Created December 21, 2022 00:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nero-dv/a63447734f825a0990ecc182e94abc45 to your computer and use it in GitHub Desktop.
Save nero-dv/a63447734f825a0990ecc182e94abc45 to your computer and use it in GitHub Desktop.
Seamlessly redirect to old.reddit.com, tampermonkey script
// ==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