diff options
Diffstat (limited to 'search.html')
-rw-r--r-- | search.html | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/search.html b/search.html index 38f17b3..1ec7433 100644 --- a/search.html +++ b/search.html @@ -40,30 +40,30 @@ layout: page <script> // search function query(queryterm) { - var result = idx.search(queryterm); - const rbase = document.getElementById("results") - rbase.textContent = ""; - if(result.length) { - var root = rbase.appendChild(document.createElement("ul")); - result.forEach(r => { - const p = pages.find(p => p.id == r.ref); - var li = document.createElement("li") - var el = li.appendChild(document.createElement("a")); - el.textContent = p.title; - el.href = p.url; - el = li.appendChild(document.createElement("span")); - el.textContent = " [score: " + r.score.toString() + "]"; - root.appendChild(li); - }); - } else { - var el = document.createElement("p"); - el.textContent = "No results"; - rbase.appendChild(el); - } - document.getElementById("qterm").textContent = queryterm; + var result = idx.search(queryterm); + const rbase = document.getElementById("results") + rbase.textContent = ""; + if (result.length) { + var root = rbase.appendChild(document.createElement("ul")); + result.forEach(r => { + const p = pages.find(p => p.id == r.ref); + var li = document.createElement("li") + var el = li.appendChild(document.createElement("a")); + el.textContent = p.title; + el.href = p.url; + el = li.appendChild(document.createElement("span")); + el.textContent = " [score: " + r.score.toString() + "]"; + root.appendChild(li); + }); + } else { + var el = document.createElement("p"); + el.textContent = "No results"; + rbase.appendChild(el); + } + document.getElementById("qterm").textContent = queryterm; }; const qbox = document.getElementById("input_qterm"); document.getElementById("qsubmit").onclick = ev => { - alert(qbox.value); + alert(qbox.value); }; </script> |