From f6676d7d273ad1c9fd2c625e74a82084f25585cc Mon Sep 17 00:00:00 2001 From: lelo Date: Sun, 23 Mar 2025 17:35:48 +0100 Subject: [PATCH] fix ui --- static/app.js | 9 ++++++--- static/gallery.js | 10 +++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/static/app.js b/static/app.js index 6ab1c16..bf23e84 100644 --- a/static/app.js +++ b/static/app.js @@ -184,7 +184,6 @@ document.querySelectorAll('.play-file').forEach(link => { const fileType = this.getAttribute('data-file-type'); const relUrl = this.getAttribute('data-url'); const nowPlayingInfo = document.getElementById('nowPlayingInfo'); - document.getElementById('audioPlayerContainer').style.display = "block" // Remove the class from all file items. document.querySelectorAll('.file-item').forEach(item => { @@ -192,12 +191,16 @@ document.querySelectorAll('.play-file').forEach(link => { }); if (fileType === 'music') { - // Update currentMusicIndex based on the clicked element. const idx = this.getAttribute('data-index'); const audioPlayer = document.getElementById('globalAudio'); - currentMusicIndex = idx !== null ? parseInt(idx) : -1; const playerButton = document.querySelector('.player-button'); + // Update currentMusicIndex based on the clicked element. + currentMusicIndex = idx !== null ? parseInt(idx) : -1; + + // Show the audio player container. + document.getElementById('audioPlayerContainer').style.display = "block" + // Add the class to the clicked file item's parent. this.closest('.file-item').classList.add('currently-playing'); diff --git a/static/gallery.js b/static/gallery.js index 7bda56f..32509e5 100644 --- a/static/gallery.js +++ b/static/gallery.js @@ -88,7 +88,15 @@ function preloadNextImage() { function closeGalleryModal() { document.getElementById('gallery-modal').style.display = 'none'; - document.body.style.overflow = ''; // Restore scrolling. + // remove all images + const existingImages = document.querySelectorAll('#gallery-modal img'); + existingImages.forEach(img => { + if (img.parentNode) { + img.parentNode.removeChild(img); + } + }); + // Restore scrolling. + document.body.style.overflow = ''; } function handleGalleryImageClick(e) {