-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
58 lines (55 loc) · 2.2 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
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<meta name="robots" content="noindex">
<title>The Experiment Factory: Affect Grid</title>
<link rel='stylesheet' type='text/css' href='jspsych.css'>
<link rel='stylesheet' type='text/css' href='default_style.css'>
<link rel='stylesheet' type='text/css' href='style.css'>
</head>
<body>
<script src='js/jquery.min.js'></script>
<script src='js/math.min.js'></script>
<script src='js/jsPsych-6.0.1/jspsych.js'></script>
<script src="js/jsPsych-6.0.1/plugins/jspsych-html-keyboard-response.js"></script>
<script src="js/jsPsych-6.0.1/plugins/jspsych-html-button-response.js"></script>
<script src="js/jsPsych-6.0.1/plugins/jspsych-fullscreen.js"></script>
<script src='js/jsPsych-6.0.1/poldrack_plugins/poldrack_utils.js'></script>
<script src='experiment.js'></script>
<script>
$( document ).ready(function() {
jsPsych.init({
timeline: affect_grid,
on_trial_finish: function(data) {
addID('affect-grid')
},
on_finish: function(data) {
// serialize the data
var promise = new Promise(function(resolve, reject) {
var data = jsPsych.data.get().json();
resolve(data);
})
promise.then(function(data) {
$.ajax({
type: "POST",
url: '/save',
data: { "data": data },
success: function(){ document.location = "/next" },
dataType: "application/json",
// FIXME: https://github.com/expfactory/expfactory/issues/76
error: function(err) {
if (err.status == 200) { // endpoint not running
document.location = "/next"
} else { // local save
jsPsych.data.get().localSave('json','affect-grid_results.json');
}
}
});
})
}
});
});
</script>
</body>
</html>