Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Reddit - Collapsed deleted comments
- // @author gavin19
- // @description Collapse deleted comments.
- // @match http://*.reddit.com/*/*/comments/*
- // @include http://*.reddit.com/*/*/comments/*
- // @version 1.0
- // ==/UserScript==
- var collapseComments = {
- hideDeleted: function(x) {
- for (var i = 0, lenx = x.length; i < lenx; i++) {
- if (x[i]) {
- x[i].parentNode.setAttribute('style', 'display:none !important');
- }
- }
- },
- init: function() {
- var x;
- document.body.addEventListener('DOMNodeInserted', function(event) {
- if ((event.target.tagName == 'DIV') && (/comment/ig.test(event.target.getAttribute('class')))) {
- x = event.target.querySelectorAll('.content .grayed');
- collapseComments.hideDeleted(x);
- }
- }, false);
- x = document.querySelectorAll('.content .grayed');
- this.hideDeleted(x);
- }
- }
- if (document.body) setTimeout(function() {
- collapseComments.init();
- }, 3000);
- else window.addEventListener("load", function() {
- collapseComments.init();
- }, false);
Add Comment
Please, Sign In to add comment