new: Add interactive bar script

This commit is contained in:
ngn 2024-03-21 20:10:38 +03:00
parent 275053ddb3
commit 52c619d289
5 changed files with 19 additions and 4 deletions

13
public/bar.js Normal file
View File

@ -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
}

View File

@ -46,7 +46,7 @@ body{
} }
.links a{ .links a{
margin-left: 7px; margin-left: 12px;
color: var(--bright-main); color: var(--bright-main);
font-family: Ubuntu; font-family: Ubuntu;
font-size: 20px; font-size: 20px;

View File

@ -60,7 +60,7 @@ func PostRoute(c *fiber.Ctx) error {
} }
return c.Render("post", fiber.Map{ return c.Render("post", fiber.Map{
"title": "News", "title": con.Title,
"post": con, "post": con,
}) })
} }

View File

@ -45,7 +45,7 @@ func WikiRoute(c *fiber.Ctx) error{
con.Title = "Wiki: "+con.Title con.Title = "Wiki: "+con.Title
return c.Render("post", fiber.Map{ return c.Render("post", fiber.Map{
"title": "Wiki", "title": con.Title,
"post": con, "post": con,
}) })
} }

View File

@ -1,11 +1,13 @@
<div class="bar"> <div class="bar">
<h1 class="logo">MatterLinux</h1> <h1 class="logo">MatterLinux</h1>
<div class="links"> <div class="links" id="links">
<a href="/">Home</a> <a href="/">Home</a>
<a href="/news">News</a> <a href="/news">News</a>
<a href="/wiki">Wiki</a> <a href="/wiki">Wiki</a>
<a href="https://git.matterlinux.xyz/Matter">Source</a> <a href="https://git.matterlinux.xyz/Matter">Source</a>
<a href="https://tracker.matterlinux.xyz">Packages</a> <a href="https://tracker.matterlinux.xyz">Packages</a>
<a href="https://security.matterlinux.xyz">Security</a>
<a href="/download">Download</a> <a href="/download">Download</a>
</div> </div>
<script src="/bar.js"></script>
</div> </div>