cocoat commited on
Commit
7646fd4
·
verified ·
1 Parent(s): 4577771

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -529,14 +529,19 @@ with gr.Blocks(css=css, theme=gr.themes.Default(font=[gr.themes.GoogleFont("Play
529
  <script>
530
  window.addEventListener('load', () => {
531
  const observer = new MutationObserver(() => {
 
532
  const svg = document.querySelector('svg.svelte-zyxd38 g');
533
  // SVGが存在しない場合、ローダーを非表示にする
534
  if (!svg) {
535
- if (document.getElementById('custom-loader')) {
536
- document.getElementById('custom-loader').style.display = 'none';
537
  }
538
  return;
539
  }
 
 
 
 
540
  const component25 = document.querySelector('#component-25');
541
  if (!component25) return;
542
  if (component25.querySelector('#custom-loader')) {
@@ -546,7 +551,7 @@ window.addEventListener('load', () => {
546
  if (component25) {
547
  // カスタムローダーのHTML
548
  const loaderHTML = `
549
- <div id="custom-loader" style="display: none;">
550
  <div class="loading-text">
551
  <span style="animation-delay:0s">i</span>
552
  <span style="animation-delay:0.1s">n</span>
@@ -564,12 +569,7 @@ window.addEventListener('load', () => {
564
  </div>
565
  `;
566
  component25.insertAdjacentHTML('beforeend', loaderHTML);
567
- // SVGのg要素が存在する場合、ローダーを表示する
568
- if (svg && customLoader) {
569
- customLoader.style.display = 'block';
570
- }
571
  }
572
-
573
  });
574
  observer.observe(document.body, { childList: true, subtree: true });
575
  });
 
529
  <script>
530
  window.addEventListener('load', () => {
531
  const observer = new MutationObserver(() => {
532
+ let customLoader = document.getElementById('custom-loader');
533
  const svg = document.querySelector('svg.svelte-zyxd38 g');
534
  // SVGが存在しない場合、ローダーを非表示にする
535
  if (!svg) {
536
+ if (customLoader) {
537
+ customLoader.style.display = 'none';
538
  }
539
  return;
540
  }
541
+ // SVGのg要素が存在する場合、ローダーを表示する
542
+ if (svg && customLoader) {
543
+ customLoader.style.display = 'block';
544
+ }
545
  const component25 = document.querySelector('#component-25');
546
  if (!component25) return;
547
  if (component25.querySelector('#custom-loader')) {
 
551
  if (component25) {
552
  // カスタムローダーのHTML
553
  const loaderHTML = `
554
+ <div id="custom-loader">
555
  <div class="loading-text">
556
  <span style="animation-delay:0s">i</span>
557
  <span style="animation-delay:0.1s">n</span>
 
569
  </div>
570
  `;
571
  component25.insertAdjacentHTML('beforeend', loaderHTML);
 
 
 
 
572
  }
 
573
  });
574
  observer.observe(document.body, { childList: true, subtree: true });
575
  });