-
Notifications
You must be signed in to change notification settings - Fork 2
/
end.html
94 lines (82 loc) · 3 KB
/
end.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
<!DOCTYPE html>
<html>
<!--
simple end experiment screen
10/23/23 (CELS): Multi-lang support using Honeycomb style language file
-->
<head>
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: 'unsafe-inline' 'unsafe-eval'
https://fonts.gstatic.com ;
style-src 'self' 'unsafe-inline' https://fonts.googleapis.com/css; media-src *;
img-src 'self' data: content:;">
<script type="text/javascript" src="jatos.js"></script>
<script src="js/jquery-3.1.1.min.js"></script>
<link rel="stylesheet" href="css/jspsych.css"></link>
<style>
.jspsych-display-element {
font-size: 200%;
}
.jspsych-btn {
font-size: 150%;
}
</style>
</head>
<body>
<script type="text/javascript">
function waitFor(conditionFunction) {
const poll = resolve => {
if(conditionFunction()) resolve();
else setTimeout(_ => poll(resolve), 400);
}
return new Promise(poll)
}
jatos.onLoad(async function () {
var d= new Date();
var lang='en';
if (typeof jatos.studySessionData['lang'] !== 'undefined') {
lang=jatos.studySessionData['lang'];
}
if (jatos.studyJsonInput && typeof jatos.studyJsonInput['lang'] !== 'undefined' ) {
lang=jatos.studyJsonInput['lang']
}
if (jatos.batchJsonInput && typeof jatos.batchJsonInput['lang'] !== 'undefined' ) {
lang=jatos.batchJsonInput['lang']
}
// load honeycomb version of lang file
console.log('loading json lang')
var langfile='lang/omst_'+lang+'.json';
var json_prompts=null;
$.getJSON(langfile,function( data ) {
json_prompts=data;
console.debug(langfile + ' loaded...ish');
});
await waitFor(_ => json_prompts !== null);
console.log(json_prompts['task']['name'])
let prompts=json_prompts['end']; // Load hin this phase's section
// Baisc HTML thank you text
p=document.createElement("p");
p.innerHTML='<div class="jspsych-display-element"> <p><p style="text-align:center;">' +
prompts['ty'] + '</p></p> </div>';
document.body.appendChild(p)
if (typeof jatos.urlQueryParameters.sona === 'undefined' ||
typeof jatos.studyJsonInput['experiment_id'] === 'undefined' || typeof jatos.studyJsonInput['credit_token'] === 'undefined') {
console.log('not sona');
jatos.submitResultData({
task: "end-SCAN",
msg: "study ended",
date: d.toString()
},jatos.endStudy);
}
else {
var redirect='https://uci.sona-systems.com/webstudy_credit.aspx?experiment_id='+jatos.studyJsonInput['experiment_id']+
'&credit_token='+jatos.studyJsonInput['credit_token']+'&survey_code='+jatos.urlQueryParameters.sid;
jatos.endStudyAndRedirect(redirect,{
task: "end-SCAN",
msg: "SONA study ended",
date: d.toString()
});
}
});
</script>
</body>
</html>