forked from AnnaleseBolton/mrtcode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex3.html
534 lines (477 loc) · 26.8 KB
/
index3.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
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
<!doctype html>
<html>
<head>
<title>UNSW CCS</title>
<script src="./js/jquery.min.js"></script>
<script src="./js/jspsych.js"></script>
<script src="./js/plugins/jspsych-survey-multi-choice.js"></script>
<script src="./js/plugins/jspsych-html-button-response.js"></script>
<script src="./js/plugins/jspsych-html-keyboard-response.js"></script>
<script src="./js/welcome.js"></script>
<link href="./js/css/jspsych.css" rel="stylesheet" type="text/css"></link>
</head>
<body>
<div id="welcome"></div>
</body>
<script>
/* initialise timeline*/
var timeline=[];
var introloop=[];
var turkcode = (Math.floor(Math.random() * 899999) + 100000).toString();
// check whether this allows for duplicates
var images = [
'./img/test1.jpg',
'./img/test2.jpg',
'./img/RiskResponseTable.jpg',
'./img/Category_button_NotCP.jpg',
'./img/Category_button_Prob.jpg',
'./img/Category_button_HRN.jpg',
'./img/Category_button_ROSH.jpg',
'./img/Category_button_iROSH.jpg',
'./img/greenTick.png',
'./img/redCross.png',
'./img/NotCP_10b.jpg',
'./img/NotCP_56d.jpg',
'./img/NotCP_72c.jpg',
'./img/NotCP_112d.jpg',
'./img/NotCP_117b.jpg',
'./img/NotCP_120e.jpg',
'./img/NotCP_132d.jpg',
'./img/NotCP_141d.jpg',
'./img/NotCP_145c.jpg',
'./img/NotCP_10b_feedback.jpg',
'./img/NotCP_56d_feedback.jpg',
'./img/NotCP_72c_feedback.jpg',
'./img/NotCP_112d_feedback.jpg',
'./img/NotCP_117b_feedback.jpg',
'./img/NotCP_120e_feedback.jpg',
'./img/NotCP_132d_feedback.jpg',
'./img/NotCP_141d_feedback.jpg',
'./img/NotCP_145c_feedback.jpg',
'./img/Prob_23d.jpg',
'./img/Prob_41a.jpg',
'./img/Prob_70e.jpg',
'./img/Prob_72b.jpg',
'./img/Prob_75.jpg',
'./img/Prob_78.jpg',
'./img/Prob_80a.jpg',
'./img/Prob_91b.jpg',
'./img/Prob_106b.jpg',
'./img/Prob_23d_feedback.jpg',
'./img/Prob_41a_feedback.jpg',
'./img/Prob_70e_feedback.jpg',
'./img/Prob_72b_feedback.jpg',
'./img/Prob_75_feedback.jpg',
'./img/Prob_78_feedback.jpg',
'./img/Prob_80a_feedback.jpg',
'./img/Prob_91b_feedback.jpg',
'./img/Prob_106b_feedback.jpg',
'./img/HRN_23b.jpg',
'./img/HRN_25.jpg',
'./img/HRN_32.jpg',
'./img/HRN_54a.jpg',
'./img/HRN_59a.jpg',
'./img/HRN_61b.jpg',
'./img/HRN_66a.jpg',
'./img/HRN_96a.jpg',
'./img/HRN_100.jpg',
'./img/HRN_23b_feedback.jpg',
'./img/HRN_25_feedback.jpg',
'./img/HRN_32_feedback.jpg',
'./img/HRN_54a_feedback.jpg',
'./img/HRN_59a_feedback.jpg',
'./img/HRN_61b_feedback.jpg',
'./img/HRN_66a_feedback.jpg',
'./img/HRN_96a_feedback.jpg',
'./img/HRN_100_feedback.jpg',
'./img/ROSH_11.jpg',
'./img/ROSH_30a.jpg',
'./img/ROSH_42a.jpg',
'./img/ROSH_48.jpg',
'./img/ROSH_68b.jpg',
'./img/ROSH_90a.jpg',
'./img/ROSH_103a.jpg',
'./img/ROSH_123.jpg',
'./img/ROSH_140.jpg',
'./img/ROSH_11_feedback.jpg',
'./img/ROSH_30a_feedback.jpg',
'./img/ROSH_42a_feedback.jpg',
'./img/ROSH_48_feedback.jpg',
'./img/ROSH_68b_feedback.jpg',
'./img/ROSH_90a_feedback.jpg',
'./img/ROSH_103a_feedback.jpg',
'./img/ROSH_123_feedback.jpg',
'./img/ROSH_140_feedback.jpg',
'./img/iROSH_17b.jpg',
'./img/iROSH_24b.jpg',
'./img/iROSH_37e.jpg',
'./img/iROSH_71a.jpg',
'./img/iROSH_106a.jpg',
'./img/iROSH_108a.jpg',
'./img/iROSH_115.jpg',
'./img/iROSH_116.jpg',
'./img/iROSH_128.jpg',
'./img/iROSH_17b_feedback.jpg',
'./img/iROSH_24b_feedback.jpg',
'./img/iROSH_37e_feedback.jpg',
'./img/iROSH_71a_feedback.jpg',
'./img/iROSH_106a_feedback.jpg',
'./img/iROSH_108a_feedback.jpg',
'./img/iROSH_115_feedback.jpg',
'./img/iROSH_116_feedback.jpg',
'./img/iROSH_128_feedback.jpg',
];
var NotCP_scenarios = [
{stimulus: "<img src ='img/NotCP_10b.jpg' width=1000px>", data: {correct_response: 0,}, expert_reasoning: "<img src ='img/NotCP_10b_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/NotCP_56d.jpg' width=1000px>", data: {correct_response: 0,}, expert_reasoning: "<img src ='img/NotCP_56d_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/NotCP_72c.jpg' width=1000px>", data: {correct_response: 0,}, expert_reasoning: "<img src ='img/NotCP_72c_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/NotCP_112d.jpg' width=1000px>", data: {correct_response: 0,}, expert_reasoning: "<img src ='img/NotCP_112d_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/NotCP_117b.jpg' width=1000px>", data: {correct_response: 0,}, expert_reasoning: "<img src ='img/NotCP_117b_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/NotCP_120e.jpg' width=1000px>", data: {correct_response: 0,}, expert_reasoning: "<img src ='img/NotCP_120e_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/NotCP_132d.jpg' width=1000px>", data: {correct_response: 0,}, expert_reasoning: "<img src ='img/NotCP_132d_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/NotCP_141d.jpg' width=1000px>", data: {correct_response: 0,}, expert_reasoning: "<img src ='img/NotCP_141d_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/NotCP_145c.jpg' width=1000px>", data: {correct_response: 0,}, expert_reasoning: "<img src ='img/NotCP_145c_feedback.jpg' width=1000px>", },
];
var Shuffled_NotCP_Scenarios = jsPsych.randomization.shuffleNoRepeats(NotCP_scenarios);
var Prob_scenarios = [
{stimulus: "<img src ='img/Prob_23d.jpg' width=1000px>", data: {correct_response: 1,}, expert_reasoning: "<img src ='img/Prob_23d_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/Prob_41a.jpg' width=1000px>", data: {correct_response: 1,}, expert_reasoning: "<img src ='img/Prob_41a_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/Prob_70e.jpg' width=1000px>", data: {correct_response: 1,}, expert_reasoning: "<img src ='img/Prob_70e_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/Prob_72b.jpg' width=1000px>", data: {correct_response: 1,}, expert_reasoning: "<img src ='img/Prob_72b_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/Prob_75.jpg' width=1000px>", data: {correct_response: 1,}, expert_reasoning: "<img src ='img/Prob_75_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/Prob_78.jpg' width=1000px>", data: {correct_response: 1,}, expert_reasoning: "<img src ='img/Prob_78_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/Prob_80a.jpg' width=1000px>", data: {correct_response: 1,}, expert_reasoning: "<img src ='img/Prob_80a_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/Prob_91b.jpg' width=1000px>", data: {correct_response: 1,}, expert_reasoning: "<img src ='img/Prob_91b_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/Prob_106b.jpg' width=1000px>", data: {correct_response: 1,}, expert_reasoning: "<img src ='img/Prob_106b_feedback.jpg' width=1000px>", },
];
var Shuffled_Prob_Scenarios = jsPsych.randomization.shuffleNoRepeats(Prob_scenarios);
var HRN_scenarios = [
{stimulus: "<img src ='img/HRN_23b.jpg' width=1000px>", data: {correct_response: 2,}, expert_reasoning: "<img src ='img/HRN_23b_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/HRN_25.jpg' width=1000px>", data: {correct_response: 2,}, expert_reasoning: "<img src ='img/HRN_25_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/HRN_32.jpg' width=1000px>", data: {correct_response: 2,}, expert_reasoning: "<img src ='img/HRN_32_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/HRN_54a.jpg' width=1000px>", data: {correct_response: 2,}, expert_reasoning: "<img src ='img/HRN_54a_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/HRN_59a.jpg' width=1000px>", data: {correct_response: 2,}, expert_reasoning: "<img src ='img/HRN_59a_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/HRN_61b.jpg' width=1000px>", data: {correct_response: 2,}, expert_reasoning: "<img src ='img/HRN_61b_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/HRN_66a.jpg' width=1000px>", data: {correct_response: 2,}, expert_reasoning: "<img src ='img/HRN_66a_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/HRN_96a.jpg' width=1000px>", data: {correct_response: 2,}, expert_reasoning: "<img src ='img/HRN_96a_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/HRN_100.jpg' width=1000px>", data: {correct_response: 2,}, expert_reasoning: "<img src ='img/HRN_100_feedback.jpg' width=1000px>", },
];
var Shuffled_HRN_Scenarios = jsPsych.randomization.shuffleNoRepeats(HRN_scenarios);
var ROSH_scenarios = [
{stimulus: "<img src ='img/ROSH_11.jpg' width=1000px>", data: {correct_response: 3,}, expert_reasoning: "<img src ='img/ROSH_11_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/ROSH_30a.jpg' width=1000px>", data: {correct_response: 3,}, expert_reasoning: "<img src ='img/ROSH_30a_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/ROSH_42a.jpg' width=1000px>", data: {correct_response: 3,}, expert_reasoning: "<img src ='img/ROSH_42a_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/ROSH_48.jpg' width=1000px>", data: {correct_response: 3,}, expert_reasoning: "<img src ='img/ROSH_48_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/ROSH_68b.jpg' width=1000px>", data: {correct_response: 3,}, expert_reasoning: "<img src ='img/ROSH_68b_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/ROSH_90a.jpg' width=1000px>", data: {correct_response: 3,}, expert_reasoning: "<img src ='img/ROSH_90a_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/ROSH_103a.jpg' width=1000px>", data: {correct_response: 3,}, expert_reasoning: "<img src ='img/ROSH_103a_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/ROSH_123.jpg' width=1000px>", data: {correct_response: 3,}, expert_reasoning: "<img src ='img/ROSH_123_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/ROSH_140.jpg' width=1000px>", data: {correct_response: 3,}, expert_reasoning: "<img src ='img/ROSH_140_feedback.jpg' width=1000px>", },
];
var Shuffled_ROSH_Scenarios = jsPsych.randomization.shuffleNoRepeats(ROSH_scenarios);
var iROSH_scenarios = [
{stimulus: "<img src ='img/iROSH_17b.jpg' width=1000px>", data: {correct_response: 4,}, expert_reasoning: "<img src ='img/iROSH_17b_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/iROSH_24b.jpg' width=1000px>", data: {correct_response: 4,}, expert_reasoning: "<img src ='img/iROSH_24b_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/iROSH_37e.jpg' width=1000px>", data: {correct_response: 4,}, expert_reasoning: "<img src ='img/iROSH_37e_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/iROSH_71a.jpg' width=1000px>", data: {correct_response: 4,}, expert_reasoning: "<img src ='img/iROSH_71a_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/iROSH_106a.jpg' width=1000px>", data: {correct_response: 4,}, expert_reasoning: "<img src ='img/iROSH_106a_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/iROSH_108a.jpg' width=1000px>", data: {correct_response: 4,}, expert_reasoning: "<img src ='img/iROSH_108a_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/iROSH_115.jpg' width=1000px>", data: {correct_response: 4,}, expert_reasoning: "<img src ='img/iROSH_115_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/iROSH_116.jpg' width=1000px>", data: {correct_response: 4,}, expert_reasoning: "<img src ='img/iROSH_116_feedback.jpg' width=1000px>", },
{stimulus: "<img src ='img/iROSH_128.jpg' width=1000px>", data: {correct_response: 4,}, expert_reasoning: "<img src ='img/iROSH_128_feedback.jpg' width=1000px>", },
];
var Shuffled_iROSH_Scenarios = jsPsych.randomization.shuffleNoRepeats(iROSH_scenarios);
// Pretest array
var short_Pretest_NotCP = Shuffled_NotCP_Scenarios.slice(0,2);
var short_Pretest_Prob = Shuffled_Prob_Scenarios.slice(0,2);
var short_Pretest_HRN = Shuffled_HRN_Scenarios.slice(0,2);
var short_Pretest_ROSH = Shuffled_ROSH_Scenarios.slice(0,2);
var short_Pretest_iROSH = Shuffled_iROSH_Scenarios.slice(0,2);
var PreTest_array = short_Pretest_NotCP.concat(short_Pretest_Prob, short_Pretest_HRN,short_Pretest_ROSH,short_Pretest_iROSH);
//var PreTest_array = [short_Pretest_NotCP, short_Pretest_Prob, short_Pretest_HRN, short_Pretest_ROSH, short_Pretest_iROSH];
//console.log(short_Pretest_NotCP.concat(short_Pretest_Prob, short_Pretest_HRN,short_Pretest_ROSH,short_Pretest_iROSH));
// Training Arrary
var short_Train_NotCP = Shuffled_NotCP_Scenarios.slice(2,7);
var short_Train_Prob = Shuffled_Prob_Scenarios.slice(2,7);
var short_Train_HRN = Shuffled_HRN_Scenarios.slice(2,7);
var short_Train_ROSH = Shuffled_ROSH_Scenarios.slice(2,7);
var short_Train_iROSH = Shuffled_iROSH_Scenarios.slice(2,7);
var Train_array = short_Train_NotCP.concat(short_Train_Prob, short_Train_HRN,short_Train_ROSH,short_Train_iROSH);
// Post-Test New Arrary
var short_Posttest_NotCP = Shuffled_NotCP_Scenarios.slice(2,7);
var short_Posttest_Prob = Shuffled_Prob_Scenarios.slice(2,7);
var short_Posttest_HRN = Shuffled_HRN_Scenarios.slice(2,7);
var short_Posttest_ROSH = Shuffled_ROSH_Scenarios.slice(2,7);
var short_Posttest_iROSH = Shuffled_iROSH_Scenarios.slice(2,7);
var Posttest_New_array = short_Posttest_NotCP.concat(short_Posttest_Prob, short_Posttest_HRN,short_Posttest_ROSH,short_Posttest_iROSH);
// My attempt at Post-test Trained Arrary
// Assign participant id's and condition
var pid = Math.floor(Math.random() * 100000);
var condition = ['Basic', 'Expert'];
var condition = jsPsych.randomization.sampleWithoutReplacement(condition, 1)[0]; // not sure what this does
jsPsych.data.addProperties({
condition: condition
});
/* This code might be helpful for later saving the data
var filename = "pilot_" + pid;
function saveData(filename, filedata){
$.ajax({
type:'post',
cache: false,
url: 'save_data.php', // this is the path to the above PHP script
data: {filename: filename, filedata: filedata}
});
};
*/
/* function to start the jsPsych experiment */
function startExperiment(){
// record the turkcode in the jsPsych data
jsPsych.data.addProperties({
turkcode: turkcode
});
jsPsych.init({
timeline: timeline,
preload_images: images,
on_finish: function() {
endExperiment( jsPsych.data.get().csv(), function() { document.write('<div id="endscreen" class="endscreen" style="width:1000px"><div class="endscreen" style="text-align:center; border:0px solid; padding:10px; font-size:120%; width:800px; float:right"><p><br><br><br>All done!<br><br>Your completion code is <span id="turkcode" style="font-weight:bold;font-size:130%">' + turkcode + '</span>. To receive payment for the HIT, return to the Amazon Mechanical Turk page and enter this code. Please contact us if something goes wrong and we\'ll fix it as quickly as possible.</p></div></div>') })
}
});
}
/* save and finish */
function endExperiment(dataset,callback) {
// $.post('submit',{"content": dataset}); // uncomment to post data
console.log(dataset) // comment out to avoid console log
setTimeout(callback,1000)
}
/* change the display property of a set of objects */
function setDisplay(theClass, theValue) {
var i, classElements = document.getElementsByClassName(theClass);
for (i = 0; i < classElements.length; i = i + 1) {
classElements[i].style.display = theValue;
}
}
/* A grossly typical way to run the instructions is to go through a series
of small slides (implemeted as trials in jsPsych) with a minimum reading time
enforced for each slide, such that the "continue" button doesn't appear until
the time elapses. At the end of the instructions, there is a short quiz, and if
the participant gets them wrong they are sent back to the beginning */
/* define the instruction block */
var instruction_block = {
type: 'html-button-response',
timing_post_trial: 0,
choices: ['Click here to continue'],
on_trial_start: function() { setTimeout(function() {setDisplay("jspsych-btn","")}, 1000)},
is_html: true,
timeline: [
{stimulus: '<br><br><b>Child Protection Response Options in New South Wales </b><br><br>Each column in the table below represents a category of response options based upon the level of risk of a given situation.<br><br> Please read this table carefully. <br><br><br><br><img src="img/RiskResponseTable.jpg" width="1400px"></img><br><br>'},
// insert image img src =
]
};
// introloop.push(instruction_block); // <- the setup block gets pushed to a "loop node"
/* define instruction check block */
var instructioncorrect = false;
var instruction_check = {
type: "survey-multi-choice",
preamble: ["<p align='center'><b>Check your knowledge before you begin!</b></p>"],
questions: [
{prompt: "<b>Question 1</b>: True or false?: All situations where you suspect a child/young person is at risk of harm needs to be reported to the FaCS Child Protection Helpline.", options: [" True"," False"], required: true},
{prompt: "<b>Question 2</b>: Which statement is false?", options: [" ALL HRN situations need to be reported to the FaCS Child Protection Helpline", " You may need to consider calling Emergency Services for iROSH situations", " Supporting the family to engage with family support services is an appropriate response for HRN situations"], required: true},
{prompt: "<b>Question 3</b>: Australian child protection legislation covers all young people under the age of...", options: [" 16 years"," 18 years", " 21 years"], required: true}
],
on_finish: function(data) {
if( data.responses == '{"Q0":" False","Q1":" ALL HRN situations need to be reported to the FaCS Child Protection Helpline","Q2":" 18 years"}') {
action = false;
instructioncorrect = true;
}
}
}
// introloop.push(instruction_check)
/* define a page for the incorrect response */
var showsplash = true;
var splash_screen = {
type: 'html-button-response',
timing_post_trial: 0,
// button_html: '<button class="jspsych-btn" style="display:none">%choice%</button>',
choices: ['Click here to read the instructions again'],
on_trial_start: function() {setTimeout(function() {setDisplay("jspsych-btn","")}, 500)},
is_html: true,
stimulus: 'Unfortunately, at least one of your answers was incorrect.'
}
/* ...but push it to a conditional node that only shows it if the response was wrong */
var conditional_splash = {
timeline: [splash_screen],
conditional_function: function(data) {
return !instructioncorrect // skip if correct
}
}
// introloop.push(conditional_splash)
/* finally, add the entirety of this introductory section to a loop node ... */
var loop_node = {
timeline: introloop,
loop_function: function(data) {
//var action = true;
return !instructioncorrect // stop looping if correct
}
}
// timeline.push(loop_node) // ... and add that to the timeline
/* success trial */
var successtrial = {
type: 'html-button-response',
timing_post_trial: 0,
// button_html: '<button class="jspsych-btn" style="display:none">%choice%</button>',
choices: ['Click here to begin the PRE-TEST phase of the experiment'],
on_trial_start: function() { setTimeout(function() {setDisplay("jspsych-btn","")}, 500)},
is_html: true,
stimulus: 'Well done!'
};
// timeline.push(successtrial);
/*
var PreTest_instruction_block = {
type: 'html-button-response',
timing_post_trial: 0,
choices: ['Click here to continue'],
on_trial_start: function() { setTimeout(function() {setDisplay("jspsych-btn","")}, 1000)},
is_html: true,
stimulus: '<br><br><b>Pre-test phase</b><br><br>On the following pages you will be presented with 10 scenarios. After reading each scenario, click on the risk/response category that you feel is most appropritate for the scenario. <br><br> Try to be as accurate and quick as you can be.<br><br> '},
};
// timeline.push(PreTest_instruction_block);
*/
// create category buttons, define variables to use later
categoryButtons = ["Category_button_NotCP","Category_button_Prob","Category_button_HRN","Category_button_ROSH","Category_button_iROSH"];
//var scenarios = ["NotCP_10b","Prob_41a","HRN_23b","ROSH_11","iROSH_17b"];
// 32 = psychologist, 25 = midwife
//var correctResponse = [0,1,2,3,4];
//
var i = 0;
var j = jsPsych.timelineVariable('expert_reasoning');
// The Pre-test Trial
/*
var PreTest_Trial = {
type: 'html-button-response',
stimulus: jsPsych.timelineVariable('stimulus'),
// stimulus: function(data){
// return "<img src ='img/" + scenarios[i] + ".jpg' width=1000px>"
// },
button_html: '<button><img src="img/%choice%.jpg" width="260px"></button>',
choices: categoryButtons,
post_trial_gap: 100,
data: jsPsych.timelineVariable('data'),
on_finish: function(data) {
var lastClick = jsPsych.data.get().last(1).values()[0].button_pressed;
data.correct_response = lastClick == data.correct_response;
}
};
var PreTest_Feedback = {
type: 'html-button-response',
is_html:true,
stimulus: function(){
var Laststimuli = jsPsych.timelineVariable('stimulus')[jsPsych.data.get().last(1).values()[0]];
// var lastClick = jsPsych.data.get().last(1).values()[0].button_pressed;
var lastChoice = categoryButtons[jsPsych.data.get().last(1).values()[0].button_pressed];
var display_result = "<img src='img/"+ Laststimuli +".jpg'>" + "<br><br><b>You chose</b> <br><br><img src='img/" + lastChoice + ".jpg' width = 280px>";
if (jsPsych.data.get().last(1).values()[0].correct_response) {
display_result += "<img src='img/greenTick.png' width = 280px>"
} else {
display_result += "<img src='img/redCross.png' width = 280px>"
}
return display_result;
},
choices: ['Next'],
on_finish: function(data){i = i + 1}, //need this to stay until the next Training_Trial, so that scenarios[i] now = scenarios[i+1]
};
var PreTestBlock = {
timeline: [PreTest_Trial, PreTest_Feedback],
timeline_variables: PreTest_array,
repetitions: 10,
randomize_order: false,
};
timeline.push(PreTestBlock);
*/
// the training trial
var Training_Trial = {
type: 'html-button-response',
stimulus: jsPsych.timelineVariable('stimulus'),
// stimulus: function(data){
// return "<img src ='img/" + scenarios[i] + ".jpg' width=1000px>"
// },
button_html: '<button><img src="img/%choice%.jpg" width="260px"></button>',
choices: categoryButtons,
post_trial_gap: 100,
data: jsPsych.timelineVariable('data'),
on_finish: function(data) {
var lastClick = jsPsych.data.get().last(1).values()[0].button_pressed;
data.correct_response = lastClick == data.correct_response;
}
};
// the feedback
/*var Training_Feedback = {
type: 'html-keyboard-response',
is_html:true,
stimulus: function(){
// var lastClick = jsPsych.data.get().last(1).values()[0].button_pressed;
var lastChoice = categoryButtons[jsPsych.data.get().last(1).values()[0].button_pressed];
var display_result = "<b>You chose</b> <br><br><img src='img/" + lastChoice + ".jpg' width = 280px>";
if (jsPsych.data.get().last(1).values()[0].correct_response) {
display_result += "<img src='img/greenTick.png' width = 280px>"
} else {
display_result += "<img src='img/redCross.png' width = 280px>"
}
return display_result;
var display_feedback = "<br>"
if (condition == "Expert") {
//var laststimuli = Training_Trial[jsPsych.data.get().last(1).jsPsych.timelineVariable()[0].expert_reasoning];
display_feedback += "<br><img src= 'img/" + jsPsych.timelineVariable('expert_reasoning') + ".jpg'>"
} else {display_feedback += ""}
return display_feedback;
},
choices: jsPsych.NO_KEYS,
trial_duration: 1400,
on_finish: function(data){i = i + 1}, //need this to stay until the next Training_Trial, so that scenarios[i] now = scenarios[i+1]
};
*/
var Training_Feedback = {
type: 'html-button-response',
is_html:true,
stimulus: function(){
// var lastClick = jsPsych.data.get().last(1).values()[0].button_pressed;
var lastChoice = categoryButtons[jsPsych.data.get().last(1).values()[0].button_pressed];
var display_result = "<b>You chose</b> <br><br><img src='img/" + lastChoice + ".jpg' width = 280px>" + condition_feedback;
if (jsPsych.data.get().last(1).values()[0].correct_response) {
display_result += "<img src='img/greenTick.png' width = 280px>"
} else {
display_result += "<img src='img/redCross.png' width = 280px>"
}
var condition_feedback = ""
if (condition == "Expert") {
condition_feedback += "<img src='img/" + jsPsych.timelineVariable('expert_reasoning') + "jpg' width=1000px>"
} else {condition_feedback += ""}
return display_result
},
choices: ['Next'],
on_finish: function(data){i = i + 1}, //need this to stay until the next Training_Trial, so that scenarios[i] now = scenarios[i+1]
};
var TrainingBlock = {
timeline: [Training_Trial, Training_Feedback],
timeline_variables: Train_array,
repetitions: 25,
randomize_order: false,
};
timeline.push(TrainingBlock);
/* define the instruction block */
// var experiment_block = {
// type: 'html-button-response',
// timing_post_trial: 0,
// button_html: '<button class="jspsych-btn" style="display:none">%choice%</button>',
// choices: ['Click here to continue'],
// on_trial_start: function() { setTimeout(function() {setDisplay("jspsych-btn","")}, 500)},
// is_html: true,
// timeline: [
// {stimulus: 'This is the first experimental trial'},
// {stimulus: 'This is the second experimental trial'}
// ]
// };
// timeline.push(experiment_block);
/* start by running the "welcome" */
welcome.run();
</script>
</html>