Last active
August 23, 2018 10:54
-
-
Save Zorgatone/1fec4be76e649d9d0c6fbe52f73e465a to your computer and use it in GitHub Desktop.
KissAnime Ad-Blocker Userscript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name KissAnime Ad-Blocker | |
// @namespace http://zorgatone.tk/ | |
// @version 0.7.1 | |
// @description Hides the ads on KissAnime | |
// @author Zorgatone <[email protected]> | |
// @include /^https?://kissanime\.(?:com|to|ru)(?:\/.*)?$/ | |
// @update https://cdn.rawgit.com/Zorgatone/1fec4be76e649d9d0c6fbe52f73e465a/raw/499b5612ee2f45b8cb7b0702f08cec7da88482d6/kissanime-ad-blocker.user.js | |
// ==/UserScript== | |
/* jshint esnext: false */ | |
/* jshint esversion: 5 */ | |
(function () { | |
"use strict"; | |
console.info("KissAnime Ad-Blocker v0.7"); | |
doChecks(); | |
setInterval(doChecks, 200); | |
})(); | |
function doChecks() { | |
"use strict"; | |
var elements = document.getElementsByClassName("divCloseBut"); | |
var len = elements && elements.length; | |
var i, child; | |
if (len) { | |
for (i = 0; i < len; i += 1) { | |
child = elements[i]; | |
if (child && child.parentNode) { | |
child.parentNode.removeChild(child); | |
} | |
} | |
} | |
elements = document.getElementsByTagName("iframe"); | |
len = elements && elements.length; | |
if (len) { | |
for (i = 0; i < len; i += 1) { | |
child = elements[i]; | |
if ( | |
child && child.parentNode && | |
( | |
child.id.toLowerCase().indexOf("ads") >= 0 || | |
child.src.toLowerCase().indexOf("ads") >= 0 | |
) | |
) { | |
child.parentNode.removeChild(child); | |
} | |
} | |
} | |
elements = document.querySelectorAll("*[id*=ads]"); | |
len = elements && elements.length; | |
if (len) { | |
for (i = 0; i < len; i += 1) { | |
child = elements[i]; | |
if ( | |
child && child.parentNode && | |
child.id.toLowerCase().indexOf("ads") >= 0 && | |
!child.classList.contains("bigBarContainer") | |
) { | |
child.parentNode.removeChild(child); | |
} | |
} | |
} | |
function collectionToArray(collection) { | |
return Array.prototype.slice.call(collection); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment