spee.ch/views/partials/navBar.handlebars

32 lines
1.7 KiB
Handlebars
Raw Normal View History

2017-10-23 22:07:05 +02:00
<div class="row row--wide nav-bar">
2017-10-24 22:39:06 +02:00
<div class="nav-bar-title-section row row--padded row--short">
2017-10-21 01:08:08 +02:00
<div class="nav-bar-title">
<a href="/"><img class="nav-bar-logo" src="/assets/img/logo.gif" alt="spee.ch"/></a>
<span class="nav-bar-title nav-bar-title--tagline">Open-source, decentralized image and video sharing.</span>
</div>
2017-09-29 21:40:02 +02:00
<div class="nav-bar-link-section">
2017-10-18 22:54:42 +02:00
<a class="nav-bar-link" href="/">Upload</a>
2017-09-29 23:11:00 +02:00
<a class="nav-bar-link" href="/popular">Popular</a>
<a class="nav-bar-link" href="/about">About</a>
2017-10-11 01:51:07 +02:00
<select type="text" id="nav-bar-channel-select" class="select select--no-arrow nav-bar-link" onchange="toggleNavBarSelection(event.target.selectedOptions[0].value)" {{#unless user}}style="display:none"{{/unless}}>
<option id="nav-bar-channel-select-channel-option">@{{user.userName}}</option>
<option value="VIEW">View</option>
<option value="LOGOUT">Logout</option>
</select>
<a id="nav-bar-login-link" class="nav-bar-link" href="/login" {{#if user}}style="display:none"{{/if}}>Channel</a>
2017-09-29 21:40:02 +02:00
</div>
2017-09-29 20:59:53 +02:00
</div>
</div>
<script type="text/javascript">
// highlight the link for the current page
const navBarLinks = document.getElementsByClassName('nav-bar-link');
for (let i = 0; i < navBarLinks.length; i++){
const link = navBarLinks[i];
if (link.href == window.location.href) {
link.setAttribute('class', 'nav-bar-link nav-bar-link--active');
} else if (`/${link.value}` === window.location.pathname) {
link.setAttribute('class', 'select select--no-arrow nav-bar-link nav-bar-link--active');
}
}
</script>