bibibi12345 commited on
Commit
633140b
·
1 Parent(s): 6ab515a

ui bug fix

Browse files
Files changed (1) hide show
  1. static/script.js +48 -48
static/script.js CHANGED
@@ -778,60 +778,60 @@ function updateHistoryCount() {
778
  });
779
  countElement.textContent = totalImages;
780
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
781
 
782
- // Modal functionality for viewing large images
783
- let currentModalImage = null;
784
 
785
- function openImageModal(imageId, imageSrc, prompt, timestamp) {
786
- const modal = document.getElementById('imageModal');
787
- const modalImg = document.getElementById('modalImage');
788
- const modalCaption = document.getElementById('modalCaption');
789
-
790
- // Store current image info for use in "Use as Input"
791
- currentModalImage = { id: imageId, src: imageSrc };
792
-
793
- // Set modal content
794
- modalImg.src = imageSrc;
795
- modalCaption.innerHTML = `
796
- <strong>Generated:</strong> ${timestamp}<br>
797
- <strong>Prompt:</strong> ${prompt}
798
- `;
799
-
800
- // Show modal
801
- modal.classList.add('show');
802
-
803
- // Prevent body scroll when modal is open
804
- document.body.style.overflow = 'hidden';
805
-
806
- // Close modal on escape key
807
- document.addEventListener('keydown', handleModalEscape);
808
-
809
- // Close modal on clicking outside the image
810
- modal.onclick = function(event) {
811
- if (event.target === modal || event.target === modalImg.parentElement) {
812
- closeImageModal();
813
- }
814
- };
815
- }
816
 
817
- function closeImageModal() {
818
- const modal = document.getElementById('imageModal');
819
- modal.classList.remove('show');
820
- document.body.style.overflow = '';
821
- document.removeEventListener('keydown', handleModalEscape);
822
- currentModalImage = null;
823
- }
824
 
825
- function handleModalEscape(event) {
826
- if (event.key === 'Escape') {
 
827
  closeImageModal();
828
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
829
  }
830
-
831
- function useModalImageAsInput() {
832
- if (currentModalImage) {
833
- useAsInput(currentModalImage.id, currentModalImage.src);
834
- closeImageModal();
835
- }
836
  }
837
  }
 
778
  });
779
  countElement.textContent = totalImages;
780
  }
781
+ }
782
+
783
+ // Modal functionality for viewing large images
784
+ let currentModalImage = null;
785
+
786
+ function openImageModal(imageId, imageSrc, prompt, timestamp) {
787
+ const modal = document.getElementById('imageModal');
788
+ const modalImg = document.getElementById('modalImage');
789
+ const modalCaption = document.getElementById('modalCaption');
790
+
791
+ // Store current image info for use in "Use as Input"
792
+ currentModalImage = { id: imageId, src: imageSrc };
793
+
794
+ // Set modal content
795
+ modalImg.src = imageSrc;
796
+ modalCaption.innerHTML = `
797
+ <strong>Generated:</strong> ${timestamp}<br>
798
+ <strong>Prompt:</strong> ${prompt}
799
+ `;
800
 
801
+ // Show modal
802
+ modal.classList.add('show');
803
 
804
+ // Prevent body scroll when modal is open
805
+ document.body.style.overflow = 'hidden';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
806
 
807
+ // Close modal on escape key
808
+ document.addEventListener('keydown', handleModalEscape);
 
 
 
 
 
809
 
810
+ // Close modal on clicking outside the image
811
+ modal.onclick = function(event) {
812
+ if (event.target === modal || event.target === modalImg.parentElement) {
813
  closeImageModal();
814
  }
815
+ };
816
+ }
817
+
818
+ function closeImageModal() {
819
+ const modal = document.getElementById('imageModal');
820
+ modal.classList.remove('show');
821
+ document.body.style.overflow = '';
822
+ document.removeEventListener('keydown', handleModalEscape);
823
+ currentModalImage = null;
824
+ }
825
+
826
+ function handleModalEscape(event) {
827
+ if (event.key === 'Escape') {
828
+ closeImageModal();
829
  }
830
+ }
831
+
832
+ function useModalImageAsInput() {
833
+ if (currentModalImage) {
834
+ useAsInput(currentModalImage.id, currentModalImage.src);
835
+ closeImageModal();
836
  }
837
  }