Guest User

Untitled

a guest
Jul 21st, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.50 KB | None | 0 0
  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.  
  27. /* gnblizz reported a missing captcha, bail out there */
  28. if (element_host === 'www.sweetcaptcha.com' || element_host === 'apis.google.com')
  29. return;
  30.  
  31. if (e.target.src && element_host !== document.domain &&
  32. element_host !== document.domain.split('.')[0] + '.disqus.com') e.preventDefault();
  33.  
  34. if (!e.target.src)
  35. for (var i of ['charCodeAt', 'BB_', 'taboola', 'plusone', 'analytics', 'Please disable AdBlock'])
  36. if (e.target.textContent.indexOf(i) != -1)
  37. e.preventDefault();
  38.  
  39. console.log('[i] blocking script element: ', e.defaultPrevented, e.target.src);
  40. });
  41.  
  42. /* override the check in Chrome and call it a day */
  43. try
  44. {
  45. Object.defineProperty(window, 'DoDetect2',
  46. {
  47. configurable: false,
  48. writable: false,
  49. value: function()
  50. {
  51. console.info('[/] check overriden!');
  52. }
  53. });
  54. } catch(e) {}
  55.  
  56. window.addEventListener('DOMContentLoaded', function(e)
  57. {
  58. console.log('DOM loaded, processing stuff...');
  59.  
  60. /* get rid of the cruft */
  61. for (var elem of document.querySelectorAll(`
  62. iframe[src*='ad']:not([src*='openload']),
  63. .divCloseBut,
  64. .clear2,
  65. div[style*='!important'],
  66. div[id^='divFloat'],
  67. .episodeList div[style$='float: left;'],
  68. .episodeList .clear,
  69. div[style$='height:80px'],
  70. img[id^='adCheck'],
  71. div[id^=adsFloat][style],
  72. div[id^=btnClose],
  73. div[style*='width:800px'],
  74. div[id*=fl-ads].rf-container,
  75. iframe[src*='Ads'],
  76. iframe[src*='facebook'],
  77. div[style*='300px'][style*='250px'],
  78. div[style*='margin: 0px auto'],
  79. div[style*='height: 600px'],
  80. div[style*='820px'][style*='215px'],
  81. div[style*='728px'][style*='200px'],
  82. li#liFlappy, li#liReportError,
  83. body > script[src],
  84. script[data-cfasync],
  85. div[style*='728px'][style*='90px']
  86. `))
  87. {
  88. console.log('[-] removing cruft: ', elem);
  89. elem.parentElement.removeChild(elem);
  90. }
  91.  
  92. /* let's hook the AJAX requests, just in case, and filter out the so-called 'ban'
  93. avoiding potential fake points loss and such, what a scummy move by the site owner */
  94. (function (xhr_proto_open)
  95. {
  96. window.XMLHttpRequest.prototype.open = function(method, url)
  97. {
  98. if (url.match(/ban|Banned|GotBanned/gi) !== null)
  99. {
  100. console.info("[x] intercepted shitty 'ban' request!", arguments); this.abort();
  101. }
  102. else
  103. {
  104. xhr_proto_open.apply(this, arguments);
  105. }
  106. };
  107. }(XMLHttpRequest.prototype.open));
  108. });
Add Comment
Please, Sign In to add comment