mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-06 03:50:04 +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){
|
function startGoogleAd(selector){
|
||||||
if(isVisibleAndInViewport(selector)){
|
if(isVisibleAndInViewport(selector)){
|
||||||
console.log('startGoogleAd',selector);
|
console.log('startGoogleAd',selector);
|
||||||
|
try {
|
||||||
(adsbygoogle = window.adsbygoogle || []).push({});
|
(adsbygoogle = window.adsbygoogle || []).push({});
|
||||||
|
} catch (e) {
|
||||||
|
console.log('startGoogleAd ERROR',selector);
|
||||||
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
setTimeout(function(){startGoogleAd(selector);},1000);
|
setTimeout(function(){startGoogleAd(selector);},1000);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue