-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.js
37 lines (33 loc) · 1.11 KB
/
settings.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const focusTimeInput = document.querySelector("#focusTime");
const breakTimeInput = document.querySelector("#breakTime");
const pauseBtn = document.querySelector(".pause");
focusTimeInput.value = localStorage.getItem("focusTime");
breakTimeInput.value = localStorage.getItem("breakTime");
document.querySelector("form").addEventListener("submit", (e) => {
e.preventDefault();
localStorage.setItem("focusTime", focusTimeInput.value);
localStorage.setItem("breakTime", breakTimeInput.value);
});
document.querySelector(".reset").addEventListener("click", () => {
startBtn.style.transform = "scale(1)";
clearTimeout(initial);
setProgress(0);
mindiv.textContent = 0;
secdiv.textContent = 0;
});
pauseBtn.addEventListener("click", () => {
if (paused === undefined) {
return;
}
if (paused) {
paused = false;
initial = setTimeout("decremenT()", 60);
pauseBtn.textContent = "pause";
pauseBtn.classList.remove("resume");
} else {
clearTimeout(initial);
pauseBtn.textContent = "resume";
pauseBtn.classList.add("resume");
paused = true;
}
});