-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
454 lines (415 loc) · 21 KB
/
index.html
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
<!Doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="keywords" content="">
<meta name="description" content="">
<title>Sports, Exercise Medicine & Lifestyle Institute</title>
<!-- Favicons -->
<link rel="icon" sizes="18x18" type="image/png" href="img/favicon.png">
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Exo:400,600,700" rel="stylesheet">
<!-- Icons -->
<link rel="stylesheet" href="css/fa/font-awesome.min.css" type="text/css">
<style>
#draggable {
width: 150px;
height: 150px;
padding: 0.5em;
}
table {
font-size: 1em;
}
.ui-draggable, .ui-droppable {
background-position: top;
}
</style>
<!-- CSS Implementing Plugins -->
<link rel="stylesheet" href="css/vendor/animate.css" type="text/css">
<link rel="stylesheet" href="css/vendor/lity.min.css" type="text/css">
<link rel="stylesheet" href="css/vendor/owl.carousel.min.css" type="text/css">
<link rel="stylesheet" href="css/vendor/owl.theme.default.min.css" type="text/css">
<!-- CSS Global Compulsory -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css" type="text/css">
<style>
button.big-button {
padding: 0em 1em;
border: 2px solid #7A7A7A;
border-radius: 1em;
background: #EDE7E7;
transform-style: preserve-3d;
transition: all 175ms cubic-bezier(0, 0, 1, 1);
}
button.big-button:hover {
background: #E0CFCF;
transform: translate(0, 0.375em);
z-index: 999;
cursor: pointer;
}
button.big-button:hover::before {
transform: translate3d(0, 0.75em, -1em);
}
button.big-button:active {
transform: translate(0em, 0.75em);
}
</style>
</head>
<body class="t-login s-section-alt" onload="session_id_gen();">
<!-- BEGIN PRELOADER -->
<div class="preloader">
<div class="sk-cube-grid">
<div class="sk-cube sk-cube1"></div>
<div class="sk-cube sk-cube2"></div>
<div class="sk-cube sk-cube3"></div>
<div class="sk-cube sk-cube4"></div>
<div class="sk-cube sk-cube5"></div>
<div class="sk-cube sk-cube6"></div>
<div class="sk-cube sk-cube7"></div>
<div class="sk-cube sk-cube8"></div>
<div class="sk-cube sk-cube9"></div>
</div>
</div>
<!-- END PRELOADER -->
<!-- BEGIN MAIN CONTENT -->
<main id="main">
<!-- BEGIN LOGIN SECTION -->
<section id="login" class="login">
<div class="container">
<div id="step1">
<div class="login__container">
<div style="text-align: center;"> <a href="#"> <img src="img/logo.png" style="max-width: 50%;
margin-bottom: 30px;"> </a> </div>
<div class="login__header s-back-grad" style="margin-bottom:-25px">
<h3><i class="fa fa-play-circle"></i>Digital Trail Making Test</h3>
<p></p>
</div>
</div>
<div class="login__container">
<br>
<h3 style="font-size:20px;font-weight:bold;">Part A</h3>
<br>
<ul class="list-group list-group-flush">
<li class="list-group-item">- When you press start, the numbers 1 to 25 will be randomly scattered on your screen</li>
<li class="list-group-item">- Touch the numbers in order from 1 to 25</li>
<li class="list-group-item">- If you make a mistake, do not stop, continue to complete the test</li>
<li class="list-group-item">- The time (sec) it takes you to touch the numbers in the correct order and any incorrect touches will be recorded</li>
<li class="list-group-item">- Once you have completed Part A, you will move on to Part B</li>
</ul>
<br>
<h3 style="font-size:20px;font-weight:bold;">Part B</h3>
<br>
<ul class="list-group list-group-flush">
<li class="list-group-item">- When you press “Continue to Part B”, the numbers 1 to 13 AND the letters A to L will be randomly scattered on your screen</li>
<li class="list-group-item">- Alternate touching the numbers and letters in order. E.g. 1, A, 2, B, 3, C… 12, L, 13. Your last touch will be number 13</li>
<li class="list-group-item">- If you make a mistake, do not stop, continue to complete the test</li>
<li class="list-group-item">- The time (sec) it takes you to touch the numbers and letters in the correct order and any incorrect touches will be recorded</li>
</ul>
<br>
When you make a CORRECT connection, the number/letter will turn green.<br>
Once you press start your test will begin immediately. You will not be able to start again. <br>
<br>
<div style="text-align:center;">
<button onclick="startA();" type="button" name="button" class="c-btn c-btn--action -big">Start A</button>
</div>
</div>
</div>
<div id="step3" style="display:none;">
<div class="login__container">
<div class="login__header s-back-grad">
<h3><i class="fa fa-check-circle"></i>SECTION A COMPLETED</h3>
<p>Once you click "Start B" the second part of the test will start immediately<br>
Start with numbers first and then letters (e.g. 1, A, 2, B, 3, C...). Your last touch will be 13.</p>
</div>
<div style="text-align:center;"> <br>
<br> <div id="aTimeTakenDiv"></div>
<div id="aErrorsDiv"></div><br>
<br>
<button onclick="startB();" type="submit" name="button" class="c-btn c-btn--action -big">Start B</button>
</div>
</div>
</div>
<div id="step4" style="display:none;">
<div class="login__container">
<div class="login__header s-back-grad">
<h3><i class="fa fa-check-circle"></i>SECTION B COMPLETED</h3>
<p></p>
</div>
<div style="text-align:center;"> <br>
<br> <div id="bTimeTakenDiv"></div>
<div id="bErrorsDiv"></div><br>
<br>
</div>
</div>
</div>
</div>
</div>
<em></em>
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<section id="cnt">
<div class="login__container" id="numbersRandom" style="position:relative;display:none;height:34em;">
<p></p>
<!-- <div id="numbersRandom"> -->
<button id="1" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;left: 25px;"></button>
<button id="2" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;top:130px;left:85px;"></button>
<button id="3" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;left: 134px;"></button>
<button id="4" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;left:190px;top:130px;"></button>
<button id="5" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;right: 64px;"></button>
<button id="6" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;right: 5px;
top: 130px;"></button>
<button id="7" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;top: 172px;"></button>
<button id="8" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;top: 172px;
left: 100px;"></button>
<button id="9" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;top: 172px;
right: 50px;"></button>
<button id="10" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;top: 220px;
right: 20px;"></button>
<button id="11" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;top: 220px;
left: 20px;"></button>
<button id="12" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;top: 220px;"></button>
<button id="13" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;top: 265px;
left: 80px;"></button>
<button id="14" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;top: 265px;
left: 157px;"></button>
<button id="15" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;top: 265px;
right: 58px;"></button>
<button id="16" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;position: absolute;
top: 317px;
left: 20px;"></button>
<button id="17" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;top: 317px;
right: 20px;"></button>
<button id="18" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;top: 317px;"></button>
<button id="19" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;top: 365px;"></button>
<button id="20" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;top: 365px;
left: 109px;"></button>
<button id="21" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;top: 365px;
left: 39px;"></button>
<button id="22" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;position: absolute;
top: 365px;
right: 38px;"></button>
<button id="23" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;top: 411px;"></button>
<button id="24" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;top: 411px;
left: 40px;"></button>
<button id="25" class="big-button" onclick="a_clickCheck(this.value)" style="position:absolute;top: 411px;
right: 40px;"></button>
</div>
<div class="login__container" id="numbersLettersRandom" style="position:relative;display:none;height:34em;">
<p></p>
<button id="letters1" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;left:25px;"></button>
<button id="letters2" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;top:130px;left:85px;"></button>
<button id="letters3" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;left:134px;"></button>
<button id="letters4" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;left:190px;top:130px;"></button>
<button id="letters5" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;right:64px;"></button>
<button id="letters6" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;right:5px;top:130px;"></button>
<button id="letters7" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;top:172px;"></button>
<button id="letters8" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;top:172px;left:100px;"></button>
<button id="letters9" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;top:172px;right:50px;"></button>
<button id="letters10" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;top:220px;right:20px;"></button>
<button id="letters11" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;top:220px;left:20px;"></button>
<button id="letters12" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;top:220px;"></button>
<button id="letters13" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;top:265px;left:80px;"></button>
<button id="letters14" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;top:265px;left:157px;"></button>
<button id="letters15" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;top:265px;right:58px;"></button>
<button id="letters16" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;position:absolute;top:317px;left:20px;"></button>
<button id="letters17" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;top:317px;right:20px;"></button>
<button id="letters18" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;top:317px;"></button>
<button id="letters19" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;top:365px;"></button>
<button id="letters20" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;top:365px;left:109px;"></button>
<button id="letters21" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;top:365px;left:39px;"></button>
<button id="letters22" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;position:absolute;top:365px;right:38px;"></button>
<button id="letters23" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;top:411px;"></button>
<button id="letters24" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;top:411px;left:40px;"></button>
<button id="letters25" class="big-button" onclick="b_clickCheck(this.value)" style="position:absolute;top:411px;right:40px;"></button>
</div>
</div>
</div>
</div>
</section>
<!-- END LOGIN SECTION -->
</main>
<!-- BEGIN MAIN CONTENT -->
<!-- JS FILES -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/plugins.js"></script>
<script type="text/javascript" src="js/custom.js"></script>
<script>
var session_id = null;
var last_clicked = 0;
var highest_number = 0;
var aStartTime;
var aEndTime;
var aErrors = 0;
var bStartTime;
var bEndTime;
var bErrors = 0;
var bPreviousCorrectClick = 0;
function session_id_gen() {
session_id = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
console.debug(session_id);
}
function personalInfo(){
var userName = document.getElementById("userName").value;
var userEmail = document.getElementById("userEmail").value;
if(userName == null || userName == "") {
alert('Please enter your name');
return false;
}
else if(userEmail == null || userEmail == ""){
alert('Please enter your email address');
return false;
}
else {
$.ajax({
type: "POST",
url: "https://omswlahiz7.execute-api.af-south-1.amazonaws.com/dev/personalInfo",
data: JSON.stringify({ 'session_id':session_id,'userName': userName,'userEmail':userEmail }),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg){
console.log('sucess');
document.getElementById("step1").style.display = "none"
document.getElementById("step2").style.display = "block"
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
//alert("Something went wrong");
console.log(errorThrown);
}
});
}
}
function save(){
alert("Thank you for completing the tests")
window.close();
}
///Number Test START
var buttons = new Array(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);
function endNumbersRandom(number){
var aEndTime = new Date().getTime();
var aTimeTaken = (aEndTime - aStartTime)/1000;
document.getElementById("aTimeTakenDiv").innerHTML = "Total time taken: "+aTimeTaken+" seconds"
document.getElementById("aErrorsDiv").innerHTML = "Number of incorrect selections: "+aErrors
console.log('endNumbersRandom - sucess');
document.getElementById("numbersRandom").style.display = "none"
document.getElementById("step3").style.display = "block"
}
function populate(number,randonButton){
console.debug("randonButton",randonButton);
console.log("number",number);
document.getElementById(number).innerHTML = randonButton;
document.getElementById(number).value = randonButton;
document.getElementById(number).setAttribute('name',randonButton);
document.getElementById("numbersRandom").style.display = "block"
}
function startA(){
console.log('startA - sucess');
document.getElementById("step1").style.display = "none"
const numbers = [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];
for(var i = 1 ; i <= numbers.length ; i++ ){
const randonButton = buttons.sort(function() { return 0.5 - Math.random();}).pop();
aStartTime = new Date().getTime();
populate(i,randonButton);
highest_number = i;
}
};
function a_clickCheck(number){
number = parseInt(number);
if(last_clicked + 1 == number && number == 25) {
endNumbersRandom(number);
}
if (last_clicked + 1 == number){
try{
document.getElementsByName(String(last_clicked))[0].style.background = "#EDE7E7";
}
catch(err) {
console.log(err)
}
last_clicked = number;
console.debug('last_clicked');
console.debug(String(last_clicked));
document.getElementsByName(String(last_clicked))[0].style.background = "#bfe6bf";
console.log('last_clicked')
console.log(last_clicked)
console.log('a_clickCheck - sucess');
}
else {
aErrors++
console.log("errors",aErrors)
console.log('a_clickCheck - error');
}
}
///Number Test END
///NumberLetter Test START
var buttonsNumbersletters = new Array(1,"A",2,"B",3,"C",4,"D",5,"E",6,"F",7,"G",8,"H",9,"I",10,"J",11,"K",12,"L",13);
function endNumbersLettersRandom(number){
var bEndTime = new Date().getTime();
var bTimeTaken = (bEndTime - bStartTime)/1000;
document.getElementById("bTimeTakenDiv").innerHTML = "Total time taken: "+ bTimeTaken +" seconds"
document.getElementById("bErrorsDiv").innerHTML = "Number of incorrect selections: "+bErrors
console.log('endNumbersRandom - sucess');
document.getElementById("numbersLettersRandom").style.display = "none"
document.getElementById("step4").style.display = "block"
}
var last_clicked_letters = 0;
var highest_number_letters = 0;
var numbersLetters = [1,"A",2,"B",3,"C",4,"D",5,"E",6,"F",7,"G",8,"H",9,"I",10,"J",11,"K",12,"L",13];
function populateLetters(number,randonButtonLetters){
console.log(+String(number))
uniqueId = 'letters'+String(number);
console.debug('setting this = '+uniqueId);
console.debug('equal to this = '+randonButtonLetters);
document.getElementById(uniqueId).innerHTML = randonButtonLetters;
document.getElementById(uniqueId).value = randonButtonLetters;
document.getElementById(uniqueId).setAttribute('name','b_'+randonButtonLetters);
}
function startB(){
bStartTime = new Date().getTime();
console.log('startB - sucess');
document.getElementById("step3").style.display = "none"
document.getElementById("numbersLettersRandom").style.display = "block";
for(var i = 1 ; i <= numbersLetters.length ; i++ ){
const randonButtonLetters = buttonsNumbersletters.sort(function() { return 0.5 - Math.random();}).pop();
console.log(buttonsNumbersletters)
console.warn(randonButtonLetters);
populateLetters(i,randonButtonLetters);
highest_number_letters = 13;}
};
function b_clickCheck(numberLetter){
console.log('What was clicked');
console.log(String(numberLetter));
console.log('What should have been clicked');
console.log(String(numbersLetters[last_clicked_letters]));
if(String(numbersLetters[last_clicked_letters]) == String(numberLetter) && numberLetter == highest_number_letters) {
endNumbersLettersRandom(numberLetter);
}
if (String(numbersLetters[last_clicked_letters]) == String(numberLetter)){
try{
document.getElementsByName('b_'+String(numbersLetters[last_clicked_letters-1]))[0].style.background = "#EDE7E7";
}
catch(err) {
console.log(err)
}
document.getElementsByName('b_'+String(numbersLetters[last_clicked_letters]))[0].style.background = "#bfe6bf";
last_clicked_letters = last_clicked_letters + 1
console.log('bclickCheck - sucess');
console.log('What is next',numbersLetters[last_clicked_letters])
//document.getElementsByName('letters'+numbersLetters[last_clicked_letters]).style.color = "white";
}
else {
bErrors++
console.log("bERrors",bErrors)
//Restyle to nice looking modal that does not stop user interacting with page and disappears after 1 second
console.log('bclickCheck - sucess');
}
}
///NumberLetter Test END
</script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$('.drag').draggable();
</script>
</body>
</html>