-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
executable file
·293 lines (256 loc) · 6.94 KB
/
script.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
var answer1 = "111210211011"; // time zones
var answer2 = "012205613"; // scavenger hunt
var answer3 = "5112"; // book
var answer4 = "eye3"; // arduino
var answer5 = "54531"; // count items
var answer6 = "Green"; // thermometer
//var answer1 = ""; // scavenger hunt
//var answer2 = ""; // time zones
//var answer3 = ""; // book
//var answer4 = "eye3"; // arduino
//var answer5 = ""; // thermometer
//var answer6 = "Green"; // thermometer
var firstPage = $("#intro");
var startBtn = $(".start-btn.beg");
var wrongPg = $(".wrong-page");
var endPg = $(".end-page");
var clue1 = $("#clue-1");
var clue2 = $("#clue-2");
var clue3 = $("#clue-3");
var clue4 = $("#clue-4");
var clue5 = $("#clue-5");
var clue6 = $("#clue-6");
var lock1 = $(".lock-1");
var lock2 = $(".lock-2");
var lock3 = $(".lock-3");
var lock4 = $(".lock-4");
var pass1 = $("#password1");
var pass2 = $("#password2");
var pass3 = $("#password3");
var pass4 = $("#password4");
var pass5 = $("#password5");
var pass6 = $("#password6");
var clone = $(".clone");
endPg.hide();
wrongPg.hide();
clue1.hide();
clue2.hide();
clue3.hide();
clue4.hide();
clue5.hide();
clue6.hide();
lock2.hide();
lock3.hide();
lock4.hide();
$(".laser-beam").hide();
//startBtn.hide();
startBtn.click(function () {
firstPage.fadeOut("fast", function () {
clue1.fadeIn("slow");
});
});
$(".trigger").click(function () {
$(".modal-wrapper").toggleClass("open");
});
//1. Password
$("#clue-1 i").click(function () {
if (pass1.val() == answer1) {
clue1.fadeOut("fast", function () {
clue2.fadeIn("slow");
});
} else {
$("#clue-1 div.error").removeAttr("hidden");
}
});
$(pass1).keypress(function (e) {
if (e.which == 13) {
$("#clue-1 #pass-submit").click();
} else {
$("#clue-1 div.error").attr("hidden", true);
}
});
$("#clue-2 i").click(function () {
if (pass2.val() == answer2) {
clue2.fadeOut("fast", function () {
clue3.fadeIn("slow");
});
} else {
$("#clue-2 div.error").removeAttr("hidden");
}
});
$(pass2).keypress(function (e) {
if (e.which == 13) {
$("#clue-2 #pass-submit").click();
} else {
$("#clue-2 div.error").attr("hidden", true);
}
});
$("#clue-3 i").click(function () {
if (pass3.val() == answer3) {
clue3.fadeOut("fast", function () {
lock4.fadeIn("slow");
});
} else {
$("#clue-3 div.error").removeAttr("hidden");
}
});
$(pass3).keypress(function (e) {
if (e.which == 13) {
$("#clue-3 #pass-submit").click();
} else {
$("#clue-3 div.error").attr("hidden", true);
}
});
//4. Retinal Scan
$(".drag-eye").draggable();
$("#dropzone").droppable({
drop: function (event, ui) {
$(".lock-4 div.error").attr("hidden", true);
$(".laser-beam").show();
$(".laser-beam").css("animation-play-state", "running");
setTimeout(function () {
$(".laser-beam").hide();
$(".laser-beam").css("animation-play-state", "paused");
if (ui.draggable.attr("id") == answer4) {
lock4.fadeOut("fast", function () {
clue5.fadeIn("slow");
});
} else {
$(".lock-4 div.error").removeAttr("hidden");
}
}, 4000);
},
over: function (event, ui) {
$(this).css("background", "#d00909");
},
out: function (event, ui) {
$(this).css(
"background",
"radial-gradient(circle, rgba(208,9,9,1) 0%, rgba(65,65,65,1) 100%)"
);
$(".laser-beam").hide();
$(".laser-beam").css("animation-play-state", "paused");
},
});
$("#clue-5 i").click(function () {
if (pass5.val() == answer5) {
clue5.fadeOut("fast", function () {
clue6.fadeIn("slow");
});
} else {
$("#clue-5 div.error").removeAttr("hidden");
if (pass5.val()
&& pass5.val().substring(1) == answer5.substring(1)
&& pass5.val().charAt(0) == 4)
{
$("#clue-5 div.error-hint").removeAttr("hidden");
}
}
});
$(pass5).keypress(function (e) {
if (e.which == 13) {
$("#clue-5 #pass-submit").click();
} else {
$("#clue-5 div.error").attr("hidden", true);
$("#clue-5 div.error-hint").attr("hidden", true);
}
});
$("#clue-6 i").click(function () {
if (pass6.val().toLowerCase() == answer6.toLowerCase()) {
clue6.fadeOut("fast", function () {
endPg.fadeIn("slow");
});
} else {
$("#clue-6 div.error").removeAttr("hidden");
}
});
$(pass6).keypress(function (e) {
if (e.which == 13) {
$("#clue-6 #pass-submit").click();
} else {
$("#clue-6 div.error").attr("hidden", true);
}
});
//2. Key Card
function makeId2(perId, perObj) {
//OBJECT REQUIRES: name, img, qr, email
var newDiv = $("<div id='" + perId + "'>");
newDiv.appendTo("#ids");
var divId = "#" + perId + "";
$(divId).html($("#cam").html());
$(divId + " h2").text(perObj.name);
$(divId + " .email").text(perObj.email);
$(divId + " img.photo").attr("src", perObj.img);
$(divId + " img.qr").attr("src", perObj.qr);
$(divId).draggable();
}
var cam = {
name: "Cameron Doe-Nut",
img: "http://www.whichfaceisreal.com/fakeimages/image-2019-02-18_050528.jpeg",
qr: "https://chart.googleapis.com/chart?cht=qr&chl=Cameron%20Doe-Nut&chs=180x180&choe=UTF-8&chld=L|2",
email: "CameronDoeNut2",
};
makeId2("rob", {
name: "Robert McKinley",
img: "http://www.whichfaceisreal.com/fakeimages/image-2019-02-18_011037.jpeg",
qr: "https://chart.googleapis.com/chart?cht=qr&chl=Robert%20McKinley&chs=180x180&choe=UTF-8&chld=L|2",
email: "RobertMcKinely66",
});
makeId2("john", {
name: "John Richards",
img: "http://www.whichfaceisreal.com/fakeimages/image-2019-02-18_030313.jpeg",
qr: "https://chart.googleapis.com/chart?cht=qr&chl=John%20Richards&chs=180x180&choe=UTF-8&chld=L|2",
email: "John.Richards",
});
$("#cam h2").text(cam.name);
$("#cam .email").text(cam.email);
$("#cam img.photo").attr("src", cam.img);
$("#cam img.qr").attr("src", cam.qr);
$("#cam").draggable();
$("#id-reader").droppable({
drop: function (event, ui) {
var droppedId = ui.draggable.attr("id");
if (droppedId == "rob" && $("#" + droppedId + " #soc-sec").val() == 1313) {
$("#id-reader").addClass("idplaced");
lock2.fadeOut("fast", function () {
lock3.fadeIn("slow");
});
} else {
$("#id-reader").removeClass("idhover");
lock2.fadeOut("fast", function () {
wrongPg.fadeIn("slow");
});
}
},
over: function (event, ui) {
$("#id-reader").addClass("idhover");
},
out: function (event, ui) {
$("#id-reader").removeClass("idhover");
},
});
//3. Fingerprint
function finishedDrawing() {
var drawStatus = animation.getStatus();
if (drawStatus === "end") {
lock3.fadeOut("fast", function () {
lock4.fadeIn("slow");
});
}
}
var options = {
duration: 180,
type: "scenario",
animTimingFunction: Vivus.EASE_OUT,
};
var animation = new Vivus("fingerprint", options, finishedDrawing);
animation.stop();
lock3.on("mousedown", function () {
animation.reset();
clone.addClass("active");
animation.play(1);
});
lock3.on("mouseup", function () {
clone.removeClass("active");
animation.play(-1);
});