From 3ebf766240f91ef2a44298504449bf8c1d22a76a Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 22 Jul 2019 21:43:12 +0200 Subject: [PATCH] Simplify add() in list.js. Signed-off-by: DL6ER --- scripts/pi-hole/js/list.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/scripts/pi-hole/js/list.js b/scripts/pi-hole/js/list.js index 8545de5b..3feb24fc 100644 --- a/scripts/pi-hole/js/list.js +++ b/scripts/pi-hole/js/list.js @@ -151,16 +151,11 @@ function sub(index, entry, arg) { }); } -function add(arg) { - var locallistType = listType; +function add(type) { var domain = $("#domain"); if(domain.val().length === 0){ return; } - if(arg === "wild") - { - locallistType = listType+"_wild"; - } var alInfo = $("#alInfo"); var alSuccess = $("#alSuccess"); @@ -175,7 +170,7 @@ function add(arg) { $.ajax({ url: "scripts/pi-hole/php/add.php", method: "post", - data: {"domain":domain.val().trim(), "list":locallistType, "token":token}, + data: {"domain":domain.val().trim(), "list":type, "token":token}, success: function(response) { if (response.indexOf(" already exists in ") !== -1) { alWarning.show(); @@ -232,15 +227,15 @@ $(document).keypress(function(e) { // Handle buttons $("#btnAdd").on("click", function() { - add("exact"); + add(listType); }); $("#btnAddWildcard").on("click", function() { - add("wild"); + add(listType+"_wild"); }); $("#btnAddRegex").on("click", function() { - add("regex"); + add(listType+"_regex"); }); $("#btnRefresh").on("click", function() {