-
Notifications
You must be signed in to change notification settings - Fork 0
/
index copy.html
612 lines (503 loc) · 22.3 KB
/
index copy.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
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- <script src="https://psyc241.ucsd.edu/Chaipat/TB_PCL_vWM_delays/js/vismemCC.js"></script> -->
<script src="https://timbrady.org/turk/TimTurkTools.js"></script>
<script src="js/vismemCC_simon.js"></script>
<!--
//////////////////////////////////////////////////////////////////////////////////
-->
<style>
.trialDiv {
/* border: 2px solid gray;*/
border: 0px;
padding: auto;
width: auto;
position: relative;
top: 50px;
left: 50%;
/* bring your own prefixes */
transform: translate(-50%, -50%);
text-align: center;
display: none;
}
body {
font-family: Arial, Helvetica;
font-size: 12pt;
}
#submitButton {
display: none;
}
#instructions {
width: 60%;
margin: 0 auto;
text-align: center;
margin-top: 100px;
}
#startExperiment {
color: rgb(200,200,200);
text-decoration: none;
}
#startExperiment:hover{
color: white;
}
#startExperimentButton {
width: 200px;
text-align: center;
border: 4px outset gray;
background: gray;
padding: 5px;
margin: 0 auto;
}
.continueExp:hover{
color: white;
}
.continueExp {
color: rgb(200,200,200);
text-decoration: none;
}
.continueButton {
width: 100px;
text-align: center;
border: 4px outset gray;
background: gray;
padding: 5px;
margin: 0 auto;
}
#meter{
width: 10cm;
height: 10cm;
}
.instr {
display: none;
}
#done {
display: none;
}
</style>
<!--
//////////////////////////////////////////////////////////////////////////////////
-->
<!--say something when done -->
<div id="done" class="taskDiv">
Saving data...
</div>
<!-- make submit button -->
<input type="submit" value="Submit" name="submitButton" id="submitButton" style="display: none">
<!--
//////////////////////////////////////////////////////////////////////////////////
-->
<!-- make instruction -->
<div id="instructions">
<h2> สวัสดีชาวโลก
<br> ต่อไปเป็นการทดสอบการทำงานสมองของคุณ ช่วยพยายามกันหน่อยนะ</h2>
<p>เดี๋ยวจะมีวงกลมหลายวงโผล่ขึ้นมา <b>พยายามจำกันหน่อย</b> แล้วเดี๋ยวจะต้องตอบทีหลังนะ</p>
<p> <b> ถ้าอยากโดนก็กดขยายหน้าจอให้ใหญ่เบิ้มๆหน่อยนะ ขอสัก 400 pixels </b>
<br> กด <b>F11</b> สิจ๊ะถ้าตัวเธอว์ใช้ windows
</p>
<p style="font:5px"> กดปุ่มยินยอมถ้าเธอว์พร้อมจะลุยมาตั้งนานแล้ว </p>
<div id="startExperimentButton">
<a href="#" id="startExperiment">เอาเลยเถอะ</a>
</div>
<p></p>
<div id="consent" style="height:120px; border:1px solid #ccc;font:12px Arial, Helvetica; overflow:auto" align="justify">
<p align="center"><b>UNIVERSITY OF CALIFORNIA, SAN DIEGO
<br>CONSENT TO ACT AS A RESEARCH SUBJECT</b>
<p>
<br> Timothy Brady, Ph.D., is conducting a research study to find out more about attention, memory and vision. You have been asked to participate because you are a healthy young adult. There will be approximately 1600 participants in this study this year. The expected duration of the study is 5 years, though your participation will last only between 3 minutes and 45 minutes, with the exact expected timing listed in the HIT description.</p>
<p>
<br><b>PROCEDURES.</b> If you agree to participate in this study by accepting this HIT and continuing in the task, the following will happen to you:
<br>   1. You will be shown displays of letters, words, or pictures, right here in your web browser.
<br>   2. You will try to perceive and remember these stimuli, and respond by pressing keys or moving and clicking the mouse in a manner that we will describe to you.</p>
<p>
<br> <b>RISKS.</b> You will be required only to continue to interact with your web browser and make responses for a short duration. Thus, no potential risks or discomforts are anticipated except for the possibility that some tasks may be slightly boring. However, there may be risks that are currently unforeseeable.</p>
<p>
<br><b>PAYMENT/REMUNERATION.</b> In consideration of your time, you will receive payment at the rate described through the Amazon Mechanical Turk system. Compensation will range from $0.60 (for a 3 min task) up to as much as $8 (for a task that takes 45 min), with rates between $8/hr and $12/hr. The exact payment rate for this HIT is provided in the HIT description.</p>
<p>
<br><b>RIGHTS.</b> You may call the UCSD Human Research Protection Program at 858-657-5100 to ask about your rights as a research subject or to report research-related problems.</p>
<p>
<br><b>BENEFITS.</b> There will be no direct benefit to you from these procedures. However, the investigator may learn more about basic questions pertaining to attention, memory and vision. This knowledge may have benefits to society in fields ranging from improving education to visual design, but these benefits will be indirect.</p>
<p>
<br><b>EXPLANATION.</b> The researcher has explained this study to you and answered your questions. If you have questions about the research or research-related problems, including any adverse events, you may reach Dr. Timothy Brady at [email protected] or 858-822-4530.</p>
<p>
<br><b>VOLUNTARY NATURE OF PARTICIPATION.</b> Participation in research is entirely voluntary. You may refuse to participate or withdraw at any time without penalty. The alternative to participation is to choose not to participate.</p>
<p>
<br><b>CONFIDENTIALITY.</b> Research records will be kept confidential to the extent allowed by law. As with all research, there is also the possibility of loss of confidentiality. Information from participants such as yourself will be identified by a subject number, which is not associated with your identity, by the researchers, to minimize the potential loss of confidentiality.</p>
<p>
<br>By clicking “I agree”, you are indicating that you are at least 18 years old, have read this consent form and agree to participate in this research study. Please print a copy of this page for your records.</p>
</p>
</div>
</div>
<!--
//////////////////////////////////////////////////////////////////////////////////
-->
<!-- set CANVAS -->
<div align="center">
<canvas id="myCanvas" width="800" height="600" style="cursor:default;border:none;outline-width:2px;outline-color:#000000">
</canvas>
<p id="instr"></p>
</div>
<!--
//////////////////////////////////////////////////////////////////////////////////
-->
<div id='frame1'; class='trialDiv'>
<p>
<br> อยากจะให้ทำอะไรสักอย่าง
<br> แต่ยังไม่แน่ใจ
<br>
<br>
<div class="continueButton">
<a href="#" id="cont1" class="continueExp"> ไปค่ะพี่สุชาติ </a>
</div>
</div>
<div id='frame2'; class='trialDiv'>
<p>
<br> อะไรจะโผล่มาแบบนี้
<br> พยายามจำตำแหน่งเอาไว้
<div class="continueButton">
<a href="#" id="cont2" class="continueExp"> ไปค่ะพี่สุชาติ </a>
</div>
</div>
<div id='frame3'; class='trialDiv'>
<p>
<br> แล้วก็จะหายไป
<br>
<div class="continueButton">
<a href="#" id="cont3" class="continueExp"> ไปค่ะพี่สุชาติ </a>
</div>
</div>
<div id='frame4'; class='trialDiv'>
<p>
<br> พอมีสัญญาณให้ตอบก็ตอบได้เลย
<br> กดลงไปบนกลมๆที่มองเห็นได้เลยเพื่อตอบ
<div class="continueButton">
<a href="#" id="cont4" class="continueExp"> ไปค่ะพี่สุชาติ </a>
</div>
</div>
<div id='frame5'; class='trialDiv'>
<p>
<br> จะเป็นเช่นนี้ไปเรื่อยๆ
<br> พร้อมไหม
<div class="continueButton">
<a href="#" id="cont5" class="continueExp"> ไปค่ะพี่สุชาติ </a>
</div>
</div>
<div id='rule0'; class='trialDiv'>
<p>
<br> ถ้าพื้นหลังเป็น <font color=darkgreen> <b>สีเขียว</b> </font> ให้กดปุ่ม <b>ตามลำดับ</b> ที่จำไว้
<br> ถ้าพื้นหลังเป็น <font color=darkred> <b>สีแดง</b> </font> ให้กดปุ่ม <b>ย้อนกลับ</b> จากลำดับที่จำไว้
<br> <br> กรุณาใช้ <b>เมาส์</b> กดลงบนปุ่ม </p>
</div>
<div id='rule1'; class='trialDiv'>
<p>
<br> ให้กดปุ่มย้อนกลับจากลำดับที่จำไว้
<br>
<br> <br> กรุณาใช้ <b>เมาส์</b> กดลงบนปุ่ม </p>
</div>
<!--
//////////////////////////////////////////////////////////////////////////////////
-->
<p id="debug"></p>
<form id="record" action="examplePause.php" name="nextpage" method="post">
<input type="hidden" id="targ" name="targ" value='[0,0,0,0,0,0,0,0,0,0,0,0]'>
<input type="hidden" id="resp" name="resp" value='[0,0,0,0,0,0,0,0,0,0,0,0]'>
<input type="hidden" id="targAng" name="targAng" value='[0,0,0,0,0,0,0,0,0,0,0,0]'>
<input type="hidden" id="respAng" name="respAng" value='[0,0,0,0,0,0,0,0,0,0,0,0]'>
<input type="hidden" id="rt" name="rt" value='0'>
</form>
<script type="text/javascript">
// Settings
var code = "CC" + Math.round(Math.random()*100000) + "92";
var task='conjsearch';
var c1=document.getElementById("myCanvas");
var ctx1=c1.getContext("2d");
var centerX=c1.width/2;
var centerY=c1.height/2;
var width=c1.width;
var height=c1.height;
var objSize=40;
var objDist=120;
var visualang = Math.round((Math.atan(((objSize))/objDist))*(180/Math.PI));
// var wheelRad=objSize+objDist+30;
var nubX=null;
var nubY=null;
var nTrials = 10000;
var numDots=6;
var thetadiff = 360/numDots;
var nSeq = 4;
var circRot= 0;
// var colRot= 0;
var nullcolor = []; for (var idot =0; idot<numDots;idot++){nullcolor[idot] = '#FFFFFF'}
const testtemp = []; for (var idot =0; idot<numDots;idot++){testtemp[idot] = 99999}
var stimdur = 500;
var delay = 500;
var rt=[];
var moveLast=0;
var bgcolor = '#404040';
var bgx = Math.round(Math.random());
var isTest=false;
var isTrain = false;
var currProbe=-1;
var realstimtime =[];
var realdelaytime =[];
var colors = ['#FFFFFF','#000000'];//['#73FA78','#FF9E98'];
var Xspan = 400;
var Yspan = 300;
// var SSS = [6,8,10,12,14,16,18,20,22]
var currSS = 6;
var nTrials = 50;
var NupNdown = 3;
var quickerBy = 1000;
var slowerBy = 500;
var nBlockx = 8;
var nBlocky = 6;
var recW = 30;
var recH = 30;
var timeLimit = 10*1000;
var Xblock = Xspan*2/nBlockx;
var Yblock = Yspan*2/nBlocky;
var posjit = 8;
var Xtemps = []; for (ix = 0; ix < nBlockx; ix++) { Xtemps.push(Math.round(Xblock/2)+Xblock*ix - Xspan + centerX)}
var Ytemps = []; for (iy = 0; iy < nBlocky; iy++) { Ytemps.push(Math.round(Yblock/2)+Yblock*iy- Yspan + centerY)}
var Xs = [];
var Ys = [];
var posId = [];
var count = 0;
for (ix =0; ix < nBlockx; ix++) {
for (iy = 0; iy< nBlocky; iy++) {
Xs.push(Xtemps[ix]);
Ys.push(Ytemps[iy]);
posId.push(count);
count++;
}
}
var maxss = Math.floor((nBlockx*nBlocky-1)/2);
var oris = []; for (j = 0; j < maxss; j++) {oris.push(0);oris.push(1)};
var cols = []; for (k = 0; k < maxss; k++) {cols.push(0);cols.push(1)};
var ss = 20;
var trialStruct = [];
var trackRecord = 0;
var thatRight = false;
function shuffleSS(setsize){
Shuffle(posId);
if (Math.random()>0.5){
for (j = 0; j < cols.length; j++) {cols[j] = 1-cols[j]};
}
X = []; for (ix = 0; ix < setsize+1; ix++) {X.push(Xs[posId[ix]])};
Y = []; for (iy = 0; iy < setsize+1; iy++) {Y.push(Ys[posId[iy]])};
ori = []; for (j = 0; j < setsize; j++) {ori.push(oris[j])};
col = []; for (j = 0; j < setsize; j++) {col.push(colors[cols[j]])};
if (Math.random > 0.5){
ori.push(oris[setsize]);
col.push(colors[1-cols[setsize]]);
} else {
ori.push(1-oris[setsize]);
col.push(colors[cols[setsize]]);
}
}
function shuffle(array) {
var currentIndex = array.length, temporaryValue, randomIndex;
// While there remain elements to shuffle...
while (0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
// And swap it with the current element.
temporaryValue = array[currentIndex];
array[currentIndex] = array[randomIndex];
array[randomIndex] = temporaryValue;
}
return array;
}
// function makeSearchArray(numarrayX,numarrayY,recW,recH,orienVec,colorVec){
// // Draw rectangles
// for(i=0;i<orienVec.length;i++){
// if (orienVec[i] == 0){
// makeRectangle('v',numarrayX[i]+(Math.random()-0.5)*2*posjit,numarrayY[i]+(Math.random()-0.5)*2*posjit,recW,recH,false,colorVec[i],colorVec[i],0,45);
// }
// else {
// makeRectangle('h',numarrayX[i]+(Math.random()-0.5)*2*posjit,numarrayY[i]+(Math.random()-0.5)*2*posjit,recH,recW,false,colorVec[i],colorVec[i],0,45);
// }
// }
// }
function makeSearchArray(numarrayX,numarrayY,recW,recH,orienVec,colorVec){
// Draw rectangles
for(i=0;i<orienVec.length;i++){
if (orienVec[i] == 0){
makeCircle('c',numarrayX[i]+(Math.random()-0.5)*2*posjit,numarrayY[i]+(Math.random()-0.5)*2*posjit,recW/2,false,colorVec[i],colorVec[i]);
}
else {
makeRectangle('s',numarrayX[i]+(Math.random()-0.5)*2*posjit,numarrayY[i]+(Math.random()-0.5)*2*posjit,recH,recW,false,colorVec[i],colorVec[i],0,0);
}
}
}
function makeBackground(bgcolor){
// Fill background
makeRectangle('bg',centerX,centerX,800,800,false,bgcolor,bgcolor);
}
var st=null;
function startTime(){
var d = new Date();
st=d.getTime();
}
function endTime(){
var d = new Date();
timeDif=d.getTime()-st;
return timeDif;
}
var curTrial = 0;
function trialIsOver() {
// Initial
erase(ctx1);
clear();
makeBackground(bgcolor)
drawObjects(ctx1,objects);
var curtrialStruct = {};
curtrialStruct.X = X;
curtrialStruct.Y = Y;
curtrialStruct.ori = ori;
curtrialStruct.col = col;
curtrialStruct.corr = thatRight;
curtrialStruct.rt = rt;
curtrialStruct.track = trackRecord;
curtrialStruct.currSS = currSS;
curtrialStruct.timeLimit = timeLimit;
if (trackRecord>=NupNdown){
if (currSS < maxss*2-2){
currSS = currSS+2;
}else{
timeLimit = timeLimit-quickerBy;
}
}
if (trackRecord==0 & currSS >4){
currSS = currSS-2;
timeLimit = timeLimit+slowerBy;
}
trialStruct.push(curtrialStruct);
curTrial = curTrial+1 ;
if (curTrial >= nTrials){
Done();
// $('#submitButton'.show());
} else {
// var selColor=[];var selAng=[];
// for (var item=0;item<numDots;item++){selColor[item]='#FFFFFF';selAng[item]=null};
// $('#rule0').hide();
// $('#rule1').hide();
showTrial(curTrial);
startTrialTime = new Date();
}
}
function showTrial(){
// isTest= false;
shuffleSS(ss)
erase(ctx1);
clear();
drawObjects(ctx1,objects);
initialT(0,currSS);
}
function initialT(waittime,SS){
// Initial
setTimeout(function(){
// Draw stimuli
erase(ctx1);
clear();
shuffleSS(SS);
makeBackground('#404040')
makeSearchArray(X,Y,recW,recH,ori,col)
drawObjects(ctx1,objects);
var dT = new Date();
STT=dT.getTime();
isTest = true;
},waittime);
}
function showFirstTrial() {
isTrain = false;
// Begin
$('#frame5').hide();
showTrial();
startTrialTime = new Date();
// $('.trialDiv').hide();
}
function showPractice_f1(){
if ($(window).width() >= 600 && screen.width*.8 < $(window).width()){
$('#instructions').hide();
myCanvas.style.border = 'solid'
shuffleSS(ss);
makeBackground('#404040')
makeSearchArray(X,Y,recW,recH,ori,col)
drawObjects(ctx1,objects);
$('#frame1').show();
// Begin
$('#cont1').on('click',showPractice_f5);
}
}
function showPractice_f5(){
$('#frame1').hide();
$('#frame5').show();
$('#cont5').click(showFirstTrial);
}
function Done() {
$("#myCanvas").hide();
$("#done").show();
var dataToServer = {};
dataToServer.id = getParameterByName("subjectId"); /* getParameterByName("code") */
dataToServer.experimenter = 'Chaipat';
dataToServer.experimentName = 'conjsearch';
dataToServer.curData = JSON.stringify(trialStruct);
$.post("https://psyc241.ucsd.edu/Turk/save.php", dataToServer, AfterSuccessDataSaving).fail(AfterFailedSaving);
}
function AfterSuccessDataSaving() {
// After they are done, send them here:
// window.location = "https://ucsd.sona-systems.com/webstudy_credit.aspx?experiment_id=1267&credit_token=805f6634de5a46b3aecffe2818d8d90c&survey_code=" + getParameterByName("code");
$('#submitButton').show();
$('#done').html("All done, thanks! Please click submit button.");
console.log("Saved!");
}
function AfterFailedSaving() {
console.log("oops, failed to save");
// window.location = "https://ucsd.sona-systems.com/webstudy_credit.aspx?experiment_id=1267&credit_token=805f6634de5a46b3aecffe2818d8d90c&survey_code=" + getParameterByName("code");
$('#submitButton').show();
$('#done').html("All done, thanks! Please click submit button.");
}
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
// =========================================================
$('#startExperiment').click(showPractice_f1);
$('.responseButton').click(trialIsOver);
// =========================================================
/**
* Gets a URL parameter from the query string
*/
function turkGetParam( name, defaultValue ) {
var regexS = "[\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var tmpURL = window.location.href;
var results = regex.exec( tmpURL );
if( results == null ) {
return defaultValue;
} else {
return results[1];
}
}
function GetWorkerId() {
var workerId = turkGetParam( 'workerId', 'NONE' );
return workerId;
}
function IsTurkPreview() {
return GetWorkerId() == "NONE";
}
function IsOnTurk() {
try {
return ((window.location.host.indexOf('mturk')!=-1) || document.forms["mturk_form"] ||
(top != self && window.parent.location.host.indexOf("mturk") != -1));
} catch(err) {
// insecure content trying to access https://turk probably, so say yes:
return true;
}
}
</script>