2017-09-29 12:40:02 -07:00
|
|
|
<div class="row-wide nav-bar">
|
|
|
|
<div class="nav-bar-title-section">
|
2017-09-29 14:11:00 -07:00
|
|
|
<a href="/"><span class="nav-bar-title">spee<h</span></a><span class="nav-bar-title nav-bar-title--superscript">(beta)</span>
|
2017-10-09 10:30:19 -07:00
|
|
|
<span class="nav-bar-subtitle">Open-source, decentralized image and video hosting.</span>
|
2017-09-29 12:40:02 -07:00
|
|
|
<div class="nav-bar-link-section">
|
2017-10-02 16:23:09 -07:00
|
|
|
<a class="nav-bar-link" href="/">Upload</a>
|
2017-09-29 14:11:00 -07:00
|
|
|
<a class="nav-bar-link" href="/popular">Popular</a>
|
|
|
|
<a class="nav-bar-link" href="/about">About</a>
|
2017-10-09 18:29:40 -07:00
|
|
|
{{#if user}}
|
2017-10-10 16:00:08 -07:00
|
|
|
<select type="text" id="nav-bar-channel-select" class="select select--no-arrow nav-bar-link" onchange="toggleLogin(event.target.selectedOptions[0].value)">
|
|
|
|
<option id="nav-bar-channel-select-channel-option">@{{user.userName}}</option>
|
|
|
|
<option value="VIEW">View</option>
|
|
|
|
<option value="LOGOUT">Logout</option>
|
2017-10-09 18:29:40 -07:00
|
|
|
</select>
|
|
|
|
{{else}}
|
|
|
|
<a class="nav-bar-link" href="/login">Login</a>
|
|
|
|
{{/if}}
|
2017-09-29 12:40:02 -07:00
|
|
|
</div>
|
2017-09-29 11:59:53 -07:00
|
|
|
</div>
|
2017-09-29 12:40:02 -07:00
|
|
|
|
|
|
|
|
2017-09-26 15:12:47 -07:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
2017-10-10 16:00:08 -07:00
|
|
|
function toggleLogin (value) {
|
|
|
|
const selectedOption = value;
|
|
|
|
if (selectedOption === 'LOGOUT') {
|
2017-10-06 16:42:19 -07:00
|
|
|
console.log('log out');
|
|
|
|
// remove session cookies
|
2017-10-10 16:00:08 -07:00
|
|
|
clearCookies();
|
2017-10-06 16:42:19 -07:00
|
|
|
// send logout request to server
|
2017-09-26 15:12:47 -07:00
|
|
|
window.location.href = '/logout';
|
2017-10-10 16:00:08 -07:00
|
|
|
} else if (selectedOption === 'VIEW') {
|
2017-09-26 15:12:47 -07:00
|
|
|
console.log('view channel');
|
2017-10-10 16:00:08 -07:00
|
|
|
// get channel info
|
|
|
|
const channelName = getCookie('channel_name');
|
|
|
|
const channelClaimId = getCookie('channel_claim_id');
|
|
|
|
// redirect to channel page
|
|
|
|
window.location.href = `/${channelName}:${channelClaimId}`;
|
2017-10-02 16:23:09 -07:00
|
|
|
}
|
|
|
|
}
|
2017-09-26 15:12:47 -07:00
|
|
|
</script>
|