Skip to content

Instantly share code, notes, and snippets.

@tavi-vi
Last active December 21, 2022 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tavi-vi/bf918a88a15bc583cc1f2ab81c20cde7 to your computer and use it in GitHub Desktop.
Save tavi-vi/bf918a88a15bc583cc1f2ab81c20cde7 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);
})();
@tavi-vi
Copy link
Author

tavi-vi commented Feb 1, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment