Change prettier option trailingComma from "none" to the new default "es5" (see https://prettier.io/docs/en/options.html#trailing-commas)

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2021-06-23 11:26:43 +02:00
parent 731bb98820
commit 0d0a8dba67
20 changed files with 192 additions and 192 deletions
+1 -1
View File
@@ -40,7 +40,7 @@
"endOfLine": "auto", "endOfLine": "auto",
"printWidth": 100, "printWidth": 100,
"singleQuote": false, "singleQuote": false,
"trailingComma": "none" "trailingComma": "es5"
}, },
"xo": { "xo": {
"envs": [ "envs": [
+2 -2
View File
@@ -100,14 +100,14 @@ function add(domain, list) {
list: list, list: list,
token: token, token: token,
action: list === "audit" ? "add_audit" : "add_domain", action: list === "audit" ? "add_audit" : "add_domain",
comment: "Added from Audit Log" comment: "Added from Audit Log",
}, },
success: function () { success: function () {
updateTopLists(); updateTopLists();
}, },
error: function (jqXHR, exception) { error: function (jqXHR, exception) {
console.log(exception); // eslint-disable-line no-console console.log(exception); // eslint-disable-line no-console
} },
}); });
} }
+7 -7
View File
@@ -46,7 +46,7 @@ $(function () {
ajax: { ajax: {
url: "scripts/pi-hole/php/customcname.php", url: "scripts/pi-hole/php/customcname.php",
data: { action: "get", token: token }, data: { action: "get", token: token },
type: "POST" type: "POST",
}, },
columns: [{}, {}, { orderable: false, searchable: false }], columns: [{}, {}, { orderable: false, searchable: false }],
columnDefs: [ columnDefs: [
@@ -62,12 +62,12 @@ $(function () {
'<span class="far fa-trash-alt"></span>' + '<span class="far fa-trash-alt"></span>' +
"</button>" "</button>"
); );
} },
} },
], ],
lengthMenu: [ lengthMenu: [
[10, 25, 50, 100, -1], [10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"] [10, 25, 50, 100, "All"],
], ],
order: [[0, "asc"]], order: [[0, "asc"]],
stateSave: true, stateSave: true,
@@ -79,7 +79,7 @@ $(function () {
}, },
drawCallback: function () { drawCallback: function () {
$(".deleteCustomCNAME").on("click", deleteCustomCNAME); $(".deleteCustomCNAME").on("click", deleteCustomCNAME);
} },
}); });
// Disable autocorrect in the search box // Disable autocorrect in the search box
var input = document.querySelector("input[type=search]"); var input = document.querySelector("input[type=search]");
@@ -107,7 +107,7 @@ function addCustomCNAME() {
}, },
error: function () { error: function () {
showAlert("error", "Error while adding this custom CNAME record"); showAlert("error", "Error while adding this custom CNAME record");
} },
}); });
} }
@@ -130,6 +130,6 @@ function deleteCustomCNAME() {
error: function (jqXHR, exception) { error: function (jqXHR, exception) {
showAlert("error", "Error while deleting this custom CNAME record"); showAlert("error", "Error while deleting this custom CNAME record");
console.log(exception); // eslint-disable-line no-console console.log(exception); // eslint-disable-line no-console
} },
}); });
} }
+7 -7
View File
@@ -46,7 +46,7 @@ $(function () {
ajax: { ajax: {
url: "scripts/pi-hole/php/customdns.php", url: "scripts/pi-hole/php/customdns.php",
data: { action: "get", token: token }, data: { action: "get", token: token },
type: "POST" type: "POST",
}, },
columns: [{}, { type: "ip-address" }, { orderable: false, searchable: false }], columns: [{}, { type: "ip-address" }, { orderable: false, searchable: false }],
columnDefs: [ columnDefs: [
@@ -62,12 +62,12 @@ $(function () {
'<span class="far fa-trash-alt"></span>' + '<span class="far fa-trash-alt"></span>' +
"</button>" "</button>"
); );
} },
} },
], ],
lengthMenu: [ lengthMenu: [
[10, 25, 50, 100, -1], [10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"] [10, 25, 50, 100, "All"],
], ],
order: [[0, "asc"]], order: [[0, "asc"]],
stateSave: true, stateSave: true,
@@ -79,7 +79,7 @@ $(function () {
}, },
drawCallback: function () { drawCallback: function () {
$(".deleteCustomDNS").on("click", deleteCustomDNS); $(".deleteCustomDNS").on("click", deleteCustomDNS);
} },
}); });
// Disable autocorrect in the search box // Disable autocorrect in the search box
var input = document.querySelector("input[type=search]"); var input = document.querySelector("input[type=search]");
@@ -107,7 +107,7 @@ function addCustomDNS() {
}, },
error: function () { error: function () {
showAlert("error", "Error while adding this custom DNS entry"); showAlert("error", "Error while adding this custom DNS entry");
} },
}); });
} }
@@ -130,6 +130,6 @@ function deleteCustomDNS() {
error: function (jqXHR, exception) { error: function (jqXHR, exception) {
showAlert("error", "Error while deleting this custom DNS entry"); showAlert("error", "Error while deleting this custom DNS entry");
console.log(exception); // eslint-disable-line no-console console.log(exception); // eslint-disable-line no-console
} },
}); });
} }
+21 -21
View File
@@ -28,21 +28,21 @@ $(function () {
Today: [moment().startOf("day"), moment()], Today: [moment().startOf("day"), moment()],
Yesterday: [ Yesterday: [
moment().subtract(1, "days").startOf("day"), moment().subtract(1, "days").startOf("day"),
moment().subtract(1, "days").endOf("day") moment().subtract(1, "days").endOf("day"),
], ],
"Last 7 Days": [moment().subtract(6, "days"), moment()], "Last 7 Days": [moment().subtract(6, "days"), moment()],
"Last 30 Days": [moment().subtract(29, "days"), moment()], "Last 30 Days": [moment().subtract(29, "days"), moment()],
"This Month": [moment().startOf("month"), moment()], "This Month": [moment().startOf("month"), moment()],
"Last Month": [ "Last Month": [
moment().subtract(1, "month").startOf("month"), moment().subtract(1, "month").startOf("month"),
moment().subtract(1, "month").endOf("month") moment().subtract(1, "month").endOf("month"),
], ],
"This Year": [moment().startOf("year"), moment()], "This Year": [moment().startOf("year"), moment()],
"All Time": [moment(0), moment()] "All Time": [moment(0), moment()],
}, },
opens: "center", opens: "center",
showDropdowns: true, showDropdowns: true,
autoUpdateInput: false autoUpdateInput: false,
}, },
function (startt, endt) { function (startt, endt) {
from = moment(startt).utc().valueOf() / 1000; from = moment(startt).utc().valueOf() / 1000;
@@ -166,7 +166,7 @@ $(function () {
pointRadius: 1, pointRadius: 1,
pointHoverRadius: 5, pointHoverRadius: 5,
data: [], data: [],
pointHitRadius: 5 pointHitRadius: 5,
}, },
{ {
label: "Permitted DNS Queries", label: "Permitted DNS Queries",
@@ -177,9 +177,9 @@ $(function () {
pointRadius: 1, pointRadius: 1,
pointHoverRadius: 5, pointHoverRadius: 5,
data: [], data: [],
pointHitRadius: 5 pointHitRadius: 5,
} },
] ],
}, },
options: { options: {
tooltips: { tooltips: {
@@ -267,11 +267,11 @@ $(function () {
} }
return data.datasets[tooltipItems.datasetIndex].label + ": " + tooltipItems.yLabel; return data.datasets[tooltipItems.datasetIndex].label + ": " + tooltipItems.yLabel;
} },
} },
}, },
legend: { legend: {
display: false display: false,
}, },
scales: { scales: {
xAxes: [ xAxes: [
@@ -287,22 +287,22 @@ $(function () {
week: "MMM DD", week: "MMM DD",
month: "MMM", month: "MMM",
quarter: "MMM", quarter: "MMM",
year: "YYYY MMM" year: "YYYY MMM",
} },
} },
} },
], ],
yAxes: [ yAxes: [
{ {
stacked: true, stacked: true,
ticks: { ticks: {
beginAtZero: true beginAtZero: true,
} },
} },
] ],
}, },
maintainAspectRatio: false maintainAspectRatio: false,
} },
}); });
}); });
+4 -4
View File
@@ -30,21 +30,21 @@ $(function () {
Today: [moment().startOf("day"), moment()], Today: [moment().startOf("day"), moment()],
Yesterday: [ Yesterday: [
moment().subtract(1, "days").startOf("day"), moment().subtract(1, "days").startOf("day"),
moment().subtract(1, "days").endOf("day") moment().subtract(1, "days").endOf("day"),
], ],
"Last 7 Days": [moment().subtract(6, "days"), moment()], "Last 7 Days": [moment().subtract(6, "days"), moment()],
"Last 30 Days": [moment().subtract(29, "days"), moment()], "Last 30 Days": [moment().subtract(29, "days"), moment()],
"This Month": [moment().startOf("month"), moment()], "This Month": [moment().startOf("month"), moment()],
"Last Month": [ "Last Month": [
moment().subtract(1, "month").startOf("month"), moment().subtract(1, "month").startOf("month"),
moment().subtract(1, "month").endOf("month") moment().subtract(1, "month").endOf("month"),
], ],
"This Year": [moment().startOf("year"), moment()], "This Year": [moment().startOf("year"), moment()],
"All Time": [moment(0), moment()] "All Time": [moment(0), moment()],
}, },
opens: "center", opens: "center",
showDropdowns: true, showDropdowns: true,
autoUpdateInput: false autoUpdateInput: false,
}, },
function (startt, endt) { function (startt, endt) {
from = moment(startt).utc().valueOf() / 1000; from = moment(startt).utc().valueOf() / 1000;
+11 -11
View File
@@ -48,21 +48,21 @@ $(function () {
Today: [moment().startOf("day"), moment()], Today: [moment().startOf("day"), moment()],
Yesterday: [ Yesterday: [
moment().subtract(1, "days").startOf("day"), moment().subtract(1, "days").startOf("day"),
moment().subtract(1, "days").endOf("day") moment().subtract(1, "days").endOf("day"),
], ],
"Last 7 Days": [moment().subtract(6, "days"), moment()], "Last 7 Days": [moment().subtract(6, "days"), moment()],
"Last 30 Days": [moment().subtract(29, "days"), moment()], "Last 30 Days": [moment().subtract(29, "days"), moment()],
"This Month": [moment().startOf("month"), moment()], "This Month": [moment().startOf("month"), moment()],
"Last Month": [ "Last Month": [
moment().subtract(1, "month").startOf("month"), moment().subtract(1, "month").startOf("month"),
moment().subtract(1, "month").endOf("month") moment().subtract(1, "month").endOf("month"),
], ],
"This Year": [moment().startOf("year"), moment()], "This Year": [moment().startOf("year"), moment()],
"All Time": [moment(0), moment()] "All Time": [moment(0), moment()],
}, },
opens: "center", opens: "center",
showDropdowns: true, showDropdowns: true,
autoUpdateInput: false autoUpdateInput: false,
}, },
function (startt, endt) { function (startt, endt) {
from = moment(startt).utc().valueOf() / 1000; from = moment(startt).utc().valueOf() / 1000;
@@ -310,7 +310,7 @@ $(function () {
x[0] = x[0] * 1e6 + dataIndex++; x[0] = x[0] * 1e6 + dataIndex++;
return x; return x;
}); });
} },
}, },
autoWidth: false, autoWidth: false,
processing: true, processing: true,
@@ -327,26 +327,26 @@ $(function () {
} }
return data; return data;
} },
}, },
{ width: "10%" }, { width: "10%" },
{ width: "40%", render: $.fn.dataTable.render.text() }, { width: "40%", render: $.fn.dataTable.render.text() },
{ width: "20%", type: "ip-address", render: $.fn.dataTable.render.text() }, { width: "20%", type: "ip-address", render: $.fn.dataTable.render.text() },
{ width: "10%" }, { width: "10%" },
{ width: "5%" } { width: "5%" },
], ],
lengthMenu: [ lengthMenu: [
[10, 25, 50, 100, -1], [10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"] [10, 25, 50, 100, "All"],
], ],
columnDefs: [ columnDefs: [
{ {
targets: -1, targets: -1,
data: null, data: null,
defaultContent: "" defaultContent: "",
} },
], ],
initComplete: reloadCallback initComplete: reloadCallback,
}); });
$("#all-queries tbody").on("click", "button", function () { $("#all-queries tbody").on("click", "button", function () {
var data = tableApi.row($(this).parents("tr")).data(); var data = tableApi.row($(this).parents("tr")).data();
+1 -1
View File
@@ -20,7 +20,7 @@ function eventsource() {
$.ajax({ $.ajax({
method: "GET", method: "GET",
url: "scripts/pi-hole/php/debug.php?IE&token=" + token + "&" + checked, url: "scripts/pi-hole/php/debug.php?IE&token=" + token + "&" + checked,
async: false async: false,
}).done(function (data) { }).done(function (data) {
ta.show(); ta.show();
ta.empty(); ta.empty();
+10 -10
View File
@@ -112,7 +112,7 @@ function initTable() {
ajax: { ajax: {
url: "scripts/pi-hole/php/groups.php", url: "scripts/pi-hole/php/groups.php",
data: { action: "get_adlists", token: token }, data: { action: "get_adlists", token: token },
type: "POST" type: "POST",
}, },
order: [[0, "asc"]], order: [[0, "asc"]],
columns: [ columns: [
@@ -122,7 +122,7 @@ function initTable() {
{ data: "enabled", searchable: false }, { data: "enabled", searchable: false },
{ data: "comment" }, { data: "comment" },
{ data: "groups", searchable: false }, { data: "groups", searchable: false },
{ data: null, width: "80px", orderable: false } { data: null, width: "80px", orderable: false },
], ],
drawCallback: function () { drawCallback: function () {
$('button[id^="deleteAdlist_"]').on("click", deleteAdlist); $('button[id^="deleteAdlist_"]').on("click", deleteAdlist);
@@ -198,7 +198,7 @@ function initTable() {
off: "Disabled", off: "Disabled",
size: "small", size: "small",
onstyle: "success", onstyle: "success",
width: "80px" width: "80px",
}); });
statusEl.on("change", editAdlist); statusEl.on("change", editAdlist);
@@ -286,7 +286,7 @@ function initTable() {
"<'row'<'col-sm-5'i><'col-sm-7'p>>", "<'row'<'col-sm-5'i><'col-sm-7'p>>",
lengthMenu: [ lengthMenu: [
[10, 25, 50, 100, -1], [10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"] [10, 25, 50, 100, "All"],
], ],
stateSave: true, stateSave: true,
stateSaveCallback: function (settings, data) { stateSaveCallback: function (settings, data) {
@@ -304,7 +304,7 @@ function initTable() {
data.columns[0].visible = false; data.columns[0].visible = false;
// Apply loaded state to table // Apply loaded state to table
return data; return data;
} },
}); });
table.on("order.dt", function () { table.on("order.dt", function () {
@@ -368,7 +368,7 @@ function addAdlist() {
action: "add_adlist", action: "add_adlist",
address: address, address: address,
comment: comment, comment: comment,
token: token token: token,
}, },
success: function (response) { success: function (response) {
utils.enableAll(); utils.enableAll();
@@ -386,7 +386,7 @@ function addAdlist() {
utils.enableAll(); utils.enableAll();
utils.showAlert("error", "", "Error while adding new adlist: ", jqXHR.responseText); utils.showAlert("error", "", "Error while adding new adlist: ", jqXHR.responseText);
console.log(exception); // eslint-disable-line no-console console.log(exception); // eslint-disable-line no-console
} },
}); });
} }
@@ -438,7 +438,7 @@ function editAdlist() {
comment: comment, comment: comment,
status: status, status: status,
groups: groups, groups: groups,
token: token token: token,
}, },
success: function (response) { success: function (response) {
utils.enableAll(); utils.enableAll();
@@ -468,7 +468,7 @@ function editAdlist() {
jqXHR.responseText jqXHR.responseText
); );
console.log(exception); // eslint-disable-line no-console console.log(exception); // eslint-disable-line no-console
} },
}); });
} }
@@ -497,6 +497,6 @@ function deleteAdlist() {
utils.enableAll(); utils.enableAll();
utils.showAlert("error", "", "Error while deleting adlist with ID " + id, jqXHR.responseText); utils.showAlert("error", "", "Error while deleting adlist with ID " + id, jqXHR.responseText);
console.log(exception); // eslint-disable-line no-console console.log(exception); // eslint-disable-line no-console
} },
}); });
} }
+9 -9
View File
@@ -69,7 +69,7 @@ $(function () {
$("select").select2({ $("select").select2({
tags: true, tags: true,
placeholder: "Select client...", placeholder: "Select client...",
allowClear: true allowClear: true,
}); });
reloadClientSuggestions(); reloadClientSuggestions();
@@ -87,7 +87,7 @@ function initTable() {
ajax: { ajax: {
url: "scripts/pi-hole/php/groups.php", url: "scripts/pi-hole/php/groups.php",
data: { action: "get_clients", token: token }, data: { action: "get_clients", token: token },
type: "POST" type: "POST",
}, },
order: [[0, "asc"]], order: [[0, "asc"]],
columns: [ columns: [
@@ -95,7 +95,7 @@ function initTable() {
{ data: "ip", type: "ip-address" }, { data: "ip", type: "ip-address" },
{ data: "comment" }, { data: "comment" },
{ data: "groups", searchable: false }, { data: "groups", searchable: false },
{ data: "name", width: "80px", orderable: false } { data: "name", width: "80px", orderable: false },
], ],
drawCallback: function () { drawCallback: function () {
$('button[id^="deleteClient_"]').on("click", deleteClient); $('button[id^="deleteClient_"]').on("click", deleteClient);
@@ -214,7 +214,7 @@ function initTable() {
"<'row'<'col-sm-5'i><'col-sm-7'p>>", "<'row'<'col-sm-5'i><'col-sm-7'p>>",
lengthMenu: [ lengthMenu: [
[10, 25, 50, 100, -1], [10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"] [10, 25, 50, 100, "All"],
], ],
stateSave: true, stateSave: true,
stateSaveCallback: function (settings, data) { stateSaveCallback: function (settings, data) {
@@ -232,7 +232,7 @@ function initTable() {
data.columns[0].visible = false; data.columns[0].visible = false;
// Apply loaded state to table // Apply loaded state to table
return data; return data;
} },
}); });
// Disable autocorrect in the search box // Disable autocorrect in the search box
@@ -310,7 +310,7 @@ function addClient() {
utils.enableAll(); utils.enableAll();
utils.showAlert("error", "", "Error while adding new client", jqXHR.responseText); utils.showAlert("error", "", "Error while adding new client", jqXHR.responseText);
console.log(exception); // eslint-disable-line no-console console.log(exception); // eslint-disable-line no-console
} },
}); });
} }
@@ -354,7 +354,7 @@ function editClient() {
id: id, id: id,
groups: groups, groups: groups,
token: token, token: token,
comment: comment comment: comment,
}, },
success: function (response) { success: function (response) {
utils.enableAll(); utils.enableAll();
@@ -378,7 +378,7 @@ function editClient() {
jqXHR.responseText jqXHR.responseText
); );
console.log(exception); // eslint-disable-line no-console console.log(exception); // eslint-disable-line no-console
} },
}); });
} }
@@ -413,6 +413,6 @@ function deleteClient() {
utils.enableAll(); utils.enableAll();
utils.showAlert("error", "", "Error while deleting client with ID " + id, jqXHR.responseText); utils.showAlert("error", "", "Error while deleting client with ID " + id, jqXHR.responseText);
console.log(exception); // eslint-disable-line no-console console.log(exception); // eslint-disable-line no-console
} },
}); });
} }
+10 -10
View File
@@ -64,7 +64,7 @@ function initTable() {
ajax: { ajax: {
url: "scripts/pi-hole/php/groups.php", url: "scripts/pi-hole/php/groups.php",
data: { action: "get_domains", showtype: showtype, token: token }, data: { action: "get_domains", showtype: showtype, token: token },
type: "POST" type: "POST",
}, },
order: [[0, "asc"]], order: [[0, "asc"]],
columns: [ columns: [
@@ -74,7 +74,7 @@ function initTable() {
{ data: "enabled", searchable: false }, { data: "enabled", searchable: false },
{ data: "comment" }, { data: "comment" },
{ data: "groups", searchable: false, visible: showtype === "all" }, { data: "groups", searchable: false, visible: showtype === "all" },
{ data: null, width: "80px", orderable: false } { data: null, width: "80px", orderable: false },
], ],
drawCallback: function () { drawCallback: function () {
$('button[id^="deleteDomain_"]').on("click", deleteDomain); $('button[id^="deleteDomain_"]').on("click", deleteDomain);
@@ -143,7 +143,7 @@ function initTable() {
off: "Disabled", off: "Disabled",
size: "small", size: "small",
onstyle: "success", onstyle: "success",
width: "80px" width: "80px",
}); });
statusEl.on("change", editDomain); statusEl.on("change", editDomain);
@@ -243,7 +243,7 @@ function initTable() {
"<'row'<'col-sm-5'i><'col-sm-7'p>>", "<'row'<'col-sm-5'i><'col-sm-7'p>>",
lengthMenu: [ lengthMenu: [
[10, 25, 50, 100, -1], [10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"] [10, 25, 50, 100, "All"],
], ],
stateSave: true, stateSave: true,
stateSaveCallback: function (settings, data) { stateSaveCallback: function (settings, data) {
@@ -275,7 +275,7 @@ function initTable() {
table.page(page).draw(false); table.page(page).draw(false);
} }
} }
} },
}); });
// Disable autocorrect in the search box // Disable autocorrect in the search box
var input = document.querySelector("input[type=search]"); var input = document.querySelector("input[type=search]");
@@ -360,7 +360,7 @@ function addDomain() {
domain: domain, domain: domain,
type: type, type: type,
comment: comment, comment: comment,
token: token token: token,
}, },
success: function (response) { success: function (response) {
utils.enableAll(); utils.enableAll();
@@ -378,7 +378,7 @@ function addDomain() {
utils.enableAll(); utils.enableAll();
utils.showAlert("error", "", "Error while adding new " + domainRegex, jqXHR.responseText); utils.showAlert("error", "", "Error while adding new " + domainRegex, jqXHR.responseText);
console.log(exception); // eslint-disable-line no-console console.log(exception); // eslint-disable-line no-console
} },
}); });
} }
@@ -450,7 +450,7 @@ function editDomain() {
comment: comment, comment: comment,
status: status, status: status,
groups: groups, groups: groups,
token: token token: token,
}, },
success: function (response) { success: function (response) {
utils.enableAll(); utils.enableAll();
@@ -479,7 +479,7 @@ function editDomain() {
jqXHR.responseText jqXHR.responseText
); );
console.log(exception); // eslint-disable-line no-console console.log(exception); // eslint-disable-line no-console
} },
}); });
} }
@@ -531,6 +531,6 @@ function deleteDomain() {
jqXHR.responseText jqXHR.responseText
); );
console.log(exception); // eslint-disable-line no-console console.log(exception); // eslint-disable-line no-console
} },
}); });
} }
+9 -9
View File
@@ -17,7 +17,7 @@ $(function () {
ajax: { ajax: {
url: "scripts/pi-hole/php/groups.php", url: "scripts/pi-hole/php/groups.php",
data: { action: "get_groups", token: token }, data: { action: "get_groups", token: token },
type: "POST" type: "POST",
}, },
order: [[0, "asc"]], order: [[0, "asc"]],
columns: [ columns: [
@@ -25,7 +25,7 @@ $(function () {
{ data: "name" }, { data: "name" },
{ data: "enabled", searchable: false }, { data: "enabled", searchable: false },
{ data: "description" }, { data: "description" },
{ data: null, width: "60px", orderable: false } { data: null, width: "60px", orderable: false },
], ],
drawCallback: function () { drawCallback: function () {
$('button[id^="deleteGroup_"]').on("click", deleteGroup); $('button[id^="deleteGroup_"]').on("click", deleteGroup);
@@ -56,7 +56,7 @@ $(function () {
off: "Disabled", off: "Disabled",
size: "small", size: "small",
onstyle: "success", onstyle: "success",
width: "80px" width: "80px",
}); });
statusEl.on("change", editGroup); statusEl.on("change", editGroup);
@@ -83,7 +83,7 @@ $(function () {
"<'row'<'col-sm-5'i><'col-sm-7'p>>", "<'row'<'col-sm-5'i><'col-sm-7'p>>",
lengthMenu: [ lengthMenu: [
[10, 25, 50, 100, -1], [10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"] [10, 25, 50, 100, "All"],
], ],
stateSave: true, stateSave: true,
stateSaveCallback: function (settings, data) { stateSaveCallback: function (settings, data) {
@@ -101,7 +101,7 @@ $(function () {
data.columns[0].visible = false; data.columns[0].visible = false;
// Apply loaded state to table // Apply loaded state to table
return data; return data;
} },
}); });
// Disable autocorrect in the search box // Disable autocorrect in the search box
@@ -161,7 +161,7 @@ function addGroup() {
utils.enableAll(); utils.enableAll();
utils.showAlert("error", "", "Error while adding new group", jqXHR.responseText); utils.showAlert("error", "", "Error while adding new group", jqXHR.responseText);
console.log(exception); // eslint-disable-line no-console console.log(exception); // eslint-disable-line no-console
} },
}); });
} }
@@ -211,7 +211,7 @@ function editGroup() {
name: name, name: name,
desc: desc, desc: desc,
status: status, status: status,
token: token token: token,
}, },
success: function (response) { success: function (response) {
utils.enableAll(); utils.enableAll();
@@ -235,7 +235,7 @@ function editGroup() {
jqXHR.responseText jqXHR.responseText
); );
console.log(exception); // eslint-disable-line no-console console.log(exception); // eslint-disable-line no-console
} },
}); });
} }
@@ -264,6 +264,6 @@ function deleteGroup() {
utils.enableAll(); utils.enableAll();
utils.showAlert("error", "", "Error while deleting group with ID " + id, jqXHR.responseText); utils.showAlert("error", "", "Error while deleting group with ID " + id, jqXHR.responseText);
console.log(exception); // eslint-disable-line no-console console.log(exception); // eslint-disable-line no-console
} },
}); });
} }
+57 -57
View File
@@ -27,7 +27,7 @@ var THEME_COLORS = [
"#8e24aa", "#8e24aa",
"#d81b60", "#d81b60",
"#222222", "#222222",
"#d2d6de" "#d2d6de",
]; ];
var customTooltips = function (tooltip) { var customTooltips = function (tooltip) {
@@ -244,7 +244,7 @@ function updateQueriesOverTime() {
pointHitRadius: 5, pointHitRadius: 5,
pointHoverRadius: 5, pointHoverRadius: 5,
label: labels[i], label: labels[i],
cubicInterpolationMode: "monotone" cubicInterpolationMode: "monotone",
}); });
} }
@@ -399,7 +399,7 @@ function updateClientsOverTime() {
pointHitRadius: 5, pointHitRadius: 5,
pointHoverRadius: 5, pointHoverRadius: 5,
label: labels[i], label: labels[i],
cubicInterpolationMode: "monotone" cubicInterpolationMode: "monotone",
}); });
} }
@@ -753,7 +753,7 @@ function updateSummaryData(runOnce) {
"dns_queries_today", "dns_queries_today",
"ads_percentage_today|percentage_blocked_today", "ads_percentage_today|percentage_blocked_today",
"unique_clients", "unique_clients",
"domains_being_blocked" "domains_being_blocked",
].forEach(function (arrayItem, idx) { ].forEach(function (arrayItem, idx) {
var apiElName = arrayItem.split("|"); var apiElName = arrayItem.split("|");
var apiName = apiElName[0]; var apiName = apiElName[0];
@@ -828,7 +828,7 @@ $(function () {
type: utils.getGraphType(), type: utils.getGraphType(),
data: { data: {
labels: [], labels: [],
datasets: [{ data: [] }] datasets: [{ data: [] }],
}, },
options: { options: {
tooltips: { tooltips: {
@@ -868,11 +868,11 @@ $(function () {
} }
return data.datasets[tooltipItems.datasetIndex].label + ": " + tooltipItems.yLabel; return data.datasets[tooltipItems.datasetIndex].label + ": " + tooltipItems.yLabel;
} },
} },
}, },
legend: { legend: {
display: false display: false,
}, },
scales: { scales: {
xAxes: [ xAxes: [
@@ -882,33 +882,33 @@ $(function () {
time: { time: {
unit: "hour", unit: "hour",
displayFormats: { displayFormats: {
hour: "HH:mm" hour: "HH:mm",
}, },
tooltipFormat: "HH:mm" tooltipFormat: "HH:mm",
}, },
gridLines: { gridLines: {
color: gridColor color: gridColor,
}, },
ticks: { ticks: {
fontColor: ticksColor fontColor: ticksColor,
} },
} },
], ],
yAxes: [ yAxes: [
{ {
stacked: true, stacked: true,
ticks: { ticks: {
beginAtZero: true, beginAtZero: true,
fontColor: ticksColor fontColor: ticksColor,
}, },
gridLines: { gridLines: {
color: gridColor color: gridColor,
} },
} },
] ],
}, },
maintainAspectRatio: false maintainAspectRatio: false,
} },
}); });
// Pull in data via AJAX // Pull in data via AJAX
@@ -923,7 +923,7 @@ $(function () {
type: utils.getGraphType(), type: utils.getGraphType(),
data: { data: {
labels: [], labels: [],
datasets: [{ data: [] }] datasets: [{ data: [] }],
}, },
options: { options: {
tooltips: { tooltips: {
@@ -946,11 +946,11 @@ $(function () {
}, },
label: function (tooltipItems, data) { label: function (tooltipItems, data) {
return data.datasets[tooltipItems.datasetIndex].label + ": " + tooltipItems.yLabel; return data.datasets[tooltipItems.datasetIndex].label + ": " + tooltipItems.yLabel;
} },
} },
}, },
legend: { legend: {
display: false display: false,
}, },
scales: { scales: {
xAxes: [ xAxes: [
@@ -960,36 +960,36 @@ $(function () {
time: { time: {
unit: "hour", unit: "hour",
displayFormats: { displayFormats: {
hour: "HH:mm" hour: "HH:mm",
}, },
tooltipFormat: "HH:mm" tooltipFormat: "HH:mm",
}, },
gridLines: { gridLines: {
color: gridColor color: gridColor,
}, },
ticks: { ticks: {
fontColor: ticksColor fontColor: ticksColor,
} },
} },
], ],
yAxes: [ yAxes: [
{ {
ticks: { ticks: {
beginAtZero: true, beginAtZero: true,
fontColor: ticksColor fontColor: ticksColor,
}, },
stacked: true, stacked: true,
gridLines: { gridLines: {
color: gridColor color: gridColor,
} },
} },
] ],
}, },
maintainAspectRatio: false, maintainAspectRatio: false,
hover: { hover: {
animationDuration: 0 animationDuration: 0,
} },
} },
}); });
// Pull in data via AJAX // Pull in data via AJAX
@@ -1048,16 +1048,16 @@ $(function () {
type: "doughnut", type: "doughnut",
data: { data: {
labels: [], labels: [],
datasets: [{ data: [] }] datasets: [{ data: [] }],
}, },
options: { options: {
elements: { elements: {
arc: { arc: {
borderColor: $(".box").css("background-color") borderColor: $(".box").css("background-color"),
} },
}, },
legend: { legend: {
display: false display: false,
}, },
tooltips: { tooltips: {
enabled: false, enabled: false,
@@ -1068,14 +1068,14 @@ $(function () {
}, },
label: function (tooltipItems, data) { label: function (tooltipItems, data) {
return doughnutTooltip(tooltipItems, data); return doughnutTooltip(tooltipItems, data);
} },
} },
}, },
animation: { animation: {
duration: 750 duration: 750,
}, },
cutoutPercentage: 0 cutoutPercentage: 0,
} },
}); });
// Pull in data via AJAX // Pull in data via AJAX
@@ -1088,16 +1088,16 @@ $(function () {
type: "doughnut", type: "doughnut",
data: { data: {
labels: [], labels: [],
datasets: [{ data: [] }] datasets: [{ data: [] }],
}, },
options: { options: {
elements: { elements: {
arc: { arc: {
borderColor: $(".box").css("background-color") borderColor: $(".box").css("background-color"),
} },
}, },
legend: { legend: {
display: false display: false,
}, },
tooltips: { tooltips: {
enabled: false, enabled: false,
@@ -1108,14 +1108,14 @@ $(function () {
}, },
label: function (tooltipItems, data) { label: function (tooltipItems, data) {
return doughnutTooltip(tooltipItems, data); return doughnutTooltip(tooltipItems, data);
} },
} },
}, },
animation: { animation: {
duration: 750 duration: 750,
}, },
cutoutPercentage: 0 cutoutPercentage: 0,
} },
}); });
// Pull in data via AJAX // Pull in data via AJAX
+1 -1
View File
@@ -115,5 +115,5 @@ $.extend($.fn.dataTableExt.oSort, {
"ip-address-desc": function (a, b) { "ip-address-desc": function (a, b) {
return a < b ? 1 : a > b ? -1 : 0; return a < b ? 1 : a > b ? -1 : 0;
} },
}); });
+5 -5
View File
@@ -88,7 +88,7 @@ $(function () {
url: "api_db.php?messages", url: "api_db.php?messages",
data: { token: token }, data: { token: token },
type: "POST", type: "POST",
dataSrc: "messages" dataSrc: "messages",
}, },
order: [[0, "asc"]], order: [[0, "asc"]],
columns: [ columns: [
@@ -100,7 +100,7 @@ $(function () {
{ data: "blob2", visible: false }, { data: "blob2", visible: false },
{ data: "blob3", visible: false }, { data: "blob3", visible: false },
{ data: "blob4", visible: false }, { data: "blob4", visible: false },
{ data: "blob5", visible: false } { data: "blob5", visible: false },
], ],
dom: dom:
"<'row'<'col-sm-4'l><'col-sm-8'f>>" + "<'row'<'col-sm-4'l><'col-sm-8'f>>" +
@@ -108,10 +108,10 @@ $(function () {
"<'row'<'col-sm-5'i><'col-sm-7'p>>", "<'row'<'col-sm-5'i><'col-sm-7'p>>",
lengthMenu: [ lengthMenu: [
[10, 25, 50, 100, -1], [10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"] [10, 25, 50, 100, "All"],
], ],
language: { language: {
emptyTable: "No issues found." emptyTable: "No issues found.",
}, },
stateSave: true, stateSave: true,
stateSaveCallback: function (settings, data) { stateSaveCallback: function (settings, data) {
@@ -134,6 +134,6 @@ $(function () {
// Apply loaded state to table // Apply loaded state to table
return data; return data;
} },
}); });
}); });
+8 -8
View File
@@ -47,7 +47,7 @@ function mixColors(ratio, rgb1, rgb2) {
return [ return [
(1 - ratio) * rgb1[0] + ratio * rgb2[0], (1 - ratio) * rgb1[0] + ratio * rgb2[0],
(1 - ratio) * rgb1[1] + ratio * rgb2[1], (1 - ratio) * rgb1[1] + ratio * rgb2[1],
(1 - ratio) * rgb1[2] + ratio * rgb2[2] (1 - ratio) * rgb1[2] + ratio * rgb2[2],
]; ];
} }
@@ -194,7 +194,7 @@ $(function () {
} }
return data; return data;
} },
}, },
{ {
data: "lastQuery", data: "lastQuery",
@@ -205,14 +205,14 @@ $(function () {
} }
return data; return data;
} },
}, },
{ data: "numQueries", width: "9%", render: $.fn.dataTable.render.text() }, { data: "numQueries", width: "9%", render: $.fn.dataTable.render.text() },
{ data: "", width: "6%", orderable: false } { data: "", width: "6%", orderable: false },
], ],
lengthMenu: [ lengthMenu: [
[10, 25, 50, 100, -1], [10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"] [10, 25, 50, 100, "All"],
], ],
stateSave: true, stateSave: true,
stateSaveCallback: function (settings, data) { stateSaveCallback: function (settings, data) {
@@ -225,9 +225,9 @@ $(function () {
{ {
targets: -1, targets: -1,
data: null, data: null,
defaultContent: "" defaultContent: "",
} },
] ],
}); });
// Disable autocorrect in the search box // Disable autocorrect in the search box
var input = document.querySelector("input[type=search]"); var input = document.querySelector("input[type=search]");
+8 -8
View File
@@ -21,7 +21,7 @@ var replyTypes = [
"SERVFAIL", "SERVFAIL",
"REFUSED", "REFUSED",
"NOTIMP", "NOTIMP",
"upstream error" "upstream error",
]; ];
var colTypes = ["time", "query type", "domain", "client", "status", "reply type"]; var colTypes = ["time", "query type", "domain", "client", "status", "reply type"];
@@ -282,7 +282,7 @@ $(function () {
x[6] = dnssec; x[6] = dnssec;
return x; return x;
}); });
} },
}, },
autoWidth: false, autoWidth: false,
processing: true, processing: true,
@@ -298,18 +298,18 @@ $(function () {
} }
return data; return data;
} },
}, },
{ width: "4%" }, { width: "4%" },
{ width: "36%", render: $.fn.dataTable.render.text() }, { width: "36%", render: $.fn.dataTable.render.text() },
{ width: "8%", type: "ip-address", render: $.fn.dataTable.render.text() }, { width: "8%", type: "ip-address", render: $.fn.dataTable.render.text() },
{ width: "14%", orderData: 4 }, { width: "14%", orderData: 4 },
{ width: "8%", orderData: 5 }, { width: "8%", orderData: 5 },
{ width: "10%", orderData: 4 } { width: "10%", orderData: 4 },
], ],
lengthMenu: [ lengthMenu: [
[10, 25, 50, 100, -1], [10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"] [10, 25, 50, 100, "All"],
], ],
stateSave: true, stateSave: true,
stateSaveCallback: function (settings, data) { stateSaveCallback: function (settings, data) {
@@ -322,8 +322,8 @@ $(function () {
{ {
targets: -1, targets: -1,
data: null, data: null,
defaultContent: "" defaultContent: "",
} },
], ],
initComplete: function () { initComplete: function () {
var api = this.api(); var api = this.api();
@@ -416,7 +416,7 @@ $(function () {
input.attr("spellcheck", false); input.attr("spellcheck", false);
input.attr("placeholder", "Type / Domain / Client"); input.attr("placeholder", "Type / Domain / Client");
} }
} },
}); });
resetColumnsFilters(); resetColumnsFilters();
+1 -1
View File
@@ -40,7 +40,7 @@ function eventsource() {
$.ajax({ $.ajax({
method: "GET", method: "GET",
url: "scripts/pi-hole/php/queryads.php?domain=" + domain.toLowerCase() + "&" + exact + "&IE", url: "scripts/pi-hole/php/queryads.php?domain=" + domain.toLowerCase() + "&" + exact + "&IE",
async: false async: false,
}).done(function (data) { }).done(function (data) {
ta.show(); ta.show();
ta.empty(); ta.empty();
+11 -11
View File
@@ -33,7 +33,7 @@ $(".confirm-poweroff").confirm({
post: true, post: true,
confirmButtonClass: "btn-danger", confirmButtonClass: "btn-danger",
cancelButtonClass: "btn-success", cancelButtonClass: "btn-success",
dialogClass: "modal-dialog" dialogClass: "modal-dialog",
}); });
$(".confirm-reboot").confirm({ $(".confirm-reboot").confirm({
text: "Are you sure you want to send a reboot command to your Pi-hole?", text: "Are you sure you want to send a reboot command to your Pi-hole?",
@@ -49,7 +49,7 @@ $(".confirm-reboot").confirm({
post: true, post: true,
confirmButtonClass: "btn-danger", confirmButtonClass: "btn-danger",
cancelButtonClass: "btn-success", cancelButtonClass: "btn-success",
dialogClass: "modal-dialog" dialogClass: "modal-dialog",
}); });
$(".confirm-restartdns").confirm({ $(".confirm-restartdns").confirm({
@@ -66,7 +66,7 @@ $(".confirm-restartdns").confirm({
post: true, post: true,
confirmButtonClass: "btn-danger", confirmButtonClass: "btn-danger",
cancelButtonClass: "btn-success", cancelButtonClass: "btn-success",
dialogClass: "modal-dialog" dialogClass: "modal-dialog",
}); });
$(".confirm-flushlogs").confirm({ $(".confirm-flushlogs").confirm({
@@ -83,7 +83,7 @@ $(".confirm-flushlogs").confirm({
post: true, post: true,
confirmButtonClass: "btn-danger", confirmButtonClass: "btn-danger",
cancelButtonClass: "btn-success", cancelButtonClass: "btn-success",
dialogClass: "modal-dialog" dialogClass: "modal-dialog",
}); });
$(".confirm-flusharp").confirm({ $(".confirm-flusharp").confirm({
@@ -100,7 +100,7 @@ $(".confirm-flusharp").confirm({
post: true, post: true,
confirmButtonClass: "btn-warning", confirmButtonClass: "btn-warning",
cancelButtonClass: "btn-success", cancelButtonClass: "btn-success",
dialogClass: "modal-dialog" dialogClass: "modal-dialog",
}); });
$(".confirm-disablelogging-noflush").confirm({ $(".confirm-disablelogging-noflush").confirm({
@@ -117,7 +117,7 @@ $(".confirm-disablelogging-noflush").confirm({
post: true, post: true,
confirmButtonClass: "btn-warning", confirmButtonClass: "btn-warning",
cancelButtonClass: "btn-success", cancelButtonClass: "btn-success",
dialogClass: "modal-dialog" dialogClass: "modal-dialog",
}); });
$(".api-token").confirm({ $(".api-token").confirm({
@@ -135,7 +135,7 @@ $(".api-token").confirm({
post: true, post: true,
confirmButtonClass: "btn-danger", confirmButtonClass: "btn-danger",
cancelButtonClass: "btn-success", cancelButtonClass: "btn-success",
dialogClass: "modal-dialog" dialogClass: "modal-dialog",
}); });
$("#DHCPchk").click(function () { $("#DHCPchk").click(function () {
@@ -184,7 +184,7 @@ $(function () {
}, },
stateLoadCallback: function () { stateLoadCallback: function () {
return utils.stateLoadCallback("activeDhcpLeaseTable"); return utils.stateLoadCallback("activeDhcpLeaseTable");
} },
}); });
} }
@@ -203,7 +203,7 @@ $(function () {
}, },
stateLoadCallback: function () { stateLoadCallback: function () {
return utils.stateLoadCallback("staticDhcpLeaseTable"); return utils.stateLoadCallback("staticDhcpLeaseTable");
} },
}); });
} }
@@ -300,7 +300,7 @@ $('button[id="removedynamic"]').on("click", function () {
dataType: "json", dataType: "json",
data: { data: {
delete_lease: ipaddr, delete_lease: ipaddr,
token: token token: token,
}, },
success: function (response) { success: function (response) {
utils.enableAll(); utils.enableAll();
@@ -326,6 +326,6 @@ $('button[id="removedynamic"]').on("click", function () {
utils.enableAll(); utils.enableAll();
utils.showAlert("error", "Error while deleting DHCP lease for " + ipname, jqXHR.responseText); utils.showAlert("error", "Error while deleting DHCP lease for " + ipname, jqXHR.responseText);
console.log(exception); // eslint-disable-line no-console console.log(exception); // eslint-disable-line no-console
} },
}); });
}); });
+9 -9
View File
@@ -14,7 +14,7 @@ function escapeHtml(text) {
"<": "&lt;", "<": "&lt;",
">": "&gt;", ">": "&gt;",
'"': "&quot;", '"': "&quot;",
"'": "&#039;" "'": "&#039;",
}; };
if (text === null) return null; if (text === null) return null;
@@ -30,7 +30,7 @@ function unescapeHtml(text) {
"&lt;": "<", "&lt;": "<",
"&gt;": ">", "&gt;": ">",
"&quot;": '"', "&quot;": '"',
"&#039;": "'" "&#039;": "'",
}; };
if (text === null) return null; if (text === null) return null;
@@ -72,7 +72,7 @@ function showAlert(type, icon, title, message) {
type: "info", type: "info",
icon: "far fa-clock", icon: "far fa-clock",
title: title, title: title,
message: message message: message,
}; };
info = $.notify(opts); info = $.notify(opts);
break; break;
@@ -81,7 +81,7 @@ function showAlert(type, icon, title, message) {
type: "success", type: "success",
icon: icon, icon: icon,
title: title, title: title,
message: message message: message,
}; };
if (info) { if (info) {
info.update(opts); info.update(opts);
@@ -95,7 +95,7 @@ function showAlert(type, icon, title, message) {
type: "warning", type: "warning",
icon: "fas fa-exclamation-triangle", icon: "fas fa-exclamation-triangle",
title: title, title: title,
message: message message: message,
}; };
if (info) { if (info) {
info.update(opts); info.update(opts);
@@ -109,7 +109,7 @@ function showAlert(type, icon, title, message) {
type: "danger", type: "danger",
icon: "fas fa-times", icon: "fas fa-times",
title: "&nbsp;<strong>Error, something went wrong!</strong><br>", title: "&nbsp;<strong>Error, something went wrong!</strong><br>",
message: message message: message,
}; };
if (info) { if (info) {
info.update(opts); info.update(opts);
@@ -284,7 +284,7 @@ function addFromQueryLog(domain, list) {
list: list, list: list,
token: token, token: token,
action: "replace_domain", action: "replace_domain",
comment: "Added from Query Log" comment: "Added from Query Log",
}, },
success: function (response) { success: function (response) {
alProcessing.hide(); alProcessing.hide();
@@ -314,7 +314,7 @@ function addFromQueryLog(domain, list) {
setTimeout(function () { setTimeout(function () {
alertModal.modal("hide"); alertModal.modal("hide");
}, 8000); }, 8000);
} },
}); });
}); });
@@ -346,6 +346,6 @@ window.utils = (function () {
getGraphType: getGraphType, getGraphType: getGraphType,
validateMAC: validateMAC, validateMAC: validateMAC,
validateHostname: validateHostname, validateHostname: validateHostname,
addFromQueryLog: addFromQueryLog addFromQueryLog: addFromQueryLog,
}; };
})(); })();