mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
Run ads only when container is visible
This commit is contained in:
parent
e3106cae59
commit
32d6922a68
1 changed files with 6 additions and 1 deletions
|
@ -2239,7 +2239,12 @@ function downloadURLOrAlertError(jsonURL, data, filename) {
|
|||
function startGoogleAd(selector){
|
||||
if(isVisibleAndInViewport(selector)){
|
||||
console.log('startGoogleAd',selector);
|
||||
(adsbygoogle = window.adsbygoogle || []).push({});
|
||||
try {
|
||||
(adsbygoogle = window.adsbygoogle || []).push({});
|
||||
} catch (e) {
|
||||
console.log('startGoogleAd ERROR',selector);
|
||||
}
|
||||
|
||||
}else{
|
||||
setTimeout(function(){startGoogleAd(selector);},1000);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue