Fixed issue where ads would not show in some places. (#216)

This commit is contained in:
Redblueflame 2021-05-21 00:44:21 +02:00 committed by GitHub
parent e876712af5
commit 9cd5bf2992
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,6 +78,7 @@ export default {
displayed: false,
onSmallScreen: false,
windowResizeListenerDebounce: null,
ethicalAdLoad: null,
}
},
computed: {
@ -151,8 +152,15 @@ export default {
}, 300)
},
refresh_ad() {
if (this.ethical_ads_on && typeof window.ethicalads !== 'undefined') {
ethicalads.load()
if (this.ethical_ads_on) {
clearTimeout(this.ethicalAdLoad)
this.ethicalAdLoad = setTimeout(() => {
if (typeof window.ethicalads === 'undefined') {
console.log('EthicalAds are not loaded yet, retrying...')
this.refresh_ad()
}
ethicalads.load()
}, 100)
}
},
},