Spaces:
Running
Running
now please review everything and fix what are need to be fixed
Browse files- index.html +5 -8
index.html
CHANGED
|
@@ -121,10 +121,10 @@
|
|
| 121 |
updateTimerDisplay(); // Update display mode
|
| 122 |
}
|
| 123 |
function updateTimer() {
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
elapsedTime = time;
|
| 129 |
document.getElementById('live-clock').textContent = formatTime(time);
|
| 130 |
}
|
|
@@ -220,8 +220,7 @@ function updateTimer() {
|
|
| 220 |
updateLiveClock();
|
| 221 |
}
|
| 222 |
}
|
| 223 |
-
|
| 224 |
-
// Format time function
|
| 225 |
function formatTime(time) {
|
| 226 |
const totalSeconds = Math.floor(time / 1000);
|
| 227 |
const seconds = totalSeconds % 60;
|
|
@@ -234,7 +233,6 @@ function updateTimer() {
|
|
| 234 |
seconds.toString().padStart(2, '0')
|
| 235 |
].join(':');
|
| 236 |
}
|
| 237 |
-
|
| 238 |
// Update live clock
|
| 239 |
function updateLiveClock() {
|
| 240 |
if (!isRunning && elapsedTime === 0) {
|
|
@@ -254,7 +252,6 @@ function updateTimer() {
|
|
| 254 |
document.getElementById('live-date').textContent = dateStr;
|
| 255 |
}
|
| 256 |
}
|
| 257 |
-
|
| 258 |
// Update live clock immediately and every second
|
| 259 |
updateLiveClock();
|
| 260 |
setInterval(updateLiveClock, 1000);
|
|
|
|
| 121 |
updateTimerDisplay(); // Update display mode
|
| 122 |
}
|
| 123 |
function updateTimer() {
|
| 124 |
+
elapsedTime = Date.now() - startTime;
|
| 125 |
+
updateDisplay(elapsedTime);
|
| 126 |
+
}
|
| 127 |
+
function updateDisplay(time) {
|
| 128 |
elapsedTime = time;
|
| 129 |
document.getElementById('live-clock').textContent = formatTime(time);
|
| 130 |
}
|
|
|
|
| 220 |
updateLiveClock();
|
| 221 |
}
|
| 222 |
}
|
| 223 |
+
// Format time function
|
|
|
|
| 224 |
function formatTime(time) {
|
| 225 |
const totalSeconds = Math.floor(time / 1000);
|
| 226 |
const seconds = totalSeconds % 60;
|
|
|
|
| 233 |
seconds.toString().padStart(2, '0')
|
| 234 |
].join(':');
|
| 235 |
}
|
|
|
|
| 236 |
// Update live clock
|
| 237 |
function updateLiveClock() {
|
| 238 |
if (!isRunning && elapsedTime === 0) {
|
|
|
|
| 252 |
document.getElementById('live-date').textContent = dateStr;
|
| 253 |
}
|
| 254 |
}
|
|
|
|
| 255 |
// Update live clock immediately and every second
|
| 256 |
updateLiveClock();
|
| 257 |
setInterval(updateLiveClock, 1000);
|