Compact Reddit

One of my User Scripts.

Everyone knows about old.reddit.com, but I suspect that interface will eventually be removed. There's another interface called the "compact" interface that can be accessed by appending any reddit URL with .compact. I don't know if they'll remove it, but it's what I tend to use, and this script automates it.

// ==UserScript==
// @name               Compact Reddit
// @namespace          https://rpdillon.net
// @description        Redirect to the little-known "compact" interface for Reddit
// @include            *://www.reddit.com/*
// @version            0.1
// @run-at             document-start
// @author             rpdillon
// @grant              none
// @icon               https://www.redditstatic.com/desktop2x/img/favicon/apple-icon-76x76.png
// ==/UserScript==

if (!window.location.pathname.endsWith(".compact")) {
  window.location.replace(window.location.origin + 
                          window.location.pathname + 
                          ".compact" + 
                          window.location.search);
}