-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathkeyboard.js
117 lines (97 loc) · 3.5 KB
/
keyboard.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
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
document.onkeydown = function (e) {
if(e.key=="ArrowRight")
{
chrome.storage.sync.get(["page"], function(result)
{
if(result.page==1)
{
$("#mainDiv").css('display','none');
$("#qsre").css({"display":"flex","flex-direction":"column"});
chrome.storage.sync.set({page:2}, function() {});
}
else if(result.page==2)
{
$("#qsre").css('display','none');
$("#choose").css({"display":"flex","flex-direction":"column"});
chrome.storage.sync.set({page:3}, function() {});
}
})
}
else if(e.key=="ArrowLeft")
{
chrome.storage.sync.get(["page"], function(result)
{
if(result.page==3)
{
$("#choose").css('display','none');
$("#qsre").css({"display":"flex","flex-direction":"column"});
chrome.storage.sync.set({page:2}, function() {});
}
else if(result.page==2)
{
$("#qsre").css('display','none');
$("#mainDiv").css({"display":"block"});
chrome.storage.sync.set({page:1}, function() {});
}
else if(result.page==5 || result.page==6 || result.page==7)
{
$("#bldRes1").css('display','none');
$("#cct").css('display','none');
$("#ishihara").css('display','none');
$("#qsre").css({"display":"flex","flex-direction":"column"});
chrome.storage.sync.set({page:2}, function() {});
}
})
}
else if(e.key.toLowerCase()=="x")
{
window.close();
}
else if(e.key.toLowerCase()=="i")
{
$("#mainDiv").css('display','none');
$("#qsre").css('display','none');
$("#choose").css('display','none');
$("#bldRes1").css('display','none');
$("#cct").css('display','none');
$("#ishihara").css({"display":"flex","flex-direction":"column"});
setVal("red-green");
chrome.storage.sync.set({ishNextVal:1}, function() {});
chrome.storage.sync.set({score1:0}, function() {});
chrome.storage.sync.set({score2:0}, function() {});
chrome.storage.sync.set({page:7}, function() {});
$("#ishNum").focus();
}
else if(e.key.toLowerCase()=="c")
{
$("#mainDiv").css('display','none');
$("#qsre").css('display','none');
$("#choose").css('display','none');
$("#bldRes1").css('display','none');
$("#ishihara").css('display','none');
$("#cct").css({"display":"flex","flex-direction":"column"});
setCamVal("red-green");
chrome.storage.sync.set({cctNextVal:1}, function() {});
chrome.storage.sync.set({score1:0}, function() {});
chrome.storage.sync.set({score2:0}, function() {});
chrome.storage.sync.set({page:6}, function() {});
}
else if(e.key.toLowerCase()=="s")
{
$("#mainDiv").css('display','none');
$("#qsre").css('display','none');
$("#cct").css('display','none');
$("#bldRes1").css('display','none');
$("#ishihara").css('display','none');
$("#choose").css({"display":"flex","flex-direction":"column"});
chrome.storage.sync.set({page:3}, function() {});
}
else if(e.key.toLowerCase()=="w")
{
document.getElementById("click_to_record").click();
}
else if(e.key.toLowerCase()=="h")
{
document.getElementById("speech_help").click();
}
};