Reddit De-tiktokified

Redirects you to new.reddit.com, avoiding the new beta UI.

// ==UserScript==
// @name         Reddit De-tiktokified
// @version      0.0.4
// @description  Redirects you to new.reddit.com, avoiding the new beta UI.
// @license      MIT
// @namespace    https://github.com/tadghh
// @author       https://github.com/tadghh
// @source	     https://github.com/tadghh/reddit-redirect
// @match        *://www.reddit.com/*
// @exclude      *://www.reddit.com/media*
// @run-at       document-start
// ==/UserScript==
(() => {
    'use strict';

    const isRedditSessionCookieExists = document.cookie.includes('recent_srs');

    if (!window.location.href.includes('new.reddit.com') && location.pathname.indexOf('new.') === -1 && isRedditSessionCookieExists) {
        var newURL = location.protocol;

        newURL += "//new.reddit.com";
        newURL += location.pathname;
        newURL += location.search;
        newURL += location.hash;

        window.location.href = newURL;

        document.open();
        document.close();
    }
})();