generated from RealityBending/TemplateOnlineExperiment
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
1041 lines (941 loc) · 34.4 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
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
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!-- Load jsPsych-->
<!DOCTYPE html>
<html>
<head>
<!--create title shown in tab; not the same as header on webpage-->
<title>FacePerception2</title>
<!--load the jsPsych library; set src to own path-->
<script src="utils/jspsych/jspsych.js"></script>
<!--Load all necessary plugins-->
<script src="utils/jspsych/plugin-html-keyboard-response.js"></script>
<script src="utils/jspsych/plugin-html-button-response.js"></script>
<script src="utils/jspsych/plugin-fullscreen.js"></script>
<script src="utils/jspsych/plugin-survey-text.js"></script>
<script src="utils/jspsych/plugin-preload.js"></script>
<script src="utils/jspsych/plugin-image-keyboard-response.js"></script>
<script src="utils/jspsych/plugin-survey-multi-choice.js"></script>
<script src="utils/jspsych/plugin-browser-check.js"></script>
<script src="utils/jspsych/plugin-survey-likert.js"></script>
<script src="utils/jspsych/plugin-image-button-response.js"></script>
<script src="utils/jspsych/plugin-external-html.js"></script>
<!--Load Stimuli and custom plugins-->
<script src="https://realitybending.github.io/JSmisc/misc/utils.js"></script>
<!--<script src = "utils/jspsych/plugin-jspsych-pavlovia-2021.js"></script>-->
<script src="parameters.js"></script>
<script src="stimuli/stimuli.js"></script>
<!--<script src="utils/questions_demo.png"></script>-->
<script src="utils/plugin-survey-multiple-slider.js"></script>
<!-- Default CSS -->
<link href="utils/jspsych/jspsych.css" rel="stylesheet" type="text/css" />
<!--<script type="text/javascript" src="lib/vendors/jquery-2.2.0.min.js"></script>-->
<style>
#jspsych-image-keyboard-response-stimulus {
/*adjust image stimuli params to fit screen*/
height: auto;
width: 55%;
}
body {
/*Hide scrollbar while keeping it functional */
overflow-y: scroll;
overflow-x: flow;
}
Body::-webkit-scrollbar {
display: none;
}
/* set canvas to be full screen */
.jspsych-content {
max-width: 100%;
}
</style>
</head>
<body></body>
<script>
timeline = []
/* Initialize connection to Pavlovia ----*/
// var pavloviaInfo
// var pavlovia_init = {
// type: jsPsychPavlovia,
// command: "init",
// setPavloviaInfo: function (info) {
// console.log(info);
// pavloviaInfo = info;
// }
// }
// timeline.push(pavlovia_init)
/* Initialize jsPsych ================================================================*/
var jsPsych = initJsPsych({
show_progress_bar: true,
message_progress_bar: "Completion",
on_finish: function () {
jsPsych.data.displayData("json")
jsPsych.data
.get()
.localSave(
"json",
`${jsPsych.data.get().values()[0]["participant_id"]
}_FF.json`
)
// window.location = "https://app.prolific.co/submissions/complete?cc=XXXXX" /* redirect to prolific when experiment is finished */
},
})
/* Initialize Experiment =============================================================*/
// Fullscreen Mode
timeline.push({
type: jsPsychFullscreen,
fullscreen_mode: true,
})
// Preload demo image
timeline.push({
type: jsPsychPreload,
images: ["utils/question_demo_2.png", "utils/realness_demo.png"], //change to images for pavlovia to preload
})
var stimuli_part1 = stimuli.slice(0, 55)
var stimuli_part2 = stimuli.slice(55,109)
// Preload Stimuli Images
timeline.push({
type: jsPsychHtmlKeyboardResponse,
stimulus: "<p>Please wait for the experiment to load...</p>",
choices: "NO_KEYS",
trial_duration: 1000,
data: { screen: "stimuli_1_loading" },
})
// Preload image stimuli to prevent lagging during experiment
timeline.push({
type: jsPsychPreload,
images: stimuli_part1.map((a) => a.stimulus), // stimuli is a stimulus in ../stimuli
max_load_time: 5*60*1000
})
// Retrieve and save browser info
var browser_check = {
type: jsPsychBrowserCheck,
data: {
screen: "browser_info",
version: "1.0",
date: new Date().toLocaleDateString("fr-FR"),
time: new Date().toLocaleTimeString("fr-FR"),
},
on_finish: function () {
data = jsPsych.data
.get()
.filter({ screen: "browser_info" })
.values()[0]
jsPsych.data.addProperties({
["screen_height"]: data["height"],
["screen_width"]: data["width"],
})
for (var key in data) {
if (
[
"vsync_rate",
"os",
"mobile",
"browser",
"browser_version",
].includes(key)
) {
jsPsych.data.addProperties({
[key]: data[key],
})
}
}
jsPsych.data.addProperties()
},
}
timeline.push(browser_check)
// Participant information
var prolific_id = jsPsych.data.getURLVariable("PROLIFIC_PID")
var jspsych_id = jsPsych.randomization.randomID(5)
var participant_id = `${prolific_id}_${jspsych_id}`
var study_id = jsPsych.data.getURLVariable("STUDY_ID")
var session_id = jsPsych.data.getURLVariable("SESSION_ID")
// Consent Form
var consent ={
type: jsPsychHtmlButtonResponse,
stimulus:
"<div style='font-size:10px';><h1></br></br>Study on Face Perception</h1></div>" +
"<div class='margin-left-10'>"+
"<p>In this study, you will first be asked to answer questions about yourself, and then rate images of faces them according to certain characteristics.</p>" +
"<p>Your participation in this study is completely voluntary. If you do not wish to complete this survey, simply close your browser.</p>" +
"<p>Your participation in this research will be kept completely confidential. Your responses are anonymous and IP addresses will not be collected to guarantee complete anonymity.</p>" +
"<p>If you have any questions about the project, you may contact the team via the chat option in Prolific.</p>" +
"<p>This project has been reviewed and approved by the University Institutional Review Board (NTU IRB-2022-187).<br>Questions concerning your rights as a participant in this research may be directed to the NTU-IRB at [email protected] or call +65 6592 2495.</p></div>",
choices: ["I consent"],
data: { screen: "consent" }
}
timeline.push(consent)
// Preload Stimuli Images
timeline.push({
type: jsPsychHtmlKeyboardResponse,
stimulus: "<p>Please wait for the experiment to load...</p>",
choices: "NO_KEYS",
trial_duration: 1000,
data: { screen: "stimuli_2_loading" },
})
// Preload image stimuli to prevent lagging during experiment
timeline.push({
type: jsPsychPreload,
images: stimuli_part2.map((a) => a.stimulus), // stimuli is a stimulus in ../stimuli
max_load_time: 5*60*1000
})
// Instructions Demographics
var instructions1 = {
type: jsPsychHtmlButtonResponse,
stimulus:
"<h1>Part 1/4</h1>" +
"<p>Welcome to the study! Before starting the face perception task, it is important for us to understand our participants' characteristics, so that our conclusions are scientifically valid.</p>" +
"<p>Let's start with some questions about yourself.</p>",
choices: ["Continue"],
data: { screen: "instructions1" },
}
timeline.push(instructions1)
var participant_info = {
type: jsPsychSurveyText,
questions: [
{
prompt: "Please enter your age (in years, e.g., '31')",
name: "age",
required: true,
},
{
prompt: "Please enter your country of birth (e.g., 'France')",
name: "nationality",
required: true,
},
{
prompt: "Please enter your ethnicity (e.g., 'Caucasian')",
name: "ethnicity",
required: true,
},
],
on_finish: function () {
jsPsych.data.addProperties({
participant_id: participant_id,
study_id: study_id,
session_id: session_id,
})
},
data: {
screen: "demographics",
},
}
var demographics = {
type: jsPsychSurveyMultiChoice,
questions: [
{
prompt: "What is your sex?",
options: ["Male", "Female", "Other", "Prefer not to say"],
name: "sex",
required: true,
},
{
prompt: "What is your highest completed education level?",
options: [
"University (doctorate)",
"University (master)",
"University (bachelor)",
"High school",
"Other",
"Prefer not to say",
],
name: "education",
required: true,
},
],
data: {
screen: "demographics",
},
}
var sexual_orientation = {
type: jsPsychSurveyMultiChoice,
questions: [
{
prompt: "What sexual orientation do you identify with?",
options: [
"Heterosexual",
"Homosexual",
"Bisexual",
"Other",
],
name: "sexual_orientation",
required: true,
},
],
data: {
screen: "demographics",
},
}
var sexual_orientation_other = {
type: jsPsychSurveyText,
questions: [
{
prompt: "If you answered 'Other' in the previous question, please specify",
name: "sexual_orientation_other",
required: false,
},
],
data: {
screen: "demographics",
},
}
timeline.push(
participant_info,
demographics,
sexual_orientation,
sexual_orientation_other
)
var religion = {
type: jsPsychSurveyMultiChoice,
questions: [
{
prompt: "Please indicate your religion or the religious context you grew up in?",
options: [
"Christianity",
"Islam",
"Hinduism",
"Buddhism",
"Taoism",
"Other",
"No Religion",
],
name: "religion",
required: true,
},
],
data: {
screen: "demographics",
},
}
var religion_other = {
type: jsPsychSurveyText,
questions: [
{
prompt: "If you answered 'Other' in the previous question, please specify",
name: "religion_other",
required: false,
},
],
data: {
screen: "demographics",
},
}
var religiosity = {
type: jsPsychMultipleSlider,
questions: [
{
prompt: "How religious would you define yourself?<br>",
name: "religiosity",
ticks: ["Not at All", "Very Religious"],
required: true,
min: 0,
max: 1,
step: 0.01,
slider_start: 0.5
},
{
prompt: "How actively engaged are you in religious activities and practices?<br>",
name: "religious_activity",
ticks: ["Not at All", "Very Active"],
required: true,
min: 0,
max: 1,
step: 0.01,
slider_start: 0.5
},
],
require_movement: true,
data: {
screen: "demographics",
},
}
timeline.push(religion, religion_other, religiosity)
// Instructions Questionnaires
var instructions2 = {
type: jsPsychHtmlButtonResponse,
stimulus:
"<h1>Part 2/4</h1>" +
"<p>Great! We will continue with a series of questionnaires about your personality.<br>Again, it is important that you answer truthfully. Please read the statements carefully and answer according to what describe you the best.</p>",
choices: ["Continue"],
data: { screen: "instructions2" },
}
timeline.push(instructions2)
/*======================================================================*/
/*---------------------Psychometric Scales------------------------------*/
/*======================================================================*/
/* Mini IPIP *==========================*/
var IPIP_items = []
for (const [index, element] of IPIP.entries()) {
IPIP_items.push({
prompt: element,
name: IPIP_dim[index],
ticks: scale2,
required: true,
min: 0,
max: 1,
step: 0.01,
slider_start: 0.5
})
}
var IPIP6 = {
type: jsPsychMultipleSlider,
questions: IPIP_items,
randomize_question_order: false,
preamble:
"<p><b>Survey 1/7</b></b></p>" +
"<p>Please answer the following questions based on how accurately each statement describes you.</p>",
require_movement: true,
on_start: function () {
; (document.body.style.cursor = "auto"),
(document.querySelector(
"#jspsych-progressbar-container"
).style.display = "inline")
},
data: {
screen: "IPIP6",
},
}
timeline.push(IPIP6)
/* Social Interaction Anxiety *==========================*/
var SIAS_items = []
//for (const [index, element] of SIAS_SF.entries()) {
for (var i = 0; i < 2; i++) {
SIAS_items.push({
prompt: SIAS_SF[i],
name: SIAS_dim[i],
ticks: scale2,
required: true,
min: 0,
max: 1,
step: 0.01,
slider_start: 0.5
})
}
// Attention Check 1
SIAS_items.push({
prompt: "<b>I am paying attention right now</b><br>",
name: "Attention_Check_1",
ticks: ["Strongly Disagree", "Strongly Agree"],
required: true,
min: 0,
max: 1,
step: 0.01,
slider_start: 0.5
})
for (var i = 2; i < 6; i++) {
SIAS_items.push({
prompt: SIAS_SF[i],
name: SIAS_dim[i],
ticks: scale2,
required: true,
min: 0,
max: 1,
step: 0.01,
slider_start: 0.5
})
}
var SIAS = {
type: jsPsychMultipleSlider,
questions: SIAS_items,
randomize_question_order: false,
preamble:
"<p><b>Survey 2/7</b></p>" +
"<p>Please answer the following questions based on how accurately each statement describes you.</p>",
require_movement: true,
on_start: function () {
; (document.body.style.cursor = "auto"),
(document.querySelector(
"#jspsych-progressbar-container"
).style.display = "inline")
},
data: {
screen: "SIAS",
},
}
timeline.push(SIAS)
/* Social Phobia *==========================*/
var SPS_items = []
for (const [index, element] of SPS_SF.entries()) {
SPS_items.push({
prompt: element,
name: "Social_Phobia_" + (index + 1),
ticks: scale2,
required: true,
min: 0,
max: 1,
step: 0.01,
slider_start: 0.5
})
}
var SPS = {
type: jsPsychMultipleSlider,
questions: SPS_items,
randomize_question_order: false,
preamble:
"<p><b>Survey 3/7</b></p>" +
"<p>Please answer the following questions based on how accurately each statement describes you.</p>",
require_movement: true,
on_start: function () {
; (document.body.style.cursor = "auto"),
(document.querySelector(
"#jspsych-progressbar-container"
).style.display = "inline")
},
data: {
screen: "SPS",
},
}
timeline.push(SPS)
/* Attitudes towards AI *==========================*/
var GAAIS_items = []
for (const [index, element] of GAAIS.entries()) {
GAAIS_items.push({
prompt: element,
name: GAAIS_dim[index],
ticks: scale2,
required: true,
min: 0,
max: 1,
step: 0.01,
slider_start: 0.5
})
}
var AI_attitudes = {
type: jsPsychMultipleSlider,
questions: GAAIS_items,
randomize_question_order: false,
preamble:
"<p><b>Survey 4/7</b></p>" +
"<p>We are interested in your attitudes towards Artificial Intelligence (AI).</p>" +
"<p>Please read the statements below carefully and indicate the extent to which you agree with each statement.</p>",
require_movement: true,
on_start: function () {
; (document.body.style.cursor = "auto"),
(document.querySelector(
"#jspsych-progressbar-container"
).style.display = "inline")
},
data: {
screen: "GAAIS",
},
}
timeline.push(AI_attitudes)
/* Narcissism *==========================*/
var FFNI_items = []
//for (const [index, element] of FFNI_BF.entries()) {
for (var i = 0; i < 20; i++) {
FFNI_items.push({
prompt: FFNI_BF[i],
name: FFNI_dim[i],
ticks: scale2,
required: true,
min: 0,
max: 1,
step: 0.01,
slider_start: 0.5
})
}
// Attention Check 2
FFNI_items.push({
prompt: "<b>Please select Strongly Agree to demonstrate your attention</b><br>",
name: "Attention_Check_2",
ticks: ["Strongly Disagree", "Strongly Agree"],
required: true,
min: 0,
max: 1,
step: 0.01,
slider_start: 0.5
})
for (var i = 20; i < 30; i++) {
FFNI_items.push({
prompt: FFNI_BF[i],
name: FFNI_dim[i],
ticks: scale2,
required: true,
min: 0,
max: 1,
step: 0.01,
slider_start: 0.5
})
}
// Marcinkowska et al., 2021 (https://doi.org/10.1038/s41598-021-90473-3)
FFNI_items.push({
prompt: "<b>How attractive would you say you are?</b><br>",
name: "self_rated_general_attractiveness",
ticks: ["Very Unattractive", "Very Attractive"],
required: false,
min: 0,
max: 1,
step: 0.01,
slider_start: 0.5
})
// Spielmann1 et al., 2019 (https://doi.org/10.1177/0265407519856701)
FFNI_items.push({
prompt: "<b>How would you rate your own physical attractiveness relative to the average person?</b><br>",
name: "self_rated_physical_attractiveness",
ticks: ["Not at all Attractive", "Very Attractive"],
required: false,
min: 0,
max: 1,
step: 0.01,
slider_start: 0.5
})
var FFNI = {
type: jsPsychMultipleSlider,
questions: FFNI_items,
randomize_question_order: false,
preamble:
"<p><b>Survey 5/7</b></p>" +
"<p>Please respond based on how much you agree or disagree with each each statement.</p>",
require_movement: true,
on_start: function () {
; (document.body.style.cursor = "auto"),
(document.querySelector(
"#jspsych-progressbar-container"
).style.display = "inline")
},
data: {
screen: "FFNI-BF",
},
}
timeline.push(FFNI)
/* Paranoia *==========================*/
var GPTS_items = []
for (const [index, element] of R_GPTS.entries()) {
GPTS_items.push({
prompt: element,
name: GPTS_dim[index],
ticks: scale1,
required: true,
min: 0,
max: 1,
step: 0.01,
slider_start: 0.5
})
}
var GPTS = {
type: jsPsychMultipleSlider,
questions: GPTS_items,
randomize_question_order: false,
preamble:
"<p><b>Survey 6/7</b></p>" +
"<p>Each statement below refers to thoughts and feelings you may have had <b>about others over the last month.</b></p>" +
"<p>Please think about the last month and indicate the extent to which you think each of these statements apply to you.</p>",
require_movement: true,
on_start: function () {
; (document.body.style.cursor = "auto"),
(document.querySelector(
"#jspsych-progressbar-container"
).style.display = "inline")
},
data: {
screen: "GPTS",
},
}
timeline.push(GPTS)
/* Intolerance to Uncertainty *==========================*/
var IUS_items = []
// for (const [index, element] of IUS.entries()) {
for (var i = 0; i < 8; i++) {
IUS_items.push({
prompt: IUS[i],
name: IUS_dim[i],
ticks: scale2,
required: true,
min: 0,
max: 1,
step: 0.01,
slider_start: 0.5
})
}
// Attention Check 3
IUS_items.push({
prompt: "<b>Please select Not at All to demonstrate your attention</b><br>",
name: "Attention_Check_3",
ticks: ["Not at All", "Extremely"],
required: true,
min: 0,
max: 1,
step: 0.01,
slider_start: 0.5
})
for (var i = 8; i <12; i++){
IUS_items.push({
prompt: IUS[i],
name: IUS_dim[i],
ticks:scale2,
required:true,
min: 0,
max: 1,
step: 0.01,
slider_start: 0.5
})
}
var uncertainty_intolerance_scale = {
type: jsPsychMultipleSlider,
questions: IUS_items,
randomize_question_order: false,
preamble:
"<p><b>Survey 7/7</b></p>" +
"<p>Please read the statements below carefully and indicate the extent to which you agree with each statement.</p>",
require_movement: true,
on_start: function () {
; (document.body.style.cursor = "auto"),
(document.querySelector(
"#jspsych-progressbar-container"
).style.display = "inline")
},
data: {
screen: "IUS",
},
}
timeline.push(uncertainty_intolerance_scale)
/*=================================================================================*/
/*=========================== Experiment Block 1 ===================================*/
/*=================================================================================*/
// Experiment Instructions
var task_instructions_1 = {
type: jsPsychHtmlButtonResponse,
stimulus:
"<h1>Part 3/4</h1>" +
"<div style='text-align: left'>" +
"<p>In this part of the experiment, images of faces will be briefly flashed on the screen.</p>" +
"<p>After each image, you will be asked a series of questions, such as:</p><ul>" +
"<li><p>To what extent do you find this person <b>good-looking</b> (the degree to which the face is aesthetically appealing).</p></li>" +
"<li><p>How <b>attractive</b> do you find this person (how drawn are you to this person).</p></li>" +
"<li><p>To what extent do you find this person <b>trustworthy</b> (reliable, honest, responsible etc.,).</p></li>" +
"<li><p>How much does this person remind you of <b>someone you know</b> (how familiar does this face look to you).</p></li><br>" +
"<p>Below is an example of how the questions will appear after each image:</p></div>" +
"<div style='float: center'><img src='utils/question_demo_2.png' height='400' style='border:5px solid #D3D3D3; padding:3px; margin:5px'></img>" +
"<p>We are interested in your <b>first impressions</b>. Please respond according to your gut feelings.</p>",
choices: ["Start"],
data: { screen: "task_instructions_1" },
}
timeline.push(task_instructions_1)
var trial_number = 1 // trial indexing variable starts at 1 for convenience
var block_number = 1
// Fixation cross
var fixation = {
type: jsPsychHtmlKeyboardResponse,
stimulus: '<div style="font-size:60px;">+</div>',
choices: "NO_KEYS",
trial_duration: 750,
// trial_duration: 0, // for testing
on_start: function () {
; (document.body.style.cursor = "none"),
(document.querySelector(
"#jspsych-progressbar-container"
).style.display = "none")
},
save_trial_parameters: {
trial_duration: true,
},
data: { screen: "fixation" },
}
//Stimuli block
// var images = [];
// for (var i = 10; i < 20; i++) {
// images.push({stimulus: "utils/Faces/NS1" + i + ".jpg"});
// }
// Loop through stimuli
var stimuli_trial = {
type: jsPsychImageKeyboardResponse,
stimulus: jsPsych.timelineVariable("stimulus"),
choices: "NO_KEYS",
trial_duration: 500,
// trial_duration: 200, // for testing
on_start: function () {
; (document.body.style.cursor = "none"),
(document.querySelector(
"#jspsych-progressbar-container"
).style.display = "none")
},
save_trial_parameters: {
trial_duration: true,
},
on_finish: function (data) {
data.trial_number = trial_number
trial_number += 1
data.block_number = block_number
},
data: { screen: "stimuli" },
}
var trait_items = []
// Add Items on Attractiveness Trustworthiness and Familiarity
for (const [index, element] of items.entries()) {
trait_items.push({
prompt: element,
name: dimensions[index],
ticks: scale1,
required: true,
min: 0,
max: 1,
step: 0.01,
slider_start: 0.5
})
}
var questionnaire = {
type: jsPsychMultipleSlider, // this is a custom plugin in utils
questions: trait_items,
randomize_question_order: false,
//preamble: '<div style="font-size:24px;"><b>Assuming that the face you saw was real</b><br></p></div>',
require_movement: true,
on_start: function () {
; (document.body.style.cursor = "auto"),
(document.querySelector(
"#jspsych-progressbar-container"
).style.display = "inline")
},
data: {
screen: "questionnaire",
},
}
//Loop through fixation, stimuli and questionnaire blocks
var test_procedure = {
timeline: [fixation, stimuli_trial, questionnaire],
timeline_variables: stimuli,
randomize_order: true,
repetitions: 0,
}
timeline.push(test_procedure)
/*=================================================================================*/
/*=================================== Break =======================================*/
/*=================================================================================*/
// var make_break = {
// type: jsPsychHtmlButtonResponse,
// choices: ["I am ready to continue!"],
// stimulus: "<h1>BREAK</h1>" +
// "<p>You are left with one last part of the experiment.</p>" +
// "<p> We know it's long and challenging, so we appreciate you staying focused until the end!</p>",
// save_trial_parameters: {
// trial_duration: true,
// },
// on_finish: function(){
// block_number +=1
// trial_number =1
// },
// data: { screen: "break" }
// }
// timeline.push(make_break)
/*=================================================================================*/
/*=========================== Experiment Block 2===================================*/
/*=================================================================================*/
timeline.push({
type: jsPsychHtmlKeyboardResponse,
stimulus: "<p>Please wait for the experiment to load...</p>",
choices: "NO_KEYS",
trial_duration: 1000,
data: { screen: "part_3_loading" },
})
// Preload image stimuli to prevent lagging during experiment
// timeline.push({
// type: jsPsychPreload,
// images: stimuli.map((a) => a.stimulus), // stimuli is a variable defined in ../stimuli
// })
// Experiment Instructions
var task_instructions_2 = {
type: jsPsychHtmlButtonResponse,
stimulus:
"<h1>Part 4/4</h1>" +
"<p>In the final part of the experiment, you will see the faces again. Only this time, you have to tell whether they are real or fake.</p>" +
"<p>These images were actually created specially for this experiment: about half of them are <b>photos of real people</b>, and the other half of faces were entirely <b>computer-generated</b> using a new AI algorithm that we want to test.</p>" +
"<p>This algorithm, based on a new generation of deep-learning models, is able to produce photo-realistic images of faces according to pre-specified parameters (e.g., gender, age, emotion, ...).</p>" +
"<p>Among the artificial faces generated, only those that best matched the characteristics of the real photos were selected for this experiment (same background, lighting conditions, age range, etc.).</p>" +
"<p>In order to help us validate our algorithm, we will ask you to tell whether you think the faces you see are <b>real</b> (photos of real people) or <b>fake</b> (computer-generated images).</p></br>"+
"<div style='float: center'><img src='utils/realness_demo.png' height='150' style='border:5px solid #D3D3D3; padding:3px; margin:5px'></img>"+
"<p>Please respond according to your gut feelings.</p></div>",
choices: ["Continue"],
on_finish: function(){
block_number +=1
trial_number =1
},
data: { screen: "task_instructions_2" },
}
timeline.push(task_instructions_2)
// Add Item on Perception of Realness
var realness = {
type: jsPsychMultipleSlider, // this is a custom plugin in utils
questions: [{
prompt: "I think this face is...",
name: "perceived_realness",
ticks: ["Fake", "Real"],
required: true,
min: 0,
max: 1,
step: 0.01,
slider_start: 0.5,
}],
randomize_question_order: false,
//preamble: '<div style="font-size:24px;"><b>Assuming that the face you saw was real</b><br></p></div>',
require_movement: true,
on_start: function () {
; (document.body.style.cursor = "auto"),
(document.querySelector(
"#jspsych-progressbar-container"
).style.display = "inline")
},
data: {
screen: "perceived_realness",
},
}
// Create loop
var test_procedure_2 = {
timeline: [fixation, stimuli_trial, realness],
timeline_variables: stimuli,
randomize_order: true,
repetitions: 0,
}
timeline.push(test_procedure_2)
/*============================================================*/
/*==================== End of Experiment =====================*/
/*===========================================================*/
var end_screen = {
type: jsPsychHtmlButtonResponse,
stimulus:
"<p>You have come to the end of this study. </p>" +
"<p>Thank you for participating!</p>",
choices: ["End"],
data: {
screen: 'end_screen'
}
}
timeline.push(end_screen)
// Fullscreen mode
timeline.push({
type: jsPsychFullscreen,
fullscreen_mode: false,
})