1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 17:59:55 +02:00

Run ads only when container is visible

This commit is contained in:
Daniel 2022-02-09 12:58:54 -03:00
parent 9a557f882f
commit 896a6b570e

View file

@ -2237,10 +2237,8 @@ function downloadURLOrAlertError(jsonURL, data, filename) {
}
function startGoogleAd(selector){
if($(selector).is(":visible")){
setTimeout(function(){
if($(selector).is(":visible") && $(selector).height() >= 80 && $(selector).width() >= 200){
(adsbygoogle = window.adsbygoogle || []).push({});
},1000);
}else{
setTimeout(function(){startGoogleAd(selector);},1000);
}