THZU.cc ads block

thzu.cc ads block

  1. // ==UserScript==
  2. // @name THZU.cc ads block
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.11
  5. // @description thzu.cc ads block
  6. // @author bhlzlx
  7. // @include http://*th*.cc/*
  8. // @include https://*th*.cc/*
  9. // @include */vodplay/*
  10. // @icon https://www.google.com/s2/favicons?domain=29th.cc
  11. // @grant none
  12. // @license MIT
  13. // ==/UserScript==
  14.  
  15. function remove_specified_child_for_class( parent, child_name ) {
  16. var eles = parent.getElementsByClassName(child_name);
  17. if(null != eles) {
  18. for (var i = 0; i < eles.length; i++) {
  19. parent.removeChild(eles[i]);
  20. }
  21. }
  22. }
  23.  
  24. (function() {
  25. 'use strict';
  26. // console.log("thzu.cc start!");
  27. var nv_forum = document.getElementById("nv_forum");
  28. if( null != nv_forum) {
  29. // remove left/right ads!!!
  30. remove_specified_child_for_class(nv_forum, "a_fl");
  31. remove_specified_child_for_class(nv_forum, "a_fl a_cb");
  32. remove_specified_child_for_class(nv_forum, "a_fr a_cb");
  33. remove_specified_child_for_class(nv_forum, "a_cn");
  34. // remove foot ads
  35. var ft = document.getElementById("ft");
  36. if( null != ft) {
  37. ft.parentNode.removeChild(ft);
  38. }
  39. // remove top ads
  40. var diynavtop = document.getElementById("diynavtop");
  41. if( null != diynavtop) {
  42. diynavtop.parentNode.removeChild(diynavtop);
  43. }
  44. for(var i = 0; i<4; ++i) {
  45. nv_forum.removeChild(nv_forum.children[0]);
  46. }
  47. }
  48. var ct = document.getElementById("ct");
  49. if( null != ct ) {
  50. if(ct.children[0].id == "chart" || ct.children[0].id == "diy_chart" ) {
  51. for( var idx = 0; idx<ct.children.length; ++idx) {
  52. if(ct.children[idx].className == "mn") {
  53. var mn = ct.children[idx];
  54. // if( mn.children[0].tagName == "style") {
  55. for(var mnidx = 0; mnidx<4 && mnidx<mn.children.length; ++mnidx ){
  56. mn.removeChild(mn.children[0]);
  57. }
  58. // }
  59. }
  60. }
  61. }
  62. }
  63. // console.log("vod!!!");
  64. var adimgs = document.getElementsByTagName("IMG");
  65. // console.log(adimgs.length);
  66. var total = adimgs.length;
  67. for(i = 0; i<total; ++i) {
  68. // console.log(i);
  69. var parent = adimgs[0].parentNode;
  70. if(parent.tagName == "A" && parent.children.length == 1) {
  71. parent.parentNode.removeChild(parent);
  72. }
  73. }
  74. })();