GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — pomodoro-timer/main.js at main · ankyBot/pomodoro-timer

Expand file tree

/

main.js

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
167 lines (132 loc) · 3.71 KB
/

main.js

Copy path

File metadata and controls

167 lines (132 loc) · 3.71 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
let stopTime = 0;
let myVal = 0;
var counter;
let breakTime = 5;
var sessionTime = 25;
let tempTime = sessionTime;
let myTestVal = 0;
//adding audio for session start and end
var x = document.getElementById("myAudio-1");
var y = document.getElementById("myAudio-2");
var sessionEndVoice = document.getElementById("myVoice-1");
var sessionStartVoice = document.getElementById("myVoice-2");
//input control operations
document
.getElementById("left_up_arrow")
.addEventListener("click", incrementBreakTime);
function incrementBreakTime() {
// breakTime = breakTime + 1;
breakTime = Math.ceil(breakTime) + 1;
document.getElementById("break-length").innerText = `${Math.ceil(breakTime)}`;
clearInterval(myVal);
}
document
.getElementById("left_down_arrow")
.addEventListener("click", decrementBreakTime);
function decrementBreakTime() {
clearInterval(myVal);
if (breakTime > 0) {
breakTime = Math.ceil(breakTime) - 1;
}
document.getElementById("break-length").innerText = `${Math.ceil(breakTime)}`;
}
document
.getElementById("right_up_arrow")
.addEventListener("click", incrementSessionTime);
function incrementSessionTime() {
tempTime = Math.ceil(tempTime) + 1;
document.getElementById("session-length").innerText = `${Math.ceil(
tempTime
)}`;
clearInterval(myVal);
}
document
.getElementById("right_down_arrow")
.addEventListener("click", decrementSessionTime);
function decrementSessionTime() {
if (tempTime > 0) {
// tempTime--;
tempTime = Math.ceil(tempTime) - 1;
}
document.getElementById("session-length").innerText = `${Math.ceil(
tempTime
)}`;
clearInterval(myVal);
}
//Timer function
function mainTimer(value = 0) {
let time = value;
counter++;
console.log(counter);
myVal = setInterval(timer, 1000);
function timer() {
let min = Math.floor(time / 60);
let sec = time % 60;
if (min < 10) {
min = `0${min}`;
}
if (sec < 10) {
sec = `0${sec}`;
}
if (min == 0 && sec == 0) {
clearInterval(myVal);
if (counter % 2 != 0) {
x.play();
// sessionEndVoice.play();
redBackground();
mainTimer(convertInSec(breakTime));
} else {
y.play();
// sessionStartVoice.play();
greenBackground();
mainTimer(convertInSec(tempTime));
}
}
document.getElementById("countDownTimer").innerHTML = `${min}:${sec}`;
time--;
stopTime = time;
console.log(stopTime);
}
}
//Timer starter function
document.getElementById("start").addEventListener("click", starterFun);
function starterFun() {
clearInterval(myVal);
y.play();
// sessionStartVoice.play();
greenBackground();
mainTimer(convertInSec(tempTime));
}
//Timer reset function
document.getElementById("reset").addEventListener("click", resetFun);
function resetFun() {
clearInterval(myVal);
// mainTimer(convertInSec(sessionTime));
location.reload();
}
//Timer stoper function
document.getElementById("stop").addEventListener("click", stoperFun);
function stoperFun() {
counter = 0;
if (stopTime >= 1) {
tempTime = stopTime / 60;
}
noBackground();
clearInterval(myVal);
}
function convertInSec(val) {
// if (val >= 1) {
// return val * 60;
// }
return val * 60;
}
//function for change background color
function redBackground() {
document.getElementById("main").style.backgroundColor = "red";
}
function greenBackground() {
document.getElementById("main").style.backgroundColor = "green";
}
function noBackground() {
document.getElementById("main").style.backgroundColor = "rgb(96, 138, 138)";
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.