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*

目前為 2018-10-06 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        KissAnime Anti-Adblock Blocker
// @author      Swyter
// @contributor 7 Deadly
// @namespace   userscripts.org/user/swyter
// @description Not even the people from Easylist seem to fight this site anymore, someone had to try as this looks popular enough. *sigh*
// @match       *://kissanime.com/*
// @match       *://kisscartoon.me/*
// @match       *://kissanime.to/*
// @match       *://kissasian.com/*
// @match       *://kissmanga.com/*
// @match       *://readcomiconline.to/*
// @match       *://kissanime.ru/*
// @match       *://kisscartoon.se/*
// @match       *://kissasian.ch/*
// @match       *://kimcartoon.me/*
// @version     2018.10.06
// @grant       none
// @run-at      document-start
// ==/UserScript==

console.log('Started KissAnime Anti-Adblock Blocker, waiting for the DOM to load...');

window.addEventListener('beforescriptexecute', function(e)
{
  /* typical js kludge, holy carp, that's convoluted! */
  var element_host = ((tmp = document.createElement('a')).href = e.target.src) && tmp.host;
  
  /* gnblizz reported a missing captcha, bail out there */
  if (element_host === 'www.sweetcaptcha.com' || element_host === 'apis.google.com')
      return;

  if (e.target.src && element_host !== document.domain &&
                      element_host !== document.domain.split('.')[0] + '.disqus.com') e.preventDefault();

  if (!e.target.src)
    for (var i of ['charCodeAt', 'BB_', 'taboola', 'plusone', 'analytics', 'AdBlock', 'TemporaryBlock', 'adsIfrme'])
      if (e.target.textContent.indexOf(i) != -1)
        e.preventDefault();

  console.log('[i] blocking script element: ', e.defaultPrevented, e.target.src);
});

/* override the check in Chrome and call it a day */
try
{
  Object.defineProperty(window, 'DoDetect2',
  {
    configurable: false,
    writable: false,
    value: function()
    {
      console.info('[/] check overriden!');
    }
  });
  
  Object.defineProperty(window, 'YANMKABFYWRW',
  {
    configurable: false,
    writable: false,
    value: function()
    {
      console.info('[/] YANMKABFYWRW check overriden!');
    }
  });
  
  Object.defineProperty(window, 'HAYNQMAKDASAS',
  {
    configurable: false,
    writable: false,
    value: function()
    {
      console.info('[/] HAYNQMAKDASAS check overriden!');
    }
  });
  
  Object.defineProperty(window, 'YANABWEKA',
  {
    configurable: false,
    writable: false,
    value: function()
    {
      console.info('[/] YANABWEKA check overriden!');
    }
  }); 
} catch(e) {}

window.addEventListener('DOMContentLoaded', function(e)
{
  console.log('DOM loaded, processing stuff...');

  /* get rid of the cruft */
  for (var elem of document.querySelectorAll(`
     iframe[src*='ad']:not([src*='openload']),
    .divCloseBut,
    .clear2,
     div[style*='!important'],
     iframe[style*='!important'][src^='/'],
     div[id^='divFloat'],
    .episodeList div[style$='float: left;'],
    .episodeList .clear,
     div[style$='height:80px'],
     img[id^='adCheck'],
     div[id^=adsFloat][style],
     div[id^=btnClose],
     div[style*='width:800px'],
     div[id*=fl-ads].rf-container,
     div[id^=adsIfrme]:not([id=adsIfrme]),
     iframe[src*='Ads'],
     iframe[src*='facebook'],
     iframe[src*='mgi'][height='215'],
     div[style*='300px'][style*='250px'],
     div[style*='margin: 0px auto'],
     div[style*='height: 600px'],
     div[style*='820px'][style*='215px'],
     div[style*='728px'][style*='200px'],
     iframe[width='728px'][height='90px'],
     li#liFlappy, li#liReportError,
     body > script[src],
     script[data-cfasync],
     div[style*='728px'][style*='90px']
  `))
  {
    console.log('[-] removing cruft: ', elem);
    elem.parentElement.removeChild(elem);
  }
  
  /* show the comic pages and comment buttons; they are hidden (display: none) by default */
  (img=document.querySelector("div#divImage[style]")) && img && (img.style.display="block");
  (img=document.querySelector("a#btnShowComments.specialButton[style]")) && img && (img.style.display="inline-block");
  
  /* let's hook the AJAX requests, just in case, and filter out the so-called 'ban'
     avoiding potential fake points loss and such, what a scummy move by the site owner */
  (function (xhr_proto_open)
  {
    window.XMLHttpRequest.prototype.open = function(method, url)
    {
      if (url.match(/ban|Banned|GotBanned|TemporaryBlock/gi) !== null)
      {
        console.info("[x] intercepted shitty 'ban' request!", arguments); this.abort();
      }
      else
      {
        xhr_proto_open.apply(this, arguments);
      }
    };
  }(XMLHttpRequest.prototype.open));
});