diff --git a/queries.php b/queries.php index bd9df8fe..c51bc434 100644 --- a/queries.php +++ b/queries.php @@ -132,6 +132,7 @@ if(strlen($showing) > 0) +
diff --git a/scripts/pi-hole/js/db_graph.js b/scripts/pi-hole/js/db_graph.js index 201cad5d..d543f16b 100644 --- a/scripts/pi-hole/js/db_graph.js +++ b/scripts/pi-hole/js/db_graph.js @@ -182,7 +182,7 @@ $(document).ready(function() { title: function(tooltipItem, data) { var label = tooltipItem[0].xLabel; var time = new Date(label); - var date = time.getFullYear()+"-"+padNumber(time.getMonth())+"-"+padNumber(time.getDate()); + var date = time.getFullYear()+"-"+padNumber(time.getMonth()+1)+"-"+padNumber(time.getDate()); var h = time.getHours(); var m = time.getMinutes(); var from = padNumber(h)+":"+padNumber(m)+":00"; diff --git a/scripts/pi-hole/js/list.js b/scripts/pi-hole/js/list.js index 664d64b2..e438f1b9 100644 --- a/scripts/pi-hole/js/list.js +++ b/scripts/pi-hole/js/list.js @@ -141,7 +141,7 @@ function add(arg) { $.ajax({ url: "scripts/pi-hole/php/add.php", method: "post", - data: {"domain":domain.val(), "list":locallistType, "token":token}, + data: {"domain":domain.val().trim(), "list":locallistType, "token":token}, success: function(response) { if (response.indexOf("] Pi-hole blocking is ") === -1) { alFailure.show(); diff --git a/scripts/pi-hole/js/queries.js b/scripts/pi-hole/js/queries.js index 50bf40a9..4c97905e 100644 --- a/scripts/pi-hole/js/queries.js +++ b/scripts/pi-hole/js/queries.js @@ -3,7 +3,7 @@ * Network-wide ad blocking via your own hardware. * * This file is copyright under the latest version of the EUPL. -* Please see LICENSE file for your rights under this license. */ +* Please see LICENSE file for your rights under this license. */ var tableApi; function escapeRegex(text) { @@ -96,6 +96,10 @@ function handleAjaxError( xhr, textStatus, error ) { tableApi.draw(); } +function autofilter(){ + return document.getElementById("autofilter").checked; +} + $(document).ready(function() { var status; @@ -189,22 +193,22 @@ $(document).ready(function() { "initComplete": function () { var api = this.api(); // Query type IPv4 / IPv6 - api.$('td:eq(1)').click( function () { api.search( this.innerHTML ).draw(); $('#resetButton').show(); } ); - api.$('td:eq(1)').hover( + api.$("td:eq(1)").click( function () { if(autofilter()){ api.search( this.innerHTML ).draw(); $("#resetButton").show(); }}); + api.$("td:eq(1)").hover( function () { this.title="Click to show only "+this.innerHTML+" queries"; this.style.color="#72afd2" }, function () { this.style.color="" } ); api.$("td:eq(1)").css("cursor","pointer"); // Domain - api.$('td:eq(2)').click( function () { api.search( this.innerHTML ).draw(); $('#resetButton').show(); } ); - api.$('td:eq(2)').hover( + api.$("td:eq(2)").click( function () { if(autofilter()){ api.search( this.innerHTML ).draw(); $("#resetButton").show(); }}); + api.$("td:eq(2)").hover( function () { this.title="Click to show only queries with domain "+this.innerHTML; this.style.color="#72afd2" }, function () { this.style.color="" } ); api.$("td:eq(2)").css("cursor","pointer"); // Client - api.$('td:eq(3)').click( function () { api.search( this.innerHTML ).draw(); $('#resetButton').show(); } ); - api.$('td:eq(3)').hover( + api.$("td:eq(3)").click( function () { if(autofilter()){ api.search( this.innerHTML ).draw(); $("#resetButton").show(); }}); + api.$("td:eq(3)").hover( function () { this.title="Click to show only queries made by "+this.innerHTML; this.style.color="#72afd2" }, function () { this.style.color="" } ); @@ -224,7 +228,7 @@ $(document).ready(function() { } } ); - $('#resetButton').click( function () { tableApi.search("").draw(); $('#resetButton').hide(); } ); + $("#resetButton").click( function () { tableApi.search("").draw(); $("#resetButton").hide(); } ); } ); diff --git a/scripts/pi-hole/js/queryads.js b/scripts/pi-hole/js/queryads.js index 5d56068f..b86a0309 100644 --- a/scripts/pi-hole/js/queryads.js +++ b/scripts/pi-hole/js/queryads.js @@ -57,9 +57,10 @@ function httpGet(ta,quiet,theUrl) function eventsource() { var ta = $("#output"); - var domain = $("#domain"); + var domain = $("#domain").val().trim(); var q = $("#quiet"); - if(domain.val().length === 0) + + if(domain.length === 0) { return; } @@ -73,12 +74,12 @@ function eventsource() { // IE does not support EventSource - load whole content at once if (typeof EventSource !== "function") { - httpGet(ta,quiet,"/admin/scripts/pi-hole/php/queryads.php?domain="+domain.val().toLowerCase()+exact+"&IE"); + httpGet(ta,quiet,"/admin/scripts/pi-hole/php/queryads.php?domain="+domain.toLowerCase()+exact+"&IE"); return; } var host = window.location.host; - var source = new EventSource("/admin/scripts/pi-hole/php/queryads.php?domain="+domain.val().toLowerCase()+"&"+exact); + var source = new EventSource("/admin/scripts/pi-hole/php/queryads.php?domain="+domain.toLowerCase()+"&"+exact); // Reset and show field ta.empty(); diff --git a/scripts/pi-hole/php/footer.php b/scripts/pi-hole/php/footer.php index d9ca6cec..43cc2041 100644 --- a/scripts/pi-hole/php/footer.php +++ b/scripts/pi-hole/php/footer.php @@ -48,7 +48,7 @@