-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemographics.html
More file actions
495 lines (435 loc) · 13.6 KB
/
demographics.html
File metadata and controls
495 lines (435 loc) · 13.6 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Particinnnnpant Information | Parkinsense Assessment</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
background-color: #ffffff;
background-image:
linear-gradient(rgba(0, 0, 0, 0.08) 1px, transparent 1px),
linear-gradient(90deg, rgba(0, 0, 0, 0.08) 1px, transparent 1px);
background-size: 50px 50px;
background-position: 0 0, 0 0;
color: #1a1a1a;
line-height: 1.6;
min-height: 100vh;
padding: 2rem;
position: relative;
font-size: 1.25rem;
}
body::before {
content: '';
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: radial-gradient(circle at center, rgba(255, 255, 255, 1) 20%, rgba(255, 255, 255, 0.7) 50%, rgba(255, 255, 255, 0) 80%);
pointer-events: none;
z-index: 1;
}
/* Animated grid lights */
.grid-light {
position: fixed;
width: 8px;
height: 8px;
background: radial-gradient(circle, #888888 0%, rgba(136, 136, 136, 0.6) 50%, transparent 70%);
border-radius: 50%;
pointer-events: none;
z-index: 1;
opacity: 0.6;
}
.grid-light-1 {
top: 15%;
left: -10px;
animation: moveRightHorizontal 14s linear infinite, greenGlow 3.2s ease-in-out infinite;
}
.grid-light-2 {
top: 85%;
left: -10px;
animation: moveRightHorizontal 11s linear infinite, greenGlow 2.8s ease-in-out infinite;
animation-delay: 2s, 0.5s;
}
.grid-light-3 {
top: -10px;
left: 30%;
animation: moveDownVertical 13s linear infinite, greenGlow 3.5s ease-in-out infinite;
animation-delay: 1s, 1.2s;
}
.grid-light-4 {
bottom: -10px;
left: 70%;
animation: moveUpVertical 12s linear infinite, greenGlow 2.6s ease-in-out infinite;
animation-delay: 3s, 0.8s;
}
@keyframes moveRightHorizontal {
0% { left: -10px; }
100% { left: calc(100% + 10px); }
}
@keyframes moveDownVertical {
0% { top: -10px; }
100% { top: calc(100% + 10px); }
}
@keyframes moveUpVertical {
0% { bottom: -10px; }
100% { bottom: calc(100% + 10px); }
}
@keyframes greenGlow {
0%, 70%, 100% {
background: radial-gradient(circle, #888888 0%, rgba(136, 136, 136, 0.6) 50%, transparent 70%);
box-shadow: 0 0 0 rgba(34, 197, 94, 0);
opacity: 0.6;
transform: scale(1);
}
15%, 55% {
background: radial-gradient(circle, #22c55e 0%, rgba(34, 197, 94, 0.8) 50%, rgba(34, 197, 94, 0.2) 70%);
box-shadow: 0 0 15px rgba(34, 197, 94, 0.8), 0 0 30px rgba(34, 197, 94, 0.4);
opacity: 1;
transform: scale(1.3);
}
}
.container {
max-width: 800px;
width: 100%;
margin: 0 auto;
position: relative;
z-index: 2;
background: rgba(255, 255, 255, 0.95);
border-radius: 20px;
padding: 3rem;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
border: 1px solid rgba(0, 0, 0, 0.05);
backdrop-filter: blur(10px);
}
h1 {
font-size: 3.5rem;
font-weight: 400;
color: #1a1a1a;
margin-bottom: 0.5rem;
letter-spacing: -0.02em;
text-align: center;
}
.subtitle {
font-size: 1.5rem;
color: #4a4a4a;
text-align: center;
margin-bottom: 3rem;
max-width: 60ch;
margin-left: auto;
margin-right: auto;
}
form {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 2rem;
justify-items: stretch;
align-items: start;
}
.form-group {
display: flex;
flex-direction: column;
}
.form-group.full-width {
grid-column: 1 / -1;
}
label {
font-size: 1.1rem;
font-weight: 500;
color: #374151;
margin-bottom: 0.5rem;
text-transform: uppercase;
letter-spacing: 0.05em;
}
input, select {
padding: 1.25rem 1.5rem;
border-radius: 12px;
border: 1px solid #e5e7eb;
background-color: #ffffff;
color: #1a1a1a;
font-size: 1.25rem;
font-family: inherit;
transition: all 0.2s ease;
appearance: none;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
background-position: right 0.5rem center;
background-repeat: no-repeat;
background-size: 1.5em 1.5em;
padding-right: 2.5rem;
}
input {
background-image: none !important;
padding-right: 1.5rem;
}
input:focus, select:focus {
outline: none;
border-color: #1a1a1a;
box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.1);
}
input:hover, select:hover {
border-color: #d1d5db;
}
select option {
color: #1a1a1a;
background-color: #ffffff;
}
button {
background-color: #1a1a1a;
color: white;
border: none;
padding: 1.5rem 4rem;
font-size: 1.4rem;
font-weight: 500;
border-radius: 2rem;
cursor: pointer;
transition: all 0.2s ease;
font-family: inherit;
margin: 2rem auto 0 auto;
grid-column: 1 / -1;
display: block;
width: fit-content;
}
button:hover {
background-color: #333333;
transform: translateY(-1px);
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}
button:active {
transform: translateY(0);
}
.required {
color: #ef4444;
}
@media (max-width: 768px) {
.container {
padding: 2rem;
margin: 1rem;
}
form {
grid-template-columns: 1fr;
gap: 1.5rem;
}
h1 {
font-size: 2.8rem;
}
button {
width: 100%;
}
}
/* Loading state */
.loading {
opacity: 0.6;
pointer-events: none;
}
.loading button {
background-color: #9ca3af;
cursor: not-allowed;
}
.success-message {
background: #dcfce7;
border: 1px solid #bbf7d0;
color: #166534;
padding: 1rem;
border-radius: 8px;
margin-bottom: 1rem;
text-align: center;
display: none;
}
</style>
<!-- Firebase SDK -->
<script src="https://www.gstatic.com/firebasejs/10.12.0/firebase-app-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/10.12.0/firebase-firestore-compat.js"></script>
<script>
const firebaseConfig = {
apiKey: "AIzaSyCIijYBeCcyl8Mt414nueAgIId8PfWaW5M",
authDomain: "pdstudy-99397.firebaseapp.com",
projectId: "pdstudy-99397",
storageBucket: "pdstudy-99397.firebasestorage.app",
messagingSenderId: "235927780090",
appId: "1:235927780090:web:348a8c85c130371686a743",
measurementId: "G-Y116J49LYT"
};
firebase.initializeApp(firebaseConfig);
const db = firebase.firestore();
</script>
</head>
<body>
<!-- Animated grid lights -->
<div class="grid-light grid-light-1"></div>
<div class="grid-light grid-light-2"></div>
<div class="grid-light grid-light-3"></div>
<div class="grid-light grid-light-4"></div>
<div class="container">
<h1>Participant Information</h1>
<p class="subtitle">Please provide some basic information about yourself to help us analyze the results.</p>
<div class="success-message" id="successMessage">
Information saved successfully! Redirecting...
</div>
<form id="infoForm">
<div class="form-group">
<label for="prolificID">
Prolific ID <span class="required">*</span>
</label>
<input type="text" id="prolificID" required placeholder="Enter your Prolific ID" />
</div>
<div class="form-group">
<label for="age">
Age <span class="required">*</span>
</label>
<input type="number" min="0" max="90" id="age" required placeholder="Enter your age" />
</div>
<div class="form-group">
<label for="gender">
Gender
</label>
<select id="gender">
<option value="">Select gender</option>
<option value="male">Male</option>
<option value="female">Female</option>
<option value="other">Other</option>
</select>
</div>
<div class="form-group">
<label for="handedness">
Handedness
</label>
<select id="handedness">
<option value="">Select handedness</option>
<option value="right">Right-handed</option>
<option value="left">Left-handed</option>
<option value="ambidextrous">Ambidextrous</option>
</select>
</div>
<div class="form-group">
<label for="education">
Education (Years)
</label>
<input type="number" min="0" max="40" id="education" placeholder="Years of education" />
</div>
<div class="form-group">
<label for="sleep">
Sleep Last Night
</label>
<select id="sleep">
<option value="">Select hours slept</option>
<option value="less_than_4">Less than 4 hours</option>
<option value="4_6">4–6 hours</option>
<option value="6_8">6–8 hours</option>
<option value="8_plus">8+ hours</option>
</select>
</div>
<div class="form-group">
<label for="ethnicity">
Ethnicity
</label>
<select id="ethnicity">
<option value="">Select ethnicity</option>
<option value="hispanic">Hispanic or Latino</option>
<option value="non_hispanic">Not Hispanic or Latino</option>
</select>
</div>
<div class="form-group">
<label for="race">
Race
</label>
<select id="race">
<option value="">Select race</option>
<option value="white">White</option>
<option value="black">Black or African American</option>
<option value="asian">Asian</option>
<option value="native">American Indian or Alaska Native</option>
<option value="pacific">Pacific Islander</option>
<option value="multiple">Multiple</option>
</select>
</div>
<button type="button" onclick="startExperiment()">Continue to Assessment</button>
</form>
</div>
<script>
function startExperiment() {
const pid = document.getElementById('prolificID').value.trim();
const age = parseInt(document.getElementById('age').value);
const sex = document.getElementById('gender').value;
const handedness = document.getElementById('handedness').value;
const education = parseInt(document.getElementById('education').value);
const sleep = document.getElementById('sleep').value;
const ethnicity = document.getElementById('ethnicity').value;
const race = document.getElementById('race').value;
if (!pid || !age) {
alert('Please fill in all required fields (Prolific ID and Age).');
return;
}
// Add loading state
document.body.classList.add('loading');
const button = document.querySelector('button');
const originalText = button.textContent;
button.textContent = 'Saving...';
// Save to Firestore: Subjects collection
const subjectData = {
id: pid,
age: age,
sex: sex,
handedness: handedness,
education: education,
sleep: sleep,
ethnicity: ethnicity,
race: race,
returner: null,
distractions: [],
distraction: null,
comments: null,
currTrial: 0,
dpin: null,
tgt_file: null,
target_visibility: "present",
timestamp: new Date().toISOString()
};
db.collection("Subjects").doc(pid).set(subjectData)
.then(() => {
// Store in sessionStorage for other pages
sessionStorage.setItem('prolificID', pid);
sessionStorage.setItem('age', age);
sessionStorage.setItem('gender', sex);
sessionStorage.setItem('handedness', handedness);
sessionStorage.setItem('education', education);
sessionStorage.setItem('sleep', sleep);
sessionStorage.setItem('ethnicity', ethnicity);
sessionStorage.setItem('race', race);
// Show success message
document.getElementById('successMessage').style.display = 'block';
// Go to instructions after a brief delay
setTimeout(() => {
window.location.href = 'instructions.html';
}, 1500);
})
.catch((error) => {
console.error("Error saving to Firebase:", error);
alert("Could not save your information. Please check your connection and try again.");
// Remove loading state
document.body.classList.remove('loading');
button.textContent = originalText;
});
}
// Add some basic form validation feedback
document.addEventListener('DOMContentLoaded', function() {
const requiredFields = document.querySelectorAll('input[required]');
requiredFields.forEach(field => {
field.addEventListener('blur', function() {
if (!this.value.trim()) {
this.style.borderColor = '#ef4444';
} else {
this.style.borderColor = '#e5e7eb';
}
});
});
});
</script>
</body>
</html>