From 1e811290906221448a8b018f477edcd2d87c67a2 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Mon, 26 Dec 2016 15:35:02 -0500 Subject: [PATCH] add search by hash --- contrib/static/search.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/contrib/static/search.js b/contrib/static/search.js index 7240822..ca8edb3 100644 --- a/contrib/static/search.js +++ b/contrib/static/search.js @@ -6,6 +6,7 @@ function inject_search(elem) { var inner = document.createElement("div"); inner.setAttribute("class", "search-navbar"); + var hash = document.createElement("input"); var button = document.createElement("button"); var input = document.createElement("input"); var newsgroup = document.createElement("input"); @@ -57,7 +58,12 @@ function inject_search(elem) { status.innerHTML = "searching... "; } }; - ajax.open("GET", "/api/find?text="+text+"&group="+group); + var h = hash.value; + if (!h) { + ajax.open("GET", "/api/find?text="+text+"&group="+group); + } else { + ajax.open("GET", "/api/find?hash="+h); + } ajax.send(); }; @@ -79,6 +85,8 @@ function inject_search(elem) { inner.appendChild(input); inner.appendChild(document.createTextNode("board: ")); inner.appendChild(newsgroup); + inner.appendChild(document.createTextNode("posthash: ")) + inner.appendChild(hash); inner.appendChild(button); inner.appendChild(status);