-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComplete.html
More file actions
87 lines (76 loc) · 2.9 KB
/
Complete.html
File metadata and controls
87 lines (76 loc) · 2.9 KB
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
<!DOCTYPE html>
<html>
<head>
<title>Thank you</title>
<meta charset="UTF-8">
<!-- Set the favicon logo -->
<link rel="icon" href="./Assets/Logo.png" type="image/x-icon" />
<!-- Import the stylesheet -->
<link rel="stylesheet" href="./Assets/w3.css">
<!-- Some more styling -->
<style>
body {
padding: 30px 0;
}
</style>
<!-- Get participant IDs passed in from URL -->
<script src="./Assets/GetPpantIds.js"></script>
<!-- Get DateTime_Start and ClientTimeZone (and add to TaskIO) -->
<script src="./Assets/SetDateTime.js"></script>
<!-- Main script block -->
<script>
async function GetCompletionLink() {
var P1 = await fetch('./CompleteActions.php', {
method: 'post',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({ SubjectId: SubjectId })
}
);
var Result = await P1.json();
return Result;
}
async function OnBodyLoad() {
var Response = await GetCompletionLink();
if (!Response.FoundSubject) {
alert('Sorry, we could not find any record of your ' +
'participation.\nPlease contact Sophie Johnson at ' +
'sj483@sussex.ac.uk.');
var ErrorCode = 'XXX';
var URL = "./Error.html?SubjectId=" +
encodeURIComponent(String(SubjectId)) +
'&ErrorCode=' +
encodeURIComponent(String(ErrorCode)) +
"#";
window.location.replace(URL);
return;
}
if (!Response.Completed) {
alert('Sorry, it appears that you have not ' +
'completed all parts of the experiment yet. ' +
'I am not sure how you ended up on this page.');
var ErrorCode = 'XXX';
var URL = "./Error.html?SubjectId=" +
encodeURIComponent(String(SubjectId)) +
'&ErrorCode=' +
encodeURIComponent(String(ErrorCode)) +
"#";
window.location.replace(URL);
return;
}
document.getElementById('CompletionLink').outerHTML =
Response.CompletionLink;
}
</script>
</head>
<body class="w3-center" onload="OnBodyLoad()">
<h1>Thank you! 🙏</h1>
<p>The experiment is now complete. Thank you for taking part.</p>
<br /><br />
<p>Please click on the link below to make your submission:<br />
<a id="CompletionLink" href="./Error.html" target="_blank">###</a>
</p>
</body>
</html>