Last active
April 8, 2024 18:56
-
-
Save ErdbeerbaerLP/e76dbbf54d29fc7cad1be59506ff1104 to your computer and use it in GitHub Desktop.
This file contains 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== | |
// | |
// Install with Tampermonkey or Greasemonkey | |
// | |
// @name Aternos Anti AdBlock Blocker | |
// @version 1.0.5 | |
// @description Blocks the anti ad block message and removes all red ad banners | |
// @author ErdbeerbaerLP | |
// @match https://aternos.org/* | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js | |
// @grant none | |
// @updateURL https://gist.github.com/ErdbeerbaerLP/e76dbbf54d29fc7cad1be59506ff1104/raw/Aternos%2520Anti%2520AdBlock%2520Blocker.user.js | |
// ==/UserScript== | |
(function() { | |
window.jQuery310 = $.noConflict(true); | |
function removeFilteredDivs(div){ | |
if(div.className !== "body" && !document.body.getElementsByClassName("body")[0].contains(div) && !document.body.getElementsByClassName("header")[0].contains(div) && !(div.classList == "" && div.id == "")){ | |
div.style = "display: none !important;" | |
} | |
} | |
function removeAllDivs(div){ | |
div.style = "display: none !important;" | |
} | |
function deStyle(elmt){ | |
if(elmt.classList.contains("ad") || elmt.classList == "" || elmt.id == "") return; | |
var styl = elmt.style; | |
if(styl.display === "none") styl.setProperty("display", "initial"); | |
console.log(styl.important); | |
styl.setProperty("important", "initial"); | |
elmt.style = styl; | |
} | |
function main(){ | |
document.body.getElementsByClassName("header")[0].style = ""; | |
Array.prototype.slice.call(document.body.getElementsByTagName("div")).forEach(removeFilteredDivs); | |
Array.prototype.slice.call(document.body.getElementsByClassName("ad")).forEach(removeAllDivs); | |
Array.prototype.slice.call(document.body.querySelectorAll('*')).forEach(deStyle); | |
} | |
function enableStart(){ | |
$('#start').each(function () { | |
this._ready = true; | |
}) | |
} | |
var interval = setInterval(main, 10); | |
function clearIv(){ | |
clearInterval(interval) | |
} | |
setTimeout(enableStart, 500); | |
setTimeout(clearIv,6000); //Stop processing that after 6 seconds | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After much research without success of a working userscript, I decided to make my own anti anti-adblock. Give it a try!
To annoy Aternos devs it's obfuscated, also prevents easy patching. Sorry!