Advertisement
Guest User

Untitled

a guest
Nov 11th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.36 KB | None | 0 0
  1. // ==UserScript==
  2. // @name KissAnime Anti-Adblock Blocker
  3. // @author Swyter
  4. // @contributor 7 Deadly
  5. // @contributor BoLaMN
  6. // @namespace userscripts.org/user/swyter
  7. // @description Not even the people from Easylist seem to fight this site anymore, someone had to try as this looks popular enough. *sigh*
  8. // @match *://kissanime.com/*
  9. // @match *://kisscartoon.me/*
  10. // @match *://kissanime.to/*
  11. // @match *://kissasian.com/*
  12. // @match *://kissmanga.com/*
  13. // @match *://readcomiconline.to/*
  14. // @match *://kissanime.ru/*
  15. // @match *://kisscartoon.se/*
  16. // @match *://kissasian.ch/*
  17. // @match *://kimcartoon.me/*
  18. // @match *://kissasian.sh/*
  19. // @match *://kimcartoon.to/*
  20. // @version 2019.03.11
  21. // @grant none
  22. // @run-at document-start
  23. // ==/UserScript==
  24.  
  25. console.log('Started KissAnime Anti-Adblock Blocker, waiting for the DOM to load...');
  26.  
  27. window.addEventListener('beforescriptexecute', function(e)
  28. {
  29. /* typical js kludge, holy carp, that's convoluted! */
  30. var element_host = ((tmp = document.createElement('a')).href = e.target.src) && tmp.host;
  31.  
  32. /* gnblizz reported a missing captcha, bail out there */
  33. if (element_host === 'www.sweetcaptcha.com' || element_host === 'apis.google.com')
  34. return;
  35.  
  36. if (e.target.src && element_host !== document.domain &&
  37. element_host !== document.domain.split('.')[0] + '.disqus.com') e.preventDefault();
  38.  
  39. if (!e.target.src)
  40. for (var i of ['charCodeAt', 'window.BB_', 'taboola', 'plusone', 'analytics', 'AdBlock', 'TemporaryBlock'])
  41. if (e.target.textContent.indexOf(i) != -1)
  42. e.preventDefault();
  43.  
  44. console.log('[i] blocking script element: ', e.defaultPrevented, e.target.src);
  45. });
  46.  
  47. window.addEventListener('DOMContentLoaded', function(e)
  48. {
  49. console.log('DOM loaded, processing stuff...');
  50.  
  51. /* get rid of the cruft */
  52. for (var elem of document.querySelectorAll(`
  53. iframe[src*='ad']:not([src*='openload']):not([src*='fbsbx']):not([src*='mp4upload']),
  54. .divCloseBut,
  55. .clear2,
  56. div[style*='!important'],
  57. iframe[style*='!important'][src^='/'],
  58. div[id^='divFloat'],
  59. .episodeList div[style$='float: left;'],
  60. .episodeList .clear,
  61. div[style$='height:80px'],
  62. img[id^='adCheck'],
  63. div[id^=adsFloat][style],
  64. div[id^=btnClose],
  65. div[style*='width:800px'],
  66. div[id*=fl-ads].rf-container,
  67. div[id^=adsIfrme]:not([id=adsIfrme]),
  68. iframe[src*='Ads'],
  69. iframe[src*='facebook'],
  70. iframe[src*='mgi'][height='215'],
  71. div[style*='300px'][style*='250px'],
  72. div[style*='margin: 0px auto'],
  73. div[style*='height: 600px'],
  74. div[style*='820px'][style*='215px'],
  75. div[style*='728px'][style*='200px'],
  76. iframe[width='728px'][height='90px'],
  77. li#liFlappy, li#liReportError,
  78. body > script[src],
  79. script[data-cfasync],
  80. div[style*='728px'][style*='90px']
  81. `))
  82. {
  83. console.log('[-] removing cruft: ', elem);
  84. elem.parentElement.removeChild(elem);
  85. }
  86.  
  87. /* show the comic pages and comment buttons; they are hidden (display: none) by default */
  88. (img = document.querySelector("div#divImage[style]")) && (img.style.display = "block");
  89. (com = document.querySelector("a#btnShowComments.specialButton[style]")) && (com.style.display = "inline-block");
  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|TemporaryBlock|AGBXSKCSYWBSDAPOLA/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.  
  108. /* override the check in Chrome and call it a day */
  109. for (var i of ['DoDetect2', 'YANMKABFYWRW', 'HAYNQMAKDASAS', 'YANABWEKA', 'YASBATMBCL'])
  110. try
  111. {
  112. Object.defineProperty(window, i,
  113. {
  114. configurable: false,
  115. writable: false,
  116. value: function()
  117. {
  118. console.info(`[/] ${i} check overriden!`);
  119. }
  120. });
  121. } catch(e) {}
  122. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement