From 21223ec9cc0dcd8c3a5d62478f9b12785f6790a9 Mon Sep 17 00:00:00 2001 From: Ken D'Ambrosio Date: Sat, 9 May 2026 15:39:34 +0000 Subject: Add live album filter search box MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Typing in the search box instantly hides non-matching album cards. Shown only when an album has more than 4 sub-albums (no point otherwise). Pure client-side — no server round-trips. Co-Authored-By: Claude Sonnet 4.6 --- public/js/album.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'public/js') diff --git a/public/js/album.js b/public/js/album.js index 74d524c..d3a563a 100644 --- a/public/js/album.js +++ b/public/js/album.js @@ -96,6 +96,19 @@ window.addEventListener('DOMContentLoaded', () => { } }); +// Album search filter +(function () { + const input = document.getElementById('album-search'); + if (!input) return; + input.addEventListener('input', () => { + const q = input.value.trim().toLowerCase(); + document.querySelectorAll('#album-grid .album-card').forEach(card => { + const label = (card.querySelector('.album-label')?.textContent || '').toLowerCase(); + card.style.display = !q || label.includes(q) ? '' : 'none'; + }); + }); +})(); + // Touch swipe (function () { let startX = null; -- cgit v1.2.3