diff options
author | uvok cheetah | 2020-05-23 15:45:33 +0200 |
---|---|---|
committer | uvok cheetah | 2020-05-23 15:45:33 +0200 |
commit | 40669b1fd8ff2fcf9270adcdc97fb6fc13b4139e (patch) | |
tree | 1681e343a5a60b44c25f39699843de2009ce32c8 /search.html | |
parent | 0150a1151cce7e278284667c11ad2e5e97a7f13d (diff) |
Reformat code
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> |