This commit is contained in:
lelo 2025-03-23 17:35:48 +01:00
parent d144274c4c
commit f6676d7d27
2 changed files with 15 additions and 4 deletions

View File

@ -184,7 +184,6 @@ document.querySelectorAll('.play-file').forEach(link => {
const fileType = this.getAttribute('data-file-type'); const fileType = this.getAttribute('data-file-type');
const relUrl = this.getAttribute('data-url'); const relUrl = this.getAttribute('data-url');
const nowPlayingInfo = document.getElementById('nowPlayingInfo'); const nowPlayingInfo = document.getElementById('nowPlayingInfo');
document.getElementById('audioPlayerContainer').style.display = "block"
// Remove the class from all file items. // Remove the class from all file items.
document.querySelectorAll('.file-item').forEach(item => { document.querySelectorAll('.file-item').forEach(item => {
@ -192,12 +191,16 @@ document.querySelectorAll('.play-file').forEach(link => {
}); });
if (fileType === 'music') { if (fileType === 'music') {
// Update currentMusicIndex based on the clicked element.
const idx = this.getAttribute('data-index'); const idx = this.getAttribute('data-index');
const audioPlayer = document.getElementById('globalAudio'); const audioPlayer = document.getElementById('globalAudio');
currentMusicIndex = idx !== null ? parseInt(idx) : -1;
const playerButton = document.querySelector('.player-button'); 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. // Add the class to the clicked file item's parent.
this.closest('.file-item').classList.add('currently-playing'); this.closest('.file-item').classList.add('currently-playing');

View File

@ -88,7 +88,15 @@ function preloadNextImage() {
function closeGalleryModal() { function closeGalleryModal() {
document.getElementById('gallery-modal').style.display = 'none'; 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) { function handleGalleryImageClick(e) {