From 6f8862b631a0e099c1a094b423ce1d54676c85d7 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Mon, 26 Dec 2016 11:48:00 -0500 Subject: [PATCH] fix --- contrib/static/search.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/contrib/static/search.js b/contrib/static/search.js index 8f84ae2..4d53245 100644 --- a/contrib/static/search.js +++ b/contrib/static/search.js @@ -14,6 +14,7 @@ function inject_search(elem) { button.innerHTML = "search"; function inject_search_result(r) { + if(!r)return; var e = document.createElement("div"); var a = document.createElement("a"); a.href = r.URL; @@ -63,11 +64,13 @@ function inject_search(elem) { }; input.onsubmit = function(ev) { - search(); + if (ev.keyCode == 13) + search(); }; - newsgroup.onsubmit = function(ev) { - search(); + newsgroup.onkeydown = function(ev) { + if (ev.keyCode == 13) + search(); }; inner.appendChild(document.createTextNode("text: "));