Greasy Fork

KissAnime Auto Hide

Automatically hide ads on KissAnime pages. Also automatically hides the beta player ad.

目前为 2018-06-09 提交的版本。查看 最新版本

// ==UserScript==
// @name         KissAnime Auto Hide
// @version      1.0.1
// @description  Automatically hide ads on KissAnime pages.  Also automatically hides the beta player ad.
// @author       G-Rex
// @match        http://kissanime.ru/*
// @match        https://kissanime.ru/*
// @grant        none
// @run-at	 document-idle
//
// @namespace https://greasyfork.org/users/154522
// ==/UserScript==

(function() {
    'use strict';

    setTimeout(hideAds, 3000);
})();

function hideAds() {
    let hideAnchors = document.querySelectorAll('.divCloseBut a');

    for(let i = 0; i < hideAnchors.length; i++) {
        hideAnchors[i].onclick();
    }

    let videoAd = document.getElementById('videoAd');
    if(videoAd) {
        videoAd.parentNode.removeChild(videoAd);
    }

    let videoAdClose = document.getElementsByClassName('videoAdClose');

    for(let i = 0; i < hideAnchors.length; i++) {
        if(videoAdClose[i]) {
            videoAdClose[i].parentNode.removeChild(videoAdClose[i]);
        }
    }
}