From 6d07f9bb2bfcbaf9b10879b25f3db9ef7f699c9d Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 9 Feb 2023 18:22:45 +0100 Subject: [PATCH] Adjust enbaled checkboxes on advanced settings tab Signed-off-by: DL6ER --- scripts/pi-hole/js/footer.js | 12 +++++++++--- scripts/pi-hole/js/settings.js | 15 +++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/scripts/pi-hole/js/footer.js b/scripts/pi-hole/js/footer.js index f0df3d52..69cb7b8f 100644 --- a/scripts/pi-hole/js/footer.js +++ b/scripts/pi-hole/js/footer.js @@ -142,7 +142,8 @@ function initCheckboxRadioStyle() { } var boxsheet = $(''); - boxsheet.appendTo("head"); + // Only add the stylesheet if it's not already present + if ($("link[href='" + boxsheet.attr("href") + "']").length === 0) boxsheet.appendTo("head"); iCheckStyle = chkboxStyle; applyCheckboxRadioStyle(); @@ -303,8 +304,13 @@ function updateSensorsInfo() { .done(function (data) { if (data.sensors.cpu_temp !== null) { var temp = data.sensors.cpu_temp.toFixed(1) + " °C"; - var color = data.sensors.cpu_temp > data.sensors.hot_limit ? "text-red fa-temperature-high" : "text-green-light fa-temperature-low"; - $("#temperature").html(' Temp: ' + temp); + var color = + data.sensors.cpu_temp > data.sensors.hot_limit + ? "text-red fa-temperature-high" + : "text-green-light fa-temperature-low"; + $("#temperature").html( + ' Temp: ' + temp + ); } else $("#temperature").html(' Temp: N/A'); // Update every 20 seconds clearTimeout(sensorsTimer); diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index 858111c5..49ef6ed5 100644 --- a/scripts/pi-hole/js/settings.js +++ b/scripts/pi-hole/js/settings.js @@ -5,7 +5,7 @@ * This file is copyright under the latest version of the EUPL. * Please see LICENSE file for your rights under this license. */ -/* global utils:false, apiFailure:false, initCheckboxRadioStyle:false */ +/* global utils:false, apiFailure:false, applyCheckboxRadioStyle:false */ var hostinfoTimer = null; function updateHostInfo() { @@ -262,13 +262,16 @@ function generateRow(topic, key, value) { case "boolean": { row += - '' + - '
' + '
" + + ' id="' + + key + + '-checkbox">
"; + "" + + " "; break; } @@ -391,7 +394,7 @@ function createDynamicConfigTabs() { }); $("#advanced-overlay").hide(); - initCheckboxRadioStyle(); + applyCheckboxRadioStyle(); }) .fail(function (data) { apiFailure(data);