-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.js
424 lines (401 loc) · 11.7 KB
/
main.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
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
PennController.ResetPrefix(null) // Keep here
DebugOff()
Sequence("intro", "consent", "catch_1", "catch_2", //Consent form and catch questions
"instructions_psa", "PSA", //PSA
"instructions_story", "Story1", "Story2", //Story 1, Story 2
"instructions_character", randomize("character"), //Introduce character (random order)
"instructions_math", randomize("math"), //Math questions (random order)
"instructions_memory", randomize("memory"), //Memory questions (random order grouped by character)
"instructions_production", randomize("production"), //Production questions (random order)
"demographics", //Demographics
"validation_1", SendResults(), "validation_2") //Validation instructions, record results, give code
code = (()=>([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,a=>(a^Math.random()*16>>a/4).toString(16)))()
//Intro
newTrial("intro",
newText("instructions", "This study involves reading PSA (public service announcement) \
texts on various topics, reading descriptions of different people, and then answering \
questions about what you have read. <br><br>Please click the arrow to continue.")
.print()
,
newButton("next", "Next")
.print()
.wait()
)
//Consent form
newTrial("consent",
newHtml("consent_form", "consent.html")
.center()
.print()
,
newText("consent_question", "I have read this informed consent document and the material \
contained in it has been explained to me verbally. All my questions have been answered, \
and I freely and voluntarily choose to participate.")
.css("width", "600px")
.left()
.print()
,
newScale("consent_answer", "I want to participate in this study.",
"I do not wish to participate in this study.")
.radio()
.labelsPosition("right")
.vertical()
.css("width", "600px")
.print()
.wait()
.test.selected("I do not wish to participate in this study.")
.success(
clear()
,
newText("leave", "You indicated that you did not want to participate in this study, so it will not begin.")
.print()
,
SendResults()
,
newButton().wait()
)
)
//Catch trial 1
newTrial("catch_1",
newText("catch_text", "Add 2 to 4, and type the answer out in lower-case word form.")
.print()
,
newTextInput("catch_answer", "")
.center()
.lines(0)
.size(100, 30)
.print()
,
newButton("next", "Next")
.print()
.wait(getTextInput("catch_answer").test.text(/six/))
)
//Catch trial 2
newTrial("catch_2",
newText("catch2_text", "Type the word that you hear in upper case.")
.print()
,
newAudio("catch2_audio", "catch_word.mp3")
.center()
.print()
.wait()
,
newTextInput("catch2_answer", "")
.center()
.lines(0)
.size(200, 30)
.print()
,
newButton("next", "Next")
.print()
.wait(getTextInput("catch2_answer").test.text(/LANGUAGE/))
)
//Instructions: PSA
newTrial("instructions_psa",
newText("instructions", "In this study, you will read three different kinds of texts. \
Please read each one carefully. <br><brFirst, you'll see an informational article.")
.print()
,
newButton("next", "Next")
.print()
.wait()
)
//PSA
Template("stimuli_training.csv", row =>
newTrial("PSA",
newHtml("PSA_text", row.psa)
.print()
,
newTimer("wait", "20000")
.start()
.wait()
,
newButton("next", "Next")
.print()
.wait()
)
)
//Instructions: stories
newTrial("instructions_story",
newText("instructions", "Next, please read the following short biographies.")
.print()
,
newButton("next", "Next")
.print()
.wait()
)
//Story 1
Template("stimuli_training.csv", row =>
newTrial("Story1",
newHtml("story1_text", row.story1)
.print()
,
newTimer("wait", "20000")
.start()
.wait()
,
newButton("next", "Next")
.print()
.wait()
)
)
//Story 2
Template("stimuli_training.csv", row =>
newTrial("Story2",
newHtml("story2_text", row.story2)
.print()
,
newTimer("wait", "20000")
.start()
.wait()
,
newButton("next", "Next")
.print()
.wait()
)
)
//Instructions: introduce characters
newTrial("instructions_character",
newText("instructions", "Now, you're going to meet 12 different people. For each person, \
you'll see their name and a few facts about them. Please read these descriptions carefully.")
.print()
,
newButton("next", "Next")
.print()
.wait()
)
//Characters
Template("stimuli_characters.csv", row =>
newTrial("character",
newText("stim", row.introduction)
.center()
.print()
,
newTimer("wait", "2000")
.start()
.wait()
,
newButton("next", "Next")
.print()
.wait()
)
)
//Instructions: math
newTrial("instructions_math",
newText("instructions", "In the following section, you will be asked to solve a series \
of math questions. Please do your best to arrive at the correct answer. You may use \
scratch paper, but no calculators.")
.print()
,
newButton("start", "Next")
.print()
.wait()
)
//Math
Template("math.csv", row =>
newTrial("math",
newText("question", row.question)
,
newTextInput("answer", "")
.before(getText("question"))
.center()
.lines(0)
.size(100, 30)
.print()
.log()
,
newButton("next", "Next")
.print()
.wait(getTextInput("answer").test.text(/^(?!\s*$).+/))
)
)
//Instructions: memory
newTrial("instructions_memory",
newText("instructions", "Now, we're going to ask some questions about the people you met. \
Please answer, trying to remember as best you can. If you can't remember, please make \
your best guess.")
.center()
.print()
,
newButton("start", "Next")
.print()
.wait()
)
//Memory
Template("stimuli_characters.csv", row =>
newTrial("memory",
defaultText
.css("width", "350px")
.left()
.print()
,
newText("job_prompt", row.memory_job)
,
newDropDown("job_answers", "")
.add("engineer", "Uber driver", "food service", "mechanic", "teacher", "accountant",
"retail", "janitor", "IT", "nurse", "doctor", "sales")
.before(getText("job_prompt"))
.shuffle()
.print()
.log()
,
newText("pet_prompt", row.memory_pet)
,
newDropDown("pet_answers", "")
.add("cat", "dog", "fish")
.before(getText("pet_prompt"))
.shuffle()
.print()
.log()
,
newText("pronoun_prompt", row.memory_pronoun)
,
newDropDown("pronoun_answers", "")
.add("he/him", "she/her", "they/them")
.before(getText("pronoun_prompt"))
.shuffle()
.print()
.log()
,
newButton("next", "Next")
.print()
.wait(getDropDown("job_answers").test.selected()
.and(getDropDown("pet_answers").test.selected())
.and(getDropDown("pronoun_answers").test.selected()))
)
.log("list", row.group)
.log("condition", row.condition)
.log("name", row.name)
.log("pronoun", row.pronoun)
.log("job", row.job)
.log("pet", row.pet)
.log("subj_code", code)
)
//Instructions: production
newTrial("instructions_production",
newText("instructions", "Next, you will see the beginning of a sentence. Please write \
an ending to the sentence in a way that makes sense to you. <br><br>For example: \
<br><br>After Thomas got home from working as a personal trainer... \
<br>...he made dinner.")
.left()
.print()
,
newButton("start", "Next")
.print()
.wait()
)
//Production
Template("stimuli_characters.csv", row =>
newTrial("production",
defaultText
.left()
.css("width", "450px")
.print()
,
newText("instruction", "Please write an ending to the sentence in a way that makes sense to you.")
,
newText("prompt", row.production)
,
newTextInput("sentence", "")
.lines(0)
.size(425, 100)
.print()
.log()
,
newButton("next", "Next")
.print()
.wait(getTextInput("sentence").test.text(/^(?!\s*$).+/))
)
.log("list", row.group)
.log("condition", row.condition)
.log("name", row.name)
.log("pronoun", row.pronoun)
.log("job", row.job)
.log("pet", row.pet)
.log("subj_code", code)
)
//Demographics
newTrial("demographics",
newText("instructions", "To wrap up, please answer these demographic questions.")
.css("width", "700px")
.left()
.print()
,
newText("age", "Age:")
.css("width", "150px")
.left()
,
newTextInput("enter_age", "")
.before(getText("age"))
.css("width", "300px")
.print()
.log()
,
newText("gender", "Gender:")
.css("width", "150px")
.left()
,
newTextInput("enter_gender", "")
.before(getText("gender"))
.css("width", "300px")
.print()
.log()
,
newText("english", "Please rate your overall ability in the English language:")
.css("width", "700px")
.left()
.print()
,
newScale("enter_english", "Native (learned from birth)",
"Fully competent in speaking, listening, reading, and writing, but not native",
"Limited but adequate competence in speaking, reading, and writing",
"Restricted ability (e.g. only reading or speaking/listening)",
"Some familiarity (e.g. a year of instruction in school)")
.radio()
.labelsPosition("right")
.css("width", "700px")
.vertical()
.print()
.log()
,
newText("turkID", "MTurk ID:")
.css("width", "150px")
.left()
,
newTextInput("enter_turkID", "")
.before(getText("turkID"))
.css("width", "300px")
.print()
.log()
,
newButton("next", "Next")
.print()
.wait(getTextInput("enter_age").test.text(/^(?!\s*$).+/)
.and(getTextInput("enter_gender").test.text(/^(?!\s*$).+/))
.and(getTextInput("enter_turkID").test.text(/^(?!\s*$).+/))
.and(getScale("enter_english").test.selected()))
)
//Validation
newTrial("validation_1",
newText("validation", "Thank you for participating in this study! We are studying \
how people learn facts about others. <br><br> If you have any questions or concerns, \
please email the requester through MTurk. <br><br> To get credit, please enter \
this validation code in MTurk.")
.print()
,
newButton("next", "Get validation code")
.print()
.wait()
)
newTrial("validation_2",
newText("Your code is: ")
.print()
,
newText(code)
.bold()
.print()
,
newButton("next", "Finish")
.print()
.wait()
)
code=undefined