Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ <h3 id="progress">Progress: 0% (0/0 tasks completed)</h3>
<h2 id="time">00:00:00</h2>
<button onclick="startTimer()">Start</button>
<button onclick="stopTimer()">Stop</button>
<!-- Fix #36: Added Reset button to clear timer without page refresh -->
<button onclick="resetTimer()">Reset</button>
</div>
</div>

Expand Down
8 changes: 7 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ function updateProgress() {
`Progress: ${percent}% (${doneTasks}/${total} tasks completed)`;
}



// ⏱️ Timer
let seconds = 0;
Expand All @@ -86,6 +85,13 @@ function stopTimer() {
timer = null;
}

// Fix #36: Added resetTimer so users don't need a full page refresh to reset
function resetTimer() {
stopTimer();
seconds = 0;
updateTime();
}

function updateTime() {
let hrs = Math.floor(seconds / 3600);
let mins = Math.floor((seconds % 3600) / 60);
Expand Down