Advertisement
taerkitty

IPB_Completely_hide_user.user.js

Apr 23rd, 2012
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // IPB Completely hide user
  2. //
  3. // Remove table elements (posts) by given user
  4. // from UserScripts.org
  5. // http://userscripts.org/scripts/show/31174
  6. //
  7. // This is a Greasemonkey user script
  8. // Requires Greasemonkey Version 0.8
  9. //
  10. // To install, you need Greasemonkey, get it from: http://www.greasespot.net
  11. // Then restart Firefox and revisit this script.
  12. // Under Tools, there will be a new menu item to "Install User Script".
  13. // Accept the default configuration and install.
  14. //
  15. // To uninstall, go to Tools/Manage User Scripts,
  16. // select "IPB Completely hide user", and click Uninstall.
  17. //
  18. //
  19. // --------------------------------------------------------------------------
  20. // ==UserScript==
  21. // @name           IPB Completely hide user
  22. // @namespace      http://userscripts.org/scripts/show/31174
  23. // @description    Remove table elements with certain user names
  24. // ==/UserScript==
  25. //
  26. // --------------------------------------------------------------------------
  27. // VERSION HISTORY:
  28. //
  29. // 1.3.1
  30. // Updated for new IPB version
  31. //
  32. // 1.3
  33. // Changed string match method to exact match for posts and better match
  34. // for quotes
  35. //
  36. // 1.2
  37. // Added hide quotes from users
  38. //
  39. // 1.1
  40. // Switched from remove to hide - faster and more reliable.
  41. //
  42. // 1.0
  43. // Basic remove post from posters given in the list
  44. //
  45. // --------------------------------------------------------------------------
  46.  
  47.  
  48.  
  49. var asshats =
  50. [
  51.     "A N idiot",
  52.     "some other cupid stunt"
  53. ];
  54.  
  55.  
  56. function removePosts(node)
  57. {
  58.     var namelink = node.getElementsByTagName("a")[0];
  59.     if (namelink && namelink.firstChild)
  60.     {
  61.         var username = namelink.firstChild.nodeValue;
  62.  
  63. //      GM_log(username);
  64.  
  65.         for (j = 0; j<asshats.length; j++)
  66.         {
  67.  
  68. //          GM_log(asshats[j]);
  69.  
  70.             if (username == asshats[j])
  71.             {
  72.                 var p = namelink.parentNode.parentNode.parentNode.parentNode;
  73.                 // remove the table element that contains the post by the user
  74.                 p.style.display='none';
  75.             }
  76.         }
  77.     }
  78. }
  79.  
  80.  
  81. var foo = document.getElementsByTagName("span");
  82. for (var i=0; i<foo.length; i++)
  83. {
  84.     if (foo[i].className == "author vcard")
  85.     {
  86.         removePosts(foo[i]);
  87.     }
  88. }
  89.  
  90. // now get rid of quotes
  91.  
  92. function removeQuotes(quote)
  93. {
  94.     var quotetop = quote.textContent.replace(/,.*/,"");
  95.  
  96. //  GM_log(quotetop);
  97.  
  98.     for (j = 0; j < asshats.length; j++) {
  99.         if (quotetop == asshats[j])
  100.         {
  101.             // hide the element that contains the quote by the user
  102.             quote.style.display='none';
  103.             quote.nextSibling.style.display='none';
  104.         }
  105.     }
  106. }
  107.  
  108. var quotes = document.getElementsByClassName("citation");
  109. for (var i=0; i<quotes.length; i++)
  110. {
  111.     removeQuotes(quotes[i]);
  112. }
  113.  
  114. return;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement