-
-
Save Rapptz/7ea7c57dd55cbcf14728936dd7f94c5d to your computer and use it in GitHub Desktop.
This file contains 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 Hot Reddit Fix | |
// @namespace Rapptz.Misc | |
// @author Rapptz | |
// @description Makes the reddit homepage Hot sort | |
// @include http://*.reddit.com/* | |
// @include https://*.reddit.com/* | |
// @version 1.0 | |
// @run-at document-start | |
// ==/UserScript== | |
let url = new URL(window.location); | |
if(url.pathname == '/') { | |
// raw homepage, so just redirect | |
window.location.replace(`${url.href}hot`); | |
} | |
function replaceButton() { | |
// replace best button with /best | |
let homepage = `${url.protocol}//${url.hostname}/`; | |
for(let node of document.querySelectorAll(".tabmenu > li > a")) { | |
if(node.href === homepage) { | |
node.href = homepage + 'best'; | |
} | |
} | |
} | |
window.addEventListener("load", replaceButton); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment