From 52c619d289930d8aadff09208b8c8dbe8fc7595d Mon Sep 17 00:00:00 2001 From: ngn Date: Thu, 21 Mar 2024 20:10:38 +0300 Subject: [PATCH] new: Add interactive bar script --- public/bar.js | 13 +++++++++++++ public/global.css | 2 +- routes/news.go | 2 +- routes/wiki.go | 2 +- templates/parts/bar.html | 4 +++- 5 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 public/bar.js diff --git a/public/bar.js b/public/bar.js new file mode 100644 index 0000000..17c58a6 --- /dev/null +++ b/public/bar.js @@ -0,0 +1,13 @@ +const links = [].slice.call(document.getElementById("links").children) + +links.sort((a, b) => b.href.length - a.href.length); +for(let i in links){ + if(!location.href.startsWith(links[i].href)){ + continue + } + links[i].style = ` + color: var(--bright-second); + font-weight: 900; + text-decoration: underline;` + break +} diff --git a/public/global.css b/public/global.css index 748ca68..4ee0be0 100644 --- a/public/global.css +++ b/public/global.css @@ -46,7 +46,7 @@ body{ } .links a{ - margin-left: 7px; + margin-left: 12px; color: var(--bright-main); font-family: Ubuntu; font-size: 20px; diff --git a/routes/news.go b/routes/news.go index 1848481..c9f2567 100644 --- a/routes/news.go +++ b/routes/news.go @@ -60,7 +60,7 @@ func PostRoute(c *fiber.Ctx) error { } return c.Render("post", fiber.Map{ - "title": "News", + "title": con.Title, "post": con, }) } diff --git a/routes/wiki.go b/routes/wiki.go index 97b2941..8ebb528 100644 --- a/routes/wiki.go +++ b/routes/wiki.go @@ -45,7 +45,7 @@ func WikiRoute(c *fiber.Ctx) error{ con.Title = "Wiki: "+con.Title return c.Render("post", fiber.Map{ - "title": "Wiki", + "title": con.Title, "post": con, }) } diff --git a/templates/parts/bar.html b/templates/parts/bar.html index e9ade7a..70e7249 100644 --- a/templates/parts/bar.html +++ b/templates/parts/bar.html @@ -1,11 +1,13 @@

MatterLinux

-