mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
committed by
dependabot-preview[bot]
parent
c5520d4551
commit
274c196e42
@@ -239,13 +239,9 @@ function refreshTableData() {
|
||||
}
|
||||
|
||||
$(function () {
|
||||
var APIstring;
|
||||
|
||||
if (instantquery) {
|
||||
APIstring = "api_db.php?getAllQueries&from=" + from + "&until=" + until;
|
||||
} else {
|
||||
APIstring = "api_db.php?getAllQueries=empty";
|
||||
}
|
||||
var APIstring = instantquery
|
||||
? "api_db.php?getAllQueries&from=" + from + "&until=" + until
|
||||
: "api_db.php?getAllQueries=empty";
|
||||
|
||||
// Check if query type filtering is enabled
|
||||
var queryType = getQueryTypes();
|
||||
|
||||
@@ -96,12 +96,10 @@ function piholeChange(action, duration) {
|
||||
function checkMessages() {
|
||||
$.getJSON("api_db.php?status", function (data) {
|
||||
if ("message_count" in data && data.message_count > 0) {
|
||||
var title;
|
||||
if (data.message_count > 1) {
|
||||
title = "There are " + data.message_count + " warnings. Click for further details.";
|
||||
} else {
|
||||
title = "There is one warning. Click for further details.";
|
||||
}
|
||||
var title =
|
||||
data.message_count > 1
|
||||
? "There are " + data.message_count + " warnings. Click for further details."
|
||||
: "There is one warning. Click for further details.";
|
||||
|
||||
$("#pihole-diagnosis").prop("title", title);
|
||||
$("#pihole-diagnosis-count").text(data.message_count);
|
||||
|
||||
@@ -251,15 +251,11 @@ function updateQueriesOverTime() {
|
||||
// Add data for each hour that is available
|
||||
for (var hour in data.ads_over_time[0]) {
|
||||
if (Object.prototype.hasOwnProperty.call(data.ads_over_time[0], hour)) {
|
||||
var d, h;
|
||||
h = parseInt(data.domains_over_time[0][hour], 10);
|
||||
if (parseInt(data.ads_over_time[0][0], 10) < 1200) {
|
||||
// Fallback - old style
|
||||
d = new Date().setHours(Math.floor(h / 6), 10 * (h % 6), 0, 0);
|
||||
} else {
|
||||
// New style: Get Unix timestamps
|
||||
d = new Date(1000 * h);
|
||||
}
|
||||
var h = parseInt(data.domains_over_time[0][hour], 10);
|
||||
var d =
|
||||
parseInt(data.ads_over_time[0][0], 10) < 1200
|
||||
? new Date().setHours(Math.floor(h / 6), 10 * (h % 6), 0, 0)
|
||||
: new Date(1000 * h);
|
||||
|
||||
timeLineChart.data.labels.push(d);
|
||||
var blocked = data.ads_over_time[1][hour];
|
||||
@@ -297,14 +293,9 @@ function updateQueryTypesPie() {
|
||||
var v = [],
|
||||
c = [],
|
||||
k = [],
|
||||
i = 0,
|
||||
iter;
|
||||
i = 0;
|
||||
// Collect values and colors, and labels
|
||||
if (Object.prototype.hasOwnProperty.call(data, "querytypes")) {
|
||||
iter = data.querytypes;
|
||||
} else {
|
||||
iter = data;
|
||||
}
|
||||
var iter = Object.prototype.hasOwnProperty.call(data, "querytypes") ? data.querytypes : data;
|
||||
|
||||
querytypeids = [];
|
||||
Object.keys(iter).forEach(function (key) {
|
||||
|
||||
@@ -41,12 +41,7 @@ function add(domain, list) {
|
||||
return;
|
||||
}
|
||||
|
||||
var listtype;
|
||||
if (list === "white") {
|
||||
listtype = "Whitelist";
|
||||
} else {
|
||||
listtype = "Blacklist";
|
||||
}
|
||||
var listtype = list === "white" ? "Whitelist" : "Blacklist";
|
||||
|
||||
alProcessing.children(alDomain).html(domain);
|
||||
alProcessing.children(alList).html(listtype);
|
||||
@@ -311,14 +306,9 @@ $(function () {
|
||||
}
|
||||
|
||||
// Check for existence of sixth column and display only if not Pi-holed
|
||||
var replytext,
|
||||
replyid = data[5];
|
||||
|
||||
if (replyid >= 0 && replyid < replyTypes.length) {
|
||||
replytext = replyTypes[replyid];
|
||||
} else {
|
||||
replytext = "? (" + replyid + ")";
|
||||
}
|
||||
var replyid = data[5];
|
||||
var replytext =
|
||||
replyid >= 0 && replyid < replyTypes.length ? replyTypes[replyid] : "? (" + replyid + ")";
|
||||
|
||||
replytext += '<input type="hidden" name="id" value="' + replyid + '">';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user