Merge pull request #1199 from pi-hole/tweak/remember_filtering_chkbox

Remember last state of the "Apply filtering" checkbox on the Query Log page
This commit is contained in:
DL6ER
2020-03-31 23:08:09 +02:00
committed by GitHub
2 changed files with 16 additions and 2 deletions
+1 -1
View File
@@ -155,7 +155,7 @@ if(strlen($showing) > 0)
</tr>
</tfoot>
</table>
<label><input type="checkbox" id="autofilter" checked="true">&nbsp;Apply filtering on click on Type, Domain, and Clients</label><br/>
<label><input type="checkbox" id="autofilter">&nbsp;Apply filtering on click on Type, Domain, and Clients</label><br/>
<button type="button" id="resetButton" hidden="true">Clear Filters</button>
</div>
<!-- /.box-body -->
+15 -1
View File
@@ -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"));
});
});