Reddit Collapse Automod 🛡️

automatically collapses Automod comments (only old.reddit.com)

  1. // ==UserScript==
  2. // @name Reddit Collapse Automod 🛡️
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description automatically collapses Automod comments (only old.reddit.com)
  6. // @author Agreasyforkuser
  7. // @match https://*.reddit.com/r/*/comments/*
  8. // @icon https://www.redditstatic.com/desktop2x/img/favicon/android-icon-192x192.png
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13.  
  14. (function() {
  15. const undesirableModList = ['AutoModerator', 'example_name'];
  16. let filterAllStickyComments = true; // set to false to only filter out usernames added to the undesirableModList
  17.  
  18. let comments = document.querySelectorAll('.comment');
  19.  
  20. for (const comment of comments) {
  21. const author = comment.dataset.author;
  22. const isStickied = comment.classList.contains('stickied');
  23.  
  24. if (filterAllStickyComments && isStickied) {
  25. comment.classList.add('collapsed');
  26. comment.classList.remove('noncollapsed');
  27. } else if (undesirableModList.includes(author)) {
  28. comment.classList.add('collapsed');
  29. comment.classList.remove('noncollapsed');
  30. }
  31. }
  32. })();
  33.  
  34.  
  35. // (function(){
  36. // const undesirableModList = ['AutoModerator', 'example_bot_name'];
  37. // let filterAllStickyComments = true; //set to false to only filter out usernames added to the undesirableModList
  38. // let stickiedComments = document.querySelectorAll('.stickied.noncollapsed.comment');
  39. // for (const sc of stickiedComments) {
  40. // if (filterAllStickyComments) {
  41. // sc.classList.add('collapsed'), sc.classList.remove('noncollapsed');
  42. // } else {
  43. // if (undesirableModList.includes(sc.dataset.author)) {
  44. // sc.classList.add('collapsed'), sc.classList.remove('noncollapsed');
  45. // }
  46. // }
  47. // }
  48. // })()