diff options
Diffstat (limited to 'assets')
| -rw-r--r-- | assets/js/fastsearch.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/assets/js/fastsearch.js b/assets/js/fastsearch.js index 2546310..4b9fdb6 100644 --- a/assets/js/fastsearch.js +++ b/assets/js/fastsearch.js @@ -1,11 +1,13 @@ +import * as params from '@params'; + var fuse; // holds our search engine var resList = document.getElementById('searchResults'); var sInput = document.getElementById('searchInput'); var first, last = null var resultsAvailable = false; -// load our search index, only executed onload -function loadSearch() { +// load our search index +window.onload = function () { var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState === 4) { @@ -24,7 +26,7 @@ function loadSearch() { 'content' ] }; - {{ if . }}options = {{ jsonify . }}{{ end }} // load custom options from .Site.Params.fuseOpts + if (params.fuseOpts) options = params.fuseOpts; fuse = new Fuse(data, options); // build the index from the json file } } else { |
