cocoat commited on
Commit
1c213df
·
verified ·
1 Parent(s): c470988

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -516,13 +516,13 @@ with gr.Blocks(css=css, theme=gr.themes.Default(font=[gr.themes.GoogleFont("Play
516
  """
517
  <script>
518
  window.addEventListener('load', () => {
519
- const observer = new MutationObserver(() => {
520
- const svg = document.querySelector('svg.svelte-zyxd38');
521
- if (!svg) return;
522
  // 一度挿入したら再挿入しない
523
- if (svg.querySelector('foreignObject#custom-loader-fo')) return;
524
-
525
- if (component25) { // ★ 要素が存在する場合のみ追加
526
  // カスタムローダーのHTML
527
  const loaderHTML = `
528
  <div id="custom-loader">
@@ -542,11 +542,11 @@ window.addEventListener('load', () => {
542
  </div>
543
  </div>
544
  `;
545
- component25.insertAdjacentHTML('beforeend', loaderHTML);
546
  }
547
- svg.appendChild(fo);
548
  });
549
- observer.observe(document.body, { childList: true, subtree: true });
550
  });
551
  </script>
552
  """
 
516
  """
517
  <script>
518
  window.addEventListener('load', () => {
519
+ // const observer = new MutationObserver(() => {
520
+ // const svg = document.querySelector('svg.svelte-zyxd38');
521
+ // if (!svg) return;
522
  // 一度挿入したら再挿入しない
523
+ // if (svg.querySelector('foreignObject#custom-loader-fo')) return;
524
+ const component25 = document.getElementById('component-25');
525
+ if (component25) {
526
  // カスタムローダーのHTML
527
  const loaderHTML = `
528
  <div id="custom-loader">
 
542
  </div>
543
  </div>
544
  `;
545
+ component25.insertAdjacentHTML('afterbegin', loaderHTML);
546
  }
547
+
548
  });
549
+ // observer.observe(document.body, { childList: true, subtree: true });
550
  });
551
  </script>
552
  """