Add interpretation for Pi-hole message type ADLIST

Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
Christian König
2022-09-01 09:03:15 +02:00
parent c958cc8887
commit b75ec4530c
2 changed files with 38 additions and 0 deletions

View File

@@ -10,6 +10,7 @@
var table;
var groups = [];
var token = $("#token").text();
var GETDict = {};
function getGroups() {
$.post(
@@ -24,6 +25,13 @@ function getGroups() {
}
$(function () {
window.location.search
.substr(1)
.split("&")
.forEach(function (item) {
GETDict[item.split("=")[0]] = item.split("=")[1];
});
$("#btnAdd").on("click", addAdlist);
utils.setBsSelectDefaults();
@@ -289,6 +297,11 @@ function initTable() {
var applyBtn = "#btn_apply_" + data.id;
// Highlight row (if url parameter "adlistid=" is used)
if ("adlistid" in GETDict && data.id === parseInt(GETDict.adlistid, 10)) {
$(row).find("td").addClass("highlight");
}
var button =
'<button type="button" class="btn btn-danger btn-xs" id="deleteAdlist_' +
data.id +
@@ -371,6 +384,18 @@ function initTable() {
// Apply loaded state to table
return data;
},
initComplete: function () {
if ("adlistid" in GETDict) {
var pos = table
.column(0, { order: "current" })
.data()
.indexOf(parseInt(GETDict.adlistid, 10));
if (pos >= 0) {
var page = Math.floor(pos / table.page.info().length);
table.page(page).draw(false);
}
}
},
});
table.on("init select deselect", function () {