-
Notifications
You must be signed in to change notification settings - Fork 0
/
index-core.js
45 lines (42 loc) · 1.54 KB
/
index-core.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
38
39
40
41
42
43
44
document.addEventListener("keydown", function (event) {
if (event.defaultPrevented) {
return;
}
switch (event.key) {
case " ":
if (running == true) {
btnStop_onClick();
break;
} else if (timePaused != 0) {
btnResume_onClick();
break;
} else {
btnStart_onClick();
break;
}
break;
case "Esc":
case "Escape":
if (running == true) {
btnStop_onClick();
} else {
btnReset_onClick();
}
break;
default:
return;
}
event.preventDefault();
}, true);
function window_onLoad() {
document.getElementById("dropdownUser").addEventListener("change", loadUserData);
document.getElementById("dropdownManualTime").addEventListener("change", function () { updateSession("time", "manual"); });
document.getElementById("dropdownManualActivity").addEventListener("change", function () { updateSession("activity", "manual"); });
document.getElementById("dropdownTimerActivity").addEventListener("change", function () { updateSession("activity", "manual"); });
document.getElementById("pushSessionData").addEventListener("click", pushSessionData);
document.getElementById("timeDisplay").addEventListener("change", function () { toggleTimeframe() })
populateUsers();
populateTimer();
generateChart();
//window.setInterval("stopwatch()", refresh);
}