Skip to content

Commit

Permalink
Don't try to re-use
Browse files Browse the repository at this point in the history
  • Loading branch information
xpdota committed Nov 1, 2024
1 parent e23e58b commit 11cc8ae
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions packages/frontend/src/scripts/components/ads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,24 @@ class ManagedAd {
if (value !== this._showing || (value && !this._installed)) {
if (value) {
this.adContainer.outer.style.display = '';
if (!this._installed) {
this.installAdPlacement();
}
this.adContainer.middle.prepend(this.adContainer.inner);
this.installAdPlacement();
// if (!this._installed) {
// }
}
else {
this.adContainer.outer.style.display = 'none';
this.adContainer.middle.removeChild(this.adContainer.inner);
}
this._showing = value;
}
}

onNavigate(): void {
// this.ad?.['onNavigate']?.();
this.installAdPlacement();
// // this.ad?.['onNavigate']?.();
// if (this.showing) {
// this.installAdPlacement();
// }
}

/**
Expand All @@ -86,7 +90,7 @@ class ManagedAd {
return;
}
setTimeout(() => {
console.debug(`createAd: ${window['nitroAds'] !== undefined}`);
console.trace(`createAd: ${window['nitroAds'] !== undefined}`);
this.ad = window['nitroAds'].createAd(id, {
"refreshTime": 30,
"renderVisibleOnly": true,
Expand Down Expand Up @@ -337,6 +341,7 @@ export function insertAds(element: HTMLElement) {
console.error(e);
}
}
currentAds.forEach(ad => ad.showing = false);
element.prepend(...currentAds.map(a => a.adContainer.outer));
setTimeout(recheckAds);
setTimeout(recheckAds, 2_000);
Expand Down

0 comments on commit 11cc8ae

Please sign in to comment.