break: change the "stop" command to "reset"
- change stop channel to reset channel
- create ResetPomodoro function
- broadcast reset message to all clients
- rename stop button to reset button in index.html
🤖
This commit is contained in:
parent
bc3a306c00
commit
ffc6913344
4 changed files with 28 additions and 12 deletions
10
index.html
10
index.html
|
@ -26,7 +26,7 @@
|
|||
<!-- Buttons to start, pause/resume, and stop the timer -->
|
||||
<button id="startButton">Start</button>
|
||||
<button id="pauseResumeButton" style="display: none;">Pause</button>
|
||||
<button id="stopButton" style="display: none;">Stop</button>
|
||||
<button id="resetButton" style="display: none;">Reset</button>
|
||||
|
||||
<script>
|
||||
var ws = new WebSocket("ws://localhost:8080/ws");
|
||||
|
@ -66,7 +66,7 @@
|
|||
// Hide start button and show pause/resume and stop buttons
|
||||
document.getElementById("startButton").style.display = "none";
|
||||
document.getElementById("pauseResumeButton").style.display = "inline-block";
|
||||
document.getElementById("stopButton").style.display = "inline-block";
|
||||
document.getElementById("resetButton").style.display = "inline-block";
|
||||
|
||||
// Set the pause/resume button to show "Pause" initially
|
||||
isPaused = false;
|
||||
|
@ -88,14 +88,14 @@
|
|||
}
|
||||
});
|
||||
|
||||
// Stop Button Click Event
|
||||
document.getElementById("stopButton").addEventListener("click", function () {
|
||||
// Reset Button Click Event
|
||||
document.getElementById("resetButton").addEventListener("click", function () {
|
||||
ws.send(JSON.stringify({command: "stop"}));
|
||||
|
||||
// Reset buttons after stopping
|
||||
document.getElementById("startButton").style.display = "inline-block";
|
||||
document.getElementById("pauseResumeButton").style.display = "none";
|
||||
document.getElementById("stopButton").style.display = "none";
|
||||
document.getElementById("resetButton").style.display = "none";
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue