This repository was archived by the owner on May 12, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeyboard.js
More file actions
96 lines (73 loc) · 2.08 KB
/
Copy pathKeyboard.js
File metadata and controls
96 lines (73 loc) · 2.08 KB
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
$(window).keydown(function(e){
if(e.which >= 48 && e.which < 58) { // 0-9
if(mainDisplay.currentMode == MODE_DOWNTIMER) {
if(wallTimer.downtimerStatus() == STATUS_RUNNING) {
return;
}
wallTimer.reset();
timerInput += String.fromCharCode(e.which);
var tmIn = timerInput;
if(tmIn.length <= 4) {
mainDisplay.fixDisplay = true;
while(tmIn.length < 4) {
tmIn = '0' + tmIn;
}
var m = (tmIn.charCodeAt(0) - 48) * 10 + (tmIn.charCodeAt(1) - 48);
var s = (tmIn.charCodeAt(2) - 48) * 10 + (tmIn.charCodeAt(3) - 48);
wallTimer.setDowntimer(m*60+s);
mainDisplay.fixDisplayContent = [m, s, 0];
}
}
if(mainDisplay.currentMode == MODE_DEADLINE) {
wallTimer.reset();
dltimerInput += String.fromCharCode(e.which);
var tmIn = dltimerInput;
if(tmIn.length <= 6) {
mainDisplay.fixDisplay = true;
while(tmIn.length < 6) {
tmIn = '0' + tmIn;
}
var h = (tmIn.charCodeAt(0) - 48) * 10 + (tmIn.charCodeAt(1) - 48);
var m = (tmIn.charCodeAt(2) - 48) * 10 + (tmIn.charCodeAt(3) - 48);
var s = (tmIn.charCodeAt(4) - 48) * 10 + (tmIn.charCodeAt(5) - 48);
var curDate = new Date();
var deadline = new Date(curDate.getFullYear(), curDate.getMonth(), curDate.getDate(), h ,m, s);
wallTimer.startByDeadline(deadline);
mainDisplay.fixDisplayContent = [h, m, s];
}
}
}
if(e.which == 32 || e.which == 83) { // Space or S
mainDisplay.startStop();
}
if(e.which == 67) { // C
mainDisplay.modeClock();
}
if(e.which == 68) { // D
mainDisplay.modeDownTimer();
}
if(e.which == 85) { // U
mainDisplay.modeUpTimer();
}
if(e.which == 76) { // L
mainDisplay.modeDeadlineTimer();
}
if(e.which == 77) { // M
mainDisplay.toggleSubSeconds();
}
if(e.which == 65) { // A
mainDisplay.toggleFirstAreaDigits();
}
if(e.which == 82) { // R
mainDisplay.reset();
}
if(e.which == 72) { // H
$('.subdisplay').each (function () {
if($(this).hasClass('subdisplayhidden')) {
$(this).removeClass('subdisplayhidden');
} else {
$(this).addClass('subdisplayhidden');
}
});
}
});