diff --git a/homepage/static/assets/js/mindflow.js b/homepage/static/assets/js/mindflow.js index 984ebd9..7770fb5 100644 --- a/homepage/static/assets/js/mindflow.js +++ b/homepage/static/assets/js/mindflow.js @@ -1,5 +1,3 @@ -const categories = ["update", "diary"]; - const buttons = document.getElementsByTagName("button"); const articles = document.getElementsByTagName("article"); @@ -8,9 +6,8 @@ document.getElementById("filter").classList.remove("hidden"); for (let i = 0; i < buttons.length; ++i) if (buttons[i].name !== "") buttons[i].addEventListener("click", e => { - const category = e.target.name; for (let j = 0; j < articles.length; ++j) - if (articles[j].id.startsWith(category) || category === "all") + if (articles[j].id.startsWith(e.target.name) || e.target.name === "all") articles[j].classList.remove("hidden"); else articles[j].classList.add("hidden"); }); \ No newline at end of file