From 9fec6bb7fb1189fb501dfc591aa4ce46a42dc537 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 27 Feb 2017 15:42:50 +0100 Subject: [PATCH] Necessary changes doe to commit 85a7818e7996b44b15d51af26ecf165e672d616b --- scripts/pi-hole/js/index.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index e9226731..d942558f 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -71,11 +71,21 @@ function updateQueriesOverTime() { timeLineChart.data.labels = []; timeLineChart.data.datasets[0].data = []; timeLineChart.data.datasets[1].data = []; - // Add data for each hour that is available + + // Add data for each hour that is available for (var hour in data.ads_over_time[0]) { if ({}.hasOwnProperty.call(data.ads_over_time[0], hour)) { - var h = parseInt(data.domains_over_time[0][hour]); - var d = new Date().setHours(Math.floor(h / 6), 10 * (h % 6), 0, 0); + if(parseInt(data.ads_over_time[0][0]) < 1200) + { + // Fallback - old style + var h = parseInt(data.domains_over_time[0][hour]); + var d = new Date().setHours(Math.floor(h / 6), 10 * (h % 6), 0, 0); + } + else + { + // New style: Get Unix timestamps + var d = new Date(1000*parseInt(data.domains_over_time[0][hour])); + } timeLineChart.data.labels.push(d); timeLineChart.data.datasets[0].data.push(data.domains_over_time[1][hour]);