Skip to content

Instantly share code, notes, and snippets.

@larrasket
Created November 16, 2022 22:58
Show Gist options
  • Save larrasket/8b0355b587f15f76c52230c7f7ace2e3 to your computer and use it in GitHub Desktop.
Save larrasket/8b0355b587f15f76c52230c7f7ace2e3 to your computer and use it in GitHub Desktop.
Userscript to get card view in classical reddit view.
// ==UserScript==
// @name Reddit auto-expand
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Auto expand reddit posts
// @author marg9
// @match https://*.reddit.com/*
// @grant none
// ==/UserScript==
// crdts: https://www.reddit.com/r/Enhancement/comments/fjksmc/tutorial_how_to_auto_expand_both_text_and_image/
(function() {
'use strict';
// Auto expands images and text - works with "Never ending reddit"
$(document).ready(function () {
// Text posts
function f(){
var u=$('.selftext.collapsed')[0];
if(u)
{
$(u).click();
}
};
// One second interval because that's what reddit permits
setInterval(f,1000);
// Trigger "show images" link
document.querySelector('.res-show-images > a').click();
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment