shadofx / KissManga Adblock

// ==UserScript==
// @name         KissManga Adblock
// @namespace
// @description  Sometimes KissManga goes out of its way to screw with ad block. Install this and disable your normal adblock to avoid ads
// @copyright    2018, shadofx (
// @license      MIT
// @match        http*://*
// @match*
// @match*
// @match        http*://*
// @match*
// @match*
// @match        http*://*
// @updateURL
// @grant        none
// @version      4.98
// @run-at       document-start
// @require
// ==/UserScript==
// ==OpenUserJS==
// @author       shadofx
// ==/OpenUserJS==
var $ = jQuery;
let oldDocEvLi = EventTarget.prototype.addEventListener;
function addEventListener(type,lis){
function SwapAEL(){//sabotage addEventListener to prevent javascript popups (mostly for Edge)
    EventTarget.prototype.addEventListener = addEventListener
// If it's the challenge page then wait for it to finish beofore sabotage (sometimes challenge page gets stuck)
if($('head title').text()=="Please wait 5 seconds..."){setInterval(SwapAEL,5000)}else{SwapAEL()}
//RemoveAds removes the offending nodes
function RemoveAds(){
    $("a:contains('Hide')").click();//click on hide button
    $('a[target^="_blank"]>img').remove();//remove any image inside a link which opens in a new tab
    $('div[style*="width: 2048px"][style*="z-index: 2147483647"]').remove();//remove the massive click-interceptor that spans the entire page
    $('div[style*="z-index: 2000"]').remove();//remove the click-interceptor that blocks disqus
    $('iframe').not('#disqus_thread>iframe[src*="comments"]').not('[id^="dsq-app"]:not([src*=""])').not('#ifrmVast').remove();//remove iframes except for the disqus/video ones
    $('iframe[src*="ads-iframe"]').remove();//disqus ads
    $('body>div[style*="absolute"]').remove()//remove click-interceptor that blocks disqus (added 3/29/2019)
//repeatedly run RemoveAds while DOM loads
var loadproc = setInterval(RemoveAds, 50);
//When DOM is loaded...
window.addEventListener("DOMContentLoaded", () => {
    //..stop spamming RemoveAds...
    //..because we can add more targeted handlers to spam RemoveAds more efficiently:
    document.addEventListener("readystatechange", RemoveAds);//Run when page is entirely loaded
    new MutationObserver(RemoveAds).observe($('body')[0],{childList: true}); //Run whenever body is changed
    document.addEventListener("visibilitychange", RemoveAds);//Run when you switch tabs
    $('div#divImage').click(Next);//For unknown reasons click functionality gets compromised on chrome