aboutsummaryrefslogtreecommitdiff
path: root/misc/old-reddit-page-cleanup.user.js
blob: ab4007ae11718c00010ef37bdf5eec2bab54a8a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// ==UserScript==
// @name        old.reddit.com page cleanup
// @namespace   Violentmonkey Scripts
// @match       https://old.reddit.com/*
// @grant       none
// @version     1.0
// @author      tjkeller.xyz
// @description 10/20/2024, 7:22:44 PM
// ==/UserScript==

/* remove top welcome banner */
document.querySelector("section").remove()

/* remove login prompt above comments */
document.querySelector("section").remove()

/* remove user sidebar */
document.body.parentElement.style.paddingRight = 0
document.getElementById("header-bottom-right").remove()

/* remove most of the sidebar */
const sidebar = document.querySelector("div.side")
console.log(sidebar)
sidebar.style.float = "none"
sidebar.style.margin = "25px"
while (sidebar.children[1])
	sidebar.children[1].remove()

/* wrap code in pre instead of p */
document.querySelectorAll("code").forEach(c => {
	const pre = c.parentElement.parentElement.insertBefore(document.createElement("pre"), c.parentElement)
	pre.appendChild(c)
})