mirror of
https://github.com/pi-hole/web.git
synced 2025-12-24 20:55:28 +00:00
Remember last state of the "Apply filtering" checkbox on the Query Log page. Store this browser- not server-wise so individual users can use their own prefered settings.
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -155,7 +155,7 @@ if(strlen($showing) > 0)
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<label><input type="checkbox" id="autofilter" checked="true"> Apply filtering on click on Type, Domain, and Clients</label><br/>
|
||||
<label><input type="checkbox" id="autofilter"> Apply filtering on click on Type, Domain, and Clients</label><br/>
|
||||
<button type="button" id="resetButton" hidden="true">Clear Filters</button>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
|
||||
@@ -108,7 +108,7 @@ function handleAjaxError(xhr, textStatus) {
|
||||
}
|
||||
|
||||
function autofilter() {
|
||||
return document.getElementById("autofilter").checked;
|
||||
return $("#autofilter").prop("checked");
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
@@ -508,4 +508,18 @@ $(document).ready(function() {
|
||||
tableApi.search("").draw();
|
||||
$("#resetButton").hide();
|
||||
});
|
||||
|
||||
var chkbox_data = localStorage.getItem("query_log_filter_chkbox");
|
||||
if (chkbox_data !== null) {
|
||||
// Restore checkbox state
|
||||
$("#autofilter").prop("checked", chkbox_data === "true");
|
||||
} else {
|
||||
// Initialize checkbox
|
||||
$("#autofilter").prop("checked", true);
|
||||
localStorage.setItem("query_log_filter_chkbox", true);
|
||||
}
|
||||
|
||||
$("#autofilter").click(function() {
|
||||
localStorage.setItem("query_log_filter_chkbox", $("#autofilter").prop("checked"));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user