Merge pull request #621 from pi-hole/fix/list-outside-whitepsace

Improve domain whitespace handling in inputs
This commit is contained in:
Adam Warner
2017-12-07 01:05:04 +00:00
committed by GitHub
2 changed files with 6 additions and 5 deletions
+1 -1
View File
@@ -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();
+5 -4
View File
@@ -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();