diff --git a/index.html b/index.html index 1e0a85d58b..764107f0f6 100644 --- a/index.html +++ b/index.html @@ -4,6 +4,12 @@ + + + + Ping Dashboard - Cosmos Blockchain Explorer And Web Wallet { observer.observe(containerRef.value); } - // Load script only once - if (!document.querySelector('script[src="https://v1.slise.xyz/scripts/embed.js"]')) { + // Queue this slot for Slise. + window.adsbyslise = window.adsbyslise || []; + window.adsbyslise.push({ slot: props.slot }); + + // Fill the slot as soon as Slise's embed script is ready. Waiting for the + // script's `load` event (instead of a one-shot check) means the very first + // banner fills the moment the script arrives, rather than only on Slise's + // internal 1s location poll. + const sync = () => window.adsbyslisesync?.(); + const existing = document.querySelector(`script[src="${SLISE_EMBED_SRC}"]`); + + if (window.adsbyslisesync) { + sync(); + } else if (existing) { + existing.addEventListener('load', sync, { once: true }); + } else { const script = document.createElement('script'); - script.src = 'https://v1.slise.xyz/scripts/embed.js'; + script.src = SLISE_EMBED_SRC; script.async = true; + script.addEventListener('load', sync, { once: true }); document.head.appendChild(script); } - - // Initialize ad queue - window.adsbyslise = window.adsbyslise || []; - window.adsbyslise.push({ slot: props.slot }); - - // Sync if available - if (typeof window.adsbyslisesync === 'function') { - window.adsbyslisesync(); - } }); onBeforeUnmount(() => {