Created
December 17, 2019 13:24
-
-
Save Farow/7bdf0e1601404c6ff1afff95b45ca093 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 Reddit collapse stickied comments | |
// @namespace https://github.com/Farow/userscripts | |
// @description asdasd | |
// @include https://*.reddit.com/r/*/comments/* | |
// @version 1.0.0 | |
// @grant none | |
// ==/UserScript== | |
let load_more_comments = 1; | |
let automod_only = 1; | |
try { | |
init(); | |
} | |
catch (error) { | |
console.log(error); | |
} | |
function init () { | |
let first_comment = document.getElementsByClassName('comment')[0]; | |
if (first_comment && first_comment.classList.contains('stickied')) { | |
if (automod_only && first_comment.dataset.author != 'AutoModerator') { | |
return; | |
} | |
let expand_button = first_comment.getElementsByClassName('expand')[0]; | |
expand_button && expand_button.click(); | |
if (load_more_comments) { | |
let load_more_button = first_comment.getElementsByClassName('morecomments')[0].children[0]; | |
load_more_button && load_more_button.click(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment