diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index eddacf48..3dccbb92 100644 --- a/scripts/pi-hole/js/settings.js +++ b/scripts/pi-hole/js/settings.js @@ -152,21 +152,21 @@ $(document).ready(function(){ // Handle list deletion $("button[id^='adlist-btn-']").on("click", function (e) { - var idstring = $(this).context.id; - var id = parseInt(idstring.replace(/[^0-9\.]/g, ''), 10); + var id = parseInt($(this).context.id.replace(/[^0-9\.]/g, ""), 10); e.preventDefault(); - var status = $("input[id='adlist-del-"+id+"']").is(":checked"); + var status = $("input[name=\"adlist-del-"+id+"\"]").is(":checked"); var textType = status ? "none" : "line-through"; - console.log("idstring: "+idstring); - console.log("id: "+id); - console.log("status: "+status); - console.log("textType: "+textType); - $("input[name='adlist-del-"+id+"']").prop("checked", !status); - $("input[name='adlist-enable-"+id+"']").prop("disabled", !status); - $("button[id='adlist-btn-"+id+"']").prop("disabled", true); - $("a[id='adlist-text-"+id+"']").css("text-decoration", textType); + // Check hidden delete box (or reset) + $("input[name=\"adlist-del-"+id+"\"]").prop("checked", !status); + // Untick and disable check box (or reset) + $("input[name=\"adlist-enable-"+id+"\"]").prop("checked", status).prop("disabled", !status); + // Strink through text (or reset) + $("a[id=\"adlist-text-"+id+"\"]").css("text-decoration", textType); + // Highlight that the button has to be clicked in order to make the change live + $("button[id=\"blockinglistsaveupdate\"]").addClass("btn-danger").css("font-weight", "bold"); + }); // Javascript to go to specified tab on save or hyperlink diff --git a/settings.php b/settings.php index 3a3b7394..26338a8a 100644 --- a/settings.php +++ b/settings.php @@ -296,9 +296,9 @@ if (isset($setupVars["API_PRIVACY_MODE"])) { - -