Skip to content

Instantly share code, notes, and snippets.

@h3ct0rjs
Last active January 27, 2016 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h3ct0rjs/f29ee789d67b0c5c04ad to your computer and use it in GitHub Desktop.
Save h3ct0rjs/f29ee789d67b0c5c04ad to your computer and use it in GitHub Desktop.
Test of abp adsense blocker, seen in thescienceofcode.azurewebsites.net
<script>
$(document).ready(
function() {
$('#pubadv-accept').on('click', function(){
$('#pubadv').hide();
});
setTimeout(checkAds, 1000);
}
);
function checkAds() {
var ad = document.querySelector("ins.adsbygoogle");
if (ad && ad.innerHTML.replace('/\s / g', "").length == 0) {
$.ajax({
type: 'post',
data: {'value':true},
url: '/Home/PubAdvAccept',
success:
function(result) {
var string = window.location.href.toUpperCase(), substring = "HOME";
if(string.indexOf(substring) == -1)
window.location.replace('/Home/Index');
}
});
$('#pubadv').show('slow');
$('.pubdiv').html('<div class="alert alert-red"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button><h4>¡Importante!</h4><h4>Queremos seguir prestando un servicio gratuito y compartiendo el conocimiento, pero AdBlock está arruinando internet libre. <br/>No queremos cobrar membresías, a cambio te pedimos desactivar tu AdBlock.</h4></div>');
}
else{
$.ajax({
type: 'post',
data: {'value':false},
url: '/Home/PubAdvAccept'
});
}
}
</script>
@h3ct0rjs
Copy link
Author

@Usage is

 <div class="row well">
        <div class="col-xs-12">
            No podrás navegar hasta que verifiquemos que has desactivado el AdBlock.
            <a class="btn btn-primary" href="/Home/Index">Recargar</a>
        </div>
    </div>
<div class="row">
    <div class="col-xs-12">
        <center>
            <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
            <!-- Main TSOC -->
            <ins class="adsbygoogle"
                 style="display:block;max-width:970px;width:100%;"
                 data-ad-client="ca-pub-1426867402604645"
                 data-ad-slot="7023487219"
                 data-ad-format="auto"></ins>
            <script>
                (adsbygoogle = window.adsbygoogle || []).push({});
            </script>
            <div class="pubdiv"></div>
        </center>
    </div>
</div>

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