diff --git a/public/scripts/manage.js b/public/scripts/manage.js index de4a6e2..32ca8dd 100644 --- a/public/scripts/manage.js +++ b/public/scripts/manage.js @@ -367,10 +367,18 @@ async function listItems(category) { itemsListTable.appendChild(row); }); } +if(window.location.hash) { + let correctIndex; + let index = 0; + CATEGORIES.forEach(category => { + if(window.location.hash == '#' + category.name) correctIndex = index; + index++; + }) + if(correctIndex || correctIndex === 0) categoryDropdown.selectedIndex = correctIndex; +} listItems(CATEGORIES[categoryDropdown.selectedIndex]); - categoryDropdown.onchange = () => { listItems(CATEGORIES[categoryDropdown.selectedIndex]); };