1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 19:42:38 +02:00

Run ads only when container is visible

This commit is contained in:
Daniel 2022-02-09 12:59:53 -03:00
parent 896a6b570e
commit 3d2585344c

View file

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