diff options
Diffstat (limited to 'layouts/partials/search-form.html')
-rw-r--r-- | layouts/partials/search-form.html | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/layouts/partials/search-form.html b/layouts/partials/search-form.html new file mode 100644 index 0000000..2e6fc95 --- /dev/null +++ b/layouts/partials/search-form.html @@ -0,0 +1,19 @@ +<script> + function check_search() { + var s = document.getElementById('_display_keyword').value; + s = s.replace(/(^\s*)|(\s*$)/g, ''); + if (s == '' || s == undefined || s == null) { + document.getElementById('_display_keyword').focus(); + return false; + } + document.getElementById('{{ .key }}').value = s + " site:{{ site.BaseURL }}"; + return true; + } +</script> +<form class="search" action="{{ .url }}" target="_blank" onsubmit="return check_search()"> + <input id="_display_keyword" type="text" placeholder="Search.." name="keyword"> + <input id="{{ .key }}" type="hidden" name="{{ .key }}"> + <button type="submit"><svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="width:20px;height:20px;color:#333"> + <path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> + </svg></button> +</form> |