From c83e4842e96a6a6de1c5b8445a116fa7aab95ecf Mon Sep 17 00:00:00 2001 From: Ryan Balandran Date: Tue, 17 Nov 2020 16:32:04 -0600 Subject: [PATCH] Generalize requests without arguments in JS This commit adds a list of request types that do not have parameters. These reqeusts are handled different by the JS code, and the list makes it easier to add new custom commands that do not have arguments. --- static/js/lg.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/static/js/lg.js b/static/js/lg.js index 1a8b496..26de696 100644 --- a/static/js/lg.js +++ b/static/js/lg.js @@ -1,4 +1,4 @@ - +const noArgReqs = ["summary"]; $(window).unload(function(){ $(".progress").show() @@ -12,7 +12,7 @@ function change_url(loc){ function reload(){ loc = "/" + request_type + "/" + hosts + "/" + proto; - if (request_type != "summary" ){ + if (!noArgReqs.includes(request_type)){ if( request_args != undefined && request_args != ""){ loc = loc + "?q=" + encodeURIComponent(request_args); change_url(loc) @@ -22,7 +22,7 @@ function reload(){ } } function update_view(){ - if (request_type == "summary") + if (noArgReqs.includes(request_type)) $(".navbar-search").hide(); else $(".navbar-search").show();