don't set hash onload

This commit is contained in:
j 2025-04-27 11:46:42 +01:00
parent a6e76776cc
commit e48a1415a6

View file

@ -217,7 +217,7 @@ function loadGallery(images, idx, main, thumbnails) {
} }
}) })
function updateGallery(index) { function updateGallery(index, init) {
mainImage.src = images[index].src.replace('_display', '_thumbnail'); mainImage.src = images[index].src.replace('_display', '_thumbnail');
setTimeout(() => { setTimeout(() => {
mainImage.src = images[index].src; mainImage.src = images[index].src;
@ -253,10 +253,12 @@ function loadGallery(images, idx, main, thumbnails) {
} }
prevBtn.disabled = index === 0; prevBtn.disabled = index === 0;
nextBtn.disabled = index === images.length - 1; nextBtn.disabled = index === images.length - 1;
if (idx == 'inline') { if (!init) {
document.location.hash = `#${index + 1}` if (idx == 'inline') {
} else { document.location.hash = `#${index + 1}`
document.location.hash = `#${idx + 1}/${index + 1}` } else {
document.location.hash = `#${idx + 1}/${index + 1}`
}
} }
} }
@ -299,7 +301,7 @@ function loadGallery(images, idx, main, thumbnails) {
}; };
idx != 'inline' && createThumbnails(); idx != 'inline' && createThumbnails();
updateGallery(currentIndex); updateGallery(currentIndex, true);
const imagesIndex = images.map(img => img.src); const imagesIndex = images.map(img => img.src);
return { return {