- For large screens, centres text so it's not way over on the left (some subs have custom html styles, hence the two sections)
- Expands images automatically
- Hides the image hiphopcirclejerk stuck over their sub (thx j cole drama)
// ==UserScript==
// @name old_reddit_improver
// @namespace http://tampermonkey.net/
// @version 2024-01-26
// @description Make old.reddit.com more usable
// @author You
// @match https://old.reddit.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=reddit.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
console.log('---- tampermonkey initiated ----');
// Remove hhcj pic.
let earl = document.querySelector('a[href="#EARL"]');
if (earl) {
earl.style.display = 'none';
}
// Centre page body.
let body1 = document.querySelector('div[id="siteTable"]');
if (body1) {
body1.style = 'width: 70%; margin: auto;';
console.log('body1:', body1);
}
let body2 = document.querySelector('div[class="commentarea"]');
if (body2) {
body2.style = 'width: 70%; margin: auto;';
console.log('body2:', body2);
}
console.log('ran centre aligner');
// Expand images.
let xpath = "//a[text()='<image>']";
let iter = document.evaluate(xpath, document, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
let array = [];
let text_elem = iter.iterateNext();
while (text_elem) {
array.push(text_elem);
text_elem = iter.iterateNext();
}
array.forEach(i => {
let img_tag = new Image();
img_tag.src = i.href;
img_tag.style.maxWidth = '500px';
i.parentElement.appendChild(img_tag);
i.parentElement.removeChild(i);
})
console.log('---- tampermonkey complete ----');
})();
Jump in the discussion.
No email address required.
Can you make a tampermonkey script that just delivers a ransomware payload whenever you go to reddit?
Jump in the discussion.
No email address required.
More options
Context
Transform your Marseys!
www.pastebin.com/Jj9URfVi
Jump in the discussion.
No email address required.
The bread crumbs are piling up. After some tracking I found your IP: 80.92.56.88
Out of luck, son (snap)
Jump in the discussion.
No email address required.
More options
Context
More options
Context
That's fricking horrible lmao
Jump in the discussion.
No email address required.
What does it do? I'm guessing it makes the
<image>
links actually show the image they link to, meaning that you don't need to click on the images, but I am not a programmer.Jump in the discussion.
No email address required.
What do you think it do?
Jump in the discussion.
No email address required.
Center align isn't that bad, most comment sections have a lot of empty space on the right side of the screen (assuming that side isn't filled with ads). I was more worried about the
new image
andremoveChild
parts of itJump in the discussion.
No email address required.
Iterator that finds all the image links:
Move iterator items into an array, since iterators become invalid once the document changes:
For each link, create a literal image with its attributes. Add it to the document and remove the now-unnecessary link:
Nothing malicious.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
There's a whole section dedicated to image expansion, are you blind?
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
Jump in the discussion.
No email address required.
More options
Context
More options
Context
Are you a literal NPC? First you had trouble counting to two, now you're just copy and pasting your replies. Do you need some time to update before you can type anything new?
Jump in the discussion.
No email address required.
More options
Context