This commit is contained in:
DL6ER
2017-01-14 13:33:15 +01:00
parent 3aa1ffe114
commit 1b211cbe5c

View File

@@ -1,5 +1,30 @@
var exact = "";
// Credit: http://stackoverflow.com/a/10642418/2087442
function httpGet(ta,theUrl)
{
if (window.XMLHttpRequest)
{
// code for IE7+
xmlhttp=new XMLHttpRequest();
}
else
{
// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
ta.show();
ta.html(xmlhttp.responseText);
}
}
xmlhttp.open("GET", theUrl, false);
xmlhttp.send();
}
function eventsource() {
var ta = $("#output");
var domain = $("#domain");
@@ -9,13 +34,6 @@ function eventsource() {
return;
}
// IE does not support EventSource - exit early
if (typeof EventSource !== "function") {
ta.show();
ta.html("Querying ad lists is not supported with this browser!");
return;
}
var quiet = false;
if(q.val() === "yes")
{
@@ -23,6 +41,12 @@ function eventsource() {
exact = "exact";
}
// IE does not support EventSource - load whole content at once
if (typeof EventSource !== "function") {
httpGet(ta,"/admin/scripts/pi-hole/php/queryads.php?domain="+domain.val().toLowerCase()+"&"+exact);
return;
}
var host = window.location.host;
var source = new EventSource("/admin/scripts/pi-hole/php/queryads.php?domain="+domain.val().toLowerCase()+"&"+exact);