FuckSpam

Remove comments on music163

  1. // ==UserScript==
  2. // @name FuckSpam
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.4
  5. // @description Remove comments on music163
  6. // @author You
  7. // @match http://music.163.com//*
  8. // @grant none
  9. // @require http://code.jquery.com/jquery-1.12.4.min.js
  10. // ==/UserScript==
  11. var list = [
  12. "osu","藕苏","屙屎","b站","节奏大师","bilibili",
  13. "哔哩哔哩","逸国","a站","队形","999+","恶俗","ous"
  14. ];
  15. var listlen = list.length;
  16.  
  17. var canFuck = function(text){
  18. text = text.toLowerCase();
  19. for(var i=0;i<listlen;i++){
  20. if(text.indexOf(list[i])) return true;
  21. }
  22. return false;
  23. };
  24.  
  25. var doFilter = function(){
  26. var count = 0;
  27. var child = $(".cmmts").children(".itm");
  28. if(child.size() === 0) return;
  29. for(var i=child.size()-1;i>=0;i--){
  30. var item = child.eq(i);
  31. var text = item.find(".cntwrap .cnt").text();
  32. if(canFuck(text)){
  33. item.remove();
  34. count++;
  35. continue;
  36. }
  37. //评论节点
  38. var sub = item.find(".cntwrap .que");
  39. if(sub.size() === 0) continue;
  40. text = sub.text();
  41. if(canFuck(text)){
  42. count++;
  43. item.remove();
  44. }
  45. }
  46. console.log("Fucked " + count +"! Have fun");
  47. };
  48.  
  49. (function() {
  50. $(document).ready(function(){
  51. // Your code here...
  52. doFilter();
  53. $(".m-cmmt .u-page").on("click", "a", function(e){
  54. setTimeout(function(){
  55. doFilter();
  56. }, 500);
  57. setTimeout(function(){
  58. doFilter();
  59. }, 1000);
  60. });
  61. });
  62. })();