diff --git a/js/pihole/queryads.js b/js/pihole/queryads.js index 364534c6..8c75fb30 100644 --- a/js/pihole/queryads.js +++ b/js/pihole/queryads.js @@ -1,10 +1,18 @@ function eventsource() { var ta = $("#output"); var domain = $("#domain"); + var q = $("#quiet"); if(domain.val().length === 0) { return; } + + var quiet = false; + if(q.val() === "yes") + { + quiet = true; + } + var host = window.location.host; var source = new EventSource("http://"+host+"/admin/php/queryads.php?domain="+domain.val()); @@ -13,7 +21,18 @@ function eventsource() { ta.show(); source.addEventListener("message", function(e) { - ta.append(e.data); + if(!quiet) + { + ta.append(e.data); + } + else + { + if(e.data.indexOf("results") !== -1 && e.data.indexOf("0 results") === -1) + { + var shortstring = e.data.replace("::: /etc/pihole/",""); + ta.append(shortstring); + } + } }, false); // Will be called when script has finished diff --git a/queryads.php b/queryads.php index 4392c01f..f996b410 100644 --- a/queryads.php +++ b/queryads.php @@ -8,6 +8,7 @@
+