Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +11 -9
templates/index.html
CHANGED
|
@@ -57,16 +57,18 @@
|
|
| 57 |
|
| 58 |
function updateTimerOutput() {
|
| 59 |
var timerOutput = document.getElementById("timer_output");
|
| 60 |
-
var remaining = parseInt(document.getElementById("seconds").value);
|
| 61 |
var interval = setInterval(function() {
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
| 70 |
}
|
| 71 |
</script>
|
| 72 |
|
|
|
|
| 57 |
|
| 58 |
function updateTimerOutput() {
|
| 59 |
var timerOutput = document.getElementById("timer_output");
|
|
|
|
| 60 |
var interval = setInterval(function() {
|
| 61 |
+
fetch("/get_timer")
|
| 62 |
+
.then(response => response.json())
|
| 63 |
+
.then(data => {
|
| 64 |
+
if (data.message) {
|
| 65 |
+
timerOutput.innerText = data.message;
|
| 66 |
+
}
|
| 67 |
+
if (data.message === "Time's up!") {
|
| 68 |
+
clearInterval(interval);
|
| 69 |
+
}
|
| 70 |
+
});
|
| 71 |
+
}, 1000); // Poll every second to get the timer update
|
| 72 |
}
|
| 73 |
</script>
|
| 74 |
|