diff --git a/controllers/search_handler.go b/controllers/search_handler.go index 7a27e553..fffab02e 100644 --- a/controllers/search_handler.go +++ b/controllers/search_handler.go @@ -56,7 +56,7 @@ func SearchHandler(c *gin.Context) { searchForm := newSearchForm(c) searchForm.TorrentParam, searchForm.Category = searchParam, category - if c.Request.URL.Path == "/" { + if c.Query("refine") == "" { searchForm.ShowRefine = false } diff --git a/public/js/main.js b/public/js/main.js index 6794a159..43eacc6d 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -86,10 +86,15 @@ function playVoice() { } } + +var refine_button = document.getElementsByClassName("box refine")[0]; +refine_button.type = "button"; function toggleRefine() { - var refine_form = document.getElementsByClassName("box refine")[0]; - refine_form.type = "button"; - if(refine_form != "undefined") refine.style.display = refine.style.display == "none" ? "block" : "none"; + if(refine_button != "undefined") { + refine_button.style.display = refine_button.style.display == "none" ? "block" : "none"; + if(document.getElementsByClassName("form-input refine-searchbox")[0].value == "") + document.getElementsByClassName("form-input refine-searchbox")[0].value = document.getElementsByClassName("form-input search-box")[0].value; + } else document.getElementById("header-form").submit(); } // @license-end diff --git a/templates/layouts/partials/helpers/search.jet.html b/templates/layouts/partials/helpers/search.jet.html index fc2b9b3e..4eaa1b95 100644 --- a/templates/layouts/partials/helpers/search.jet.html +++ b/templates/layouts/partials/helpers/search.jet.html @@ -17,8 +17,8 @@