diff --git a/ArchiveState.go b/ArchiveState.go index 7d8c364..248aa67 100644 --- a/ArchiveState.go +++ b/ArchiveState.go @@ -317,7 +317,7 @@ func (this *ArchiveState) renderTemplateHead(w http.ResponseWriter) { -
+ diff --git a/static/archive.js b/static/archive.js index 5c5e9b0..931f751 100755 --- a/static/archive.js +++ b/static/archive.js @@ -97,10 +97,29 @@ function onLoad() { highlightLine( parseInt(document.location.hash.substr(6), 10) ); } - // + // fontSize(0); + // + + var $form = document.getElementById("search-form"); + $form.addEventListener("submit", function(ev) { + var query = $form.elements["q"].value; + if (query.length === 0) { + alert("No search text entered"); + ev.preventDefault(); + return false; + } + + var prefix = ($form.elements["rx"].checked ? "/rx/" : "/search/"); + window.location.hash = ""; + window.location.pathname = "/" + $form.elements["h"].value + prefix + encodeURIComponent(query); + + ev.preventDefault(); + return false; + }); + } window.addEventListener('load', onLoad);