Reddit Expand Everything Except Automod 🛡️

automatically collapses Automod but uncollapses all other comments (only old.reddit.com)

// ==UserScript==
// @name         Reddit Expand Everything Except Automod 🛡️
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  automatically collapses Automod but uncollapses all other comments (only old.reddit.com)
// @author       Agreasyforkuser
// @match        https://*.reddit.com/r/*/comments/*
// @icon         https://www.redditstatic.com/desktop2x/img/favicon/android-icon-192x192.png
// @grant        none
// @license      MIT
// ==/UserScript==

const undesirableModList = ['AutoModerator', 'example_name'];

function uncollapse() {
	document.querySelectorAll(".comment:not(.collapse-processed):not(.morechildren):not(.morerecursion)").forEach((e) => {
		e.classList.add("collapse-processed");
        const author = e.dataset.author;
		if (e.classList.contains("collapsed") && !undesirableModList.includes(author)) {
			e.querySelector(".tagline .expand").click();
		}
	});
}

const commentsObserver = new MutationObserver(() => uncollapse());
commentsObserver.observe(document.body, { childList: true, subtree: true });

(function() {
    
    let filterAllStickyComments = true; // set to false to only filter out usernames added to the undesirableModList
    let comments = document.querySelectorAll('.comment');

    for (const comment of comments) {
        const author = comment.dataset.author;
        const isStickied = comment.classList.contains('stickied');

        if (filterAllStickyComments && isStickied) {
            comment.classList.add('collapsed');
            comment.classList.remove('noncollapsed');
        } else if (undesirableModList.includes(author)) {
            comment.classList.add('collapsed');
            comment.classList.remove('noncollapsed');
        }
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址