-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
115 lines (98 loc) · 3.8 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
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<title>Decision-making and information-seeking</title>
<script src="js/jspsych.js"></script>
<script src="js/jspsych-external-html.js"></script>
<script src="js/jspsych-html-keyboard-response.js"></script>
<script src="js/jspsych-html-button-response.js"></script>
<!-- <script src="js/jspsych-image-button-response.js"></script> -->
<script src="js/jspsych-instructions.js"></script>
<script src="js/jspsych-fullscreen.js"></script>
<script src="js/jspsych-survey-html-form.js"></script>
<script src="js/jspsych-survey-multi-select.js"></script>
<script src="js/helper_funcs.js"></script>
<script src="js/exp_parameters.js"></script>
<!-- <script src="js/get-set_trial_stimulus-prompt.js"></script> -->
<script src="js/instructions-practice_trials.js"></script>
<script src="js/define_trials.js"></script>
<script src="js/get_experiment_data.js"></script>
<!-- <script src="js/get_trials_and_trial-timeline.js"></script> -->
<script src="js/timeline_setting.js"></script>
<script src="js/jquery.min.js"></script>
<link href="css/jspsych.css" rel="stylesheet" type="text/css"></link>
<link href="css/css.css" rel="stylesheet" type="text/css"></link>
</head>
<body>
<div id="jspsych-target">
<!-- <div id="loading" style="">Experiment is loading - please wait</div> -->
<div id="loading" class="lds-facebook"><div></div><div></div><div></div></div>
</div>
</body>
<script>
function saveData(filename, filedata){
return $.ajax({
type:'post',
cache: false,
url: 'save_data2.php',
data: {filename: filename, filedata: filedata}
});
}
// capture info from Prolific
var subject_id = jsPsych.data.getURLVariable('PROLIFIC_PID');
var study_id = jsPsych.data.getURLVariable('STUDY_ID');
var session_id = jsPsych.data.getURLVariable('SESSION_ID');
if (subject_id == null) {
subject_id = Math.floor(Math.random()*10000)
}
var DATA_SAVING_ITERATOR = 0
jsPsych.data.addProperties({
subject_id: subject_id,
study_id: study_id,
session_id: session_id
});
function startExperiment() {
jsPsych.init({
display_element: 'jspsych-target',
timeline: timeline,
on_finish: function() {
$.when(saveData(subject_id.toString(), jsPsych.data.get().csv()),
saveData(subject_id.toString()+'_interaction_data', jsPsych.data.getInteractionData().csv()))
.done(function(s1, s2) {
// the code here will be executed when all four ajax requests resolve.
// s1, s2 are lists of length 3 containing the response text,
// status, and jqXHR object for each ajax call respectively.
// window.open("https://app.prolific.co/submissions/complete?cc=78A9CD78", "_blank")
window.location = "https://app.prolific.co/submissions/complete?cc=76DCBDFE"
});
},
exclusions: {
min_width: 992,
min_height: 800
}
})
}
// preloading images first
var images = []
for (card of CARDS) {
images.push('images/'+card+'.png')
}
for (dealer of PT_TRIALS_DEALERS) {
images.push('images/'+dealer+'.png')
}
for (dealer of DEALERS) {
images.push('images/'+dealer+'.png')
}
images.push('images/instructions-multi-html/image1.png')
images.push('images/instructions-multi-html/image2.png')
images.push('images/instructions-multi-html/image3_v2.png')
images.push('images/instructions-multi-html/image3_v3.png')
images.push('images/face_down_card.png')
images.push('images/question-mark.png')
images.push('images/arrow.png')
images.push('images/card-presentation-background.jpg')
jsPsych.pluginAPI.preloadImages(images, function(){ startExperiment(); });
</script>
</html>