@@ -20,6 +20,8 @@ const currentIntervalText = document.getElementById("currentIntervalText");
20
20
const playPauseButton = document . getElementById ( "playPauseButton" ) ;
21
21
const playPauseIcon = playPauseButton . getElementById ( "combo-button-icon" ) ;
22
22
const playPauseIconPressed = playPauseButton . getElementById ( "combo-button-icon-press" ) ;
23
+ const restartSkipButton = document . getElementById ( "restartSkipButton" ) ;
24
+ const restartSkipIcon = restartSkipButton . getElementById ( "combo-button-icon" ) ;
23
25
24
26
25
27
const totalFlowInSeconds = 5 ; //1500;
@@ -33,6 +35,7 @@ let counting = false;
33
35
let countdownSeconds = totalFlowInSeconds ;
34
36
let flow = true ; //used to toggle between flow intervals and breaks
35
37
let currentIntervalTime ;
38
+ let currentIntervalText ;
36
39
let currentSprint = 1 ;
37
40
38
41
//setup clock
@@ -53,6 +56,10 @@ playPauseButton.onactivate = (evt) => {
53
56
counting ? pause ( ) : play ( ) ;
54
57
}
55
58
59
+ restartSkipButton . onactivate = ( evt ) => {
60
+ counting ? restart ( ) : skip ( ) ;
61
+ }
62
+
56
63
display . onchange = ( ) => { // optimize battery life
57
64
display . on ? style ( ) : stopStyle ( ) ;
58
65
}
@@ -149,18 +156,33 @@ function setupNextInterval(nextIntervalSeconds, text){
149
156
currentIntervalText . text = text ;
150
157
//set the correct seconds for progress
151
158
currentIntervalTime = countdownSeconds = nextIntervalSeconds ;
159
+ currentIntervalText = text ;
152
160
}
153
161
154
162
function play ( ) {
155
163
counting = true ;
156
164
playPauseIcon . image = "pause.png" ;
157
165
playPauseIconPressed . image = "pause_press.png" ;
166
+
167
+ restartSkipIcon . image = "reset.png" ;
158
168
}
159
169
160
170
function pause ( ) {
161
- counting = false
171
+ counting = false ;
162
172
playPauseIcon . image = "play.png" ;
163
173
playPauseIconPressed . image = "play_press.png" ;
174
+
175
+ restartSkipIcon . image = "skip.png" ;
176
+ }
177
+
178
+ function skip ( ) {
179
+ counting = false ;
180
+ nextSprint ( ) ;
181
+ }
182
+
183
+ function restart ( ) {
184
+ pause ( ) ;
185
+ setupNextInterval ( currentIntervalTime , currentIntervalText ) ;
164
186
}
165
187
166
188
function formatCountdown ( seconds ) {
0 commit comments