Hide Toronto Mike Users

Hide annoying users on Toronto Mike blog. Fucking trolls.

当前为 2014-12-08 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Hide Toronto Mike Users
  3. // @namespace torontomike
  4. // @include http://www.torontomike.com/
  5. // @include http://*.torontomike.com/
  6. // @include http://www.torontomike.com/*
  7. // @include http://*.torontomike.com/*
  8. // @grant metadata
  9. // @version 1.3
  10. // @description Hide annoying users on Toronto Mike blog. Fucking trolls.
  11. // ==/UserScript==
  12.  
  13. // Dec 5, 2014 - for redesign
  14.  
  15. var blacklist = ["cheryl", "argie", "irvine"]; // ["cheryl", "any other name", "seperated by comma"] not case sensitive
  16. var comments = document.getElementsByClassName("comment"); // Get all comments
  17. var i;
  18. var comment;
  19. var user;
  20.  
  21. /*
  22. // Old style for backward compat
  23. for(i = 0; i < comments.length; i++)
  24. {
  25. var hide = false;
  26. comment = comments[i];
  27. user = comment.getElementsByTagName("p")[0].getElementsByClassName("bigger")[0].textContent;
  28.  
  29.  
  30. for (blacklist_count = 0; blacklist_count < blacklist.length; blacklist_count++)
  31. {
  32. if (user.toUpperCase().trim() == blacklist[blacklist_count].toUpperCase().trim())
  33. {
  34.  
  35. comment.style.display = "none";
  36. break;
  37. }
  38. }
  39.  
  40. } // End comment loop
  41. */
  42. comments = document.getElementsByClassName("comment-block");
  43.  
  44. var hrs;
  45.  
  46. // New style
  47. for(i = 0; i < comments.length; i++)
  48. {
  49. var hide = false;
  50. comment = comments[i];
  51. user = comment.getElementsByClassName("comment-by")[0].getElementsByTagName("strong")[0].textContent;
  52. if (i == 0)
  53. {
  54.  
  55. hrs = comment.parentNode.getElementsByTagName("hr");
  56.  
  57. }
  58.  
  59. for (blacklist_count = 0; blacklist_count < blacklist.length; blacklist_count++)
  60. {
  61. if (user.toUpperCase().trim() == blacklist[blacklist_count].toUpperCase().trim())
  62. {
  63. hrs[i].style.display = "none";
  64. if(i > 0)
  65. {
  66. hrs[i-1].style.display = "none";
  67. }
  68. comment.style.display = "none";
  69. break;
  70. }
  71. }
  72.  
  73. } // End comment loop
  74.  
  75.