2017-09-29 21:40:02 +02:00
|
|
|
<div class="row-wide nav-bar">
|
|
|
|
<div class="nav-bar-title-section">
|
2017-09-29 23:11:00 +02:00
|
|
|
<a href="/"><span class="nav-bar-title">spee<h</span></a><span class="nav-bar-title nav-bar-title--superscript">(beta)</span>
|
2017-09-29 21:40:02 +02:00
|
|
|
<div class="nav-bar-link-section">
|
2017-10-03 01:23:09 +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-06 20:18:51 +02:00
|
|
|
<!--{{#if user}}-->
|
|
|
|
<!--<select type="text" class="select select--no-arrow nav-bar-link" onchange="toggleLogin(event)">-->
|
|
|
|
<!--<option value="{{user.channelName}}:{{user.channelClaimId}}">@{{user.userName}}</option>-->
|
|
|
|
<!--<option value="view">View</option>-->
|
|
|
|
<!--<option value="logout">Logout</option>-->
|
|
|
|
<!--</select>-->
|
|
|
|
<!--{{else}}-->
|
|
|
|
<!--<a class="nav-bar-link" href="/login">Login</a>-->
|
|
|
|
<!--{{/if}}-->
|
2017-09-29 21:40:02 +02:00
|
|
|
</div>
|
2017-09-29 20:59:53 +02:00
|
|
|
</div>
|
2017-09-29 21:40:02 +02:00
|
|
|
|
|
|
|
|
2017-09-27 00:12:47 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
function toggleLogin (event) {
|
|
|
|
console.log(event);
|
|
|
|
const selectedOption = event.target.selectedOptions[0].value;
|
|
|
|
if (selectedOption === 'logout') {
|
2017-10-07 01:42:19 +02:00
|
|
|
console.log('log out');
|
|
|
|
// remove session cookies
|
|
|
|
|
|
|
|
// send logout request to server
|
2017-09-27 00:12:47 +02:00
|
|
|
window.location.href = '/logout';
|
|
|
|
} else if (selectedOption === 'view') {
|
|
|
|
console.log('view channel');
|
|
|
|
window.location.href = '/{{user.channelName}}:{{user.channelClaimId}}';
|
|
|
|
}
|
|
|
|
}
|
2017-10-03 01:23:09 +02:00
|
|
|
// 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');
|
|
|
|
}
|
|
|
|
}
|
2017-09-27 00:12:47 +02:00
|
|
|
</script>
|