Gallery Page

'; html += '
'; images.forEach(function(img) { var dateStr = new Date(img.date).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' }); html += '
'; html += ''; html += '
'; html += '
' + img.title + '
'; html += '
' + dateStr + '
'; if (img.caption || img.description) { html += '
' + (img.caption || img.description) + '
'; } html += '
'; }); html += '
'; }); if (totalImages === 0) { html = '
'; html += '
📁
'; html += '

No tagged images found.

'; html += '

Upload images using the upload form and they\'ll appear here automatically.

'; html += '
'; } body.innerHTML = html; countEl.textContent = totalImages + ' image' + (totalImages !== 1 ? 's' : '') + ' total'; } // ── Populate filter dropdown ── function populateFilter(groups) { var select = document.getElementById('galFilter'); var currentVal = select.value; select.innerHTML = ''; Object.keys(groups).sort().forEach(function(cat) { var opt = document.createElement('option'); opt.value = cat; opt.textContent = cat + ' (' + groups[cat].length + ')'; select.appendChild(opt); }); select.value = currentVal || 'all'; } // ── Load everything ── var currentGroups = {}; async function loadGallery() { var body = document.getElementById('galBody'); body.innerHTML = '
Loading images...
'; allTags = await fetchTags(); var media = await fetchMedia(); currentGroups = groupByCategory(media, allTags); populateFilter(currentGroups); renderGallery(currentGroups, document.getElementById('galFilter').value); } // ── Filter change ── document.getElementById('galFilter').addEventListener('change', function() { renderGallery(currentGroups, this.value); }); // ── Refresh ── window.galleryRefresh = function() { loadGallery(); }; // ── Lightbox ── window.openLightbox = function(url, title, category, desc) { var lb = document.getElementById('galLightbox'); var img = document.getElementById('galLightboxImg'); var info = document.getElementById('galLightboxInfo'); img.src = url; var infoHtml = '' + category + ' — ' + title; if (desc) infoHtml += '
' + desc; info.innerHTML = infoHtml; lb.classList.add('active'); document.body.style.overflow = 'hidden'; }; window.closeLightbox = function(e) { if (e && e.target !== e.currentTarget && e.target.tagName !== 'BUTTON') return; var lb = document.getElementById('galLightbox'); lb.classList.remove('active'); document.getElementById('galLightboxImg').src = ''; document.body.style.overflow = ''; }; // Escape key to close document.addEventListener('keydown', function(e) { if (e.key === 'Escape') window.closeLightbox(); }); // ── Init ── loadGallery(); })();

This website uses cookies.