Spaces:
Running
Running
Remove premature iframe timeout overlay
Browse files204 unmodified lines20520620720820921021121221321421521621721821922022122222322422598 unmodified lines32432532632732832933033133233333433533633733833934034134234334425 unmodified lines370371372373374375376377378379380381382383384385386387388389390391392393394395396397204 unmodified linesbackground: #fff;}.fallback {display: none;position: absolute;inset: 0;place-items: center;padding: 28px;color: #16283c;text-align: center;background: #f4f8fc;}.fallback.visible { display: grid; }.fallback p { max-width: 560px; line-height: 1.65; }.fallback .button { color: #07111f; border-color: #a9bdd3; }.grid {display: grid;grid-template-columns: repeat(3, 1fr);98 unmodified linesallow="clipboard-read; clipboard-write"referrerpolicy="strict-origin-when-cross-origin"></iframe><div class="fallback" id="fallback"><div><h2>内嵌页面加载受限</h2><p>浏览器隐私设置或上游休眠可能阻止内嵌页面。请在 Hugging Face 完整页面打开,登录后还能使用你自己的 ZeroGPU 每日额度。</p><aclass="button primary"href="https://huggingface.co/spaces/24yearsold/see-through-demo"target="_blank"rel="noopener noreferrer">打开完整 Demo ↗</a></div></div></div></section>25 unmodified linesconst dot = document.getElementById("status-dot");const label = document.getElementById("status-label");const frame = document.getElementById("demo-frame");const fallback = document.getElementById("fallback");let frameLoaded = false;frame.addEventListener("load", () => {frameLoaded = true;dot.classList.add("online");label.textContent = "上游 Demo 已加载";});frame.addEventListener("error", () => {dot.classList.add("offline");label.textContent = "上游暂不可用";fallback.classList.add("visible");});window.setTimeout(() => {if (!frameLoaded) {dot.classList.add("offline");label.textContent = "上游加载超时";fallback.classList.add("visible");}}, 20000);</script></body></html>204 unmodified lines20520620720820921098 unmodified lines30931031131231331425 unmodified lines340341342343344345346347348349350351352353354355356357204 unmodified linesbackground: #fff;}.grid {display: grid;grid-template-columns: repeat(3, 1fr);98 unmodified linesallow="clipboard-read; clipboard-write"referrerpolicy="strict-origin-when-cross-origin"></iframe></div></section>25 unmodified linesconst dot = document.getElementById("status-dot");const label = document.getElementById("status-label");const frame = document.getElementById("demo-frame");frame.addEventListener("load", () => {dot.classList.remove("offline");dot.classList.add("online");label.textContent = "上游 Demo 已加载";});frame.addEventListener("error", () => {dot.classList.remove("online");dot.classList.add("offline");label.textContent = "上游连接异常,可从完整页面重试";});</script></body></html>
index.html+3-43