From 1369d1cfbb244e4a9ed73ca3ea5d31cd01d20239 Mon Sep 17 00:00:00 2001 From: Jason McPheron Date: Sun, 21 Apr 2024 10:12:02 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Plandex=20=E2=86=92=20apply=20pe?= =?UTF-8?q?nding=20changes=20=20=20=E2=9C=8F=EF=B8=8F=20=20Fix=20errors=20?= =?UTF-8?q?and=20improve=20functionality=20in=20public/script.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/script.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/public/script.js b/public/script.js index 8086b9f..567ce3b 100644 --- a/public/script.js +++ b/public/script.js @@ -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); -} \ No newline at end of file + 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); + } +}); \ No newline at end of file