From 444b4f4864aa2fd6ebf7de19b9a3fa2a84099039 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 5 Feb 2023 17:54:20 +0100 Subject: [PATCH] Do not try to load messages on the login page Signed-off-by: DL6ER --- scripts/pi-hole/js/footer.js | 10 ++++++---- scripts/pi-hole/js/settings.js | 11 ++++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/scripts/pi-hole/js/footer.js b/scripts/pi-hole/js/footer.js index 6d94671e..d8b77992 100644 --- a/scripts/pi-hole/js/footer.js +++ b/scripts/pi-hole/js/footer.js @@ -475,10 +475,12 @@ $(function () { // Apply per-browser styling settings initCheckboxRadioStyle(); - // Run check immediately after page loading ... - utils.checkMessages(); - // ... and once again with five seconds delay - setTimeout(utils.checkMessages, 5000); + if (window.location.pathname !== "/admin/login.php") { + // Run check immediately after page loading ... + utils.checkMessages(); + // ... and once again with five seconds delay + setTimeout(utils.checkMessages, 5000); + } }); // Handle Enable/Disable diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index 447cb010..858111c5 100644 --- a/scripts/pi-hole/js/settings.js +++ b/scripts/pi-hole/js/settings.js @@ -140,15 +140,16 @@ function fillDNSupstreams(value, servers) { var upstreams = $("#DNSupstreamsTextfield").val().split("\n"); var customServers = 0; $("#DNSupstreamsTable input").each(function () { - if (this.checked && !upstreams.includes(this.title)) { + var title = $(this).closest("td").attr("title"); + if (this.checked && !upstreams.includes(title)) { // Add server to array - upstreams.push(this.title); - } else if (!this.checked && upstreams.includes(this.title)) { + upstreams.push(title); + } else if (!this.checked && upstreams.includes(title)) { // Remove server from array - removeFromArray(upstreams, this.title); + removeFromArray(upstreams, title); } - if (upstreams.includes(this.title)) customServers--; + if (upstreams.includes(title)) customServers--; }); // The variable will contain a negative value, we need to add the length to // get the correct number of custom servers