42 lines
No EOL
1.8 KiB
Handlebars
42 lines
No EOL
1.8 KiB
Handlebars
<div class="row-wide nav-bar">
|
|
<div class="nav-bar-title-section">
|
|
<a href="/"><span class="nav-bar-title">spee<h</span></a><span class="nav-bar-title nav-bar-title--superscript">(beta)</span>
|
|
<span class="nav-bar-subtitle">Open-source, decentralized image and video hosting.</span>
|
|
<div class="nav-bar-link-section">
|
|
<a class="nav-bar-link" href="/">Upload</a>
|
|
<a class="nav-bar-link" href="/popular">Popular</a>
|
|
<a class="nav-bar-link" href="/about">About</a>
|
|
{{#if user}}
|
|
<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>
|
|
</select>
|
|
{{else}}
|
|
<a class="nav-bar-link" href="/login">Login</a>
|
|
{{/if}}
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
function toggleLogin (value) {
|
|
const selectedOption = value;
|
|
if (selectedOption === 'LOGOUT') {
|
|
console.log('log out');
|
|
// remove session cookies
|
|
clearCookies();
|
|
// send logout request to server
|
|
window.location.href = '/logout';
|
|
} else if (selectedOption === 'VIEW') {
|
|
console.log('view channel');
|
|
// get channel info
|
|
const channelName = getCookie('channel_name');
|
|
const channelClaimId = getCookie('channel_claim_id');
|
|
// redirect to channel page
|
|
window.location.href = `/${channelName}:${channelClaimId}`;
|
|
}
|
|
}
|
|
</script> |