mirror of
https://github.com/DerTyp7/shop-ejs-expressjs.git
synced 2025-10-29 20:42:10 +01:00
38 lines
1.4 KiB
Plaintext
38 lines
1.4 KiB
Plaintext
<div class="headerDIV">
|
|
<div class="headerDIVLogo">
|
|
<img style="cursor:pointer" onclick="window.open('/', '_self')" src="/images/logo.png">
|
|
</div>
|
|
|
|
<div class="headerDIVSearch">
|
|
<input placeholder="Suche" class="vertical-center" id="searchbar" value="<%=typeof search !== 'undefined' ? search : '' %>"></input>
|
|
<button class="vertical-center" onclick="doSearch()"><i class="material-icons">search</i></button>
|
|
</div>
|
|
|
|
<div class="headerDIVUser">
|
|
<% if(user){ %>
|
|
<button class="vertical-center" id="headerBtnLogout" onclick="window.open('/logout', '_self')">Log out</button>
|
|
<button class="vertical-center" onclick="window.open('/account', '_self')">Ihr Konto</button>
|
|
<%} else{%>
|
|
<button class="vertical-center" onclick="window.open('/register', '_self')">Registrieren</button>
|
|
<button class="vertical-center" onclick="window.open('/login', '_self')">Login</button>
|
|
<% } %>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script>
|
|
var input = document.getElementById("searchbar");
|
|
input.addEventListener("keyup", function(event) {
|
|
if (event.keyCode === 13) {
|
|
event.preventDefault();
|
|
doSearch();
|
|
}
|
|
});
|
|
|
|
function doSearch() {
|
|
var val = input.value.trim()
|
|
if (val) {
|
|
window.open('/search/'+val, '_self')
|
|
}
|
|
}
|
|
</script> |