Directly modify gravity tables from the lists pages.

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2019-08-05 21:48:31 +02:00
parent bc7aef744c
commit c9f5c9500a
4 changed files with 160 additions and 70 deletions

View File

@@ -119,6 +119,11 @@ function sub(index, entry, arg) {
heading = "#h3-regex";
locallistType = arg;
}
var alInfo = $("#alInfo");
var alSuccess = $("#alSuccess");
var alFailure = $("#alFailure");
var alWarning = $("#alWarning");
var domain = $(list+" #"+index);
domain.hide("highlight");
$.ajax({
@@ -126,14 +131,29 @@ function sub(index, entry, arg) {
method: "post",
data: {"domain":entry, "list":locallistType, "token":token},
success: function(response) {
if(response.length !== 0){
return;
}
if (response.indexOf("Success") === -1) {
alFailure.show();
err.html(response);
alFailure.delay(8000).fadeOut(2000, function() {
alFailure.hide();
});
alInfo.delay(8000).fadeOut(2000, function() {
alInfo.hide();
});
} else {
alSuccess.show();
alSuccess.delay(1000).fadeOut(2000, function() {
alSuccess.hide();
});
alInfo.delay(1000).fadeOut(2000, function() {
alInfo.hide();
});
domain.remove();
if($(list+" li").length < 1)
{
$(heading).fadeOut(100);
}
}
},
error: function(jqXHR, exception) {
alert("Failed to remove the domain!");
@@ -163,16 +183,7 @@ function add(type) {
method: "post",
data: {"domain":domain.val().trim(), "list":type, "token":token},
success: function(response) {
if (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 (response.indexOf("DONE") === -1) {
if (response.indexOf("Success") === -1) {
alFailure.show();
err.html(response);
alFailure.delay(8000).fadeOut(2000, function() {