Skip to content

Commit 5466a98

Browse files
committed
fix: invert colors every second in the countdown
1 parent 1cc80de commit 5466a98

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

asset/javascript/TimeController.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,6 @@ function TimerController(reference) {
206206
preventOpenCountdown = false;
207207
lastTimerStatus = TimerStatus.STOPPED;
208208

209-
reference.classList.add('inverted');
210-
countdownContainerReference.classList.add('inverted');
211209
showDefaultButtons();
212210
playStopSound();
213211
clearInterval(timerIntervalId);
@@ -251,6 +249,16 @@ function TimerController(reference) {
251249

252250
countdownContainerReference.classList.toggle('even');
253251
countdownContainerReference.classList.toggle('odd');
252+
253+
if (seconds % 2 === 0) {
254+
reference.classList.add('inverted');
255+
countdownContainerReference.classList.add('inverted');
256+
257+
return;
258+
}
259+
260+
reference.classList.remove('inverted');
261+
countdownContainerReference.classList.remove('inverted');
254262
}
255263

256264
function stop() {

0 commit comments

Comments
 (0)