grav-theme-disrootblog/templates/partials/simplesearch_searchbox.html...

16 lines
567 B
Twig

<form class="search-form">
<input type="search" placeholder="Search..." value="{{ query }}" data-search-input="{{ base_url }}{{ config.plugins.simplesearch.route}}/query" name="s" id="s"/>
</form>
<script>
jQuery(document).ready(function($){
var input = $('[data-search-input]');
input.on('keypress', function(event) {
if (event.which == 13 && input.val().length > 3) {
event.preventDefault();
window.location.href = input.data('search-input') + '{{ config.system.param_sep }}' + input.val();
}
});
});
</script>