forked from TrueCloudLab/dot-hugo
Merge pull request #181 from seiyria/patch-1
add autocomplete filtering on label AND value
This commit is contained in:
commit
c643719b46
1 changed files with 7 additions and 0 deletions
|
@ -19,6 +19,13 @@
|
|||
{{ $currentNode := . }} {{ $currentNode.Scratch.Set "pages" .Site.Pages
|
||||
}} {{ $pages := ($currentNode.Scratch.Get "pages") }}
|
||||
<script>
|
||||
$.ui.autocomplete.filter = function (array, term) {
|
||||
var matcher = new RegExp('(^| )' + $.ui.autocomplete.escapeRegex(term), 'i');
|
||||
return $.grep(array, function (value) {
|
||||
return matcher.test(value.label) || matcher.test(value.value) || matcher.test(value);
|
||||
});
|
||||
};
|
||||
|
||||
$(function() {
|
||||
var projects = [
|
||||
{{ range $pages }}
|
||||
|
|
Loading…
Reference in a new issue