fix: reset does not make button pause into start

This commit is contained in:
tx 2025-07-04 17:32:31 +00:00
parent e73815c79b
commit 7df3f7f41c

View file

@ -1,59 +1,59 @@
<html> <html>
<head> <head>
<title>a simple pomodoro huhu ba-ka!</title> <title>a simple pomodoro huhu ba-ka!</title>
<style> <style>
body { body {
background-color: #222222; background-color: #222222;
color: #ffffff; color: #ffffff;
font-family: monospace; font-family: monospace;
} }
button { button {
font-family: monospace; font-family: monospace;
font-size: 24px; font-size: 24px;
border-radius: none; border-radius: none;
border: none; border: none;
padding: 5px 10px; padding: 5px 10px;
} }
.box-pomodoro { .box-pomodoro {
width: 320px; width: 320px;
padding: 10px; padding: 10px;
margin: auto; margin: auto;
top: 50%; top: 50%;
left: 50%; left: 50%;
position: absolute; position: absolute;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
text-align: center; text-align: center;
background-color: #555555; background-color: #555555;
} }
#type { #type {
font-size: 36pt; font-size: 36pt;
margin: 0; margin: 0;
} }
#timer { #timer {
margin-top: 15px; margin-top: 15px;
font-size: 48pt; font-size: 48pt;
} }
</style> </style>
<script async="" defer="" src="https://xa.ba-ka.org/tracker.js" data-website-id="cm9iohk0l025fmqg5xf2gxhy4"> <script async="" defer="" src="https://xa.ba-ka.org/tracker.js" data-website-id="cm9iohk0l025fmqg5xf2gxhy4">
</script> </script>
</head> </head>
<body> <body>
<div class="box-pomodoro"> <div class="box-pomodoro">
<h3>pomodoro</h3> <h3>pomodoro</h3>
<h2 id="type">focus</h2> <h2 id="type">focus</h2>
<h1 id="timer">25:00</h1> <h1 id="timer">25:00</h1>
<button id="startpause" onclick="startpause()">pause</button> <button id="startpause" onclick="startpause()">start</button>
<button id="reset" onclick="reset()">reset</button> <button id="reset" onclick="reset()">reset</button>
<div style="margin-bottom: 20px;"></div> <div style="margin-bottom: 20px;"></div>
</div> </div>
<script> <script>
let isRunning = false; let isRunning = false;
let buttonStartPause = document.getElementById("startpause"); let buttonStartPause = document.getElementById("startpause");
let buttonReset = document.getElementById("reset"); let buttonReset = document.getElementById("reset");
let textTimer = document.getElementById("timer"); let textTimer = document.getElementById("timer");
@ -117,6 +117,8 @@
function reset() function reset()
{ {
buttonStartPause.innerHTML = "start";
clearInterval(timerInterval); clearInterval(timerInterval);
isRunning = false; isRunning = false;
isFocusSession = true; isFocusSession = true;
@ -125,7 +127,7 @@
updateDisplayTimer(); updateDisplayTimer();
console.log("reset pomodoro"); console.log("reset pomodoro");
} }
</script> </script>
</body> </body>