blog/themes/ficurinia/layouts/partials/searchbar.html

13 lines
405 B
HTML
Raw Normal View History

2023-04-29 14:12:36 +00:00
<div class="search">
<input id="searchbar" type="text" placeholder='{{ i18n "searchbarTxt" }}' />
<a class="nerdlink" onclick="newSearch();">&#xf002;</a>
</div>
<script>
function newSearch() {
let term = searchbar.value.trim();
if (!term) return;
location.href = `/search?q=${term}`;
}
searchbar.onkeyup = (ev) => {if (ev.keyCode == 13) newSearch()};
</script>