sshmon/views/partials/navbar.ejs

52 lines
1.4 KiB
Plaintext
Raw Normal View History

2022-08-18 08:57:58 +00:00
<style>
.topnav {
background-color: #333;
overflow: hidden;
}
.topnav a {
float: left;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
.topnav a.hoverable:hover {
background-color: #ddd;
color: black;
}
.topnav a.active {
background-color: #04AA6D;
color: white;
}
.topnav a.right {
float: right;
}
.topnav a.no-pointer {
cursor: default;
}
</style>
<script>
function clock() {
const x = new Date();
document.getElementById("topbar_clock").innerHTML = String(x.getHours()).padStart(2, '0') + ":" + String(x.getMinutes()).padStart(2, '0') + ":" + String(x.getSeconds()).padStart(2, '0');
}
setInterval(clock, 100);
</script>
<div class="topnav">
<a class="no-pointer" id="topbar_clock" href="#">12:00:00</a>
<a class="hoverable<% if(activeLink === "home") { %> active<% } %>" id="topnav_home" href="/">Home</a>
<% if(!loggedIn) { %>
<a class="hoverable right<% if(activeLink === "login") { %> active<% } %>" id="topnav_login" href="/login">Login</a>
<a class="hoverable right<% if(activeLink === "register") { %> active<% } %>" id="topnav_register" href="/register">Register</a>
<% } else { %>
<a class="hoverable right" id="topnav_logout" href="/logout">Log out</a>
<a class="hoverable right" id="topnav_user" href="#"><%- username %></a>
<% } %>
</div>