feat(collection): apply initial filters from URL params (dashboard deep-link target)
This commit is contained in:
parent
8fe90e431f
commit
04891a7838
@ -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(); })();
|
||||
/*]]>*/
|
||||
</script>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user