mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2026-01-06 08:45:32 +00:00
webapp: implemented js code for enable blocking and temp disable blocking features.
This commit is contained in:
@@ -884,6 +884,15 @@ function loadDnsSettings() {
|
||||
break;
|
||||
}
|
||||
|
||||
$("#chkEnableBlocking").prop("checked", responseJSON.response.enableBlocking);
|
||||
|
||||
if (responseJSON.response.temporaryDisableBlockingTill == null)
|
||||
$("#lblTemporaryDisableBlockingTill").text("Not Set");
|
||||
else
|
||||
$("#lblTemporaryDisableBlockingTill").text(responseJSON.response.temporaryDisableBlockingTill);
|
||||
|
||||
$("#txtTemporaryDisableBlockingMinutes").val("");
|
||||
|
||||
$("#txtCustomBlockingAddresses").prop("disabled", true);
|
||||
|
||||
switch (responseJSON.response.blockingType) {
|
||||
@@ -1234,6 +1243,38 @@ function forceUpdateBlockLists() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function temporaryDisableBlockingNow() {
|
||||
var minutes = $("#txtTemporaryDisableBlockingMinutes").val();
|
||||
|
||||
if ((minutes === null) || (minutes === "")) {
|
||||
showAlert("warning", "Missing!", "Please enter a value in minutes to temporarily disable blocking.");
|
||||
$("#txtTemporaryDisableBlockingMinutes").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!confirm("Are you sure to temporarily disable blocking for " + minutes + " minute(s)?"))
|
||||
return false;
|
||||
|
||||
var btn = $("#btnTemporaryDisableBlockingNow").button('loading');
|
||||
|
||||
HTTPRequest({
|
||||
url: "/api/temporaryDisableBlocking?token=" + token + "&minutes=" + minutes,
|
||||
success: function (responseJSON) {
|
||||
btn.button('reset');
|
||||
showAlert("success", "Blocking Disabled!", "Blocking was successfully disabled temporarily for " + htmlEncode(minutes) + " minute(s).");
|
||||
},
|
||||
error: function () {
|
||||
btn.button('reset');
|
||||
},
|
||||
invalidToken: function () {
|
||||
btn.button('reset');
|
||||
showPageLogin();
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function cleanTextList(text) {
|
||||
text = text.replace(/\n/g, ",");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user