-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmgr.js
180 lines (156 loc) · 6.77 KB
/
mgr.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
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
define(['managerAPI',
'https://cdn.jsdelivr.net/gh/minnojs/minno-datapipe@1.*/datapipe.min.js'], function(Manager){
//You can use the commented-out code to get parameters from the URL.
//const queryString = window.location.search;
//const urlParams = new URLSearchParams(queryString);
//const pt = urlParams.get('pt');
var API = new Manager();
//const subid = Date.now().toString(16)+Math.floor(Math.random()*10000).toString(16);
init_data_pipe(API, '14LvuF0PE03v', {file_type:'csv'});
API.setName('mgr');
API.addSettings('skip',true);
//Randomly select which of two sets of category labels to use.
let raceSet = API.shuffle(['a','b'])[0];
let blackLabels = [];
let whiteLabels = [];
if (raceSet == 'a') {
blackLabels.push('African Americans');
whiteLabels.push('European Americans');
} else {
blackLabels.push('Black people');
whiteLabels.push('White people');
}
API.addGlobal({
raceiat:{},
//YBYB: change when copying back to the correct folder
baseURL: './images/',
raceSet:raceSet,
blackLabels:blackLabels,
whiteLabels:whiteLabels,
//Select randomly what attribute words to see.
//Based on Axt, Feng, & Bar-Anan (2021).
posWords : API.shuffle([
'Love', 'Cheer', 'Friend', 'Pleasure',
'Adore', 'Cheerful', 'Friendship', 'Joyful',
'Smiling','Cherish', 'Excellent', 'Glad',
'Joyous', 'Spectacular', 'Appealing', 'Delight',
'Excitement', 'Laughing', 'Attractive','Delightful',
'Fabulous', 'Glorious', 'Pleasing', 'Beautiful',
'Fantastic', 'Happy', 'Lovely', 'Terrific',
'Celebrate', 'Enjoy', 'Magnificent', 'Triumph'
]),
negWords : API.shuffle([
'Abuse', 'Grief', 'Poison', 'Sadness',
'Pain', 'Despise', 'Failure', 'Nasty',
'Angry', 'Detest', 'Horrible', 'Negative',
'Ugly', 'Dirty', 'Gross', 'Evil',
'Rotten','Annoy', 'Disaster', 'Horrific',
'Scorn', 'Awful', 'Disgust', 'Hate',
'Humiliate', 'Selfish', 'Tragic', 'Bothersome',
'Hatred', 'Hurtful', 'Sickening', 'Yucky'
])
});
API.addTasksSet({
instructions: [{
type: 'message',
buttonText: 'Continue'
}],
intro: [{
inherit: 'instructions',
name: 'intro',
templateUrl: 'intro.jst',
title: 'Intro',
header: 'Welcome'
}],
raceiat_instructions: [{
inherit: 'instructions',
name: 'raceiat_instructions',
templateUrl: 'raceiat_instructions.jst',
title: 'IAT Instructions',
header: 'Implicit Association Test'
}],
explicits: [{
type: 'quest',
name: 'explicits',
scriptUrl: 'explicits.js'
}],
raceiat: [{
type: 'time',
name: 'raceiat',
scriptUrl: 'raceiat.js'
}],
lastpage: [{
type: 'message',
name: 'lastpage',
templateUrl: 'lastpage.jst',
title: 'End',
//Uncomment the following if you want to end the study here.
//last:true,
header: 'You have completed the study'
}],
//Use if you want to redirect the participants elsewhere at the end of the study
redirect:
[{
//Replace with any URL you need to put at the end of your study, or just remove this task from the sequence below
type:'redirect', name:'redirecting', url: 'https://www.google.com/search'
}],
//This task waits until the data are sent to the server.
uploading: uploading_task({header: 'just a moment', body:'Please wait, sending data... '})
});
API.addSequence([
{ type: 'isTouch' }, //Use Minno's internal touch detection mechanism.
{ type: 'post', path: ['$isTouch', 'raceSet', 'blackLabels', 'whiteLabels'] },
// apply touch only styles
{
mixer:'branch',
conditions: {compare:'global.$isTouch', to: true},
data: [
{
type: 'injectStyle',
css: [
'* {color:red}',
'[piq-page] {background-color: #fff; border: 1px solid transparent; border-radius: 4px; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05); margin-bottom: 20px; border-color: #bce8f1;}',
'[piq-page] > ol {margin: 15px;}',
'[piq-page] > .btn-group {margin: 0px 15px 15px 15px;}',
'.container {padding:5px;}',
'[pi-quest]::before, [pi-quest]::after {content: " ";display: table;}',
'[pi-quest]::after {clear: both;}',
'[pi-quest] h3 { border-bottom: 1px solid transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; padding: 10px 15px; color: inherit; font-size: 2em; margin-bottom: 20px; margin-top: 0;background-color: #d9edf7;border-color: #bce8f1;color: #31708f;}',
'[pi-quest] .form-group > label {font-size:1.2em; font-weight:normal;}',
'[pi-quest] .btn-toolbar {margin:15px;float:none !important; text-align:center;position:relative;}',
'[pi-quest] [ng-click="decline($event)"] {position:absolute;right:0;bottom:0}',
'[pi-quest] [ng-click="submit()"] {width:30%;line-height: 1.3333333;border-radius: 6px;}',
// larger screens
'@media (min-width: 480px) {',
' [pi-quest] [ng-click="submit()"] {width:30%;padding: 10px 16px;font-size: 1.6em;}',
'}',
// phones and smaller screens
'@media (max-width: 480px) {',
' [pi-quest] [ng-click="submit()"] {padding: 8px 13px;font-size: 1.2em;}',
' [pi-quest] [ng-click="decline($event)"] {font-size: 0.9em;padding:3px 6px;}',
'}'
]
}
]
},
{inherit: 'intro'},
{
mixer:'random',
data:[
{inherit: 'explicits'},
// force the instructions to preceed the iat
{
mixer: 'wrapper',
data: [
{inherit: 'raceiat_instructions'},
{inherit: 'raceiat'}
]
}
]
},
{inherit: 'uploading'},
{inherit: 'lastpage'},
{inherit: 'redirect'}
]);
return API.script;
});