From bd84160d4f38714b261f34cb4469b18fc7ee4018 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 29 Nov 2018 19:47:57 +0100 Subject: [PATCH] Show different warning in the case that at least one of the domains to be added were already present Signed-off-by: DL6ER --- list.php | 4 ++++ scripts/pi-hole/js/list.js | 18 +++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/list.php b/list.php index a25ef24a..da0a373c 100644 --- a/list.php +++ b/list.php @@ -59,6 +59,10 @@ function getFullName() { Failure! Something went wrong, see output below:

+ diff --git a/scripts/pi-hole/js/list.js b/scripts/pi-hole/js/list.js index 1ac0e294..530a3b3b 100644 --- a/scripts/pi-hole/js/list.js +++ b/scripts/pi-hole/js/list.js @@ -140,23 +140,35 @@ function add(arg) { var alInfo = $("#alInfo"); var alSuccess = $("#alSuccess"); var alFailure = $("#alFailure"); + var alWarning = $("#alWarning"); var err = $("#err"); + var warn = $("#warn"); alInfo.show(); alSuccess.hide(); alFailure.hide(); + alWarning.hide(); $.ajax({ url: "scripts/pi-hole/php/add.php", method: "post", data: {"domain":domain.val().trim(), "list":locallistType, "token":token}, success: function(response) { - if (!wild && response.indexOf("] Pi-hole blocking is ") === -1 || + if (!wild && response.indexOf(" already exists in ") !== -1) { + alWarning.show(); + warn.html(response); + alWarning.delay(8000).fadeOut(2000, function() { + alWarning.hide(); + }); + alInfo.delay(8000).fadeOut(2000, function() { + alInfo.hide(); + }); + } else if (!wild && response.indexOf("] Pi-hole blocking is ") === -1 || wild && response.length > 1) { alFailure.show(); err.html(response); - alFailure.delay(4000).fadeOut(2000, function() { + alFailure.delay(8000).fadeOut(2000, function() { alFailure.hide(); }); - alInfo.delay(4000).fadeOut(2000, function() { + alInfo.delay(8000).fadeOut(2000, function() { alInfo.hide(); }); } else {