diff options
Diffstat (limited to 'exampleSite/resources/_gen/assets/js')
-rw-r--r-- | exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.content | 6 | ||||
-rw-r--r-- | exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.json | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.content b/exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.content new file mode 100644 index 0000000..9c34794 --- /dev/null +++ b/exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.content @@ -0,0 +1,6 @@ +addEventListener("load",function(){let input=document.querySelector("#book-search");let results=document.querySelector("#book-search-results");Promise.all([loadScript("/example/lunr.min.js"),loadScript("/example/index.json")]).then(enableLunr);function enableLunr(){results.idx=lunr(function(){this.ref('href') +this.field('title') +this.field('content') +window.lunrData.forEach(function(page){this.add(page)},this)});input.addEventListener("keyup",search);} +function search(){if(input.value){var hits=results.idx.search(`${input.value}*`);results.innerHTML=JSON.stringify(hits);}else{results.innerHTML='';}} +function loadScript(src){return new Promise(function(resolve,reject){let script=document.createElement('script');script.src=src;script.onload=()=>resolve(script);document.head.append(script);});}});
\ No newline at end of file diff --git a/exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.json b/exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.json new file mode 100644 index 0000000..0c68ef7 --- /dev/null +++ b/exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.json @@ -0,0 +1 @@ +{"Target":"search.min.f37565c4baa28364f7b8e1e53c35bdb0ab92f2215165bd3f083f3f4f1ae78c71.js","MediaType":"application/javascript","Data":{"Integrity":"sha256-83VlxLqig2T3uOHlPDW9sKuS8iFRZb0/CD8/TxrnjHE="}}
\ No newline at end of file |