From 71c5f58d30d1a207c07f81990df013f90162e08b Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 24 Mar 2021 17:38:02 +0100 Subject: [PATCH] made the current category button disabled --- scripts/blog.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/blog.js b/scripts/blog.js index f4e6038..49b55eb 100644 --- a/scripts/blog.js +++ b/scripts/blog.js @@ -22,10 +22,10 @@ function populateBlog(json, cat) { list.html(""); cats.html(""); - addCatButton(json, cats, "All"); + addCatButton(json, cats, "All", cat); for (let i = json.length - 1; i >= 0; i--) { let obj = json[i]; - addCatButton(json, cats, obj.cat); + addCatButton(json, cats, obj.cat, cat); if (cat === "All" || obj.cat === cat) { let p = /*html*/ `
@@ -49,10 +49,10 @@ function populateBlog(json, cat) { archive.html(`There are no archived ${cat} posts.`); } -function addCatButton(json, cats, cat) { +function addCatButton(json, cats, cat, currCat) { let catAnchor = `blog-cat-${cat.toLowerCase().replace(" ", "_")}`; if (!$(`#${catAnchor}`).length) { - cats.append( /*html*/ ``); + cats.append( /*html*/ ``); $(`#${catAnchor}`).on('click', function () { populateBlog(json, cat); });