E5note commited on
Commit
79a3874
·
verified ·
1 Parent(s): 15eb296

Remove premature iframe timeout overlay

Browse files
Files changed (1) hide show
  1. index.html +3 -43
index.html CHANGED
@@ -205,21 +205,6 @@
205
  background: #fff;
206
  }
207
 
208
- .fallback {
209
- display: none;
210
- position: absolute;
211
- inset: 0;
212
- place-items: center;
213
- padding: 28px;
214
- color: #16283c;
215
- text-align: center;
216
- background: #f4f8fc;
217
- }
218
-
219
- .fallback.visible { display: grid; }
220
- .fallback p { max-width: 560px; line-height: 1.65; }
221
- .fallback .button { color: #07111f; border-color: #a9bdd3; }
222
-
223
  .grid {
224
  display: grid;
225
  grid-template-columns: repeat(3, 1fr);
@@ -324,21 +309,6 @@
324
  allow="clipboard-read; clipboard-write"
325
  referrerpolicy="strict-origin-when-cross-origin"
326
  ></iframe>
327
- <div class="fallback" id="fallback">
328
- <div>
329
- <h2>内嵌页面加载受限</h2>
330
- <p>
331
- 浏览器隐私设置或上游休眠可能阻止内嵌页面。请在 Hugging Face 完整页面打开,
332
- 登录后还能使用你自己的 ZeroGPU 每日额度。
333
- </p>
334
- <a
335
- class="button primary"
336
- href="https://huggingface.co/spaces/24yearsold/see-through-demo"
337
- target="_blank"
338
- rel="noopener noreferrer"
339
- >打开完整 Demo ↗</a>
340
- </div>
341
- </div>
342
  </div>
343
  </section>
344
 
@@ -370,28 +340,18 @@
370
  const dot = document.getElementById("status-dot");
371
  const label = document.getElementById("status-label");
372
  const frame = document.getElementById("demo-frame");
373
- const fallback = document.getElementById("fallback");
374
- let frameLoaded = false;
375
 
376
  frame.addEventListener("load", () => {
377
- frameLoaded = true;
378
  dot.classList.add("online");
379
  label.textContent = "上游 Demo 已加载";
380
  });
381
 
382
  frame.addEventListener("error", () => {
 
383
  dot.classList.add("offline");
384
- label.textContent = "上游暂不可用";
385
- fallback.classList.add("visible");
386
  });
387
-
388
- window.setTimeout(() => {
389
- if (!frameLoaded) {
390
- dot.classList.add("offline");
391
- label.textContent = "上游加载超时";
392
- fallback.classList.add("visible");
393
- }
394
- }, 20000);
395
  </script>
396
  </body>
397
  </html>
 
205
  background: #fff;
206
  }
207
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  .grid {
209
  display: grid;
210
  grid-template-columns: repeat(3, 1fr);
 
309
  allow="clipboard-read; clipboard-write"
310
  referrerpolicy="strict-origin-when-cross-origin"
311
  ></iframe>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
312
  </div>
313
  </section>
314
 
 
340
  const dot = document.getElementById("status-dot");
341
  const label = document.getElementById("status-label");
342
  const frame = document.getElementById("demo-frame");
 
 
343
 
344
  frame.addEventListener("load", () => {
345
+ dot.classList.remove("offline");
346
  dot.classList.add("online");
347
  label.textContent = "上游 Demo 已加载";
348
  });
349
 
350
  frame.addEventListener("error", () => {
351
+ dot.classList.remove("online");
352
  dot.classList.add("offline");
353
+ label.textContent = "上游连接异常,可从完整页面重试";
 
354
  });
 
 
 
 
 
 
 
 
355
  </script>
356
  </body>
357
  </html>