diff options
Diffstat (limited to 'exampleSite/resources/_gen/assets/js')
-rw-r--r-- | exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.content | 7 | ||||
-rw-r--r-- | exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.json | 2 |
2 files changed, 4 insertions, 5 deletions
diff --git a/exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.content b/exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.content index ed4cac1..93b9de9 100644 --- a/exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.content +++ b/exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.content @@ -1,6 +1,5 @@ -(function(){const input=document.querySelector("#book-search-input");const results=document.querySelector("#book-search-results");const dummy=document.querySelector("#book-search-dummy");input.addEventListener("focus",init);input.addEventListener("keyup",search);function init(){loadScript("/example/lunr.min.js") -loadScript("/example/search-data.min.34183091f91a205581bbdcc247f638b72d22f51e34ab573b24519f95c4a92895.js",function(){input.readOnly=false;search();});input.removeEventListener("focus",init);} +(function(){const input=document.querySelector("#book-search-input");const results=document.querySelector("#book-search-results");input.addEventListener("focus",init);input.addEventListener("keyup",search);function init(){input.removeEventListener("focus",init);input.required=true;loadScript("/example/lunr.min.js");loadScript("/example/search-data.min.34183091f91a205581bbdcc247f638b72d22f51e34ab573b24519f95c4a92895.js",function(){input.readOnly=false;input.required=false;search();});} function search(){while(results.firstChild){results.removeChild(results.firstChild);} -if(!input.value||!window.bookSearch){return} -const terms=lunr.tokenizer(input.value);const searchHits=window.bookSearch.idx.query(function(query){query.term(terms,{boost:100,});query.term(terms,{boost:10,wildcard:lunr.Query.wildcard.LEADING|lunr.Query.wildcard.TRAILING,});query.term(terms,{editDistance:2});});searchHits.slice(0,10).forEach(function(hit){const page=window.bookSearch.pages[hit.ref];const li=dummy.querySelector("li").cloneNode(true),a=li.querySelector("a");a.href=page.href;a.textContent=page.title;results.appendChild(li);});} +if(!input.value){return;} +const terms=lunr.tokenizer(input.value);const searchHits=window.bookSearch.idx.query(function(query){query.term(terms,{boost:100});query.term(terms,{boost:10,wildcard:lunr.Query.wildcard.LEADING|lunr.Query.wildcard.TRAILING});query.term(terms,{editDistance:2});});searchHits.slice(0,10).forEach(function(hit){const page=window.bookSearch.pages[hit.ref];const li=document.createElement("li"),a=li.appendChild(document.createElement("a"));a.href=page.href;a.textContent=page.title;results.appendChild(li);});} function loadScript(src,callback){const script=document.createElement("script");script.defer=true;script.src=src;script.onload=callback;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 index 49b83ed..28c24e1 100644 --- a/exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.json +++ b/exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.json @@ -1 +1 @@ -{"Target":"search.min.be0d747115d15ef35d8cd20b07815450b1c3d2b84c58ba4a9f35dfff3f786384.js","MediaType":"application/javascript","Data":{"Integrity":"sha256-vg10cRXRXvNdjNILB4FUULHD0rhMWLpKnzXf/z94Y4Q="}}
\ No newline at end of file +{"Target":"search.min.ea6096df2339354acbfe0aec0b99caded625821549e54c3b140a20f57db99984.js","MediaType":"application/javascript","Data":{"Integrity":"sha256-6mCW3yM5NUrL/grsC5nK3tYlghVJ5Uw7FAog9X25mYQ="}}
\ No newline at end of file |