cocoat commited on
Commit
e1a808e
·
verified ·
1 Parent(s): 7391782

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -523,13 +523,13 @@ with gr.Blocks(css=css, theme=gr.themes.Default(font=[gr.themes.GoogleFont("Play
523
  gr.HTML(
524
  """
525
  <script>
526
- window.addEventListener('load', () => {
527
  // const observer = new MutationObserver(() => {
528
  // const svg = document.querySelector('svg.svelte-zyxd38');
529
  // if (!svg) return;
530
  // 一度挿入したら再挿入しない
531
  // if (svg.querySelector('foreignObject#custom-loader-fo')) return;
532
- const component25 = document.getElementsByClassName('image-container');
533
  if (component25) {
534
  // カスタムローダーのHTML
535
  const loaderHTML = `
@@ -553,8 +553,15 @@ window.addEventListener('load', () => {
553
  document.querySelector('.image-frame').insertAdjacentHTML('afterbegin', loaderHTML);
554
  }
555
 
556
- });
557
  // observer.observe(document.body, { childList: true, subtree: true });
 
 
 
 
 
 
 
558
  });
559
  </script>
560
  """
 
523
  gr.HTML(
524
  """
525
  <script>
526
+ //window.addEventListener('load', () => {
527
  // const observer = new MutationObserver(() => {
528
  // const svg = document.querySelector('svg.svelte-zyxd38');
529
  // if (!svg) return;
530
  // 一度挿入したら再挿入しない
531
  // if (svg.querySelector('foreignObject#custom-loader-fo')) return;
532
+ // const component25 = document.getElementsByClassName('image-container');
533
  if (component25) {
534
  // カスタムローダーのHTML
535
  const loaderHTML = `
 
553
  document.querySelector('.image-frame').insertAdjacentHTML('afterbegin', loaderHTML);
554
  }
555
 
556
+ // });
557
  // observer.observe(document.body, { childList: true, subtree: true });
558
+ //});
559
+ document.addEventListener('DOMContentLoaded', function() {
560
+ const imageContainer = document.querySelector('.image-container');
561
+ if (imageContainer) {
562
+ const loaderHTML = `<div id="custom-loader" style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">test</div>`;
563
+ imageContainer.insertAdjacentHTML('beforeend', loaderHTML);
564
+ }
565
  });
566
  </script>
567
  """