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*

当前为 2017-08-31 提交的版本,查看 最新版本

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