Searches now automatically match parts of field values, and the search field has autofocus

This commit is contained in:
Erik Thuning 2019-06-12 11:09:03 +02:00
parent 97d483524a
commit 8485264714
2 changed files with 3 additions and 2 deletions

@ -624,7 +624,8 @@
onKeyPress="JavaScript:searchInput(event)" onKeyPress="JavaScript:searchInput(event)"
name="q" name="q"
placeholder="Vad letar du efter?" placeholder="Vad letar du efter?"
value="" /> value=""
autofocus />
<button type="submit"> <button type="submit">
Sök Sök
</button> </button>

@ -224,7 +224,7 @@ function match($testvalues, $matchvalues) {
} }
foreach($testvalues as $value) { foreach($testvalues as $value) {
foreach($matchvalues as $candidate) { foreach($matchvalues as $candidate) {
if(fnmatch($value, $candidate, FNM_CASEFOLD)) { if(fnmatch('*'.$value.'*', $candidate, FNM_CASEFOLD)) {
return true; return true;
} }
} }