From 8259427429862b915c15a6dd6544adf65c6e6f45 Mon Sep 17 00:00:00 2001 From: mildfire Date: Tue, 7 Jul 2026 16:54:05 +0500 Subject: [PATCH] perf: preconnect + preload Slise embed so ad banners render as the page loads Co-Authored-By: Claude Opus 4.8 (1M context) --- index.html | 3 +++ src/components/ad/AdBanner.vue | 27 +++++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/index.html b/index.html index 1e0a85d58b..457655a3e7 100644 --- a/index.html +++ b/index.html @@ -4,6 +4,9 @@ + + + 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"]')) { + window.adsbyslise = window.adsbyslise || []; + window.adsbyslise.push({ slot: props.slot }); + + 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(() => {