Answer the question
In order to leave comments, you need to log in
How to block element in adblock without class and id?
On the site moskvatv.org, you need to block the script after the div element. And I can’t imagine how to do this without a class or id identifier.
<div class="afs_ads"> </div>
<script>
(function() {
var message = "Please disable AdBlock / Пожалуйста отключите AdBlock";
// Define a function for showing the message.
// Set a timeout of 2 seconds to give adblocker
// a chance to do its thing
var tryMessage = function() {
setTimeout(function() {
if(!document.getElementsByClassName) return;
var ads = document.getElementsByClassName('afs_ads'),
ad = ads[ads.length - 1];
if(!ad
|| ad.innerHTML.length == 0
|| ad.clientHeight === 0) {
alert(message);
window.location.href = 'http://www.msk-tv.com/adblock.php';
} else {
ad.style.display = 'none';
}
}, 2000);
}
/* Attach a listener for page load ... then show the message */
if(window.addEventListener) {
window.addEventListener('load', tryMessage, false);
} else {
window.attachEvent('onload', tryMessage); //IE
}
})();
</script>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question