diff --git a/src/main/resources/templates/collection.html b/src/main/resources/templates/collection.html index 0b8ca26..e9d39a3 100644 --- a/src/main/resources/templates/collection.html +++ b/src/main/resources/templates/collection.html @@ -314,8 +314,26 @@ document.getElementById('videoModal').style.display = 'none'; } + // ----- URL 파라미터 필터 적용 ----- + function applyUrlFilters(){ + const q = new URLSearchParams(window.location.search); + const setSel = (id, val) => { + if(val == null) return; + const el = document.getElementById(id); + if(!el) return; + if(el.tagName === 'SELECT'){ + if([...el.options].some(o => o.value === String(val))) el.value = String(val); + } else { el.value = String(val); } + }; + setSel('fStatus', q.get('status')); + setSel('fCategory', q.get('categoryId')); + setSel('fSource', q.get('source')); + if(q.get('shortsOnly') === 'true'){ const c = document.getElementById('fShorts'); if(c) c.checked = true; } + if(q.get('bookmarkedOnly') === 'true'){ const c = document.getElementById('fBookmarked'); if(c) c.checked = true; } + } + // init - (async ()=>{ await loadCategories(); await loadVideos(); })(); + (async ()=>{ await loadCategories(); applyUrlFilters(); await loadVideos(); })(); /*]]>*/