forked from msaddler/jspsych_tutorial_960
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.html
69 lines (60 loc) · 3.23 KB
/
template.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
<!DOCTYPE html>
<html>
<head>
<title>Template</title>
<meta http-equiv="pragma" content="no-cache">
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
<link href="https://unpkg.com/[email protected]/css/jspsych.css" rel="stylesheet" type="text/css" />
<script src="https://unpkg.com/[email protected]"></script>
<!-- <script src="https://unpkg.com/@jspsych/[email protected]"></script> -->
<!-- <script src="https://unpkg.com/@jspsych/[email protected]"></script> -->
<!-- <script src="https://unpkg.com/@jspsych/[email protected]"></script> -->
<script src="https://unpkg.com/@jspsych/[email protected]"></script>
<!-- <script src="https://unpkg.com/@jspsych/[email protected]"></script> -->
<!-- <script src="https://unpkg.com/@jspsych/[email protected]"></script> -->
<!-- <script src="https://unpkg.com/@jspsych/[email protected]"></script> -->
<!-- <script src="https://unpkg.com/@jspsych/[email protected]"></script> -->
<!-- <script src="https://unpkg.com/@jspsych/[email protected]"></script> -->
<!-- <script src="https://unpkg.com/@jspsych/[email protected]"></script> -->
<!-- <script src="https://unpkg.com/@jspsych/[email protected]"></script> -->
<!-- <script src="https://unpkg.com/@jspsych/[email protected]"></script> -->
<!-- <script src="https://unpkg.com/@jspsych/[email protected]"></script> -->
<!-- <script src="https://unpkg.com/@jspsych/[email protected]"></script> -->
<script src='https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js'></script>
<script src="util.js"></script>
</head>
<body></body>
<script>
// Initialize the jsPsych object (possibly with arguments: https://www.jspsych.org/7.3/reference/jspsych/)
var jsPsych = initJsPsych(); // <-- set this up to display data and write it to server
// Define `url_write_data_php` and `output_filename` for the `write_data_to_server` function
var url_experiment_dir = 'https://msaddler.scripts.mit.edu/jspsych_tutorial_960/'; // <-- change this
var url_write_data_php = url_experiment_dir + 'write_data.php';
var subject_id = jsPsych.data.getURLVariable('subject_id'); // <-- use URL variables?
console.log(`subject_id from URL: ${subject_id}`);
if (!subject_id) {
subject_id = jsPsych.randomization.randomID(10);
console.log(`subject_id randomly assigned: ${subject_id}`);
}
var output_filename = `data/subject_${subject_id}.json`;
console.log(`Data will be saved to: ${url_experiment_dir + output_filename}`);
// Initialize a timeline (just an empty array)
var timeline = [];
// Always good to put experiment instructions / disclaimers on the first page
var first_page = {
type: jsPsychHtmlButtonResponse,
stimulus: [
'<h2>Template</h2>' +
'<p>In this experiment, ...</p>' +
'<p>Your task is to ...</p>'
],
choices: ['Begin experiment'],
};
timeline.push(first_page);
//
// <-- add some trials to your timeline here!
//
// Run the timeline
jsPsych.run(timeline);
</script>
</html>