new: Add interactive bar script
This commit is contained in:
parent
275053ddb3
commit
52c619d289
13
public/bar.js
Normal file
13
public/bar.js
Normal 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
|
||||
}
|
@ -46,7 +46,7 @@ body{
|
||||
}
|
||||
|
||||
.links a{
|
||||
margin-left: 7px;
|
||||
margin-left: 12px;
|
||||
color: var(--bright-main);
|
||||
font-family: Ubuntu;
|
||||
font-size: 20px;
|
||||
|
@ -60,7 +60,7 @@ func PostRoute(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
return c.Render("post", fiber.Map{
|
||||
"title": "News",
|
||||
"title": con.Title,
|
||||
"post": con,
|
||||
})
|
||||
}
|
||||
|
@ -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,
|
||||
})
|
||||
}
|
||||
|
@ -1,11 +1,13 @@
|
||||
<div class="bar">
|
||||
<h1 class="logo">MatterLinux</h1>
|
||||
<div class="links">
|
||||
<div class="links" id="links">
|
||||
<a href="/">Home</a>
|
||||
<a href="/news">News</a>
|
||||
<a href="/wiki">Wiki</a>
|
||||
<a href="https://git.matterlinux.xyz/Matter">Source</a>
|
||||
<a href="https://tracker.matterlinux.xyz">Packages</a>
|
||||
<a href="https://security.matterlinux.xyz">Security</a>
|
||||
<a href="/download">Download</a>
|
||||
</div>
|
||||
<script src="/bar.js"></script>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user