summaryrefslogtreecommitdiffstats
path: root/public/js/album.js
diff options
context:
space:
mode:
authorKen D'Ambrosio <ken@jots.org>2026-05-09 15:39:34 +0000
committerKen D'Ambrosio <ken@jots.org>2026-05-09 15:39:34 +0000
commit21223ec9cc0dcd8c3a5d62478f9b12785f6790a9 (patch)
treec9e7c7c7df94269e49b46ff53f5bc13f0d34500d /public/js/album.js
parent4bb72d5eac546c9e26af0c20169f9233e8364207 (diff)
Add live album filter search box
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 <noreply@anthropic.com>
Diffstat (limited to 'public/js/album.js')
-rw-r--r--public/js/album.js13
1 files changed, 13 insertions, 0 deletions
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;