NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Reddit - expand all images like in RES // @include https://*.reddit.com* // @version 0.5 // @description button to expand all images on reddit // @author empty // @match https://www.reddit.com* // @run-at document-start // @grant GM_setValue // @grant GM_getValue // @license MIT // @copyright 2019, empty2332 (https://openuserjs.org/users/empty2332) // ==/UserScript== $(document).ready(function () { GM_setValue("customCss", false); GM_setValue("nightmode", true); var customCssLink = $("link[title='applied_subreddit_stylesheet']"); // show image button var mylist = document.getElementsByClassName("tabmenu"); var node = document.createElement("li"); var showImgLink = document.createElement("a"); var textnodeImg = document.createTextNode("show images"); showImgLink.setAttribute("id", "show_image_btn"); node.appendChild(showImgLink); showImgLink.appendChild(textnodeImg); mylist[0].appendChild(node); // enable/disable custom css button var customCss = document.createElement("a"); var textnodeCss = document.createTextNode("custom css"); customCss.setAttribute("id", "custom_css_btn"); node.appendChild(customCss); customCss.appendChild(textnodeCss); mylist[0].appendChild(node); // enable/disable nightmode var nightmode = document.createElement("a"); var textnodeNightmode = document.createTextNode("nightmode"); nightmode.setAttribute("id", "night_mode_btn"); node.appendChild(nightmode); nightmode.appendChild(textnodeNightmode); mylist[0].appendChild(node); var nightModeCss = $.parseHTML('<link rel="stylesheet" type="text/css" href="https://danielvolz.github.io/css/nightmode-reddit.css" media="all">') $('head').append(nightModeCss) $('html').addClass('res-nightmode res-accountSwitcher-dropDownStyle-alien pinHeader-none res-betteReddit-showLastEditedTimestamp res-commentPreview-draftStyle res-commentBoxes res-commentBoxes-rounded res-commentTools-showInputLength res-commentTools-macroButtons res-RESMenu-gearIconClickAction-toggleMenuNoHover res-searchHelper-searchPageTabs res-showImages res-showImages-highlightNSFWButton res-showImages-highlightSpoilerButton res-showImages-displayImageCaptions res-showImages-captionsPosition-titleAbove res-showParent-direction-down res-navTop res-styleTweaks-showExpandos res-styleTweaks-hideUnvotable res-styleTweaks-showFullLinkFlair-never res-styleTweaks-scrollSubredditDropdown res-styleTweaks-postTitleCapitalization-none res-styleTweaks-flairEmojiAsText-never res-subredditManager res-tableTools-sort res-userHighlight res-voteEnhancements-highlightScores res-voteEnhancements-colorLinkScore-none hideOver18 res-r-magicarena res res-v5 res-v5-18 res-v5-18-7 js cssanimations csstransforms res-srstyle-disable') $('body').addClass('post-under-24h-old loggedin subscriber single-page comments-page show-controversial res-nightmode res-accountSwitcher-dropDownStyle-alien pinHeader-none res-betteReddit-showLastEditedTimestamp res-commentPreview-draftStyle res-commentBoxes res-commentBoxes-rounded res-commentTools-showInputLength res-commentTools-macroButtons res-RESMenu-gearIconClickAction-toggleMenuNoHover res-searchHelper-searchPageTabs res-showImages res-showImages-highlightNSFWButton res-showImages-highlightSpoilerButton res-showImages-displayImageCaptions res-showImages-captionsPosition-titleAbove res-showParent-direction-down res-navTop res-styleTweaks-showExpandos res-styleTweaks-hideUnvotable res-styleTweaks-showFullLinkFlair-never res-styleTweaks-scrollSubredditDropdown res-styleTweaks-postTitleCapitalization-none res-styleTweaks-flairEmojiAsText-never res-subredditManager res-tableTools-sort res-userHighlight res-voteEnhancements-highlightScores res-voteEnhancements-colorLinkScore-none hideOver18 res-r-magicarena res res-v5 res-v5-18 res-v5-18-7 res-srstyle-disabled') $("#show_image_btn").css("cursor", "pointer"); $("#custom_css_btn").css("cursor", "pointer"); $("#night_mode_btn").css("cursor", "pointer"); if (!GM_getValue("nightmode")) { $(nightModeCss).remove(); } if (!GM_getValue("customCss")) { $("link[title='applied_subreddit_stylesheet']").remove(); } $('#night_mode_btn').click(function () { console.log('clicked') if ($('head').has(nightModeCss).length) { $(nightModeCss).remove(); textnodeNightmode.data = "nightmode [off]" GM_setValue("nightmode", false); } else { $('head').append(nightModeCss); textnodeNightmode.data = "nightmode [on]" GM_setValue("nightmode", true); } }); $('#custom_css_btn').click(function () { console.log('clicked') if ($('head').has(customCssLink).length) { $("link[title='applied_subreddit_stylesheet']").remove(); textnodeCss.data = "custom css [off]" GM_setValue("customCss", false); } else { $('head').append(customCssLink); textnodeCss.data = "custom css [on]" GM_setValue("customCss", true); } }); $('#show_image_btn').click(function () { var expands = document.querySelectorAll(".expando-button.video"); for (var exp of expands) { exp.click(); } }); });