From f56ad5963a4913e357c16fcbb76b5af023d88fe0 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Mon, 19 Sep 2022 22:01:40 +0400 Subject: [PATCH] Removed unnecessary const categories array and a local const category. --- homepage/static/assets/js/mindflow.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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