Jailout2000

Imgur Downvote Fairy

Dec 23rd, 2012
1,283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.     Paste this into the Javascript console of your web browser.
  3.     This works everywhere where there is a upvote/downvote button.
  4.  
  5.     If you want to ignore the upvote/downvote button for the image you're viewing, but still upvote/downvote for everything else, replace this line:
  6.       if (!hasClass(list.item(i), 'pushed'))
  7.     with this one:
  8.       if (!hasClass(list.item(i), 'pushed') && !hasClass(list.item(i), 'title'))
  9.  
  10.     Works while viewing gallery images, a user's comments, and while viewing an image.
  11.     This will not honor your previous vote for a comment or image, unless it matches what you want the vote to be.
  12.  
  13.     If you wanna be an upvote fairy instead, just replace the word "down" with "up".
  14.  
  15.     I regret nothing. Enjoy.
  16. */
  17. function hasClass(element, cls) {
  18.     var r = new RegExp('\\b' + cls + '\\b');
  19.     return r.test(element.className);
  20. }
  21.  
  22. var list = document.getElementsByClassName('down');
  23. for (var i = 0; i < list.length; ++i) {
  24.    if (!hasClass(list.item(i), 'pushed')) /* Don't spam Imgur's servers! It also helps us do this quicker */
  25.        list.item(i).click(); /* Equivalent of pushing the button */
  26. }
Advertisement
Add Comment
Please, Sign In to add comment