Last active
July 8, 2025 05:59
-
-
Save fukionline/7a9c1294b4948bdac649abc6f64534b5 to your computer and use it in GitHub Desktop.
Maintain old Reddit without old.reddit.com redirect
This file contains hidden or 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 Maintain old Reddit without old.reddit.com redirect | |
// @namespace https://github.com/fukionline | |
// @version 1.0.0 | |
// @description | |
// @author fukionline | |
// @match *://*.reddit.com/* | |
// @grant GM_addStyle | |
// @grant GM_setValue | |
// @grant GM_getValue | |
// @grant GM_xmlhttpRequest | |
// @grant GM_registerMenuCommand | |
// @license WTFPL | |
// @downloadURL https://gist.github.com/fukionline/7a9c1294b4948bdac649abc6f64534b5/raw/56c4e5a2fa61f043f7cbb75cadb291e3aba3607a/reddit.js | |
// @updateURL https://gist.github.com/fukionline/7a9c1294b4948bdac649abc6f64534b5/raw/56c4e5a2fa61f043f7cbb75cadb291e3aba3607a/reddit.js | |
// ==/UserScript== | |
(function () { | |
'use strict'; | |
function setCookie(name, value, days, domain) { | |
let expires = ""; | |
if (days) { | |
const date = new Date(); | |
date.setTime(date.getTime() + (days*24*60*60*1000)); | |
expires = "; expires=" + date.toUTCString(); | |
} | |
document.cookie = name + "=" + encodeURIComponent(value) + expires + "; path=/; domain=" + domain + "; Secure; SameSite=None"; | |
} | |
// Check for old Reddit and set pro-Old reddit cookies if necessary | |
const cookies = document.cookie.split("; ").reduce((acc, c) => { | |
const [key, val] = c.split("="); | |
acc[key] = val; | |
return acc; | |
}, {}); | |
if (cookies["theme"] !== "1") { | |
setCookie("theme", "1", 365, ".reddit.com"); | |
} | |
if (cookies["redesign_optout"] !== "true") { | |
setCookie("redesign_optout", "true", 365, ".reddit.com"); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment