-
diff --git a/scripts/pi-hole/js/queryads.js b/scripts/pi-hole/js/queryads.js
index 28556023..8916fa64 100644
--- a/scripts/pi-hole/js/queryads.js
+++ b/scripts/pi-hole/js/queryads.js
@@ -50,7 +50,8 @@ function httpGet(ta, quiet, theUrl) {
function eventsource() {
var ta = $("#output");
- var domain = $("#domain").val().trim();
+ // process with the current visible domain input field
+ var domain = $("input[id^='domain']:visible").val().trim();
var q = $("#quiet");
if (domain.length === 0) {
@@ -68,7 +69,7 @@ function eventsource() {
httpGet(
ta,
quiet,
- "scripts/pi-hole/php/queryads.php?domain=" + domain.toLowerCase() + exact + "&IE"
+ "scripts/pi-hole/php/queryads.php?domain=" + domain.toLowerCase() + "&" + exact + "&IE"
);
return;
}
@@ -106,41 +107,22 @@ function eventsource() {
exact = "";
}
-// Handle enter button
-$(document).keypress(function (e) {
- if (e.which === 13 && $("#domain").is(":focus")) {
+// Handle enter key
+$("#domain_1, #domain_2").keypress(function (e) {
+ if (e.which === 13) {
// Enter was pressed, and the input has focus
exact = "";
eventsource();
}
});
-// Handle button
-$("#btnSearch").on("click", function () {
- exact = "";
- eventsource();
-});
-// Handle exact button
-$("#btnSearchExact").on("click", function () {
- exact = "exact";
- eventsource();
-});
-// Wrap form-group's buttons to next line when viewed on a small screen
-$(window).on("resize", function () {
- if ($(window).width() < 991) {
- $(".form-group.input-group").removeClass("input-group").addClass("input-group-block");
- $(".form-group.input-group-block > input").css("margin-bottom", "5px");
- $(".form-group.input-group-block > .input-group-btn")
- .removeClass("input-group-btn")
- .addClass("btn-block text-center");
- } else {
- $(".form-group.input-group-block").removeClass("input-group-block").addClass("input-group");
- $(".form-group.input-group > input").css("margin-bottom", "");
- $(".form-group.input-group > .btn-block.text-center")
- .removeClass("btn-block text-center")
- .addClass("input-group-btn");
+// Handle search buttons
+$("button[id^='btnSearch']").on("click", function () {
+ exact = "";
+
+ if (this.id.match("^btnSearchExact")) {
+ exact = "exact";
}
-});
-$(document).ready(function () {
- $(window).trigger("resize");
+
+ eventsource();
});