diff --git a/scripts/pi-hole/js/footer.js b/scripts/pi-hole/js/footer.js index b9160579..5e00d874 100644 --- a/scripts/pi-hole/js/footer.js +++ b/scripts/pi-hole/js/footer.js @@ -63,13 +63,7 @@ function piholeChange(action, duration) //The following three functions allow us to display time until pi-hole is enabled after disabling. //Works between all pages -$( document ).ready(function() { - var countDownTarget = localStorage.getItem("countDownTarget"); - if (countDownTarget != null) - { - setTimeout(countDown,1000); - } -}); + function setCountdownTarget(seconds){ var target = new Date(); @@ -98,10 +92,18 @@ function countDown(){ { ena.text("Enable"); piholeChanged("enabled"); - localStorage.removeItem("countDownTarget") + localStorage.removeItem("countDownTarget"); } } +$( document ).ready(function() { + var countDownTarget = localStorage.getItem("countDownTarget"); + if (countDownTarget != null) + { + setTimeout(countDown,1000); + } +}); + // Handle Enable/Disable $("#pihole-enable").on("click", function(e){ e.preventDefault();