function show_pub() { if(!navigator.onLine) { $(".adsense-h90-inject").each(function () { $(this).replaceWith('
Pas de connexion = pas de pub
'); }); $(".adsense-inject").each(function () { $(this).replaceWith('Pas de connexion = pas de pub ☹
'); }); } else { $(".adsense-inject").each(function () { $(this).append(''); (adsbygoogle = window.adsbygoogle || []).push({}); }); $(".adsense-h90-inject").each(function () { $(this).append(''); (adsbygoogle = window.adsbygoogle || []).push({}); }); } } $(document).ready(function() { show_pub(); window.onload = function() { document.body.addEventListener("online", function () { console.log("Online: yes u are"); show_pub(); }, false); document.body.addEventListener("offline", function () { console.log("Online: no, its offline."); }, false); if (adsbygoogle) { console.log("adsbygoogle", adsbygoogle); if(!adsbygoogle.loaded) { //alert("La publicité semble désactivée sur votre navigateur. Celle-ci permet pourtant de proposer un service totalement gratuit en finançant les dépenses liées à l'hébergement. Merci de débloquer les pubs pour ne plus voir cette alerte !"); $(".adsense-h90-inject").each(function () { //$(this).replaceWith('La publicité semble désactivée sur votre navigateur. Merci de débloquer les pubs pour garantir la gratuité de nos services.
'); //$(this).replaceWith( pubs[Math.floor(Math.random() * pubs.length)] ); $(this).replaceWith(''); }); $(".adsense-inject").each(function () { $(this).replaceWith('Pub désactivée ☹
'); }); } else { console.log("Adsbygoogle loaded"); } } else { console.log("No adsbygoogle. Online ? "+navigator.onLine); } $(".adsense-h90-inject").each(function () { if( ($(this).height()==0) || ($(this).filter(":visible").length==0) || ($(this).filter(":hidden").length>0) || ($(this).is("hidden")) || ($(this).css("visibility")=="hidden") || ($(this).css("display")=="none") ) { $(this).replaceWith(''); } }); $(".adsense-inject").each(function () { if( ($(this).height()==0) || ($(this).filter(":visible").length==0) || ($(this).filter(":hidden").length>0) || ($(this).is("hidden")) || ($(this).css("visibility")=="hidden") || ($(this).css("display")=="none") ) { $(this).replaceWith(''); } }); } });