forked from hongsupshin/mturk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_colorblind.js
85 lines (74 loc) · 1.5 KB
/
test_colorblind.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
function StartCBTest() {
$('#screensize_msg').hide();
$('#colorblind_test').show();
}
function CheckColorBlind() {
var answer1 = document.getElementById('colorBlindAns1').value;
var answer2 = document.getElementById('colorBlindAns2').value;
var answer3 = document.getElementById('colorBlindAns3').value;
var answer4 = document.getElementById('colorBlindAns4').value;
var answer5 = document.getElementById('colorBlindAns5').value;
var answer6 = document.getElementById('colorBlindAns6').value;
var perf_CB = 0;
if (answer1) {
if (answer1 == 6) {
perf_CB = 1;
}
}
else {
answer1 = 0;
}
if (answer2) {
if (answer2 == 5) {
perf_CB = perf_CB+1;
}
}
else {
answer2 = 0;
}
if (answer3) {
if (answer3 == 42) {
perf_CB = perf_CB+1;
}
}
else {
answer3 = 0;
}
if (answer4) {
if (answer4 == 7) {
perf_CB = perf_CB+1;
}
}
else {
answer4 = 0;
}
if (answer5) {
if (answer5 == 29) {
perf_CB = perf_CB+1;
}
}
else {
answer5 = 0;
}
if (answer6) {
if (answer6 == 10) {
perf_CB = perf_CB+1;
}
}
else {
answer6 = 0;
}
if (answer1*answer2*answer3*answer4*answer5*answer6 == 0) {
alert('Please fill in all the blanks.');
}
else {
if (perf_CB > 4) {
$('#colorblind_test').hide();
$('#demoPage1').show();
}
else {
alert('I am sorry, you are not qualified to do this task. We appreciate your participation.');
$('#colorblind_test').hide();
}
}
}