forked from magpie-ea/magpie-departure-point
-
Notifications
You must be signed in to change notification settings - Fork 0
/
05_views.js
131 lines (104 loc) · 4.85 KB
/
05_views.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
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
// In this file you can instantiate your views
// We here first instantiate wrapping views, then the trial views
/** Wrapping views below
* Obligatory properties
* trials: int - the number of trials this view will appear
* name: string
*Optional properties
* buttonText: string - the text on the button (default: 'next')
* text: string - the text to be displayed in this view
* title: string - the title of this view
* More about the properties and functions of the wrapping views - https://magpie-ea.github.io/magpie-docs/01_designing_experiments/01_template_views/#wrapping-views
*/
// Every experiment should start with an intro view. Here you can welcome your participants and tell them what the experiment is about
const intro = magpieViews.view_generator("intro", {
trials: 1,
name: 'intro',
// If you use JavaScripts Template String `I am a Template String`, you can use HTML <></> and javascript ${} inside
title:"Magpie Mental Rotation",
text: `Thank you for participating in this mental rotation experiment.
<br />
<br />
This experiment is about rotating objects in your head to find out if they are congruent or not.
<br />
<br />
This is a minimal experiment with multiple key press views.`,
buttonText: 'begin the experiment'
});
// For most tasks, you need instructions views
const instructions = magpieViews.view_generator("instructions", {
trials: 1,
name: 'instructions',
title: 'General Instructions',
text: `Look at the images presented to you in the following trials.
<br />
If you think both objects are the same, then press the f key. Else press the j key.
`,
buttonText: 'go to trials'
});
const instructions_practice = magpieViews.view_generator("instructions", {
trials: 1,
name: 'instructions_practice',
title: 'Main Tasks',
text: `The 12 Practice Trials are now over, the main tasks start now`,
buttonText: 'go to trials'
});
// In the post test questionnaire you can ask your participants addtional questions
const post_test = magpieViews.view_generator("post_test", {
trials: 1,
name: 'post_test',
title: 'Additional information',
text: 'Answering the following questions is optional, but your answers will help us analyze our results.'
// You can change much of what appears here, e.g., to present it in a different language, as follows:
// buttonText: 'Weiter',
// age_question: 'Alter',
// gender_question: 'Geschlecht',
// gender_male: 'männlich',
// gender_female: 'weiblich',
// gender_other: 'divers',
// edu_question: 'Höchster Bildungsabschluss',
// edu_graduated_high_school: 'Abitur',
// edu_graduated_college: 'Hochschulabschluss',
// edu_higher_degree: 'Universitärer Abschluss',
// languages_question: 'Muttersprache',
// languages_more: '(in der Regel die Sprache, die Sie als Kind zu Hause gesprochen haben)',
// comments_question: 'Weitere Kommentare'
});
// The 'thanks' view is crucial; never delete it; it submits the results!
const thanks = magpieViews.view_generator("thanks", {
trials: 1,
name: 'thanks',
title: 'Thank you for taking part in this experiment!',
prolificConfirmText: 'Press the button'
});
/** trial (magpie's Trial Type Views) below
* Obligatory properties
- trials: int - the number of trials this view will appear
- name: string - the name of the view type as it shall be known to _magpie (e.g. for use with a progress bar)
and the name of the trial as you want it to appear in the submitted data
- data: array - an array of trial objects
* Optional properties
- pause: number (in ms) - blank screen before the fixation point or stimulus show
- fix_duration: number (in ms) - blank screen with fixation point in the middle
- stim_duration: number (in ms) - for how long to have the stimulus on the screen
More about trial life cycle - https://magpie-ea.github.io/magpie-docs/01_designing_experiments/04_lifecycles_hooks/
- hook: object - option to hook and add custom functions to the view
More about hooks - https://magpie-ea.github.io/magpie-docs/01_designing_experiments/04_lifecycles_hooks/
* All about the properties of trial views
* https://magpie-ea.github.io/magpie-docs/01_designing_experiments/01_template_views/#trial-views
*/
// There are many more templates available:
// forced_choice, slider_rating, dropdown_choice, testbox_input, rating_scale, image_selection, sentence_choice,
// key_press, self_paced_reading and self_paced_reading_rating_scale
const key_pressed_2A = magpieViews.view_generator("key_press", {
trials: trial_info.key_pressed.length - 12,
name: 'key_pressed_2A',
data: _.shuffle(trial_info.key_pressed),
pause: 250
});
const key_pressed_trial = magpieViews.view_generator("key_press", {
trials: 12,
name: 'key_pressed_trial',
data: _.shuffle(trial_info.key_pressed),
pause: 250
});