🤖 Plandex → apply pending changes
✏️ Fix errors and improve functionality in public/script.js
This commit is contained in:
parent
d37602ef35
commit
1369d1cfbb
1 changed files with 18 additions and 4 deletions
|
@ -33,8 +33,22 @@ document.getElementById('bustGhost').addEventListener('click', function() {
|
|||
historyList.appendChild(newTime);
|
||||
}
|
||||
|
||||
function recordChallengeTime(time) {
|
||||
function recordTime(time) {
|
||||
const historyList = document.getElementById('historyList');
|
||||
const newTime = document.createElement('li');
|
||||
newTime.textContent = `Attempt: ${time} ms - ${Math.abs(2000 - time)} ms off`;
|
||||
resultsList.appendChild(newTime);
|
||||
newTime.textContent = `Time: ${time} ms`;
|
||||
historyList.appendChild(newTime);
|
||||
}
|
||||
|
||||
document.getElementById('timerButton').addEventListener('click', function() {
|
||||
if (!timerRunning) {
|
||||
startTime = Date.now();
|
||||
timerRunning = true;
|
||||
this.textContent = 'Stop Timer';
|
||||
} else {
|
||||
elapsedTime = Date.now() - startTime;
|
||||
timerRunning = false;
|
||||
this.textContent = 'Start Timer';
|
||||
recordTime(elapsedTime);
|
||||
}
|
||||
});
|
Loading…
Reference in a new issue