gavin19

Reddit - Downvote comments

Feb 28th, 2012
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name          So brave
  3. // @namespace     http://userscripts.org/
  4. // @author        Ron Paul
  5. // @description    Downvotes galore.
  6. // @match          http://*.reddit.com/*/comments/*
  7. // @include          http://*.reddit.com/*/comments/*
  8. // @version    1.0
  9. // ==/UserScript==
  10. (function(a, b, c, clickEvent) {
  11.     clickEvent = document.createEvent("MouseEvents");
  12.     clickEvent.initEvent("click", true, true);
  13.     for (var i = 0, len = a.length; i < len; i += 1) {
  14.         b = a[i].querySelector('.usertext');
  15.         if (b.textContent.match(/\so brave\b/i)) {
  16.             if (b.parentNode.parentNode.parentNode.parentNode.querySelector('.arrow.down')) {
  17.                 c.push(b.parentNode.parentNode.parentNode.parentNode.querySelector('.arrow.down'));
  18.             };
  19.         }
  20.     }
  21.         function downVote(e){e.dispatchEvent(clickEvent);};
  22.     c.forEach(function(e,i){setTimeout(function(){downVote(e)},i*2000);});
  23. })
  24. (a = document.querySelectorAll('.comment'), b = {}, c = [], clickEvent="");
Add Comment
Please, Sign In to add comment