gavin19

Reddit - Only show comment score post vote

Sep 24th, 2011
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name           Reddit - Only show comment score post vote
  3. // @namespace      gavin19
  4. // @description    Comment scores hidden by default. Votes show after voting.
  5. // @match          http://*.reddit.com/*/*/comments/*
  6. // @include        http://*.reddit.com/*/*/comments/*
  7. // @version    1.0
  8. // ==/UserScript==
  9.  
  10. var commentDisplay = {
  11.  
  12.     hideScore: function(x) {
  13.         for(var i=0,lenx=x.length;i<lenx;i++){
  14.             if(x[i]){
  15.                         x[i].style.display="none";
  16.                     }
  17.         }  
  18.     },
  19.     init: function() {
  20.         document.body.addEventListener('DOMNodeInserted', function(ev) {
  21.             if ((event.target.tagName == 'DIV') && (/even/ig.test(event.target.getAttribute('class')))) {
  22.                 var x = ev.target.querySelectorAll('.score');
  23.                 commentDisplay.hideScore(x);
  24.             }
  25.         }, false);
  26.         var x = document.querySelectorAll('.commentarea:not(.side) .score.unvoted');
  27.         this.hideScore(x);
  28.     }
  29. }
  30. commentDisplay.init();
Add Comment
Please, Sign In to add comment