-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdetscript.js
executable file
·77 lines (62 loc) · 1.68 KB
/
detscript.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
var suspectList = [1,1,1];
var image1 = document.getElementById("pic1");
var image2 = document.getElementById("pic2");
var image3 = document.getElementById("pic3");
$(".alert").click(function(){
if (sus_out() == 2){
if (suspectList[0]){
alert("As a nurse, she should have put on a mask all the times!");
}
else if (suspectList[1]){
alert("Did you notice he had the most close contacts to Covid patients?");
}
else {
alert("Yes, being an Asian or a Chinese does not mean he is positive! Follow him to the supply room :>");
sessionStorage.setItem("timePassed", timePassed);
window.location.href = "https://www.cs.ryerson.ca/~hhvu/falling.html";
}
}
else {
alert("Eliminate 2 positive staff please!");
}
});
function sus_out(){
var count = 0;
for (var i = 0; i < suspectList.length; i++){
if (suspectList[i] == null){
count += 1
}
}
return count;
}
//UPON CLICK USER IS ABLE TO CHANGE THE IMAGE AND ELIMINATE THE ELEMENT FROM THE ARRAY
function changeImage(){
if (image1.src.match("sus1.png")) {
image1.src = "sus1elim.png";
suspectList[0] = null;
}
else {
image1.src = "sus1.png";
suspectList[0] = 1;
}
}
function changeImage2(){
if (image2.src.match("sus2.png")) {
image2.src = "sus2elim.png";
suspectList[1] = null;
}
else {
image2.src = "sus2.png";
suspectList[1] = 1;
}
}
function changeImage3(){
if (image3.src.match("sus3.png")) {
image3.src = "sus3elim.png";
suspectList[2] = null;
}
else {
image3.src = "sus3.png";
suspectList[2] = 1;
}
}