Skip to content

Instantly share code, notes, and snippets.

@peruihkxt
Last active January 7, 2023 01:51
Show Gist options
  • Save peruihkxt/2f7ffe2c7ef6576de36795dadaa2a535 to your computer and use it in GitHub Desktop.
Save peruihkxt/2f7ffe2c7ef6576de36795dadaa2a535 to your computer and use it in GitHub Desktop.
Kills the Admiral anti adblock nonsense. Just click on the *Raw* button to install the script into Tampermonkey.
// ==UserScript==
// @name Admiral AntiAdblock Killer
// @version 0.2
// @description
// @author JeremyLee
// @match https://*/*
// @match http://*/*
// @grant none
// @updateURL https://gist.github.com/JeremyLee/2f7ffe2c7ef6576de36795dadaa2a535/raw/Admiral-AntiAdblock-Killer.user.js
// ==/UserScript==
(function() {
window.setInterval(function(){
if(document.getRootNode().children[0].style.overflow === "hidden" && document.getElementsByTagName("body")[0].style.overflow === "hidden") {
// Admiral Anti Adblock sets these properties when it activates.
// Search for the keyword to make sure it's actually the admiral anti-adblock. We don't want to clear the above properties if it's part of the page design.
var aTags = document.getElementsByTagName("H3");
var searchText = "Uh Oh...Adblocker detected!";
var found;
for (var i = 0; i < aTags.length; i++) {
if (aTags[i].textContent == searchText) {
found = aTags[i];
break;
}
}
if(found){
// Loop until we've found the topmost element that's part of admiral.
while(found.parentElement.nodeName !== "BODY") {
found = found.parentElement;
}
// Remove that stupid element
found.remove()
// Enable the scrollbars again.
document.getRootNode().children[0].style.overflow = null
document.getElementsByTagName("body")[0].style.overflow = null
}
}
}, 100);
})();
@BlackBurnStar
Copy link

This is a nice script, thank you for making my day less annoying!

@Drillimation
Copy link

It doesn't work on Know Your Meme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment