Stop timer when user reenabled blocking early

Signed-off-by: Fabian Preuß <preuss_fabian@gmx.de>
This commit is contained in:
Fabian Preuß
2021-08-10 21:02:05 +02:00
parent a7ec9510b5
commit 48ee7abbe8
+5
View File
@@ -46,6 +46,11 @@ function countDown() {
var target = new Date(parseInt(enaT.html(), 10));
var seconds = Math.round((target.getTime() - Date.now()) / 1000);
//Stop and remove timer when user enabled early
if ($("#pihole-enable").is(":hidden")) {
ena.text("Enable");
return;
}
if (seconds > 0) {
setTimeout(countDown, 1000);
ena.text("Enable (" + secondsTimeSpanToHMS(seconds) + ")");