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
|
{{ $currentNode := . }} {{ $currentNode.Scratch.Set "pages" .Site.Pages
|
||||||
}} {{ $pages := ($currentNode.Scratch.Get "pages") }}
|
}} {{ $pages := ($currentNode.Scratch.Get "pages") }}
|
||||||
<script>
|
<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() {
|
$(function() {
|
||||||
var projects = [
|
var projects = [
|
||||||
{{ range $pages }}
|
{{ range $pages }}
|
||||||
|
|
Loading…
Reference in a new issue