forked from jspsych/jsPsych
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjspsych-iat.html
510 lines (487 loc) · 27.3 KB
/
jspsych-iat.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
<!DOCTYPE html>
<html>
<head>
<title>IAT Example</title>
<script src="../jspsych.js"></script>
<script src="../plugins/jspsych-iat-image.js"></script>
<script src="../plugins/jspsych-iat-html.js"></script>
<script src="../plugins/jspsych-html-keyboard-response.js"></script>
<link href="../css/jspsych.css" rel="stylesheet"></link>
</head>
<body>
</body>
<script>
var welcome_block = {
type: 'html-keyboard-response',
stimulus: '<p>Welcome to the Age Task. In this study you will ' +
'complete an Implicit Association Test (IAT) in which you ' +
'will be asked to sort pictures and words into groups as ' +
'fast as you can.</p><p>Press any key to begin.</p>',
post_trial_gap: 1500
};
var category_block = {
type: 'html-keyboard-response',
stimulus: '<p>Next, you will use the "E" and "I" computer keys ' + 'to categorize items into groups as fast as you can. ' +
'These are the four groups and the items that belong to each:<br><br>' +
'<strong>Good</strong>:<br>' + 'Fabulous, Excitement, Glorious, Cheerful, Cherish, ' +
'Enjoy, Delightful, Joyous<br><br>' + '<strong>Bad</strong>:<br>' + 'Humiliate, ' +
'Evil, Grief, Yucky, Detest, Poison, Abuse, Despise<br><br>' +
'<strong>Old</strong>:<br>' + "<img src='img/age/of1.jpg'></img> " +
"<img src='img/age/of2.jpg'></img> " + "<img src='img/age/of3.jpg'></img> " +
"<img src='img/age/om1.jpg'></img> " + "<img src='img/age/om2.jpg'></img> " +
"<img src='img/age/om3.jpg'></img><br><br>" + '<strong>Young</strong>:<br>' +
"<img src='img/age/yf1.jpg'></img> " + "<img src='img/age/yf4.jpg'></img> " +
"<img src='img/age/yf5.jpg'></img> " + "<img src='img/age/ym2.jpg'></img> " +
"<img src='img/age/ym3.jpg'></img> " + "<img src='img/age/ym5.jpg'></img><br><br>" +
"Press any key to continue.</p>",
post_trial_gap: 1500
};
var instructions_block = {
type: 'html-keyboard-response',
stimulus: "<div style='position: absolute; top: 18%; left: 20%'><p>Press E for:<br><strong>OLD</strong></p></div>" +
"<div style='position: absolute; top: 18%; right: 20%'><p>Press I for:<br><strong>YOUNG</strong></p></div>" +
"<div style='position: relative; top: 42%; margin-left: auto; margin-right: auto'>Put a left finger on the <strong>E</strong> key for items that belong to the Old People category. Put a right finger on the " +
"<strong>I</strong> key for items that belong to the Young People " +
"category. Items will appear one at a time.<br><br>" + "If you " +
"make a mistake, a red X will appear. Press the keys listed below " +
"to continue. Go as fast as you can while being accurate.<br><br> " +
"Press the any key when you are ready to start.</div>",
};
var trial_block = {
timeline: [
{
type: 'iat-image',
stimulus: jsPsych.timelineVariable('stimulus'),
stim_key_association: jsPsych.timelineVariable('stim_key_association'),
html_when_wrong: '<span style="color: red; font-size: 80px">X</span>',
bottom_instructions: '<p>If you press the wrong key, a red X will appear. Press the other key to continue</p>',
force_correct_key_press: true,
display_feedback: true,
trial_duration: 3000, //Only if display_feedback is false
left_category_key: 'E',
right_category_key: 'I',
left_category_label: ['OLD'],
right_category_label: ['YOUNG'],
response_ends_trial: true,
data: { iat_type: 'practice' }
}
],
timeline_variables: [
{stimulus: "img/age/of1.jpg", stim_key_association: "left"},
{stimulus: "img/age/of2.jpg", stim_key_association: "left"},
{stimulus: "img/age/of3.jpg", stim_key_association: "left"},
{stimulus: "img/age/om1.jpg", stim_key_association: "left"},
{stimulus: "img/age/om2.jpg", stim_key_association: "left"},
{stimulus: "img/age/om3.jpg", stim_key_association: "left"},
{stimulus: "img/age/yf1.jpg", stim_key_association: "right"},
{stimulus: "img/age/yf4.jpg", stim_key_association: "right"},
{stimulus: "img/age/yf5.jpg", stim_key_association: "right"},
{stimulus: "img/age/ym2.jpg", stim_key_association: "right"},
{stimulus: "img/age/ym3.jpg", stim_key_association: "right"},
{stimulus: "img/age/ym5.jpg", stim_key_association: "right"}
],
randomize_order: true,
repetitions: 2
};
var instructions_block2 = {
type: 'html-keyboard-response',
stimulus: "<div style='position: absolute; top: 18%; left: 20%'>Press E for:<br><strong>BAD</strong></div>" +
"<div style='position: absolute; top: 18%; right: 20%'>Press I for:<br><strong>GOOD</strong></div>" +
"<div style='position: relative; top: 42%; margin-left: auto; margin-right: auto'>Put a left finger on the <strong>E</strong> key for items that " +
"belong to the Bad category. Put a right finger on the " +
"<strong>I</strong> key for items that belong to the Good " +
"category. Items will appear one at a time.<br><br>" + "If you " +
"make a mistake, a red X will appear. Press the keys listed below " +
"to continue. Go as fast as you can while being accurate.<br><br> " +
"Press the any key when you are ready to start.</div>",
};
var trial_block2 = {
timeline: [
{
type: 'iat-html',
stimulus: jsPsych.timelineVariable('stimulus'),
stim_key_association: jsPsych.timelineVariable('stim_key_association'),
html_when_wrong: '<span style="color: red; font-size: 80px">X</span>',
bottom_instructions: '<p>If you press the wrong key, a red X will appear. Press the other key to continue</p>',
force_correct_key_press: true,
display_feedback: true,
trial_duration: 3000, //Only if display_feedback is false
left_category_key: 'E',
right_category_key: 'I',
left_category_label: ['BAD'],
right_category_label: ['GOOD'],
response_ends_trial: true,
data: { iat_type: 'practice' }
}
],
timeline_variables: [
{stimulus: "Humiliate", stim_key_association: "left"},
{stimulus: "Evil", stim_key_association: "left"},
{stimulus: "Grief", stim_key_association: "left"},
{stimulus: "Yucky", stim_key_association: "left"},
{stimulus: "Detest", stim_key_association: "left"},
{stimulus: "Poison", stim_key_association: "left"},
{stimulus: "Abuse", stim_key_association: "left"},
{stimulus: "Despise", stim_key_association: "left"},
{stimulus: "Fabulous", stim_key_association: "right"},
{stimulus: "Excitement", stim_key_association: "right"},
{stimulus: "Glorious", stim_key_association: "right"},
{stimulus: "Cheerful", stim_key_association: "right"},
{stimulus: "Cherish", stim_key_association: "right"},
{stimulus: "Enjoy", stim_key_association: "right"},
{stimulus: "Delightful", stim_key_association: "right"},
{stimulus: "Joyous", stim_key_association: "right"}
],
randomize_order: true,
repetitions: 2
};
var instructions_block3 = {
type: 'html-keyboard-response',
stimulus: "<div style='position: absolute; top: 18%; left: 20%'>Press E for:<br> " +
"<strong>BAD</strong><br>" + "or<br>" + "<strong>OLD</strong></div>" + "<div style='position: absolute; top: 18%; right: 20%'>" +
"Press I for:<br>" + "<strong>GOOD</strong><br>" + "or<br>" + "<strong>YOUNG</strong></div>" +
"<div style='position: relative; top: 42%; margin-left: auto; margin-right: auto'>Use <strong>E</strong> for Bad and for " +
"Old People<br>" + "Use <strong>I</strong> for Good and for Young People<br>" +
"Each item belongs to only one category.<br><br>" + "If you " +
"make a mistake, a red X will appear. Press the keys listed below " +
"to continue. Go as fast as you can while being accurate.<br><br> " +
"Press the any key when you are ready to start.</div>",
};
var trial_block3 = {
timeline: [
{
type: jsPsych.timelineVariable('type'),
stimulus: jsPsych.timelineVariable('stimulus'),
stim_key_association: jsPsych.timelineVariable('stim_key_association'),
html_when_wrong: '<span style="color: red; font-size: 80px">X</span>',
bottom_instructions: '<p>If you press the wrong key, a red X will appear. Press the other key to continue</p>',
force_correct_key_press: true,
display_feedback: true,
trial_duration: 3000, //Only if display_feedback is false
left_category_key: 'E',
right_category_key: 'I',
left_category_label: ['BAD', 'OLD'],
right_category_label: ['GOOD', 'YOUNG'],
response_ends_trial: true,
data: { iat_type: 'practice' }
}
],
timeline_variables: [
{type: 'iat-image', stimulus: "img/age/of1.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/of2.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/of3.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/om1.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/om2.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/om3.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/yf1.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/yf4.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/yf5.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/ym2.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/ym3.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/ym5.jpg", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Humiliate", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Evil", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Grief", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Yucky", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Detest", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Poison", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Abuse", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Despise", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Fabulous", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Excitement", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Glorious", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Cheerful", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Cherish", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Enjoy", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Delightful", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Joyous", stim_key_association: "right"}
],
randomize_order: true,
repetitions: 1
};
var instructions_block4 = {
type: 'html-keyboard-response',
stimulus: "<div style='position: absolute; top: 18%; left: 20%'>Press E for:<br> " +
"<strong>BAD</strong><br>" + "or<br>" + "<strong>OLD</strong></div>" + "<div style='position: absolute; top: 18%; right: 20%'>" +
"Press I for:<br>" + "<strong>GOOD</strong><br>" + "or<br>" + "<strong>YOUNG</strong></div>" +
"<div style='position: relative; top: 42%; margin-left: auto; margin-right: auto'>This is the same as the previous part.<br>" + "Use <strong>E</strong> for Bad and for " +
"Old People<br>" + "Use <strong>I</strong> for Good and for Young People<br>" +
"Each item belongs to only one category.<br><br>" + "If you " +
"make a mistake, a red X will appear. Press the keys listed below " +
"to continue. Go as fast as you can while being accurate.<br><br> " +
"Press the any key when you are ready to start.</div>",
};
var trial_block4 = {
timeline: [
{
type: jsPsych.timelineVariable('type'),
is_html: jsPsych.timelineVariable('is_html'),
stimulus: jsPsych.timelineVariable('stimulus'),
stim_key_association: jsPsych.timelineVariable('stim_key_association'),
html_when_wrong: '<span style="color: red; font-size: 80px">X</span>',
bottom_instructions: '<p>If you press the wrong key, a red X will appear. Press the other key to continue</p>',
force_correct_key_press: true,
display_feedback: true,
trial_duration: 3000, //Only if display_feedback is false
left_category_key: 'E',
right_category_key: 'I',
left_category_label: ['BAD', 'OLD'],
right_category_label: ['GOOD', 'YOUNG'],
response_ends_trial: true,
data: { iat_type: 'bad-old' }
}
],
timeline_variables: [
{type: 'iat-image', stimulus: "img/age/of1.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/of2.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/of3.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/om1.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/om2.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/om3.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/yf1.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/yf4.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/yf5.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/ym2.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/ym3.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/ym5.jpg", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Humiliate", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Evil", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Grief", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Yucky", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Detest", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Poison", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Abuse", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Despise", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Fabulous", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Excitement", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Glorious", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Cheerful", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Cherish", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Enjoy", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Delightful", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Joyous", stim_key_association: "right"}
],
randomize_order: true,
repetitions: 2
};
var instructions_block5 = {
type: 'html-keyboard-response',
stimulus: "<div style='position: absolute; top: 18%; left: 20%'>Press E for:<br>" + "<strong>YOUNG</strong></div>" +
"<div style='position: absolute; top: 18%; right: 20%'>Press I for:<br>" + "<strong>OLD</strong></div>" +
"<div style='position: relative; top: 42%; margin-left: auto; margin-right: auto'>Watch out, the labels have changed positions!<br>" +
"Use <strong>E</strong> for Young People<br>" + "Use <strong>I</strong> for Old People<br><br>" +
"If you make a mistake, a red X will appear. Press the keys listed below " +
"to continue. Go as fast as you can while being accurate.<br><br> " +
"Press the any key when you are ready to start.</div>"
};
var trial_block5 = {
timeline: [
{
type: 'iat-image',
is_html: false,
stimulus: jsPsych.timelineVariable('stimulus'),
stim_key_association: jsPsych.timelineVariable('stim_key_association'),
html_when_wrong: '<span style="color: red; font-size: 80px">X</span>',
bottom_instructions: '<p>If you press the wrong key, a red X will appear. Press the other key to continue</p>',
force_correct_key_press: true,
display_feedback: true,
trial_duration: 3000, //Only if display_feedback is false
left_category_key: 'E',
right_category_key: 'I',
left_category_label: ['YOUNG'],
right_category_label: ['OLD'],
response_ends_trial: true,
data: { iat_type: 'practice' }
}
],
timeline_variables: [
{type: 'iat-image', stimulus: "img/age/of1.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/of2.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/of3.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/om1.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/om2.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/om3.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/yf1.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/yf4.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/yf5.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/ym2.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/ym3.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/ym5.jpg", stim_key_association: "left"}
],
randomize_order: true,
repetitions: 2
};
var instructions_block6 = {
type: 'html-keyboard-response',
stimulus: "<div style='position: absolute; top: 18%; left: 20%'>Press E for:<br>" + "<strong>BAD</strong><br>" + "or<br>" +
"<strong>YOUNG</strong></div>" + "<div style='position: absolute; top: 18%; right: 20%'>Press I for:<br>" + "<strong>GOOD</strong><br>" + "or<br>" +
"<strong>OLD</strong></div>" +
"<div style='position: relative; top: 42%; margin-left: auto; margin-right: auto'>Use <strong>E</strong> for Bad and for Young People<br>" +
"Use <strong>I</strong> for Good and for Old People<br><br>" +
"If you make a mistake, a red X will appear. Press the keys listed below " +
"to continue. Go as fast as you can while being accurate.<br><br> " +
"Press the any key when you are ready to start.</div>"
};
var trial_block6 = {
timeline: [
{
type: jsPsych.timelineVariable('type'),
stimulus: jsPsych.timelineVariable('stimulus'),
stim_key_association: jsPsych.timelineVariable('stim_key_association'),
html_when_wrong: '<span style="color: red; font-size: 80px">X</span>',
bottom_instructions: '<p>If you press the wrong key, a red X will appear. Press the other key to continue</p>',
force_correct_key_press: true,
display_feedback: true,
trial_duration: 3000, //Only if display_feedback is false
left_category_key: 'E',
right_category_key: 'I',
left_category_label: ['BAD', 'YOUNG'],
right_category_label: ['GOOD', 'OLD'],
response_ends_trial: true,
data: {iat_type: 'practice'}
}
],
timeline_variables: [
{type: 'iat-image', stimulus: "img/age/of1.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/of2.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/of3.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/om1.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/om2.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/om3.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/yf1.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/yf4.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/yf5.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/ym2.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/ym3.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/ym5.jpg", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Humiliate", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Evil", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Grief", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Yucky", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Detest", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Poison", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Abuse", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Despise", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Fabulous", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Excitement", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Glorious", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Cheerful", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Cherish", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Enjoy", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Delightful", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Joyous", stim_key_association: "right"}
],
randomize_order: true,
repetitions: 1
};
var instructions_block7 = {
type: 'html-keyboard-response',
stimulus: "<div style='position: absolute; top: 18%; left: 20%'>Press E for:<br>" + "<strong>Bad</strong><br>" + "or<br>" +
"<strong>Young People</strong></div>" + "<div style='position: absolute; top: 18%; right: 20%'>Press I for:<br>" + "<strong>Good</strong><br>" + "or<br>" +
"<strong>Old People</strong></div>" +
"<div style='position: relative; top: 42%; margin-left: auto; margin-right: auto'>This is the same as the previous part<br>" +
"Use <strong>E</strong> for Bad and for Young People<br>" +
"Use <strong>I</strong> for Good and for Old People<br>" +
"Each item belongs to only one category<br><br>" +
"If you make a mistake, a red X will appear. Press the keys listed below " +
"to continue. Go as fast as you can while being accurate.<br><br> " +
"Press the any key when you are ready to start.</div>"
};
var trial_block7 = {
timeline: [
{
type: jsPsych.timelineVariable('type'),
is_html: jsPsych.timelineVariable('is_html'),
stimulus: jsPsych.timelineVariable('stimulus'),
stim_key_association: jsPsych.timelineVariable('stim_key_association'),
html_when_wrong: '<span style="color: red; font-size: 80px">X</span>',
bottom_instructions: '<p>If you press the wrong key, a red X will appear. Press the other key to continue</p>',
force_correct_key_press: true,
display_feedback: true,
trial_duration: 3000, //Only if display_feedback is false
left_category_key: 'E',
right_category_key: 'I',
left_category_label: ['BAD', 'YOUNG'],
right_category_label: ['GOOD', 'OLD'],
response_ends_trial: true,
data: {iat_type: 'bad-young'}
}
],
timeline_variables: [
{type: 'iat-image', stimulus: "img/age/of1.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/of2.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/of3.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/om1.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/om2.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/om3.jpg", stim_key_association: "right"},
{type: 'iat-image', stimulus: "img/age/yf1.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/yf4.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/yf5.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/ym2.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/ym3.jpg", stim_key_association: "left"},
{type: 'iat-image', stimulus: "img/age/ym5.jpg", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Humiliate", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Evil", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Grief", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Yucky", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Detest", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Poison", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Abuse", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Despise", stim_key_association: "left"},
{type: 'iat-html', stimulus: "Fabulous", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Excitement", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Glorious", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Cheerful", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Cherish", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Enjoy", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Delightful", stim_key_association: "right"},
{type: 'iat-html', stimulus: "Joyous", stim_key_association: "right"}
],
randomize_order: true,
repetitions: 2
};
var debrief_block = {
type: "html-keyboard-response",
stimulus: function() {
// calculate D-score from https://faculty.washington.edu/agg/pdf/GB&N.JPSP.2003.pdf
// first find mean RT
var bad_old = jsPsych.data.get().filter({iat_type: 'bad-old'}).filterCustom(function(x) { return x.rt < 10000 });
var mean_correct_responses_bad_old = bad_old.filter({correct: true}).select('rt').mean();
var bad_young = jsPsych.data.get().filter({iat_type: 'bad-young'}).filterCustom(function(x) { return x.rt < 10000 });
var mean_correct_responses_bad_young = bad_young.filter({correct: true}).select('rt').mean();
// get overall sd
var sd = bad_old.join(bad_young).filter({correct: true}).select('rt').sd();
var d = (mean_correct_responses_bad_young - mean_correct_responses_bad_old) / sd;
return "<p>You're done! Below is some information about how you performed.</p>"+
"<p>When the pairs were BAD/YOUNG and GOOD/OLD, it took you an average of <strong>"+Math.floor(mean_correct_responses_bad_young)+"ms</strong> to respond.</p>"+
"<p>When the pairs were BAD/OLD and GOOD/YOUNG, it took you an average of <strong>"+Math.floor(mean_correct_responses_bad_old)+"ms</strong> to respond.</p>"+
"<p>Your D score, an index of performance that takes into account this difference and the overall level of variability in your responses, is <strong>"+d.toFixed(2)+"</strong></p>"+
"<p>For reference, the Project Implicit IAT website labels D scores above 0.15 as a slight bias, scores above 0.35 as a moderate bias, and scores above 0.65 a strong bias.</p>"
}
};
var timeline = [];
timeline.push(welcome_block);
timeline.push(category_block);
timeline.push(instructions_block);
timeline.push(trial_block);
timeline.push(instructions_block2);
timeline.push(trial_block2);
timeline.push(instructions_block3);
timeline.push(trial_block3);
timeline.push(instructions_block4);
timeline.push(trial_block4);
timeline.push(instructions_block5);
timeline.push(trial_block5);
timeline.push(instructions_block6);
timeline.push(trial_block6);
timeline.push(instructions_block7);
timeline.push(trial_block7);
timeline.push(debrief_block);
jsPsych.init({
timeline: timeline,
on_finish: function() {
jsPsych.data.displayData();
}
});
</script>
</html>