From a37496a90e3ce7431b691e70eeb727d2db108ac3 Mon Sep 17 00:00:00 2001 From: adityatelange Date: Sat, 16 Jan 2021 07:57:35 +0000 Subject: [PATCH] deploy: 8222f2bd113dfef5a10f1bbdbc2d66dc9a36e1d1 --- ...d697d3ff7c83a5d2d91365b1bbf12a3320eba5ab5728f54d72ba6.js} | 5 +++-- fr/search/index.html | 2 +- search/index.html | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) rename assets/js/{search.min.a7aeaa5cf0049fa909d697d27b866f2885af48d7568415ef296894a5a2f82e49.js => search.min.07b7414987cd697d3ff7c83a5d2d91365b1bbf12a3320eba5ab5728f54d72ba6.js} (98%) diff --git a/assets/js/search.min.a7aeaa5cf0049fa909d697d27b866f2885af48d7568415ef296894a5a2f82e49.js b/assets/js/search.min.07b7414987cd697d3ff7c83a5d2d91365b1bbf12a3320eba5ab5728f54d72ba6.js similarity index 98% rename from assets/js/search.min.a7aeaa5cf0049fa909d697d27b866f2885af48d7568415ef296894a5a2f82e49.js rename to assets/js/search.min.07b7414987cd697d3ff7c83a5d2d91365b1bbf12a3320eba5ab5728f54d72ba6.js index 38e94472..619603ef 100644 --- a/assets/js/search.min.a7aeaa5cf0049fa909d697d27b866f2885af48d7568415ef296894a5a2f82e49.js +++ b/assets/js/search.min.07b7414987cd697d3ff7c83a5d2d91365b1bbf12a3320eba5ab5728f54d72ba6.js @@ -151,7 +151,8 @@ return Fuse;})));;var fuse;var resList=document.getElementById('searchResults'); var resultsAvailable=false;function loadSearch(){var xhr=new XMLHttpRequest();xhr.onreadystatechange=function(){if(xhr.readyState===4){if(xhr.status===200){var data=JSON.parse(xhr.responseText);if(data){var options={isCaseSensitive:false,shouldSort:true,location:0,distance:100,threshold:0.4,minMatchCharLength:0,keys:['title','permalink','summary','content']};fuse=new Fuse(data,options);}}else{console.log(xhr.responseText);}}};xhr.open('GET',"../index.json");xhr.send();} function itemGen(name,link){return `
  • ${name} »
  • `} function activeToggle(){document.activeElement.parentElement.classList.toggle("active")} -document.getElementById("searchInput").onkeyup=function(e){const results=fuse.search(this.value);if(results.length!==0){let resultSet='';for(let item in results){resultSet=resultSet+itemGen(results[item].item.title,results[item].item.permalink)} +sInput.onkeyup=function(e){const results=fuse.search(this.value);if(results.length!==0){let resultSet='';for(let item in results){resultSet=resultSet+itemGen(results[item].item.title,results[item].item.permalink)} document.getElementById("searchResults").innerHTML=resultSet;resultsAvailable=true;first=resList.firstChild;last=resList.lastChild;}else{resultsAvailable=false;document.getElementById("searchResults").innerHTML='';}} document.onkeydown=function(e){let key=e.key;let ae=document.activeElement;let inbox=document.getElementById("searchbox").contains(ae) -if(key==="ArrowDown"&&resultsAvailable&&inbox){e.preventDefault();if(ae==sInput){activeToggle();resList.firstChild.lastChild.focus();activeToggle();}else if(ae.parentElement==last){}else{activeToggle();ae.parentElement.nextSibling.lastChild.focus();activeToggle();}}else if(key==="ArrowUp"&&resultsAvailable&&inbox){e.preventDefault();if(ae==sInput){}else if(ae.parentElement==first){activeToggle();sInput.focus();}else{activeToggle();ae.parentElement.previousSibling.lastChild.focus();activeToggle();}}else if(key==="ArrowRight"&&resultsAvailable&&inbox){ae.click();}else if(key==="Escape"){resultsAvailable=false;document.getElementById("searchResults").innerHTML=sInput.value='';sInput.focus();}} \ No newline at end of file +if(ae===sInput){var elements=document.getElementsByClassName('active');while(elements.length>0){elements[0].classList.remove('active');}} +if(key==="ArrowDown"&&resultsAvailable&&inbox){e.preventDefault();if(ae==sInput){activeToggle();resList.firstChild.lastChild.focus();activeToggle();}else if(ae.parentElement==last){}else{activeToggle();ae.parentElement.nextSibling.lastChild.focus();activeToggle();}}else if(key==="ArrowUp"&&resultsAvailable&&inbox){e.preventDefault();if(ae==sInput){}else if(ae.parentElement==first){activeToggle();sInput.focus();}else{activeToggle();ae.parentElement.previousSibling.lastChild.focus();activeToggle();}}else if(key==="ArrowRight"&&resultsAvailable&&inbox){ae.click();}else if(key==="Escape"){resultsAvailable=false;resList.innerHTML=sInput.value='';sInput.focus();}} \ No newline at end of file diff --git a/fr/search/index.html b/fr/search/index.html index e1414d78..92b41342 100644 --- a/fr/search/index.html +++ b/fr/search/index.html @@ -1,4 +1,4 @@ -SearchL2 | PaperModL2