mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
Use button to remove lists
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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]));
|
||||
|
||||
+5
-3
@@ -539,11 +539,13 @@ if(isset($_POST["submit"])) {
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<label style="word-break: break-word;">
|
||||
<input type="checkbox" name="adlist-<?php echo $key; ?>" <?php if($value[0]){ ?>checked<?php } ?>>
|
||||
<input type="checkbox" name="adlist-enable-<?php echo $key; ?>" <?php if($value[0]){ ?>checked<?php } ?>>
|
||||
<a href="<?php echo htmlentities ($value[1]); ?>" target="_new"><?php echo htmlentities($value[1]); ?></a>
|
||||
<input type="checkbox" name="adlist-del-<?php echo $key; ?>" hidden>
|
||||
<br>
|
||||
<input type="checkbox" name="adlist-del-<?php echo $key; ?>">
|
||||
Delete?
|
||||
<button class="btn btn-danger btn-xs" id="adlist-btn-<?php echo $key; ?>">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</button>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user