Guest User

anti ronpaul

a guest
Jan 5th, 2008
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name           ronpaul
  3. // @namespace      http://reddit.com
  4. // @description    Removes stories I don't want and downmods them
  5. // @include        http://reddit.com/*
  6. // @include        http://*.reddit.com/*
  7. // @include        http://reddit.com/new
  8. // @include        http://*.reddit.com/new
  9. // @exclude        http://reddit.com/user/*
  10. // @exclude        http://*.reddit.com/user/*
  11. // @exclude        http://reddit.com/info/*
  12. // @exclude        http://*.reddit.com/info/*
  13. // ==/UserScript==
  14.  
  15. var rows;
  16. var matches=0;
  17. rows = document.evaluate("//*[@class='titlerow']", document, null,
  18.                            XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  19.  
  20. regex = /Ron Paul|Impeach|Bush|Republican|Giuliani|Radiohead/i;
  21. for (var i = 0; i < rows.snapshotLength; i++) {
  22.     var row = rows.snapshotItem(i);
  23.     var text = row.childNodes[0].innerHTML;
  24.     if (regex.exec(text)) {
  25.         var storyID = row.id.substr(9);
  26.         var upmod = /upmod|downmod/i;
  27.         if (!upmod.exec(document.getElementById('up_'+storyID).className)) {
  28.             setTimeout("mod('"+storyID+"',0);",2000);
  29.             matches+=1;
  30.         }
  31.         //row.parentNode.parentNode.parentNode.style.display='none';
  32.     }
  33. }
  34.  
  35. if (matches > 0) {
  36.     var tbl = document.getElementById('siteTable'),
  37.         div = document.createElement('div'),
  38.         msg = 'Down-voted ' + matches + ' stories';
  39.     GM_log(msg);
  40.     if (!tbl) return;
  41.     div.innerHTML = '<p><i>' + msg + '.</i></p>';
  42.     tbl.parentNode.insertBefore(div, tbl);
  43. }
Add Comment
Please, Sign In to add comment