Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save adastra1826/53fd52d5a29bf059a908bb3c28978d7d to your computer and use it in GitHub Desktop.

Select an option

Save adastra1826/53fd52d5a29bf059a908bb3c28978d7d 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.3
// @description Admiral AntiAdblock Killer
// @author AdAstra1826
// @match https://*/*
// @match http://*/*
// @grant none
// @updateURL https://gist.github.com/adastra1826/53fd52d5a29bf059a908bb3c28978d7d/raw/Admiral-AntiAdblock-Killer.user.js
// @downloadURL https://gist.github.com/adastra1826/53fd52d5a29bf059a908bb3c28978d7d/raw/Admiral-AntiAdblock-Killer.user.js
// ==/UserScript==
(function() {
window.setInterval(() => {
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.
const aTags = document.getElementsByTagName("H3");
const searchText = [
"It looks like you're using an adblocker",
"Support us by disabling your adblocker"
];
let found;
for (let i = 0; i < aTags.length; i++) {
for (let t = 0; t < searchText.length; t++) {
if (aTags[i].textContent == searchText[t]) {
found = aTags[i];
break;
}
}
}
if(found){
// Loop until we've found the topmost element that's part of admiral.
while(found.parentElement.nodeName.toLowerCase() !== "body") {
found = found.parentElement;
}
// Remove that stupid element
found.remove();
console.info('Admiral AntiAdblock killed.');
// Enable the scrollbars again.
document.getRootNode().children[0].style.overflow = null;
document.getElementsByTagName("body")[0].style.overflow = null;
}
}
}, 100);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment