diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index e7e613ea..0e5f3146 100644 --- a/scripts/pi-hole/js/settings.js +++ b/scripts/pi-hole/js/settings.js @@ -87,3 +87,14 @@ $(document).ready(function(){ $("[data-toggle=\"tooltip\"]").tooltip({"html": true, container : "body"}); }); +// Handle list deletion +$("button[id^='adlist-btn-']").on("click", function (e) { + e.preventDefault(); + + var status = $(this).siblings("input[name^='adlist-del-']").is(":checked"); + var text_type = status ? "none" : "line-through"; + + $(this).siblings("input[name^='adlist-del-']").prop("checked", !status); + $(this).siblings("input[name^='adlist-enable-']").prop("disabled", !status); + $(this).siblings("a").css("text-decoration", text_type); +}); diff --git a/scripts/pi-hole/php/savesettings.php b/scripts/pi-hole/php/savesettings.php index 7f4fc8c7..08cbbcc2 100644 --- a/scripts/pi-hole/php/savesettings.php +++ b/scripts/pi-hole/php/savesettings.php @@ -406,13 +406,13 @@ function readAdlists() // Delete list exec("sudo pihole -a adlist del ".escapeshellcmd($value[1])); } - elseif(isset($_POST["adlist-".$key]) && !$value[0]) + elseif(isset($_POST["adlist-enable-".$key]) && !$value[0]) { // Is not enabled, but should be exec("sudo pihole -a adlist enable ".escapeshellcmd($value[1])); } - elseif(!isset($_POST["adlist-".$key]) && $value[0]) + elseif(!isset($_POST["adlist-enable-".$key]) && $value[0]) { // Is enabled, but shouldn't be exec("sudo pihole -a adlist disable ".escapeshellcmd($value[1])); diff --git a/settings.php b/settings.php index da8ac8e3..161957ac 100644 --- a/settings.php +++ b/settings.php @@ -539,11 +539,13 @@ if(isset($_POST["submit"])) {