KissAnime Anti-Adblock Blocker

Not even the people from Easylist seem to fight this site anymore, someone had to try as this looks popular enough. *sigh*

当前为 2018-07-04 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name KissAnime Anti-Adblock Blocker
  3. // @author Swyter
  4. // @contributor 7 Deadly
  5. // @namespace userscripts.org/user/swyter
  6. // @description Not even the people from Easylist seem to fight this site anymore, someone had to try as this looks popular enough. *sigh*
  7. // @match *://kissanime.com/*
  8. // @match *://kisscartoon.me/*
  9. // @match *://kissanime.to/*
  10. // @match *://kissasian.com/*
  11. // @match *://kissmanga.com/*
  12. // @match *://readcomiconline.to/*
  13. // @match *://kissanime.ru/*
  14. // @match *://kisscartoon.se/*
  15. // @match *://kissasian.ch/*
  16. // @match *://kimcartoon.me/*
  17. // @version 2018.07.04
  18. // @grant none
  19. // @run-at document-start
  20. // ==/UserScript==
  21.  
  22. console.log('Started KissAnime Anti-Adblock Blocker, waiting for the DOM to load...');
  23.  
  24. window.addEventListener('beforescriptexecute', function(e)
  25. {
  26. /* typical js kludge, holy carp, that's convoluted! */
  27. var element_host = ((tmp = document.createElement('a')).href = e.target.src) && tmp.host;
  28. /* gnblizz reported a missing captcha, bail out there */
  29. if (element_host === 'www.sweetcaptcha.com' || element_host === 'apis.google.com')
  30. return;
  31.  
  32. if (e.target.src && element_host !== document.domain &&
  33. element_host !== document.domain.split('.')[0] + '.disqus.com') e.preventDefault();
  34.  
  35. if (!e.target.src)
  36. for (var i of ['charCodeAt', 'BB_', 'taboola', 'plusone', 'analytics', 'AdBlock', 'TemporaryBlock', 'adsIfrme'])
  37. if (e.target.textContent.indexOf(i) != -1)
  38. e.preventDefault();
  39.  
  40. console.log('[i] blocking script element: ', e.defaultPrevented, e.target.src);
  41. });
  42.  
  43. /* override the check in Chrome and call it a day */
  44. try
  45. {
  46. Object.defineProperty(window, 'DoDetect2',
  47. {
  48. configurable: false,
  49. writable: false,
  50. value: function()
  51. {
  52. console.info('[/] check overriden!');
  53. }
  54. });
  55. Object.defineProperty(window, 'YANMKABFYWRW',
  56. {
  57. configurable: false,
  58. writable: false,
  59. value: function()
  60. {
  61. console.info('[/] YANMKABFYWRW check overriden!');
  62. }
  63. });
  64. Object.defineProperty(window, 'HAYNQMAKDASAS',
  65. {
  66. configurable: false,
  67. writable: false,
  68. value: function()
  69. {
  70. console.info('[/] HAYNQMAKDASAS check overriden!');
  71. }
  72. });
  73. Object.defineProperty(window, 'YANABWEKA',
  74. {
  75. configurable: false,
  76. writable: false,
  77. value: function()
  78. {
  79. console.info('[/] YANABWEKA check overriden!');
  80. }
  81. });
  82. } catch(e) {}
  83.  
  84. window.addEventListener('DOMContentLoaded', function(e)
  85. {
  86. console.log('DOM loaded, processing stuff...');
  87.  
  88. /* get rid of the cruft */
  89. for (var elem of document.querySelectorAll(`
  90. iframe[src*='ad']:not([src*='openload']),
  91. .divCloseBut,
  92. .clear2,
  93. div[style*='!important'],
  94. iframe[style*='!important'][src^='/'],
  95. div[id^='divFloat'],
  96. .episodeList div[style$='float: left;'],
  97. .episodeList .clear,
  98. div[style$='height:80px'],
  99. img[id^='adCheck'],
  100. div[id^=adsFloat][style],
  101. div[id^=btnClose],
  102. div[style*='width:800px'],
  103. div[id*=fl-ads].rf-container,
  104. div[id^=adsIfrme]:not([id=adsIfrme]),
  105. iframe[src*='Ads'],
  106. iframe[src*='facebook'],
  107. iframe[src*='mgi'][height='215'],
  108. div[style*='300px'][style*='250px'],
  109. div[style*='margin: 0px auto'],
  110. div[style*='height: 600px'],
  111. div[style*='820px'][style*='215px'],
  112. div[style*='728px'][style*='200px'],
  113. li#liFlappy, li#liReportError,
  114. body > script[src],
  115. script[data-cfasync],
  116. div[style*='728px'][style*='90px']
  117. `))
  118. {
  119. console.log('[-] removing cruft: ', elem);
  120. elem.parentElement.removeChild(elem);
  121. }
  122.  
  123. /* let's hook the AJAX requests, just in case, and filter out the so-called 'ban'
  124. avoiding potential fake points loss and such, what a scummy move by the site owner */
  125. (function (xhr_proto_open)
  126. {
  127. window.XMLHttpRequest.prototype.open = function(method, url)
  128. {
  129. if (url.match(/ban|Banned|GotBanned|TemporaryBlock/gi) !== null)
  130. {
  131. console.info("[x] intercepted shitty 'ban' request!", arguments); this.abort();
  132. }
  133. else
  134. {
  135. xhr_proto_open.apply(this, arguments);
  136. }
  137. };
  138. }(XMLHttpRequest.prototype.open));
  139. });