1
0
Fork 0
mirror of https://github.com/sileht/bird-lg.git synced 2024-11-21 22:44:43 +01:00

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.
This commit is contained in:
Ryan Balandran 2020-11-17 16:32:04 -06:00 committed by zorun
parent 30add2e41b
commit c83e4842e9

View file

@ -1,4 +1,4 @@
const noArgReqs = ["summary"];
$(window).unload(function(){ $(window).unload(function(){
$(".progress").show() $(".progress").show()
@ -12,7 +12,7 @@ function change_url(loc){
function reload(){ function reload(){
loc = "/" + request_type + "/" + hosts + "/" + proto; loc = "/" + request_type + "/" + hosts + "/" + proto;
if (request_type != "summary" ){ if (!noArgReqs.includes(request_type)){
if( request_args != undefined && request_args != ""){ if( request_args != undefined && request_args != ""){
loc = loc + "?q=" + encodeURIComponent(request_args); loc = loc + "?q=" + encodeURIComponent(request_args);
change_url(loc) change_url(loc)
@ -22,7 +22,7 @@ function reload(){
} }
} }
function update_view(){ function update_view(){
if (request_type == "summary") if (noArgReqs.includes(request_type))
$(".navbar-search").hide(); $(".navbar-search").hide();
else else
$(".navbar-search").show(); $(".navbar-search").show();