shadofx / KissManga Adblock

// ==UserScript==
// @name         KissManga Adblock
// @namespace    https://openuserjs.org/scripts/shadofx
// @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 (https://openuserjs.org/users/shadofx)
// @license      MIT
// @match        http*://kissmanga.com/*
// @match        https://kisscartoon.ac/*
// @match        https://kissanime.ac/*
// @match        http*://kissanime.ru/*
// @match        https://kimcartoon.ac/*
// @match        https://readcomiconline.to/*
// @match        http*://kimcartoon.me/*
// @updateURL    https://openuserjs.org/meta/shadofx/KissManga_Adblock.meta.js
// @grant        none
// @version      4.99
// @run-at       document-start
// @require      http://code.jquery.com/jquery-1.7.2.min.js
// ==/UserScript==
// ==OpenUserJS==
// @author       shadofx
// ==/OpenUserJS==
var $ = jQuery;
let oldDocEvLi = EventTarget.prototype.addEventListener;
function addEventListener(type,lis){
    try{
        if(type=='mousedown'||type=='mousemove'){return;}
        if(type=='click'&&lis.name=='m0'){return;}
        oldDocEvLi.call(this,type,lis)
    }catch(e){console.log(e)}
}
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
    $('.divCloseBut').remove();
    $('[src*="propellerads"]').remove();
    $('[id^="p_"]').remove();
    $('[src*="mgid.com"]').remove();
    $('div[id^="MarketGidComposite"]').remove();
    $('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*="disqusads.com"])').not('#ifrmVast').remove();//remove iframes except for the disqus/video ones
    $('iframe[src*="ads-iframe"]').remove();//disqus ads
    $('#divImage,#btnShowComments').show();//from https://greasyfork.org/en/scripts/372860-fu-kissmanga
    $('a[href*="bebi.com"]').remove();
    $('div.bebi-icon-hover').remove();
    $('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...
    clearInterval(loadproc);
    //..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
});