-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrt-task_main.js
91 lines (82 loc) · 2.9 KB
/
rt-task_main.js
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
/* Change 1: Adding the image hosting site */
// define the site that hosts stimuli images
// usually https://<your-github-username>.github.io/<your-experiment-name>/
var repo_site = "https://spoggesi.github.io/Practice_RT/";
/* create timeline */
var timeline = [];
/* define welcome message trial */
var welcome_block = {
type: "html-keyboard-response",
stimulus: "Welcome to the experiment. Press any key to begin."
};
timeline.push(welcome_block);
/* define instructions trial */
var instructions = {
type: "html-keyboard-response",
stimulus: "<p>You will now carry out a fast response task. Please answer as <strong>QUICKLY</strong> as you can.</p>" +
"<p>To get you ready for this you will do a few practice trials.</p>" +
"<p>You will see words appear quickly on-screen. Respond <strong>YES</strong> by using the <strong>J</strong> key or <strong>NO</strong> using the <strong>F</strong> key to whether these words can be associated with <strong>WEATHER TERMS</strong>.</p>" +
"<p>Please place your fingers over the F and J keys ready to make your choices.</p>" +
"<p>Press any key to begin.</p>",
post_trial_gap: 2000
};
timeline.push(instructions);
/* test trials */
var test_stimuli = [{
stimulus: '<div style="font-size:60px;">hot</div>',
data: {
test_part: 'hot',
correct_response: 'j'
}
},
{
stimulus: '<div style="font-size:60px;">cold</div>',
data: {
test_part: 'cold',
correct_response: 'j'
}
},
{
stimulus: '<div style="font-size:60px;">teeth</div>',
data: {
test_part: 'teeth',
correct_response: 'f'
}
},
{
stimulus: '<div style="font-size:60px;">face</div>',
data: {
test_part: 'face',
correct_response: 'f'
}
}
];
var fixation = {
type: 'html-keyboard-response',
stimulus: '<div style="font-size:60px;">+</div>',
choices: jsPsych.NO_KEYS,
prompt: '<div class = leftBoxes>press "F" for NO</div> <div class = rightBoxes>press "J" for YES</div>',
trial_duration: function () {
return jsPsych.randomization.sampleWithoutReplacement([1000], 1)[0];
},
data: {
test_part: 'fixation'
}
}
var test = {
type: "html-keyboard-response",
stimulus: jsPsych.timelineVariable('stimulus'),
choices: ['f', 'j'],
data: jsPsych.timelineVariable('data'),
prompt: '<div class = leftBoxes>press "F" for NO</div> <div class = rightBoxes>press "J" for YES</div>',
on_finish: function (data) {
data.correct = data.key_press == jsPsych.pluginAPI.convertKeyCharacterToKeyCode(data.correct_response);
},
}
var test_procedure = {
timeline: [fixation, test],
timeline_variables: test_stimuli,
repetitions: 3,
randomize_order: true
}
timeline.push(test_procedure);