Deployed dee50c2 with MkDocs version: 0.17.2

This commit is contained in:
Josh de Leeuw 2018-01-03 15:38:15 -05:00
parent 3270aff033
commit 2d0fe2bc53
217 changed files with 90056 additions and 10580 deletions

0
.nojekyll Normal file
View File

1076
404.html Executable file

File diff suppressed because it is too large Load Diff

1
CNAME
View File

@ -1 +0,0 @@
www.jspsych.org

View File

@ -1,10 +0,0 @@
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-50563838-1', 'jspsych.org');
ga('send', 'pageview');
</script>

1213
about/about/index.html Executable file

File diff suppressed because it is too large Load Diff

1356
about/contributing/index.html Executable file

File diff suppressed because it is too large Load Diff

1150
about/license/index.html Executable file

File diff suppressed because it is too large Load Diff

1147
about/support/index.html Executable file

File diff suppressed because it is too large Load Diff

BIN
assets/images/favicon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="352" height="448" viewBox="0 0 352 448" id="bitbucket"><path fill="currentColor" d="M203.75 214.75q2 15.75-12.625 25.25t-27.875 1.5q-9.75-4.25-13.375-14.5t-.125-20.5 13-14.5q9-4.5 18.125-3t16 8.875 6.875 16.875zm27.75-5.25q-3.5-26.75-28.25-41T154 165.25q-15.75 7-25.125 22.125t-8.625 32.375q1 22.75 19.375 38.75t41.375 14q22.75-2 38-21t12.5-42zM291.25 74q-5-6.75-14-11.125t-14.5-5.5T245 54.25q-72.75-11.75-141.5.5-10.75 1.75-16.5 3t-13.75 5.5T60.75 74q7.5 7 19 11.375t18.375 5.5T120 93.75Q177 101 232 94q15.75-2 22.375-3t18.125-5.375T291.25 74zm14.25 258.75q-2 6.5-3.875 19.125t-3.5 21-7.125 17.5-14.5 14.125q-21.5 12-47.375 17.875t-50.5 5.5-50.375-4.625q-11.5-2-20.375-4.5T88.75 412 70.5 401.125t-13-15.375q-6.25-24-14.25-73l1.5-4 4.5-2.25q55.75 37 126.625 37t126.875-37q5.25 1.5 6 5.75t-1.25 11.25-2 9.25zM350.75 92.5q-6.5 41.75-27.75 163.75-1.25 7.5-6.75 14t-10.875 10T291.75 288q-63 31.5-152.5 22-62-6.75-98.5-34.75-3.75-3-6.375-6.625t-4.25-8.75-2.25-8.5-1.5-9.875T25 232.75q-2.25-12.5-6.625-37.5t-7-40.375T5.5 118 0 78.5Q.75 72 4.375 66.375T12.25 57t11.25-7.5T35 43.875t12-4.625q31.25-11.5 78.25-16 94.75-9.25 169 12.5Q333 47.25 348 66.25q4 5 4.125 12.75t-1.375 13.5z"/></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg>

After

Width:  |  Height:  |  Size: 991 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500" viewBox="0 0 500 500" id="gitlab"><path fill="currentColor" d="M93.667 473.347l90.684-279.097H2.983l90.684 279.097z" transform="translate(156.198 1.16)"/><path fill="currentColor" d="M221.333 473.345L130.649 194.25H3.557l217.776 279.095z" transform="translate(28.531 1.16)" opacity=".7"/><path fill="currentColor" d="M32 195.155L4.441 279.97a18.773 18.773 0 0 0 6.821 20.99l238.514 173.29L32 195.155z" transform="translate(.089 .256)" opacity=".5"/><path fill="currentColor" d="M2.667-84.844h127.092L75.14-252.942c-2.811-8.649-15.047-8.649-17.856 0L2.667-84.844z" transform="translate(29.422 280.256)"/><path fill="currentColor" d="M2.667 473.345L93.351 194.25h127.092L2.667 473.345z" transform="translate(247.198 1.16)" opacity=".7"/><path fill="currentColor" d="M221.334 195.155l27.559 84.815a18.772 18.772 0 0 1-6.821 20.99L3.557 474.25l217.777-279.095z" transform="translate(246.307 .256)" opacity=".5"/><path fill="currentColor" d="M130.667-84.844H3.575l54.618-168.098c2.811-8.649 15.047-8.649 17.856 0l54.618 168.098z" transform="translate(336.974 280.256)"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.da=function(){this.pipeline.reset(),this.pipeline.add(e.da.trimmer,e.da.stopWordFilter,e.da.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.da.stemmer))},e.da.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA--",e.da.trimmer=e.trimmerSupport.generateTrimmer(e.da.wordCharacters),e.Pipeline.registerFunction(e.da.trimmer,"trimmer-da"),e.da.stemmer=function(){var r=e.stemmerSupport.Among,i=e.stemmerSupport.SnowballProgram,n=new function(){function e(){var e,r=l.limit-l.cursor;l.cursor>=t&&(e=l.limit_backward,l.limit_backward=t,l.ket=l.cursor,l.find_among_b(a,4)?(l.bra=l.cursor,l.limit_backward=e,l.cursor=l.limit-r,l.cursor>l.limit_backward&&(l.cursor--,l.bra=l.cursor,l.slice_del())):l.limit_backward=e)}var n,t,s,o=[new r("hed",-1,1),new r("ethed",0,1),new r("ered",-1,1),new r("e",-1,1),new r("erede",3,1),new r("ende",3,1),new r("erende",5,1),new r("ene",3,1),new r("erne",3,1),new r("ere",3,1),new r("en",-1,1),new r("heden",10,1),new r("eren",10,1),new r("er",-1,1),new r("heder",13,1),new r("erer",13,1),new r("s",-1,2),new r("heds",16,1),new r("es",16,1),new r("endes",18,1),new r("erendes",19,1),new r("enes",18,1),new r("ernes",18,1),new r("eres",18,1),new r("ens",16,1),new r("hedens",24,1),new r("erens",24,1),new r("ers",16,1),new r("ets",16,1),new r("erets",28,1),new r("et",-1,1),new r("eret",30,1)],a=[new r("gd",-1,-1),new r("dt",-1,-1),new r("gt",-1,-1),new r("kt",-1,-1)],d=[new r("ig",-1,1),new r("lig",0,1),new r("elig",1,1),new r("els",-1,1),new r("løst",-1,2)],u=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,48,0,128],c=[239,254,42,3,0,0,0,0,0,0,0,0,0,0,0,0,16],l=new i;this.setCurrent=function(e){l.setCurrent(e)},this.getCurrent=function(){return l.getCurrent()},this.stem=function(){var r=l.cursor;return function(){var e,r=l.cursor+3;if(t=l.limit,0<=r&&r<=l.limit){for(n=r;;){if(e=l.cursor,l.in_grouping(u,97,248)){l.cursor=e;break}if(l.cursor=e,e>=l.limit)return;l.cursor++}for(;!l.out_grouping(u,97,248);){if(l.cursor>=l.limit)return;l.cursor++}(t=l.cursor)<n&&(t=n)}}(),l.limit_backward=r,l.cursor=l.limit,function(){var e,r;if(l.cursor>=t&&(r=l.limit_backward,l.limit_backward=t,l.ket=l.cursor,e=l.find_among_b(o,32),l.limit_backward=r,e))switch(l.bra=l.cursor,e){case 1:l.slice_del();break;case 2:l.in_grouping_b(c,97,229)&&l.slice_del()}}(),l.cursor=l.limit,e(),l.cursor=l.limit,function(){var r,i,n,s=l.limit-l.cursor;if(l.ket=l.cursor,l.eq_s_b(2,"st")&&(l.bra=l.cursor,l.eq_s_b(2,"ig")&&l.slice_del()),l.cursor=l.limit-s,l.cursor>=t&&(i=l.limit_backward,l.limit_backward=t,l.ket=l.cursor,r=l.find_among_b(d,5),l.limit_backward=i,r))switch(l.bra=l.cursor,r){case 1:l.slice_del(),n=l.limit-l.cursor,e(),l.cursor=l.limit-n;break;case 2:l.slice_from("løs")}}(),l.cursor=l.limit,function(){var e;l.cursor>=t&&(e=l.limit_backward,l.limit_backward=t,l.ket=l.cursor,l.out_grouping_b(u,97,248)?(l.bra=l.cursor,s=l.slice_to(s),l.limit_backward=e,l.eq_v_b(s)&&l.slice_del()):l.limit_backward=e)}(),!0}};return function(e){return"function"==typeof e.update?e.update(function(e){return n.setCurrent(e),n.stem(),n.getCurrent()}):(n.setCurrent(e),n.stem(),n.getCurrent())}}(),e.Pipeline.registerFunction(e.da.stemmer,"stemmer-da"),e.da.stopWordFilter=e.generateStopWordFilter("ad af alle alt anden at blev blive bliver da de dem den denne der deres det dette dig din disse dog du efter eller en end er et for fra ham han hans har havde have hende hendes her hos hun hvad hvis hvor i ikke ind jeg jer jo kunne man mange med meget men mig min mine mit mod ned noget nogle nu når og også om op os over på selv sig sin sine sit skal skulle som sådan thi til ud under var vi vil ville vor være været".split(" ")),e.Pipeline.registerFunction(e.da.stopWordFilter,"stopWordFilter-da")}});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");var r="2"==e.version[0];e.jp=function(){this.pipeline.reset(),this.pipeline.add(e.jp.stopWordFilter,e.jp.stemmer),r?this.tokenizer=e.jp.tokenizer:(e.tokenizer&&(e.tokenizer=e.jp.tokenizer),this.tokenizerFn&&(this.tokenizerFn=e.jp.tokenizer))};var t=new e.TinySegmenter;e.jp.tokenizer=function(n){if(!arguments.length||null==n||void 0==n)return[];if(Array.isArray(n))return n.map(function(t){return r?new e.Token(t.toLowerCase()):t.toLowerCase()});for(var i=n.toString().toLowerCase().replace(/^\s+/,""),o=i.length-1;o>=0;o--)if(/\S/.test(i.charAt(o))){i=i.substring(0,o+1);break}return t.segment(i).filter(function(e){return!!e}).map(function(t){return r?new e.Token(t):t})},e.jp.stemmer=function(e){return e},e.Pipeline.registerFunction(e.jp.stemmer,"stemmer-jp"),e.jp.wordCharacters="一二三四五六七八九十百千万億兆一-龠々〆ヵヶぁ-んァ-ヴーア-ン゙a-zA-Z--0-9-",e.jp.stopWordFilter=function(t){if(-1===e.jp.stopWordFilter.stopWords.indexOf(r?t.toString():t))return t},e.jp.stopWordFilter=e.generateStopWordFilter("これ それ あれ この その あの ここ そこ あそこ こちら どこ だれ なに なん 何 私 貴方 貴方方 我々 私達 あの人 あのかた 彼女 彼 です あります おります います は が の に を で え から まで より も どの と し それで しかし".split(" ")),e.Pipeline.registerFunction(e.jp.stopWordFilter,"stopWordFilter-jp")}});

View File

@ -0,0 +1 @@
!function(e,i){"function"==typeof define&&define.amd?define(i):"object"==typeof exports?module.exports=i():i()(e.lunr)}(this,function(){return function(e){e.multiLanguage=function(){for(var i=Array.prototype.slice.call(arguments),t=i.join("-"),r="",n=[],s=[],p=0;p<i.length;++p)"en"==i[p]?(r+="\\w",n.unshift(e.stopWordFilter),n.push(e.stemmer),s.push(e.stemmer)):(r+=e[i[p]].wordCharacters,n.unshift(e[i[p]].stopWordFilter),n.push(e[i[p]].stemmer),s.push(e[i[p]].stemmer));var o=e.trimmerSupport.generateTrimmer(r);return e.Pipeline.registerFunction(o,"lunr-multi-trimmer-"+t),n.unshift(o),function(){this.pipeline.reset(),this.pipeline.add.apply(this.pipeline,n),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add.apply(this.searchPipeline,s))}}}});

View File

@ -0,0 +1 @@
!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.no=function(){this.pipeline.reset(),this.pipeline.add(e.no.trimmer,e.no.stopWordFilter,e.no.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.no.stemmer))},e.no.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA--",e.no.trimmer=e.trimmerSupport.generateTrimmer(e.no.wordCharacters),e.Pipeline.registerFunction(e.no.trimmer,"trimmer-no"),e.no.stemmer=function(){var r=e.stemmerSupport.Among,n=e.stemmerSupport.SnowballProgram,i=new function(){var e,i,t=[new r("a",-1,1),new r("e",-1,1),new r("ede",1,1),new r("ande",1,1),new r("ende",1,1),new r("ane",1,1),new r("ene",1,1),new r("hetene",6,1),new r("erte",1,3),new r("en",-1,1),new r("heten",9,1),new r("ar",-1,1),new r("er",-1,1),new r("heter",12,1),new r("s",-1,2),new r("as",14,1),new r("es",14,1),new r("edes",16,1),new r("endes",16,1),new r("enes",16,1),new r("hetenes",19,1),new r("ens",14,1),new r("hetens",21,1),new r("ers",14,1),new r("ets",14,1),new r("et",-1,1),new r("het",25,1),new r("ert",-1,3),new r("ast",-1,1)],o=[new r("dt",-1,-1),new r("vt",-1,-1)],s=[new r("leg",-1,1),new r("eleg",0,1),new r("ig",-1,1),new r("eig",2,1),new r("lig",2,1),new r("elig",4,1),new r("els",-1,1),new r("lov",-1,1),new r("elov",7,1),new r("slov",7,1),new r("hetslov",9,1)],a=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,48,0,128],m=[119,125,149,1],u=new n;this.setCurrent=function(e){u.setCurrent(e)},this.getCurrent=function(){return u.getCurrent()},this.stem=function(){var r=u.cursor;return function(){var r,n=u.cursor+3;if(i=u.limit,0<=n||n<=u.limit){for(e=n;;){if(r=u.cursor,u.in_grouping(a,97,248)){u.cursor=r;break}if(r>=u.limit)return;u.cursor=r+1}for(;!u.out_grouping(a,97,248);){if(u.cursor>=u.limit)return;u.cursor++}(i=u.cursor)<e&&(i=e)}}(),u.limit_backward=r,u.cursor=u.limit,function(){var e,r,n;if(u.cursor>=i&&(r=u.limit_backward,u.limit_backward=i,u.ket=u.cursor,e=u.find_among_b(t,29),u.limit_backward=r,e))switch(u.bra=u.cursor,e){case 1:u.slice_del();break;case 2:n=u.limit-u.cursor,u.in_grouping_b(m,98,122)?u.slice_del():(u.cursor=u.limit-n,u.eq_s_b(1,"k")&&u.out_grouping_b(a,97,248)&&u.slice_del());break;case 3:u.slice_from("er")}}(),u.cursor=u.limit,function(){var e,r=u.limit-u.cursor;u.cursor>=i&&(e=u.limit_backward,u.limit_backward=i,u.ket=u.cursor,u.find_among_b(o,2)?(u.bra=u.cursor,u.limit_backward=e,u.cursor=u.limit-r,u.cursor>u.limit_backward&&(u.cursor--,u.bra=u.cursor,u.slice_del())):u.limit_backward=e)}(),u.cursor=u.limit,function(){var e,r;u.cursor>=i&&(r=u.limit_backward,u.limit_backward=i,u.ket=u.cursor,(e=u.find_among_b(s,11))?(u.bra=u.cursor,u.limit_backward=r,1==e&&u.slice_del()):u.limit_backward=r)}(),!0}};return function(e){return"function"==typeof e.update?e.update(function(e){return i.setCurrent(e),i.stem(),i.getCurrent()}):(i.setCurrent(e),i.stem(),i.getCurrent())}}(),e.Pipeline.registerFunction(e.no.stemmer,"stemmer-no"),e.no.stopWordFilter=e.generateStopWordFilter("alle at av bare begge ble blei bli blir blitt både båe da de deg dei deim deira deires dem den denne der dere deres det dette di din disse ditt du dykk dykkar då eg ein eit eitt eller elles en enn er et ett etter for fordi fra før ha hadde han hans har hennar henne hennes her hjå ho hoe honom hoss hossen hun hva hvem hver hvilke hvilken hvis hvor hvordan hvorfor i ikke ikkje ikkje ingen ingi inkje inn inni ja jeg kan kom korleis korso kun kunne kva kvar kvarhelst kven kvi kvifor man mange me med medan meg meget mellom men mi min mine mitt mot mykje ned no noe noen noka noko nokon nokor nokre nå når og også om opp oss over på samme seg selv si si sia sidan siden sin sine sitt sjøl skal skulle slik so som som somme somt så sånn til um upp ut uten var vart varte ved vere verte vi vil ville vore vors vort vår være være vært å".split(" ")),e.Pipeline.registerFunction(e.no.stopWordFilter,"stopWordFilter-no")}});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
!function(r,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():t()(r.lunr)}(this,function(){return function(r){r.stemmerSupport={Among:function(r,t,i,s){if(this.toCharArray=function(r){for(var t=r.length,i=new Array(t),s=0;s<t;s++)i[s]=r.charCodeAt(s);return i},!r&&""!=r||!t&&0!=t||!i)throw"Bad Among initialisation: s:"+r+", substring_i: "+t+", result: "+i;this.s_size=r.length,this.s=this.toCharArray(r),this.substring_i=t,this.result=i,this.method=s},SnowballProgram:function(){var r;return{bra:0,ket:0,limit:0,cursor:0,limit_backward:0,setCurrent:function(t){r=t,this.cursor=0,this.limit=t.length,this.limit_backward=0,this.bra=this.cursor,this.ket=this.limit},getCurrent:function(){var t=r;return r=null,t},in_grouping:function(t,i,s){if(this.cursor<this.limit){var e=r.charCodeAt(this.cursor);if(e<=s&&e>=i&&(e-=i,t[e>>3]&1<<(7&e)))return this.cursor++,!0}return!1},in_grouping_b:function(t,i,s){if(this.cursor>this.limit_backward){var e=r.charCodeAt(this.cursor-1);if(e<=s&&e>=i&&(e-=i,t[e>>3]&1<<(7&e)))return this.cursor--,!0}return!1},out_grouping:function(t,i,s){if(this.cursor<this.limit){var e=r.charCodeAt(this.cursor);if(e>s||e<i)return this.cursor++,!0;if(e-=i,!(t[e>>3]&1<<(7&e)))return this.cursor++,!0}return!1},out_grouping_b:function(t,i,s){if(this.cursor>this.limit_backward){var e=r.charCodeAt(this.cursor-1);if(e>s||e<i)return this.cursor--,!0;if(e-=i,!(t[e>>3]&1<<(7&e)))return this.cursor--,!0}return!1},eq_s:function(t,i){if(this.limit-this.cursor<t)return!1;for(var s=0;s<t;s++)if(r.charCodeAt(this.cursor+s)!=i.charCodeAt(s))return!1;return this.cursor+=t,!0},eq_s_b:function(t,i){if(this.cursor-this.limit_backward<t)return!1;for(var s=0;s<t;s++)if(r.charCodeAt(this.cursor-t+s)!=i.charCodeAt(s))return!1;return this.cursor-=t,!0},find_among:function(t,i){for(var s=0,e=i,n=this.cursor,u=this.limit,o=0,h=0,c=!1;;){for(var a=s+(e-s>>1),f=0,l=o<h?o:h,_=t[a],m=l;m<_.s_size;m++){if(n+l==u){f=-1;break}if(f=r.charCodeAt(n+l)-_.s[m])break;l++}if(f<0?(e=a,h=l):(s=a,o=l),e-s<=1){if(s>0||e==s||c)break;c=!0}}for(;;){if(o>=(_=t[s]).s_size){if(this.cursor=n+_.s_size,!_.method)return _.result;var b=_.method();if(this.cursor=n+_.s_size,b)return _.result}if((s=_.substring_i)<0)return 0}},find_among_b:function(t,i){for(var s=0,e=i,n=this.cursor,u=this.limit_backward,o=0,h=0,c=!1;;){for(var a=s+(e-s>>1),f=0,l=o<h?o:h,_=(m=t[a]).s_size-1-l;_>=0;_--){if(n-l==u){f=-1;break}if(f=r.charCodeAt(n-1-l)-m.s[_])break;l++}if(f<0?(e=a,h=l):(s=a,o=l),e-s<=1){if(s>0||e==s||c)break;c=!0}}for(;;){var m=t[s];if(o>=m.s_size){if(this.cursor=n-m.s_size,!m.method)return m.result;var b=m.method();if(this.cursor=n-m.s_size,b)return m.result}if((s=m.substring_i)<0)return 0}},replace_s:function(t,i,s){var e=s.length-(i-t),n=r.substring(0,t),u=r.substring(i);return r=n+s+u,this.limit+=e,this.cursor>=i?this.cursor+=e:this.cursor>t&&(this.cursor=t),e},slice_check:function(){if(this.bra<0||this.bra>this.ket||this.ket>this.limit||this.limit>r.length)throw"faulty slice operation"},slice_from:function(r){this.slice_check(),this.replace_s(this.bra,this.ket,r)},slice_del:function(){this.slice_from("")},insert:function(r,t,i){var s=this.replace_s(r,t,i);r<=this.bra&&(this.bra+=s),r<=this.ket&&(this.ket+=s)},slice_to:function(){return this.slice_check(),r.substring(this.bra,this.ket)},eq_v_b:function(r){return this.eq_s_b(r.length,r)}}}},r.trimmerSupport={generateTrimmer:function(r){var t=new RegExp("^[^"+r+"]+"),i=new RegExp("[^"+r+"]+$");return function(r){return"function"==typeof r.update?r.update(function(r){return r.replace(t,"").replace(i,"")}):r.replace(t,"").replace(i,"")}}}}});

View File

@ -0,0 +1 @@
!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.sv=function(){this.pipeline.reset(),this.pipeline.add(e.sv.trimmer,e.sv.stopWordFilter,e.sv.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.sv.stemmer))},e.sv.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA--",e.sv.trimmer=e.trimmerSupport.generateTrimmer(e.sv.wordCharacters),e.Pipeline.registerFunction(e.sv.trimmer,"trimmer-sv"),e.sv.stemmer=function(){var r=e.stemmerSupport.Among,n=e.stemmerSupport.SnowballProgram,t=new function(){var e,t,i=[new r("a",-1,1),new r("arna",0,1),new r("erna",0,1),new r("heterna",2,1),new r("orna",0,1),new r("ad",-1,1),new r("e",-1,1),new r("ade",6,1),new r("ande",6,1),new r("arne",6,1),new r("are",6,1),new r("aste",6,1),new r("en",-1,1),new r("anden",12,1),new r("aren",12,1),new r("heten",12,1),new r("ern",-1,1),new r("ar",-1,1),new r("er",-1,1),new r("heter",18,1),new r("or",-1,1),new r("s",-1,2),new r("as",21,1),new r("arnas",22,1),new r("ernas",22,1),new r("ornas",22,1),new r("es",21,1),new r("ades",26,1),new r("andes",26,1),new r("ens",21,1),new r("arens",29,1),new r("hetens",29,1),new r("erns",21,1),new r("at",-1,1),new r("andet",-1,1),new r("het",-1,1),new r("ast",-1,1)],s=[new r("dd",-1,-1),new r("gd",-1,-1),new r("nn",-1,-1),new r("dt",-1,-1),new r("gt",-1,-1),new r("kt",-1,-1),new r("tt",-1,-1)],a=[new r("ig",-1,1),new r("lig",0,1),new r("els",-1,1),new r("fullt",-1,3),new r("löst",-1,2)],o=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,24,0,32],u=[119,127,149],c=new n;this.setCurrent=function(e){c.setCurrent(e)},this.getCurrent=function(){return c.getCurrent()},this.stem=function(){var r=c.cursor;return function(){var r,n=c.cursor+3;if(t=c.limit,0<=n||n<=c.limit){for(e=n;;){if(r=c.cursor,c.in_grouping(o,97,246)){c.cursor=r;break}if(c.cursor=r,c.cursor>=c.limit)return;c.cursor++}for(;!c.out_grouping(o,97,246);){if(c.cursor>=c.limit)return;c.cursor++}(t=c.cursor)<e&&(t=e)}}(),c.limit_backward=r,c.cursor=c.limit,function(){var e,r=c.limit_backward;if(c.cursor>=t&&(c.limit_backward=t,c.cursor=c.limit,c.ket=c.cursor,e=c.find_among_b(i,37),c.limit_backward=r,e))switch(c.bra=c.cursor,e){case 1:c.slice_del();break;case 2:c.in_grouping_b(u,98,121)&&c.slice_del()}}(),c.cursor=c.limit,function(){var e=c.limit_backward;c.cursor>=t&&(c.limit_backward=t,c.cursor=c.limit,c.find_among_b(s,7)&&(c.cursor=c.limit,c.ket=c.cursor,c.cursor>c.limit_backward&&(c.bra=--c.cursor,c.slice_del())),c.limit_backward=e)}(),c.cursor=c.limit,function(){var e,r;if(c.cursor>=t){if(r=c.limit_backward,c.limit_backward=t,c.cursor=c.limit,c.ket=c.cursor,e=c.find_among_b(a,5))switch(c.bra=c.cursor,e){case 1:c.slice_del();break;case 2:c.slice_from("lös");break;case 3:c.slice_from("full")}c.limit_backward=r}}(),!0}};return function(e){return"function"==typeof e.update?e.update(function(e){return t.setCurrent(e),t.stem(),t.getCurrent()}):(t.setCurrent(e),t.stem(),t.getCurrent())}}(),e.Pipeline.registerFunction(e.sv.stemmer,"stemmer-sv"),e.sv.stopWordFilter=e.generateStopWordFilter("alla allt att av blev bli blir blivit de dem den denna deras dess dessa det detta dig din dina ditt du där då efter ej eller en er era ert ett från för ha hade han hans har henne hennes hon honom hur här i icke ingen inom inte jag ju kan kunde man med mellan men mig min mina mitt mot mycket ni nu när någon något några och om oss på samma sedan sig sin sina sitta själv skulle som så sådan sådana sådant till under upp ut utan vad var vara varför varit varje vars vart vem vi vid vilka vilkas vilken vilket vår våra vårt än är åt över".split(" ")),e.Pipeline.registerFunction(e.sv.stopWordFilter,"stopWordFilter-sv")}});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,75 +0,0 @@
<!doctype html>
<html>
<head>
<title>CogSci 2014 Tutorial</title>
<style>
@import url(http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
@import url(http://fonts.googleapis.com/css?family=Lato:400,700);
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic);
h1 {
font-family: 'Yanone Kaffeesatz';
text-align: center;
margin: 0.25em;
}
h2, h3, h4 {
font-family: 'Lato';
}
h2, h3 {
text-align: center;
font-weight: 400;
margin: 0.25em;
color: #444;
}
h2 { font-size: 24px; }
h3 { font-size: 20px; }
h4 {
font-weight: 700;
font-size: 22px;
}
body {
font-family: 'Open Sans';
width: 780px;
margin-left: auto;
margin-right: auto;
}
#header {
margin-bottom: 40px;
}
</style>
</head>
<body>
<div id="header">
<h1>Online Experiments with jsPsych, PsiTurk, and Amazon Mechanical Turk</h1>
<h2>tutorial at the 2014 Cognitive Science Society annual meeting</h2>
<h3>Joshua R. de Leeuw, Anna Coenen, Doug Markant, Jay B. Martin, John V. McDonnell, Alexander S. Rich, and Todd M. Gureckis</h3>
</div>
<h4>Before the tutorial, we recommend that you:</h4>
<ul>
<li>Install an up-to-date WebKit-compatible browser (such as <a href="http://www.google.com/chrome">Google Chrome</a>).</li>
<li>Install a programming-friendly text editor, such as <a href="http://notepad-plus-plus.org/download/v6.6.7.html">Notepad++</a> (Windows) or <a href="http://www.barebones.com/products/textwrangler/download.html">TextWrangler</a> (OSX).</li>
<li><a href="http://psiturk.readthedocs.org/en/latest/install.html">Download and install PsiTurk</a>, which requires either OSX or another Unix-based system. Windows users can install PsiTurk on a cloud server using OpenShift. Instructions are available in the <a href="http://psiturk.readthedocs.org/en/latest/openshift.html">PsiTurk documentation</a>.</li>
<li>Browse the <a href="http://psiturk.readthedocs.org/en/latest/forward.html">PsiTurk documentation</a></li>
<li>Create an account on <a href="http://www.psiturk.org/register">psiturk.org</a></li>
<li>Create an Amazon Web Services account and register for Mechanical Turk. Instructions are available at the <a href="http://psiturk.readthedocs.org/en/latest/amt_setup.html">PsiTurk website</a>.</li>
<li>Complete an introductory lesson at <a href="http://www.codecademy.com/tracks/web">Codecademy</a> if you have never programmed with HTML or JavaScript before.</li>
</ul>
<h4>Problems getting set up?</h4>
<p>We've set up a <a href="https://groups.google.com/forum/#!forum/cogsci2014-online-experiments/">Q&A style forum</a> through google groups. Please post questions and problems there so that solutions are available to all.</p>
<h4>Tutorial materials</h4>
<ul>
<li><a href="https://iu.box.com/shared/static/1qn62nvebjb4h14i6bl7.zip">jsPsych walkthrough (.zip - 266kB)</a></li>
<li><a href="https://github.com/NYUCCL/MTurk-psiTurk-Workshop/tree/cogsci2014">tutorial slides (GitHub repository)</a></li>
</ul>
<h4>Related links</h4>
<ul>
<li><a href="http://www.jspsych.org/">jspsych - jspsych.org</a></li>
<li><a href="http://www.psiturk.org/">psiturk - psiturk.org</a></li>
<li><a href="http://www.mturk.com">amazon mechanical turk - mturk.com</a></li>
<li><a href="https://groups.google.com/forum/#!forum/jspsych">jspsych discussion/help forum</a></li>
<li><a href="https://groups.google.com/forum/#!forum/psiturk">psiturk discussion/help forum</a></li>
</ul>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,211 +0,0 @@
/*
* CSS for jsPsych experiments.
*
* This stylesheet provides minimal styling to make jsPsych
* experiments look polished without any additional styles.
*
*/
/*
*
* fonts and type
*
*/
@import url(//fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700);
html {
font-family: 'Open Sans', 'Arial', sans-serif;
font-size: 18px;
line-height: 1.6em;
}
p {
clear:both;
}
.very-small {
font-size: 50%;
}
.small {
font-size: 75%;
}
.large {
font-size: 125%;
}
.very-large {
font-size: 150%;
}
/*
*
* Classes for changing location of things
*
*/
.left {
float: left;
}
.right {
float: right;
}
.center-content {
text-align: center;
}
/*
*
* Form elements like input fields and buttons
*
*/
input[type="text"] {
font-family: 'Open Sans', 'Arial', sans-sefif;
font-size: 14px;
}
button {
padding: 0.5em;
background-color: #eaeaea;
border: 1px solid #eaeaea;
color: #333;
font-family: 'Open Sans', 'Arial', sans-serif;
font-size: 14px;
cursor: pointer;
}
button:hover {
border:1px solid #ccc;
}
/*
*
* Container holding jsPsych content
*
*/
.jspsych-display-element {
width: 800px;
margin: 50px auto 50px auto;
}
/*
*
* PLUGIN: jspsych-animation
*
*/
#jspsych-animation-image {
display: block;
margin-left: auto;
margin-right: auto;
}
/*
*
* PLUGIN: jspsych-categorize-animation
*
*/
#jspsych-categorize-animation-stimulus {
display: block;
margin-left: auto;
margin-right: auto;
}
/*
*
* PLUGIN: jspsych-categorize
*
*/
#jspsych-categorize-stimulus {
display: block;
margin-left: auto;
margin-right: auto;
}
.feedback {
display: block;
margin-left: auto;
margin-right: auto;
}
/*
*
* PLUGIN: jspsych-free-sort
*
*/
#jspsych-free-sort-arena {
margin-left: auto;
margin-right: auto;
border: 2px solid #444;
}
/*
*
* PLUGIN: jspsych-palmer
*
*/
#jspsych-palmer-raphaelCanvas {
margin-left: auto;
margin-right: auto;
}
/*
*
* PLUGIN: jspsych-same-different
*
*/
.jspsych-same-different-stimulus {
display: block;
margin-left: auto;
margin-right: auto;
}
/*
*
* PLUGIN: jspsych-single-stim
*
*/
#jspsych-single-stim-stimulus {
display: block;
margin-left: auto;
margin-right: auto;
}
/*
*
* PLUGIN: jspsych-xab
*
*/
.jspsych-xab-stimulus {
display: block;
margin-left: auto;
margin-right: auto;
}
/*
*
* PLUGIN: jspsych-survey-text
*
*/
.jspsych-survey-text {
margin: 0.25em 0em;
}
.jspsych-survey-text-question {
margin: 2em 0em;
}

View File

@ -1,12 +0,0 @@
<div id="consent">
<p>
This is a demo experiment, with this minimal consent form being loaded
as an external html document. To continue, click the checkbox below
and hit "Start Experiment".
</p>
<p>
<input type="checkbox" id="consent_checkbox" />
I agree to take part in this study.
</p>
<button type="button" id="start">Start Experiment</button>
</div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -1,59 +0,0 @@
<!doctype html>
<html>
<head>
<title>jspsych-animation plugin example</title>
<!-- jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- jsPsych -->
<script src="scripts/jspsych.js"></script>
<script src="scripts/plugins/jspsych-animation.js"></script>
<!-- style -->
<link href="css/jspsych.css" rel="stylesheet" type="text/css"></link>
</head>
<body>
<div id="jspsych_target"></div>
</body>
<script type="text/javascript">
// declare variable to hold animation sequence
var animation_sequence = ["img/face_1.jpg", "img/face_2.jpg", "img/face_3.jpg", "img/face_4.jpg", "img/face_3.jpg", "img/face_2.jpg"];
// create animation block for jspsych
var animation_block = {
type: 'animation',
stimuli: [animation_sequence],
frame_isi: 50,
repetitions: 3,
choices: [32]
};
// preload images for animation sequence
// call start() when loading is complete
jsPsych.preloadImages(animation_sequence, start);
// function to launch jspsych experiment
// putting this in a function so that it only gets called once all the
// images are loaded using preloadImages
function start() {
jsPsych.init({
display_element: $('#jspsych_target'),
experiment_structure: [animation_block],
on_finish: function(data) {
jsPsych.dataAPI.displayData();
}
});
}
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-50563838-1', 'jspsych.org');
ga('send', 'pageview');
</script>
</html>

View File

@ -1,45 +0,0 @@
<!doctype html>
<html>
<head>
<title>jspsych-call-function plugin example</title>
<!-- jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" ></script>
<!-- jsPsych -->
<script src="scripts/jspsych.js"></script>
<script src="scripts/plugins/jspsych-call-function.js"></script>
<!-- style -->
<link href="css/jspsych.css" rel="stylesheet" type="text/css"></link>
</head>
<body>
<div id="jspsych_target">
</div>
</body>
<script type="text/javascript">
// this is a simple function that changes the background color of the page
var demo_function = function(color) {
$('body').css({"background-color": color});
return color;
};
// declare the block.
var function_block = {type:'call-function', func: demo_function, args:["#ff0000"]};
jsPsych.init({
display_element: $('#jspsych_target'),
experiment_structure: [function_block],
on_finish:function(data){
jsPsych.dataAPI.displayData();
}
});
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-50563838-1', 'jspsych.org');
ga('send', 'pageview');
</script>
</html>

View File

@ -1,69 +0,0 @@
<!doctype html>
<html>
<head>
<title>jspsych-categorize-animation plugin example</title>
<!-- jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- jsPsych -->
<script src="scripts/jspsych.js"></script>
<script src="scripts/plugins/jspsych-text.js"></script>
<script src="scripts/plugins/jspsych-categorize-animation.js"></script>
<!-- style -->
<link href="css/jspsych.css" rel="stylesheet" type="text/css"></link>
</head>
<body>
<div id="jspsych_target"></div>
</body>
<script type="text/javascript">
var animation_sequences = [
["img/face_1.jpg", "img/face_2.jpg", "img/face_3.jpg", "img/face_4.jpg"],
["img/face_4.jpg", "img/face_3.jpg", "img/face_2.jpg", "img/face_1.jpg"],
["img/face_1.jpg", "img/face_2.jpg", "img/face_3.jpg", "img/face_4.jpg"],
["img/face_4.jpg", "img/face_3.jpg", "img/face_2.jpg", "img/face_1.jpg"]
];
var answers = [81,80,81,80];
// create categorization block for jspsych
var categorization_block = {
type: 'categorize-animation',
stimuli: animation_sequences,
key_answer: answers,
choices: [80, 81],
prompt: "<p class='prompt'>Press Q if the face rotates from the front to the side. Press P if the face rotates from the side to the front.</p>"
};
// create a block of instructions
var instructions_block = {
type: 'text',
text: ["<div id='instructions'><p>Press Q if the face rotates from the front to the side. Press P if the face rotates from the side to the front.</p><p>Press ENTER to begin.</p></div>"]
};
// preload images for animation sequence
// call start() when loading is complete
jsPsych.preloadImages(animation_sequences[0], start);
// launch jspsych experiment
function start(){
jsPsych.init({
display_element: $('#jspsych_target'),
experiment_structure: [instructions_block, categorization_block],
on_finish: function(data) {
jsPsych.dataAPI.displayData();
}
});
}
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-50563838-1', 'jspsych.org');
ga('send', 'pageview');
</script>
</html>

View File

@ -1,103 +0,0 @@
<!doctype html>
<html>
<head>
<title>jspsych-categorize plugin example</title>
<!-- jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- jsPsych -->
<script src="scripts/jspsych.js"></script>
<script src="scripts/plugins/jspsych-text.js"></script>
<script src="scripts/plugins/jspsych-categorize.js"></script>
<!-- style -->
<link href="css/jspsych.css" rel="stylesheet" type="text/css"></link>
<style>
#stimulus {
width: 150px;
height: 150px;
background-color: #ddd;
font-size:124px;
font-family:'Impact';
line-height: 1em;
text-align: center;
margin: auto;
}
#stimulus p {
margin: 0px;
}
</style>
</head>
<body>
<div id="jspsych_target"></div>
</body>
<script type="text/javascript">
// number of trials
var n_trials = 6;
// this is an example of using HTML objects as stimuli.
// you could also use images.
var numbers = ["1", "2", "3", "4", "5"];
var letters = ["I", "Z", "B", "A", "S"];
var stimuli = [];
var answers = [];
var text_answers = [];
// randomly choose stimuli
for (var i = 0; i < n_trials; i++) {
if (Math.floor(Math.random() * 2) === 0) {
// pick a number
stimuli.push("<div id='stimulus'><p>" + numbers[Math.floor(Math.random() * numbers.length)] + "</p></div>");
answers.push(81);
text_answers.push("number");
}
else {
// pick a letter
stimuli.push("<div id='stimulus'><p>" + letters[Math.floor(Math.random() * letters.length)] + "</p></div>");
answers.push(80);
text_answers.push("letter");
}
}
// create categorization block for jspsych
var categorization_block = {
type: 'categorize',
stimuli: stimuli,
key_answer: answers,
text_answer: text_answers,
choices: [80, 81],
correct_text: "<p class='center-content'>Correct, this is a %ANS%.</p>",
incorrect_text: "<p class='center-content'>Incorrect, this is a %ANS%.</p>",
is_html: true,
prompt: "<p class='center-content'>Press P for letter. Press Q for number.</p>"
};
// create a block of instructions
var instructions_block = {
type: 'text',
text: ["<div id='instructions'><p>Press P if you see a letter. Press Q if you see a number.</p><p>Press ENTER to begin.</p></div>"]
};
// launch jspsych experiment
jsPsych.init({
display_element: $('#jspsych_target'),
experiment_structure: [instructions_block, categorization_block],
on_finish: function(data) {
jsPsych.dataAPI.displayData();
}
});
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-50563838-1', 'jspsych.org');
ga('send', 'pageview');
</script>
</html>

View File

@ -1,63 +0,0 @@
<!doctype html>
<html>
<head>
<title>jspsych-free-sort plugin example</title>
<!-- jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- requires jQuery UI library as well -->
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<!-- jsPsych -->
<script src="scripts/jspsych.js"></script>
<script src="scripts/plugins/jspsych-free-sort.js"></script>
<!-- style -->
<link href="css/jspsych.css" rel="stylesheet" type="text/css"></link>
<style>
img {
width: 100px;
border: 1px solid #ccc;
}
#sort_arena {
border: 1px solid black;
}
</style>
</head>
<body>
<div id="jspsych_target"></div>
</body>
<script type="text/javascript">
// declare an array to hold the stimuli
var sorting_stimuli = [];
for (var i = 1; i <= 12; i++) {
sorting_stimuli.push("img/cell_img_" + i + ".jpg");
}
// create free-sort block for jspsych
var sort_block = {
type: 'free-sort',
stimuli: [sorting_stimuli],
prompt: "<p>Click and drag the images below to sort them so that similar items are close together.</p>"
};
// launch jspsych experiment
jsPsych.init({
display_element: $('#jspsych_target'),
experiment_structure: [sort_block],
on_finish: function(data) {
jsPsych.dataAPI.displayData();
}
});
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-50563838-1', 'jspsych.org');
ga('send', 'pageview');
</script>
</html>

View File

@ -1,60 +0,0 @@
<!doctype html>
<html>
<head>
<title>jspsych-html plugin example</title>
<!-- jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" ></script>
<!-- jsPsych -->
<script src="scripts/jspsych.js"></script>
<script src="scripts/plugins/jspsych-html.js"></script>
<!-- style -->
<link href="css/jspsych.css" rel="stylesheet" type="text/css"></link>
</head>
<body>
<div id="jspsych_target">
</div>
</body>
<script type="text/javascript">
// the html function loads external html content into the page.
// the external content is a file called "external_page.html"
// in the same directory as this file.
// sample function that might be used to check if a subject has given
// consent to participate.
var check_consent = function(elem) {
if ($('#consent_checkbox').is(':checked')) {
return true;
}
else {
alert("If you wish to participate, you must check the box next to the statement 'I agree to participate in this study.'");
return false;
}
return false;
};
// declare the block.
var html_block = {type:'html', pages: [{url: "external_page.html", cont_btn: "start", check_fn: check_consent}]};
jsPsych.init({
display_element: $('#jspsych_target'),
experiment_structure: [html_block],
on_finish:function(data){
jsPsych.dataAPI.displayData();
}
});
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-50563838-1', 'jspsych.org');
ga('send', 'pageview');
</script>
</html>

View File

@ -1,65 +0,0 @@
<!doctype html>
<html>
<head>
<title>jspsych-palmer plugin example</title>
<!-- jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- this plugin requires the raphael.js library -->
<script src="scripts/raphael-min.js"></script>
<!-- jsPsych -->
<script src="scripts/jspsych.js"></script>
<script src="scripts/plugins/jspsych-text.js"></script>
<script src="scripts/plugins/jspsych-palmer.js"></script>
<!-- style -->
<link href="css/jspsych.css" rel="stylesheet" type="text/css"></link>
</head>
<body>
<div id="jspsych_target"></div>
</body>
<script type="text/javascript">
var instructions = '<div id="instructions"><p>Memorize the following picture. Press ENTER when you are ready.</p></div>';
var instructions_block = {type:'text', text:[instructions]};
var stim_block = {
type: 'palmer',
configurations: [[0,1,0,0,1,1,0,0,1,1,0,0,1,0,0,0,1,0,0,1]],
editable: false,
timing_item: 2500
};
var test_block = {
type: 'palmer',
configurations: [[0,1,0,0,1,1,0,0,1,1,0,0,1,0,0,0,1,0,0,1]],
editable: true,
show_feedback: true,
timing_feedback: 2000,
prompt: '<p>Create the image you just saw. Click two circles to add or remove a line between them. Click submit when you are done.</p>'
};
// launch jspsych experiment
jsPsych.init({
display_element: $('#jspsych_target'),
experiment_structure: [instructions_block, stim_block, test_block],
on_finish: function(data) {
jsPsych.dataAPI.displayData();
}
});
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-50563838-1', 'jspsych.org');
ga('send', 'pageview');
</script>
</html>

View File

@ -1,100 +0,0 @@
<!doctype html>
<html>
<head>
<title>jspsych-same-different plugin example</title>
<!-- jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- jsPsych -->
<script src="scripts/jspsych.js"></script>
<script src="scripts/plugins/jspsych-same-different.js"></script>
<!-- style -->
<link href="css/jspsych.css" rel="stylesheet" type="text/css"></link>
<style>
img {
width: 150px;
}
</style>
</head>
<body>
<div id="jspsych_target"></div>
</body>
<script type="text/javascript">
// how many trials?
var n_trials = 6;
// declare an array to hold the stimuli
var stimuli = [];
for (var i = 1; i <= 12; i++) {
stimuli.push("img/cell_img_" + i + ".jpg");
}
var pairs = [];
var answers = [];
for (var i = 0; i < n_trials; i++) {
// randomly choose the first stim we will show to subject
var first_stim = stimuli[Math.floor(Math.random() * stimuli.length)];
// randomly choose whether this trial will be "same" or "different"
if (Math.floor(Math.random() * 2) === 0) {
// same trial
// add the matching pair to the pairs list
pairs.push([first_stim, first_stim]);
// add the answer to the answers list
answers.push("same");
}
else {
// different trial
// need a second stim that is not the same as the first
var second_stim = stimuli[Math.floor(Math.random() * stimuli.length)];
while (second_stim == first_stim) {
second_stim = stimuli[Math.floor(Math.random() * stimuli.length)];
}
// add the pair
pairs.push([first_stim, second_stim]);
// add the answer
answers.push("different");
}
}
// create free-sort block for jspsych
var same_diff_block = {
type: 'same-different',
stimuli: pairs,
answer: answers,
prompt: "<p>Press Q if the images were the same. Press P if they were different.</p>"
};
// preload images
// call start() when loading is complete
jsPsych.preloadImages(stimuli, start);
// launch jspsych experiment
function start() {
jsPsych.init({
display_element: $('#jspsych_target'),
experiment_structure: [same_diff_block],
on_finish: function(data) {
jsPsych.dataAPI.displayData();
}
});
}
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-50563838-1', 'jspsych.org');
ga('send', 'pageview');
</script>
</html>

View File

@ -1,80 +0,0 @@
<!doctype html>
<html>
<head>
<title>jspsych-similarity plugin example</title>
<!-- jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- this plugin requires the jQuery UI library and stylesheet
-->
<!-- these can be loaded from google's servers with the following links
-->
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/black-tie/jquery-ui.min.css"
rel="stylesheet" type="text/css"></link>
<!-- jsPsych -->
<script src="scripts/jspsych.js"></script>
<script src="scripts/plugins/jspsych-similarity.js"></script>
<!-- style -->
<link href="css/jspsych.css" rel="stylesheet" type="text/css"></link>
</head>
<body>
<div id="jspsych_target"></div>
</body>
<script type="text/javascript">
// how many trials?
var n_trials = 6;
// declare an array to hold the stimuli
var stimuli = [];
for (var i = 1; i <= 12; i++) {
stimuli.push("img/cell_img_" + i + ".jpg");
}
var pairs = [];
for (var i = 0; i < n_trials; i++) {
// randomly choose the two stimuli we will show to subject
var first_stim = stimuli[Math.floor(Math.random() * stimuli.length)];
var second_stim = stimuli[Math.floor(Math.random() * stimuli.length)];
// add the pair
pairs.push([first_stim, second_stim]);
}
// create free-sort block for jspsych
var similarity_block = {
type: 'similarity',
stimuli: pairs,
prompt: "<p>Drag the slider to indicate how similar the two images are.</p>"
};
// preload images
// call start() when loading is complete
jsPsych.preloadImages(stimuli, start);
// launch jspsych experiment
function start() {
jsPsych.init({
display_element: $('#jspsych_target'),
experiment_structure: [similarity_block],
on_finish: function(data) {
jsPsych.dataAPI.displayData();
}
});
}
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-50563838-1', 'jspsych.org');
ga('send', 'pageview');
</script>
</html>

View File

@ -1,71 +0,0 @@
<!doctype html>
<html>
<head>
<title>jspsych-single-stim example</title>
<!-- Load jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- Load the jspsych library and plugins -->
<script src="scripts/jspsych.js"></script>
<script src="scripts/plugins/jspsych-text.js"></script>
<script src="scripts/plugins/jspsych-single-stim.js"></script>
<!-- style -->
<link href="css/jspsych.css" rel="stylesheet" type="text/css"></link>
</head>
<body>
<div id="jspsych_target"></div>
</body>
<script type="text/javascript">
// Experiment parameters
var n_trials = 6;
var stimuli = ["img/congruent_left.gif", "img/congruent_right.gif", "img/incongruent_left.gif", "img/incongruent_right.gif"];
// Experiment Instructions
var instructions = '<div id="instructions"><p>You will see a series of images that look similar to this:</p>\
<p><img src="img/incongruent_right.gif"></p><p>Press the arrow key that corresponds to the direction that\
the middle arrow is pointing. For example, in this case you would press the right arrow key.</p>\
<p>Press enter to start.</p>';
// Generating Random Order for Stimuli
var stimuli_random_order = [];
for (var i = 0; i < n_trials; i++) {
var random_choice = Math.floor(Math.random() * stimuli.length);
stimuli_random_order.push(stimuli[random_choice]);
}
// Define experiment blocks
var instruction_block = {
type: "text",
text: [instructions],
timing_post_trial: 1000
};
var test_block = {
type: "single-stim",
stimuli: stimuli_random_order,
choices: [37, 39]
};
jsPsych.init({
display_element: $('#jspsych_target'),
experiment_structure: [instruction_block, test_block],
on_finish: function(data) {
jsPsych.dataAPI.displayData();
}
});
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-50563838-1', 'jspsych.org');
ga('send', 'pageview');
</script>
</html>

View File

@ -1,59 +0,0 @@
<!doctype html>
<html>
<head>
<title>jspsych-survey-likert plugin example</title>
<!-- jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- this plugin requires the jQuery UI library and stylesheet -->
<!-- these can be loaded from google's servers with the following links -->
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/black-tie/jquery-ui.min.css" rel="stylesheet" type="text/css"></link>
<!-- jsPsych -->
<script src="scripts/jspsych.js"></script>
<script src="scripts/plugins/jspsych-survey-likert.js"></script>
<!-- style -->
<link href="css/jspsych.css" rel="stylesheet" type="text/css"></link>
</head>
<body>
<div id="jspsych_target"></div>
</body>
<script type="text/javascript">
// defining groups of questions that will go together.
var page_1_questions = ["I like vegetables.", "I hate eggs."];
var page_2_questions = ["I like fruit."];
// definiting two different response scales that can be used.
var scale_1 = ["Strongly Disagree", "Disagree", "Neutral", "Agree", "Strongly Agree"];
var scale_2 = ["Strongly Disagree", "Disagree", "Somewhat Disagree", "Neural", "Somewhat Agree", "Agree", "Strongly Agree"];
var likert_block = {
type: 'survey-likert',
questions: [page_1_questions, page_2_questions],
labels: [[scale_1, scale_2], [scale_1]], // need one scale for every question on a page
intervals: [[5,7], [9]] // note the the intervals and labels don't necessarily need to match.
};
// launch jspsych experiment
jsPsych.init({
display_element: $('#jspsych_target'),
experiment_structure: [likert_block],
on_finish: function(data) {
jsPsych.dataAPI.displayData();
}
});
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-50563838-1', 'jspsych.org');
ga('send', 'pageview');
</script>
</html>

View File

@ -1,49 +0,0 @@
<!doctype html>
<html>
<head>
<title>jspsych-survey-text plugin example</title>
<!-- jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- jsPsych -->
<script src="scripts/jspsych.js"></script>
<script src="scripts/plugins/jspsych-survey-text.js"></script>
<!-- style -->
<link href="css/jspsych.css" rel="stylesheet" type="text/css"></link>
</head>
<body>
<div id="jspsych_target"></div>
</body>
<script type="text/javascript">
// defining groups of questions that will go together.
var page_1_questions = ["How old are you?", "Where were you born?"];
var page_2_questions = ["What is your favorite food?"];
var survey_block = {
type: 'survey-text',
questions: [page_1_questions, page_2_questions],
};
// launch jspsych experiment
jsPsych.init({
display_element: $('#jspsych_target'),
experiment_structure: [survey_block],
on_finish: function(data) {
jsPsych.dataAPI.displayData();
}
});
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-50563838-1', 'jspsych.org');
ga('send', 'pageview');
</script>
</html>

View File

@ -1,53 +0,0 @@
<!doctype html>
<html>
<head>
<title>jspsych-text plugin example</title>
<!-- jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" ></script>
<!-- jsPsych -->
<script src="scripts/jspsych.js"></script>
<script src="scripts/plugins/jspsych-text.js"></script>
<!-- style -->
<link href="css/jspsych.css" rel="stylesheet" type="text/css"></link>
</head>
<body>
<div id="jspsych_target">
</div>
</body>
<script type="text/javascript">
// declare variable to hold instructions
var instructions_part_1 = '<div id="instructions"><p>The first part of the instructions. Any HTML code can be used here.</p><p>Press ENTER to continue.</p></div>';
// you can also use a function that returns a string as the text parameter.
// the advantage of this is that the function is evaluated when the text is
// displayed, so you can show information that depends on things that
// have happened in the experiment already.
var instructions_part_2 = function() {
var d = new Date();
var n = d.toTimeString();
return '<div id="instructions"><p>Variables can also be put in the text.</p><p>The current time is '+n+'</p><p>Press ENTER to continue.</p></div>';
}
// create the text block
var text_block = {type:'text', text: [instructions_part_1,instructions_part_2]};
// launch jspsych
jsPsych.init({
display_element: $('#jspsych_target'),
experiment_structure: [text_block],
on_finish:function(data){
jsPsych.dataAPI.displayData();
}
});
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-50563838-1', 'jspsych.org');
ga('send', 'pageview');
</script>
</html>

View File

@ -1,58 +0,0 @@
<!doctype html>
<html>
<head>
<title>jspsych-vsl-animate-occlusion plugin example</title>
<!-- jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="scripts/raphael-min.js"></script>
<!-- jsPsych -->
<script src="scripts/jspsych.js"></script>
<script src="scripts/plugins/jspsych-vsl-animate-occlusion.js"></script>
<!-- style -->
<link href="css/jspsych.css" rel="stylesheet" type="text/css"></link>
</head>
<body>
<div id="jspsych_target"></div>
</body>
<script type="text/javascript">
var images = ["img/1.gif","img/2.gif","img/3.gif","img/4.gif","img/5.gif",
"img/6.gif","img/7.gif","img/8.gif","img/9.gif","img/10.gif"];
// create vsl block for jspsych
var vsl_block = {
type: 'vsl-animate-occlusion',
stimuli: images
};
// preload images
// call start() when loading is complete
jsPsych.preloadImages(images, start);
// function to launch jspsych experiment
// putting this in a function so that it only gets called once all the
// images are loaded using preloadImages
function start() {
jsPsych.init({
display_element: $('#jspsych_target'),
experiment_structure: [vsl_block],
on_finish: function(data) {
jsPsych.dataAPI.displayData();
}
});
}
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-50563838-1', 'jspsych.org');
ga('send', 'pageview');
</script>
</html>

View File

@ -1,69 +0,0 @@
<!doctype html>
<html>
<head>
<title>jspsych-vsl-grid-scene plugin example</title>
<!-- jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- jsPsych -->
<script src="scripts/jspsych.js"></script>
<script src="scripts/plugins/jspsych-vsl-grid-scene.js"></script>
<!-- style -->
<link href="css/jspsych.css" rel="stylesheet" type="text/css"></link>
</head>
<body>
<div id="jspsych_target"></div>
</body>
<script type="text/javascript">
var images = ["img/1.gif","img/2.gif","img/3.gif","img/4.gif","img/5.gif",
"img/6.gif","img/7.gif","img/8.gif","img/9.gif","img/10.gif"];
var scenes = [
[
["img/1.gif", "img/2.gif", 0],
[ 0, "img/3.gif", 0],
["img/5.gif", "img/4.gif", 0]
],
[
[ 0, 0, "img/6.gif"],
[ "img/10.gif", "img/7.gif", 0],
[ 0,"img/8.gif", "img/9.gif" ]
]
];
// create vsl block for jspsych
var vsl_block = {
type: 'vsl-grid-scene',
stimuli: scenes
};
// preload images
// call start() when loading is complete
jsPsych.preloadImages(images, start);
// function to launch jspsych experiment
// putting this in a function so that it only gets called once all the
// images are loaded using preloadImages
function start() {
jsPsych.init({
display_element: $('#jspsych_target'),
experiment_structure: [vsl_block],
on_finish: function(data) {
jsPsych.dataAPI.displayData();
}
});
}
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-50563838-1', 'jspsych.org');
ga('send', 'pageview');
</script>
</html>

View File

@ -1,72 +0,0 @@
<!doctype html>
<html>
<head>
<title>jspsych-xab plugin example</title>
<!-- jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- jsPsych -->
<script src="scripts/jspsych.js"></script>
<script src="scripts/plugins/jspsych-xab.js"></script>
<!-- style -->
<link href="css/jspsych.css" rel="stylesheet" type="text/css"></link>
</head>
<body>
<div id="jspsych_target"></div>
</body>
<script type="text/javascript">
// how many trials?
var n_trials = 6;
// declare an array to hold the stimuli
var stimuli = [];
for (var i = 1; i <= 12; i++) {
stimuli.push("img/cell_img_" + i + ".jpg");
}
var pairs = [];
for (var i = 0; i < n_trials; i++) {
// randomly choose the two stimuli we will show to subject
var first_stim = stimuli[Math.floor(Math.random() * stimuli.length)];
var second_stim = stimuli[Math.floor(Math.random() * stimuli.length)];
// add the pair
pairs.push([first_stim, second_stim]);
}
// create free-sort block for jspsych
var xab_block = {
type: 'xab',
stimuli: pairs,
prompt: "<p>Identify the image that is identical to the one you just saw. Press Q for the left image, Press P for the right image.</p>"
};
// preload images
// call start() when loading is complete
jsPsych.preloadImages(stimuli, start);
// launch jspsych experiment
function start() {
jsPsych.init({
display_element: $('#jspsych_target'),
experiment_structure: [xab_block],
on_finish: function(data) {
jsPsych.dataAPI.displayData();
}
});
}
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-50563838-1', 'jspsych.org');
ga('send', 'pageview');
</script>
</html>

View File

@ -1,946 +0,0 @@
/**
* jspsych.js
* Josh de Leeuw
*
* documentation: https://github.com/jodeleeuw/jsPsych/wiki
*
**/
(function($) {
jsPsych = (function() {
//
// public object
//
var core = {};
//
// private class variables
//
// options
var opts = {};
// exp structure
var exp_blocks = [];
// flow control
var curr_block = 0;
// everything loaded?
var initialized = false;
// target DOM element
var DOM_target;
// time that the experiment began
var exp_start_time;
//
// public methods
//
// core.init creates the experiment and starts running it
// display_element is an HTML element (usually a <div>) that will display jsPsych content
// options is an object: {
// "experiment_structure": an array of blocks specifying the experiment
// "finish": function to execute when the experiment ends
// }
//
core.init = function(options) {
// reset the key variables
exp_blocks = [];
opts = {};
initialized = false;
curr_block = 0;
// check if there is a body element on the page
var default_display_element = $('body');
if (default_display_element.length === 0) {
$(document.documentElement).append($('<body>'));
default_display_element = $('body');
}
var defaults = {
'display_element': default_display_element,
'on_finish': function(data) {
return undefined;
},
'on_trial_start': function() {
return undefined;
},
'on_trial_finish': function() {
return undefined;
},
'on_data_update': function(data) {
return undefined;
}
};
// import options
opts = $.extend({}, defaults, options);
// set target
DOM_target = opts.display_element;
// add CSS class to DOM_target
DOM_target.addClass('jspsych-display-element');
run();
};
// core.data returns all of the data objects for each block as an array
// where core.data[0] = data object from block 0, etc...
// if flatten is true, then the hierarchical structure of the data
// is removed and each array entry will be a single trial.
core.data = function() {
var all_data = [];
for (var i = 0; i < exp_blocks.length; i++) {
all_data[i] = exp_blocks[i].data;
}
return all_data;
};
// core.progress returns an object with the following properties
// total_blocks: the number of total blocks in the experiment
// total_trials: the number of total trials in the experiment
// current_trial_global: the current trial number in global terms
// i.e. if each block has 20 trials and the experiment is
// currently in block 2 trial 10, this has a value of 30.
// current_trial_local: the current trial number within the block.
// current_block: the current block number.
core.progress = function() {
var total_trials = 0;
for (var i = 0; i < exp_blocks.length; i++) {
total_trials += exp_blocks[i].num_trials;
}
var current_trial_global = 0;
for (var i = 0; i < curr_block; i++) {
current_trial_global += exp_blocks[i].num_trials;
}
current_trial_global += exp_blocks[curr_block].trial_idx;
var obj = {
"total_blocks": exp_blocks.length,
"total_trials": total_trials,
"current_trial_global": current_trial_global,
"current_trial_local": exp_blocks[curr_block].trial_idx,
"current_block": curr_block
};
return obj;
};
// core.startTime() returns the Date object which represents the time that the experiment started.
core.startTime = function() {
return exp_start_time;
};
// core.totalTime() returns the length of time in ms since the experiment began
core.totalTime = function() {
return (new Date()).getTime() - exp_start_time.getTime();
};
// core.preloadImage will load images into the browser cache so that they appear quickly when
// used during a trial.
// images: array of paths to images
// callback_complete: a function with no arguments that calls when loading is complete
// callback_load: a function with a single argument that calls whenever an image is loaded
// argument is the number of images currently loaded.
core.preloadImages = function(images, callback_complete, callback_load) {
// flatten the images array
images = flatten(images);
var n_loaded = 0;
var loadfn = (typeof callback_load === 'undefined') ? function() {} : callback_load;
var finishfn = (typeof callback_complete === 'undefined') ? function() {} : callback_complete;
for (var i = 0; i < images.length; i++) {
var img = new Image();
img.onload = function() {
n_loaded++;
loadfn(n_loaded);
if (n_loaded == images.length) {
finishfn();
}
};
img.src = images[i];
}
};
core.getDisplayElement = function() {
return DOM_target;
}
//
// private functions //
//
function run() {
// take the experiment structure and dynamically create a set of blocks
exp_blocks = new Array(opts.experiment_structure.length);
// iterate through block list to create trials
for (var i = 0; i < exp_blocks.length; i++) {
// check to make sure plugin is loaded
var plugin_name = opts.experiment_structure[i].type;
if (typeof jsPsych[plugin_name] == 'undefined') {
throw new Error("Failed attempt to create trials using plugin type " + plugin_name + ". Is the plugin loaded?");
}
var trials = jsPsych[plugin_name]["create"].call(null, opts["experiment_structure"][i]);
exp_blocks[i] = createBlock(trials);
}
// record the start time
exp_start_time = new Date();
// begin! - run the first block
exp_blocks[0].next();
}
function nextBlock() {
curr_block += 1;
if (curr_block == exp_blocks.length) {
finishExperiment();
}
else {
exp_blocks[curr_block].next();
}
}
function createBlock(trial_list) {
var block = {
trial_idx: -1,
trials: trial_list,
data: [],
next: function() {
// call on_trial_finish()
// if not very first trial
// and not the last call in this block (no trial due to advance in block)
if (typeof this.trials[this.trial_idx + 1] != "undefined" && (curr_block != 0 || this.trial_idx > -1)) {
opts.on_trial_finish();
};
this.trial_idx = this.trial_idx + 1;
var curr_trial = this.trials[this.trial_idx];
if (typeof curr_trial == "undefined") {
return this.done();
}
// call on_trial_start()
opts.on_trial_start();
do_trial(this, curr_trial);
},
writeData: function(data_object) {
this.data[this.trial_idx] = data_object;
opts.on_data_update(data_object);
},
done: nextBlock,
num_trials: trial_list.length
};
return block;
}
function finishExperiment() {
opts["on_finish"].apply((new Object()), [core.data()]);
}
function do_trial(block, trial) {
// execute trial method
jsPsych[trial.type]["trial"].call(this, DOM_target, block, trial, 1);
}
return core;
})();
jsPsych.dataAPI = (function() {
var module = {};
// core.dataAsCSV returns a CSV string that contains all of the data
// append_data is an option map object that will append values
// to every row. for example, if append_data = {"subject": 4},
// then a column called subject will be added to the data and
// it will always have the value 4.
module.dataAsCSV = function(append_data) {
var dataObj = jsPsych.data();
return JSON2CSV(flattenData(dataObj, append_data));
};
module.localSave = function(filename, format, append_data) {
var data_string;
if(format == 'JSON' || format == 'json') {
data_string = JSON.stringify(flattenData(jsPsych.data(), append_data));
} else if(format == 'CSV' || format == 'csv') {
data_string = module.dataAsCSV(append_data);
} else {
throw new Error('invalid format specified for jsPsych.dataAPI.localSave');
}
saveTextToFile(data_string, filename);
};
module.getTrialsOfType = function(trial_type){
var data = jsPsych.data();
data = flatten(data);
var trials = [];
for(var i = 0; i < data.length; i++){
if(data[i].trial_type == trial_type){
trials.push(data[i]);
}
}
return trials;
};
module.displayData = function(format) {
format = (typeof format === 'undefined') ? "json" : format.toLowerCase();
if(format != "json" && format != "csv") {
console.log('Invalid format declared for displayData function. Using json as default.');
format = "json";
}
var data_string;
if(format == 'json') {
data_string = JSON.stringify(flattenData(jsPsych.data()), undefined, 1);
} else {
data_string = module.dataAsCSV();
}
var display_element = jsPsych.getDisplayElement();
display_element.append($('<pre>', {
html: data_string
}));
}
// private function to save text file on local drive
function saveTextToFile(textstr, filename) {
var blobToSave = new Blob([textstr], {
type: 'text/plain'
});
var blobURL = "";
if (typeof window.webkitURL !== 'undefined') {
blobURL = window.webkitURL.createObjectURL(blobToSave);
}
else {
blobURL = window.URL.createObjectURL(blobToSave);
}
var display_element = jsPsych.getDisplayElement();
display_element.append($('<a>', {
id: 'jspsych-download-as-text-link',
href: blobURL,
css: {
display: 'none'
},
download: filename,
html: 'download file'
}));
$('#jspsych-download-as-text-link')[0].click();
}
//
// A few helper functions to handle data format conversion
//
function flattenData(data_object, append_data) {
append_data = (typeof append_data === undefined) ? {} : append_data;
var trials = [];
// loop through data_object
for (var i = 0; i < data_object.length; i++) {
for (var j = 0; j < data_object[i].length; j++) {
var data = $.extend({}, data_object[i][j], append_data);
trials.push(data);
}
}
return trials;
}
// this function based on code suggested by StackOverflow users:
// http://stackoverflow.com/users/64741/zachary
// http://stackoverflow.com/users/317/joseph-sturtevant
function JSON2CSV(objArray) {
var array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray;
var line = '';
var result = '';
var columns = [];
var i = 0;
for (var j = 0; j < array.length; j++) {
for (var key in array[j]) {
var keyString = key + "";
keyString = '"' + keyString.replace(/"/g, '""') + '",';
if ($.inArray(key, columns) == -1) {
columns[i] = key;
line += keyString;
i++;
}
}
}
line = line.slice(0, - 1);
result += line + '\r\n';
for (var i = 0; i < array.length; i++) {
var line = '';
for (var j = 0; j < columns.length; j++) {
var value = (typeof array[i][columns[j]] === 'undefined') ? '' : array[i][columns[j]];
var valueString = value + "";
line += '"' + valueString.replace(/"/g, '""') + '",';
}
line = line.slice(0, - 1);
result += line + '\r\n';
}
return result;
}
return module;
})();
jsPsych.turk = (function() {
// turk info
var turk_info;
var module = {};
// core.turkInfo gets information relevant to mechanical turk experiments. returns an object
// containing the workerID, assignmentID, and hitID, and whether or not the HIT is in
// preview mode, meaning that they haven't accepted the HIT yet.
module.turkInfo = function(force_refresh) {
// default value is false
force_refresh = (typeof force_refresh === 'undefined') ? false : force_refresh;
// if we already have the turk_info and force_refresh is false
// then just return the cached version.
if (typeof turk_info !== 'undefined' && !force_refresh) {
return turk_info;
} else {
var turk = {};
var param = function(url, name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(url);
return (results == null) ? "" : results[1];
};
var src = param(window.location.href, "assignmentId") ? window.location.href : document.referrer;
var keys = ["assignmentId", "hitId", "workerId", "turkSubmitTo"];
keys.map(
function(key) {
turk[key] = unescape(param(src, key));
});
turk.previewMode = (turk.assignmentId == "ASSIGNMENT_ID_NOT_AVAILABLE");
turk.outsideTurk = (!turk.previewMode && turk.hitId === "" && turk.assignmentId == "" && turk.workerId == "")
turk_info = turk;
return turk;
}
};
// core.submitToTurk will submit a MechanicalTurk ExternalHIT type
module.submitToTurk = function(data) {
var turkInfo = core.turkInfo();
var assignmentId = turkInfo.assignmentId;
var turkSubmitTo = turkInfo.turkSubmitTo;
if (!assignmentId || !turkSubmitTo) return;
var dataString = [];
for (var key in data) {
if (data.hasOwnProperty(key)) {
dataString.push(key + "=" + escape(data[key]));
}
}
dataString.push("assignmentId=" + assignmentId);
var url = turkSubmitTo + "/mturk/externalSubmit?" + dataString.join("&");
window.location.href = url;
}
return module;
})();
jsPsych.randomization = (function() {
var module = {};
module.repeat = function(array, repetitions, unpack) {
var arr_isArray = Array.isArray(array);
var rep_isArray = Array.isArray(repetitions);
// if array is not an array, then we just repeat the item
if(!arr_isArray){
if(!rep_isArray) {
array = [array];
repetitions = [repetitions];
} else {
repetitions = [repetitions[0]];
console.log('Unclear parameters given to randomizeSimpleSample. Multiple set sizes specified, but only one item exists to sample. Proceeding using the first set size.');
}
} else {
if(!rep_isArray) {
var reps = [];
for(var i = 0; i < array.length; i++){
reps.push(repetitions);
}
repetitions = reps;
} else {
if(array.length != repetitions.length) {
// throw warning if repetitions is too short,
// throw warning if too long, and then use the first N
}
}
}
// should be clear at this point to assume that array and repetitions are arrays with == length
var allsamples = [];
for(var i = 0; i < array.length; i++){
for(var j = 0; j < repetitions[i]; j++){
allsamples.push(array[i]);
}
}
var out = shuffle(allsamples);
if(unpack) { out = unpackArray(out); }
return shuffle(out);
}
module.factorial = function(factors, repetitions, unpack){
var factorNames = Object.keys(factors);
var factor_combinations = [];
for(var i = 0; i < factors[factorNames[0]].length; i++){
factor_combinations.push({});
factor_combinations[i][factorNames[0]] = factors[factorNames[0]][i];
}
for(var i = 1; i< factorNames.length; i++){
var toAdd = factors[factorNames[i]];
var n = factor_combinations.length;
for(var j = 0; j < n; j++){
var base = factor_combinations[j];
for(var k = 0; k < toAdd.length; k++){
var newpiece = {};
newpiece[factorNames[i]] = toAdd[k];
factor_combinations.push($.extend({}, base, newpiece));
}
}
factor_combinations.splice(0,n);
}
repetitions = (typeof repetitions === 'undefined') ? 1 : repetitions;
var with_repetitions = module.repeat(factor_combinations, repetitions, unpack);
return with_repetitions;
}
function unpackArray(array) {
var out = {};
for(var i = 0; i < array.length; i++){
var keys = Object.keys(array[i]);
for(var k = 0; k < keys.length; k++){
if(typeof out[keys[k]] === 'undefined') {
out[keys[k]] = [];
}
out[keys[k]].push(array[i][keys[k]]);
}
}
return out;
}
function shuffle(array) {
var m = array.length, t, i;
// While there remain elements to shuffle…
while (m) {
// Pick a remaining element…
i = Math.floor(Math.random() * m--);
// And swap it with the current element.
t = array[m];
array[m] = array[i];
array[i] = t;
}
return array;
}
return module;
})();
jsPsych.pluginAPI = (function() {
// keyboard listeners
var keyboard_listeners = [];
var module = {};
module.getKeyboardResponse = function(callback_function, valid_responses, rt_method, persist) {
rt_method = (typeof rt_method === 'undefined') ? 'date' : rt_method;
if (rt_method != 'date' && rt_method != 'performance') {
console.log('Invalid RT method specified in getKeyboardResponse. Defaulting to "date" method.');
rt_method = 'date';
}
var start_time;
if (rt_method == 'date') {
start_time = (new Date()).getTime();
}
if (rt_method == 'performance') {
start_time = performance.now();
}
var listener_id;
var listener_function = function(e) {
var key_time;
if (rt_method == 'date') {
key_time = (new Date()).getTime();
}
if (rt_method == 'performance') {
key_time = performance.now();
}
var valid_response = false;
if (typeof valid_responses === 'undefined' || valid_responses.length === 0) {
valid_response = true;
}
for (var i = 0; i < valid_responses.length; i++) {
if (typeof valid_responses[i] == 'string') {
if(typeof keylookup[valid_responses[i]] !== 'undefined'){
if(e.which == keylookup[valid_responses[i]]) {
valid_response = true;
}
} else {
throw new Error('Invalid key string specified for getKeyboardResponse');
}
} else if (e.which == valid_responses[i]) {
valid_response = true;
}
}
if (valid_response) {
var after_up = function(up) {
if(up.which == e.which) {
$(document).off('keyup', after_up);
if($.inArray(listener_id, keyboard_listeners) > -1) {
if(!persist){
// remove keyboard listener
module.cancelKeyboardResponse(listener_id);
}
callback_function({
key: e.which,
rt: key_time - start_time
});
}
}
};
$(document).keyup(after_up);
}
};
$(document).keydown(listener_function);
// create listener id object
listener_id = {type: 'keydown', fn: listener_function};
// add this keyboard listener to the list of listeners
keyboard_listeners.push(listener_id);
return listener_id;
};
module.cancelKeyboardResponse = function(listener) {
// remove the listener from the doc
$(document).off(listener.type, listener.fn);
// remove the listener from the list of listeners
if($.inArray(listener, keyboard_listeners) > -1) {
keyboard_listeners.splice($.inArray(listener, keyboard_listeners), 1);
}
};
module.cancelAllKeyboardResponses = function() {
for(var i = 0; i< keyboard_listeners.length; i++){
$(document).off(keyboard_listeners[i].type, keyboard_listeners[i].fn);
}
keyboard_listeners = [];
};
// keycode lookup associative array
var keylookup = {
'backspace': 8,
'tab': 9,
'enter': 13,
'shift': 16,
'ctrl': 17,
'alt': 18,
'pause': 19,
'capslock': 20,
'esc': 27,
'space':32,
'spacebar':32,
' ':32,
'pageup': 33,
'pagedown': 34,
'end': 35,
'home': 36,
'leftarrow': 37,
'uparrow': 38,
'rightarrow': 39,
'downarrow': 40,
'insert': 45,
'delete': 46,
'0': 48,
'1': 49,
'2': 50,
'3': 51,
'4': 52,
'5': 53,
'6': 54,
'7': 55,
'8': 56,
'9': 57,
'a': 65,
'b': 66,
'c': 67,
'd': 68,
'e': 69,
'f': 70,
'g': 71,
'h': 72,
'i': 73,
'j': 74,
'k': 75,
'l': 76,
'm': 77,
'n': 78,
'o': 79,
'p': 80,
'q': 81,
'r': 82,
's': 83,
't': 84,
'u': 85,
'v': 86,
'w': 87,
'x': 88,
'y': 89,
'z': 90,
'A': 65,
'B': 66,
'C': 67,
'D': 68,
'E': 69,
'F': 70,
'G': 71,
'H': 72,
'I': 73,
'J': 74,
'K': 75,
'L': 76,
'M': 77,
'N': 78,
'O': 79,
'P': 80,
'Q': 81,
'R': 82,
'S': 83,
'T': 84,
'U': 85,
'V': 86,
'W': 87,
'X': 88,
'Y': 89,
'Z': 90,
'0numpad': 96,
'1numpad': 97,
'2numpad': 98,
'3numpad': 99,
'4numpad': 100,
'5numpad': 101,
'6numpad': 102,
'7numpad': 103,
'8numpad': 104,
'9numpad': 105,
'multiply': 106,
'plus': 107,
'minus': 109,
'decimal': 110,
'divide': 111,
'F1': 112,
'F2': 113,
'F3': 114,
'F4': 115,
'F5': 116,
'F6': 117,
'F7': 118,
'F8': 119,
'F9': 120,
'F10': 121,
'F11': 122,
'F12': 123,
'=': 187,
',': 188,
'.': 190,
'/': 191,
'`': 192,
'[': 219,
'\\': 220,
']': 221
};
//
// These are public functions, intended to be used for developing plugins.
// They aren't considered part of the normal API for the core library.
//
module.normalizeTrialVariables = function(trial, protect) {
protect = (typeof protect === 'undefined') ? [] : protect;
var keys = getKeys(trial);
var tmp = {};
for (var i = 0; i < keys.length; i++) {
var process = true;
for (var j = 0; j < protect.length; j++) {
if (protect[j] == keys[i]) {
process = false;
break;
}
}
if (typeof trial[keys[i]] == "function" && process) {
tmp[keys[i]] = trial[keys[i]].call();
}
else {
tmp[keys[i]] = trial[keys[i]];
}
}
return tmp;
};
// if possible_array is not an array, then return a one-element array
// containing possible_array
module.enforceArray = function(params, possible_arrays) {
// function to check if something is an array, fallback
// to string method if browser doesn't support Array.isArray
var ckArray = Array.isArray || function(a) {
return toString.call(a) == '[object Array]';
};
for (var i = 0; i < possible_arrays.length; i++) {
if(typeof params[possible_arrays[i]] !== 'undefined'){
params[possible_arrays[i]] = ckArray(params[possible_arrays[i]]) ? params[possible_arrays[i]] : [params[possible_arrays[i]]];
}
}
return params;
};
function getKeys(obj) {
var r = [];
for (var k in obj) {
if (!obj.hasOwnProperty(k)) continue;
r.push(k);
}
return r;
}
return module;
})();
// methods used in multiple modules
// private function to flatten nested arrays
function flatten(arr, out) {
out = (typeof out === 'undefined') ? [] : out;
for (var i = 0; i < arr.length; i++) {
if (Array.isArray(arr[i])) {
flatten(arr[i], out);
}
else {
out.push(arr[i]);
}
}
return out;
}
})(jQuery);

View File

@ -1,139 +0,0 @@
/**
* jsPsych plugin for showing animations and recording keyboard responses
* Josh de Leeuw
*
* documentation: https://github.com/jodeleeuw/jsPsych/wiki/jspsych-animation
*/
(function($) {
jsPsych.animation = (function() {
var plugin = {};
plugin.create = function(params) {
params = jsPsych.pluginAPI.enforceArray(params, ['choices', 'data']);
var trials = new Array(params.stimuli.length);
for (var i = 0; i < trials.length; i++) {
trials[i] = {};
trials[i].type = "animation";
trials[i].stims = params.stimuli[i];
trials[i].frame_time = params.frame_time || 250;
trials[i].frame_isi = params.frame_isi || 0;
trials[i].repetitions = params.repetitions || 1;
trials[i].choices = params.choices || [];
trials[i].timing_post_trial = (typeof params.timing_post_trial === 'undefined') ? 1000 : params.timing_post_trial;
trials[i].prompt = (typeof params.prompt === 'undefined') ? "" : params.prompt;
trials[i].data = (typeof params.data === 'undefined') ? {} : params.data[i];
}
return trials;
};
plugin.trial = function(display_element, block, trial, part) {
// if any trial variables are functions
// this evaluates the function and replaces
// it with the output of the function
trial = jsPsych.pluginAPI.normalizeTrialVariables(trial);
var interval_time = trial.frame_time + trial.frame_isi;
var animate_frame = -1;
var reps = 0;
var startTime = (new Date()).getTime();
var animation_sequence = [];
var responses = [];
var current_stim = "";
var animate_interval = setInterval(function() {
var showImage = true;
display_element.html(""); // clear everything
animate_frame++;
if (animate_frame == trial.stims.length) {
animate_frame = 0;
reps++;
if (reps >= trial.repetitions) {
endTrial();
clearInterval(animate_interval);
showImage = false;
}
}
if (showImage) {
show_next_frame();
}
}, interval_time);
function show_next_frame() {
// show image
display_element.append($('<img>', {
"src": trial.stims[animate_frame],
"id": 'jspsych-animation-image'
}));
current_stim = trial.stims[animate_frame];
// record when image was shown
animation_sequence.push({
"stimulus": current_stim,
"time": (new Date()).getTime() - startTime
});
if (trial.prompt !== "") {
display_element.append(trial.prompt);
}
if (trial.frame_isi > 0) {
setTimeout(function() {
$('#jspsych-animation-image').css('visibility', 'hidden');
current_stim = 'blank';
// record when blank image was shown
animation_sequence.push({
"stimulus": 'blank',
"time": (new Date()).getTime() - startTime
});
}, trial.frame_time);
}
}
var after_response = function(info) {
responses.push({
key_press: info.key,
rt: info.rt,
stimulus: current_stim
});
// after a valid response, the stimulus will have the CSS class 'responded'
// which can be used to provide visual feedback that a response was recorded
$("#jspsych-animation-image").addClass('responded');
}
// hold the jspsych response listener object in memory
// so that we can turn off the response collection when
// the trial ends
var response_listener = jsPsych.pluginAPI.getKeyboardResponse(after_response, trial.choices, 'date', true);
function endTrial() {
jsPsych.pluginAPI.cancelKeyboardResponse(response_listener);
block.writeData($.extend({}, {
"trial_type": "animation",
"trial_index": block.trial_idx,
"animation_sequence": JSON.stringify(animation_sequence),
"responses": JSON.stringify(responses)
}, trial.data));
if(trial.timing_post_trial > 0){
setTimeout(function() {
block.next();
}, trial.timing_post_trial);
} else {
block.next();
}
}
};
return plugin;
})();
})(jQuery);

View File

@ -1,41 +0,0 @@
/**
* jspsych-call-function
* plugin for calling an arbitrary function during a jspsych experiment
* Josh de Leeuw
*
* documentation: https://github.com/jodeleeuw/jsPsych/wiki/jspsych-call-function
*
**/
(function($) {
jsPsych['call-function'] = (function() {
var plugin = {};
plugin.create = function(params) {
var trials = new Array(1);
trials[0] = {
"type": "call-function",
"func": params.func,
"args": params.args || [],
"data": (typeof params.data === 'undefined') ? {} : params.data
};
return trials;
};
plugin.trial = function(display_element, block, trial, part) {
var return_val = trial.func.apply({}, [trial.args]);
if (typeof return_val !== 'undefined') {
block.writeData($.extend({},{
trial_type: "call-function",
trial_index: block.trial_idx,
value: return_val
},trial.data));
}
block.next();
};
return plugin;
})();
})(jQuery);

View File

@ -1,166 +0,0 @@
/**
* jspsych plugin for categorization trials with feedback and animated stimuli
* Josh de Leeuw
*
* documentation: https://github.com/jodeleeuw/jsPsych/wiki/jspsych-categorize-animation
**/
(function($) {
jsPsych["categorize-animation"] = (function() {
var plugin = {};
plugin.create = function(params) {
params = jsPsych.pluginAPI.enforceArray(params, ['key_answer','text_answer','choices','data']);
var trials = new Array(params.stimuli.length);
for (var i = 0; i < trials.length; i++) {
trials[i] = {};
trials[i].type = "categorize-animation";
trials[i].stims = params.stimuli[i];
trials[i].reps = params.reps || 1;
trials[i].key_answer = params.key_answer[i];
trials[i].text_answer = (typeof params.text_answer === 'undefined') ? "" : params.text_answer[i];
trials[i].choices = params.choices;
trials[i].correct_text = params.correct_text || "Correct.";
trials[i].incorrect_text = params.incorrect_text || "Wrong.";
trials[i].allow_response_before_complete = params.allow_response_before_complete || false;
trials[i].frame_time = params.frame_time || 500;
trials[i].timing_feedback_duration = params.timing_feedback_duration || 2000;
trials[i].timing_post_trial = (typeof params.timing_post_trial === 'undefined') ? 1000 : params.timing_post_trial;
trials[i].prompt = (typeof params.prompt === 'undefined') ? '' : params.prompt;
trials[i].data = (typeof params.data === 'undefined') ? {} : params.data[i];
}
return trials;
};
plugin.trial = function(display_element, block, trial, part) {
// if any trial variables are functions
// this evaluates the function and replaces
// it with the output of the function
trial = jsPsych.pluginAPI.normalizeTrialVariables(trial);
var animate_frame = -1;
var reps = 0;
var showAnimation = true;
var responded = false;
var timeoutSet = false;
var startTime = (new Date()).getTime();
// show animation
var animate_interval = setInterval(function() {
display_element.html(""); // clear everything
animate_frame++;
if (animate_frame == trial.stims.length) {
animate_frame = 0;
reps++;
// check if reps complete //
if (trial.reps != -1 && reps >= trial.reps) {
// done with animation
showAnimation = false;
}
}
if (showAnimation) {
display_element.append($('<img>', {
"src": trial.stims[animate_frame],
"class": 'jspsych-categorize-animation-stimulus'
}));
}
if (!responded && trial.allow_response_before_complete) {
// in here if the user can respond before the animation is done
if (trial.prompt !== "") {
display_element.append(trial.prompt);
}
}
else if (!responded) {
// in here if the user has to wait to respond until animation is done.
// if this is the case, don't show the prompt until the animation is over.
if (!showAnimation) {
if (trial.prompt !== "") {
display_element.append(trial.prompt);
}
}
}
else {
// user has responded if we get here.
// show feedback
var feedback_text = "";
if (block.data[block.trial_idx].correct) {
feedback_text = trial.correct_text.replace("%ANS%", trial.text_answer);
}
else {
feedback_text = trial.incorrect_text.replace("%ANS%", trial.text_answer);
}
display_element.append(feedback_text);
// set timeout to clear feedback
if (!timeoutSet) {
timeoutSet = true;
setTimeout(function() {
endTrial();
}, trial.timing_feedback_duration);
}
}
}, trial.frame_time);
var keyboard_listener;
var after_response = function(info){
// ignore the response if animation is playing and subject
// not allowed to respond before it is complete
if (!trial.allow_response_before_complete && showAnimation) {
return false;
}
var correct = false;
if(trial.key_answer == info.key) {
correct = true;
}
responded = true;
var trial_data = {
"trial_type": trial.type,
"trial_index": block.trial_idx,
"stimulus": trial.stims[0],
"rt": info.rt,
"correct": correct,
"key_press": info.key
};
block.writeData($.extend({}, trial_data, trial.data));
jsPsych.pluginAPI.cancelKeyboardResponse(keyboard_listener);
}
jsPsych.pluginAPI.getKeyboardResponse(after_response, trial.choices, 'date', true);
function endTrial() {
clearInterval(animate_interval); // stop animation!
display_element.html(''); // clear everything
if(trial.timing_post_trial > 0){
setTimeout(function() {
block.next();
}, trial.timing_post_trial);
} else {
block.next();
}
}
};
return plugin;
})();
})(jQuery);

View File

@ -1,180 +0,0 @@
/**
* jspsych plugin for categorization trials with feedback
* Josh de Leeuw
*
* documentation: https://github.com/jodeleeuw/jsPsych/wiki/jspsych-categorize
**/
(function($) {
jsPsych.categorize = (function() {
var plugin = {};
plugin.create = function(params) {
params = jsPsych.pluginAPI.enforceArray(params, ['choices', 'stimuli', 'key_answer', 'text_answer', 'data']);
var trials = [];
for (var i = 0; i < params.stimuli.length; i++) {
trials.push({});
trials[i].type = "categorize";
trials[i].a_path = params.stimuli[i];
trials[i].key_answer = params.key_answer[i];
trials[i].text_answer = (typeof params.text_answer === 'undefined') ? "" : params.text_answer[i];
trials[i].choices = params.choices;
trials[i].correct_text = (typeof params.correct_text === 'undefined') ? "<p class='feedback'>Correct</p>" : params.correct_text;
trials[i].incorrect_text = (typeof params.incorrect_text === 'undefined') ? "<p class='feedback'>Incorrect</p>" : params.incorrect_text;
// timing params
trials[i].timing_stim = params.timing_stim || -1; // default is to show image until response
trials[i].timing_feedback_duration = params.timing_feedback_duration || 2000;
trials[i].timing_post_trial = (typeof params.timing_post_trial === 'undefined') ? 1000 : params.timing_post_trial;
// optional params
trials[i].show_stim_with_feedback = (typeof params.show_stim_with_feedback === 'undefined') ? true : params.show_stim_with_feedback;
trials[i].is_html = (typeof params.is_html === 'undefined') ? false : params.is_html;
trials[i].force_correct_button_press = (typeof params.force_correct_button_press === 'undefined') ? false : params.force_correct_button_press;
trials[i].prompt = (typeof params.prompt === 'undefined') ? '' : params.prompt;
trials[i].data = (typeof params.data === 'undefined') ? {} : params.data[i];
}
return trials;
};
var cat_trial_complete = false;
plugin.trial = function(display_element, block, trial, part) {
// if any trial variables are functions
// this evaluates the function and replaces
// it with the output of the function
trial = jsPsych.pluginAPI.normalizeTrialVariables(trial);
switch (part) {
case 1:
// set finish flag
cat_trial_complete = false;
if (!trial.is_html) {
// add image to display
display_element.append($('<img>', {
"src": trial.a_path,
"class": 'jspsych-categorize-stimulus',
"id": 'jspsych-categorize-stimulus'
}));
}
else {
display_element.append($('<div>', {
"id": 'jspsych-categorize-stimulus',
"class": 'jspsych-categorize-stimulus',
"html": trial.a_path
}));
}
// hide image after time if the timing parameter is set
if (trial.timing_stim > 0) {
setTimeout(function() {
if (!cat_trial_complete) {
$('#jspsych-categorize-stimulus').css('visibility', 'hidden');
}
}, trial.timing_stim);
}
// if prompt is set, show prompt
if (trial.prompt !== "") {
display_element.append(trial.prompt);
}
// start measuring RT
var startTime = (new Date()).getTime();
// create response function
var after_response = function(info) {
var correct = false;
if(trial.key_answer == info.key) { correct = true; }
cat_trial_complete = true;
// save data
var trial_data = {
"trial_type": "categorize",
"trial_index": block.trial_idx,
"rt": info.rt,
"correct": correct,
"stimulus": trial.a_path,
"key_press": info.key
};
block.writeData($.extend({}, trial_data, trial.data));
display_element.html('');
plugin.trial(display_element, block, trial, part + 1);
}
jsPsych.pluginAPI.getKeyboardResponse(after_response, trial.choices, 'date', false);
break;
case 2:
// show image during feedback if flag is set
if (trial.show_stim_with_feedback) {
if (!trial.is_html) {
// add image to display
display_element.append($('<img>', {
"src": trial.a_path,
"class": 'jspsych-categorize-stimulus',
"id": 'jspsych-categorize-stimulus'
}));
}
else {
display_element.append($('<div>', {
"id": 'jspsych-categorize-stimulus',
"class": 'jspsych-categorize-stimulus',
"html": trial.a_path
}));
}
}
// substitute answer in feedback string.
var atext = "";
if (block.data[block.trial_idx].correct) {
atext = trial.correct_text.replace("%ANS%", trial.text_answer);
}
else {
atext = trial.incorrect_text.replace("%ANS%", trial.text_answer);
}
// show the feedback
display_element.append(atext);
// check if force correct button press is set
if (trial.force_correct_button_press && block.data[block.trial_idx].correct === false) {
var after_forced_response = function(info) {
plugin.trial(display_element, block, trial, part + 1);
}
jsPsych.pluginAPI.getKeyboardResponse(after_forced_response, trial.key_answer, 'date', false);
}
else {
setTimeout(function() {
plugin.trial(display_element, block, trial, part + 1);
}, trial.timing_feedback_duration);
}
break;
case 3:
display_element.html("");
if(trial.timing_post_trial > 0){
setTimeout(function() {
block.next();
}, trial.timing_post_trial);
} else {
block.next();
}
break;
}
};
return plugin;
})();
})(jQuery);

View File

@ -1,157 +0,0 @@
/**
* jspsych-free-sort
* plugin for drag-and-drop sorting of a collection of images
* Josh de Leeuw
*
* documentation: https://github.com/jodeleeuw/jsPsych/wiki/jspsych-free-sort
*/
(function($) {
jsPsych['free-sort'] = (function() {
var plugin = {};
plugin.create = function(params) {
params = jsPsych.pluginAPI.enforceArray(params, ['data']);
var trials = new Array(params.stimuli.length);
for (var i = 0; i < trials.length; i++) {
trials[i] = {
"type": "free-sort",
"images": params.stimuli[i], // array of images to display
"stim_height": params.stim_height || 100,
"stim_width": params.stim_width || 100,
"timing_post_trial": (typeof params.timing_post_trial === 'undefined') ? 1000 : params.timing_post_trial,
"prompt": (typeof params.prompt === 'undefined') ? '' : params.prompt,
"prompt_location": params.prompt_location || "above",
"sort_area_width": params.sort_area_width || 800,
"sort_area_height": params.sort_area_height || 800,
"data": (typeof params.data === 'undefined') ? {} : params.data[i]
};
}
return trials;
};
plugin.trial = function(display_element, block, trial, part) {
// if any trial variables are functions
// this evaluates the function and replaces
// it with the output of the function
trial = jsPsych.pluginAPI.normalizeTrialVariables(trial);
var start_time = (new Date()).getTime();
// check if there is a prompt and if it is shown above
if (trial.prompt && trial.prompt_location == "above") {
display_element.append(trial.prompt);
}
display_element.append($('<div>', {
"id": "jspsych-free-sort-arena",
"class": "jspsych-free-sort-arena",
"css": {
"position": "relative",
"width": trial.sort_area_width,
"height": trial.sort_area_height
}
}));
// check if prompt exists and if it is shown below
if (trial.prompt && trial.prompt_location == "below") {
display_element.append(trial.prompt);
}
// store initial location data
var init_locations = [];
for (var i = 0; i < trial.images.length; i++) {
var coords = random_coordinate(trial.sort_area_width - trial.stim_width, trial.sort_area_height - trial.stim_height);
$("#jspsych-free-sort-arena").append($('<img>', {
"src": trial.images[i],
"class": "jspsych-free-sort-draggable",
"css": {
"position": "absolute",
"top": coords.y,
"left": coords.x
}
}));
init_locations.push({
"src": trial.images[i],
"x": coords.x,
"y": coords.y
});
}
var moves = [];
$('.jspsych-free-sort-draggable').draggable({
containment: "#jspsych-free-sort-arena",
scroll: false,
stack: ".jspsych-free-sort-draggable",
stop: function(event, ui) {
moves.push({
"src": event.target.src.split("/").slice(-1)[0],
"x": ui.position.left,
"y": ui.position.top
});
}
});
display_element.append($('<button>', {
"id": "jspsych-free-sort-done-btn",
"class": "jspsych-free-sort",
"html": "Done",
"click": function() {
var end_time = (new Date()).getTime();
var rt = end_time - start_time;
// gather data
// get final position of all objects
var final_locations = [];
$('.jspsych-free-sort-draggable').each(function() {
final_locations.push({
"src": $(this).attr('src'),
"x": $(this).css('left'),
"y": $(this).css('top')
});
});
block.writeData($.extend({}, {
"init_locations": JSON.stringify(init_locations),
"moves": JSON.stringify(moves),
"final_locations": JSON.stringify(final_locations),
"rt": rt
}, trial.data));
// advance to next part
display_element.html("");
if (trial.timing_post_trial > 0) {
setTimeout(function() {
block.next();
}, trial.timing_post_trial);
}
else {
block.next();
}
}
}));
};
// helper functions
function random_coordinate(max_width, max_height) {
var rnd_x = Math.floor(Math.random() * (max_width - 1));
var rnd_y = Math.floor(Math.random() * (max_height - 1));
return {
x: rnd_x,
y: rnd_y
};
}
return plugin;
})();
})(jQuery);

View File

@ -1,83 +0,0 @@
/** (July 2012, Erik Weitnauer)
The html-plugin will load and display an arbitrary number of html pages. To proceed to the next, the
user might either press a button on the page or a specific key. Afterwards, the page get hidden and
the plugin will wait of a specified time before it proceeds.
documentation: https://github.com/jodeleeuw/jsPsych/wiki/jspsych-html
*/
(function($) {
jsPsych.html = (function() {
var plugin = {};
plugin.create = function(params) {
params = jsPsych.pluginAPI.enforceArray(params, ['pages']);
var trials = [];
for (var i = 0; i < params.pages.length; i++) {
trials.push({
type: "html",
url: params.pages[i].url,
cont_key: params.pages[i].cont_key || params.cont_key,
cont_btn: params.pages[i].cont_btn || params.cont_btn,
timing_post_trial: params.pages[i].timing_post_trial || (typeof params.timing_post_trial === 'undefined') ? 1000 : params.timing_post_trial,
check_fn: params.pages[i].check_fn,
force_refresh: (typeof params.force_refresh === 'undefined') ? false : params.force_refresh
});
}
return trials;
};
plugin.trial = function(display_element, block, trial, part) {
// if any trial variables are functions
// this evaluates the function and replaces
// it with the output of the function
trial = jsPsych.pluginAPI.normalizeTrialVariables(trial, ["check_fn"]);
var url = trial.url;
if (trial.force_refresh) {
url = trial.url + "?time=" + (new Date().getTime());
}
display_element.load(trial.url, function() {
var t0 = (new Date()).getTime();
var finish = function() {
if (trial.check_fn && !trial.check_fn(display_element)) return;
if (trial.cont_key) $(document).unbind('keydown', key_listener);
block.writeData({
trial_type: "html",
trial_index: block.trial_idx,
rt: (new Date()).getTime() - t0,
url: trial.url
});
if (trial.timing_post_trial > 0) {
// hide display_element, since it could have a border and we want a blank screen during timing
display_element.hide();
setTimeout(function() {
display_element.empty();
display_element.show();
block.next();
}, trial.timing);
}
else {
display_element.empty();
block.next();
}
};
if (trial.cont_btn) $('#' + trial.cont_btn).click(finish);
if (trial.cont_key) {
var key_listener = function(e) {
if (e.which == trial.cont_key) finish();
};
$(document).keydown(key_listener);
}
});
};
return plugin;
})();
})(jQuery);

View File

@ -1,426 +0,0 @@
/**
* jspsych-palmer
* Josh de Leeuw (October 2013)
*
* a jspsych plugin for presenting and querying about stimuli modeled after
*
* Palmer, S. (1977). Hierarchical Structure in Perceptual Representation. Cognitive Psychology, 9, 441.
*
* and
*
* Goldstone, R. L., Rogosky, B. J., Pevtzow, R., & Blair, M. (2005). Perceptual and semantic reorganization during category learning.
* In H. Cohen & C. Lefebvre (Eds.) Handbook of Categorization in Cognitive Science. (pp. 651-678). Amsterdam: Elsevier.
*
* documentation: https://github.com/jodeleeuw/jsPsych/wiki/jspsych-palmer
*
*/
(function($) {
jsPsych.palmer = (function() {
var plugin = {};
plugin.create = function(params) {
params = jsPsych.pluginAPI.enforceArray(params, ['data']);
var trials = [];
for (var i = 0; i < params.configurations.length; i++) {
var trial = {
type: "palmer",
configurations: params.configurations[i],
editable: (typeof params.editable === 'undefined') ? false : params.editable,
show_feedback: (typeof params.show_feedback === 'undefined') ? false : params.show_feedback,
grid_spacing: params.grid_spacing || 75,
square_size: params.square_size || 3,
circle_radius: params.circle_radius || 20,
timing_item: params.timing_item || 1000,
timing_post_trial: (typeof params.timing_post_trial === 'undefined') ? 1000 : params.timing_post_trial,
timing_feedback: params.timing_feedback || 1000,
prompt: (typeof params.prompt === 'undefined') ? "" : params.prompt,
data: (typeof params.data === 'undefined') ? {} : params.data[i]
};
trials.push(trial);
}
return trials;
};
plugin.trial = function(display_element, block, trial, part) {
// if any trial variables are functions
// this evaluates the function and replaces
// it with the output of the function
trial = jsPsych.pluginAPI.normalizeTrialVariables(trial);
// variables to keep track of user interaction
var start_circle = -1;
var end_circle = -1;
var line_started = false;
var size = trial.grid_spacing * (trial.square_size + 1);
display_element.append($("<div id='jspsych-palmer-raphaelCanvas'>", {
css: {
width: size + "px",
height: size + "px"
}
}));
var paper = Raphael("jspsych-palmer-raphaelCanvas", size, size);
// create the circles at the vertices.
var circles = [];
var node_idx = 0;
for (var i = 1; i <= trial.square_size; i++) {
for (var j = 1; j <= trial.square_size; j++) {
var circle = paper.circle(trial.grid_spacing * j, trial.grid_spacing * i, trial.circle_radius);
circle.attr("fill", "#000").attr("stroke-width", "0").attr("stroke", "#000").data("node", node_idx);
if (trial.editable) {
circle.hover(
function() {
this.attr("stroke-width", "2");
//this.attr("stroke", "#000");
},
function() {
this.attr("stroke-width", "0");
//this.attr("stroke", "#fff")
}).click(
function() {
if (!line_started) {
line_started = true;
start_circle = this.data("node");
this.attr("fill", "#777").attr("stroke", "#777");
}
else {
end_circle = this.data("node");
draw_connection(start_circle, end_circle);
}
});
}
node_idx++;
circles.push(circle);
}
}
function draw_connection(start_circle, end_circle) {
var the_line = getLineIndex(start_circle, end_circle);
if (the_line > -1) {
toggle_line(the_line);
}
// reset highlighting on circles
for (var i = 0; i < circles.length; i++) {
circles[i].attr("fill", "#000").attr("stroke", "#000");
}
// cleanup the variables
line_started = false;
start_circle = -1;
end_circle = -1;
}
// create all possible lines that connect circles
var horizontal_lines = [];
var vertical_lines = [];
var backslash_lines = [];
var forwardslash_lines = [];
for (var i = 0; i < trial.square_size; i++) {
for (var j = 0; j < trial.square_size; j++) {
var current_item = (i * trial.square_size) + j;
// add horizontal connections
if (j < (trial.square_size - 1)) {
horizontal_lines.push([current_item, current_item + 1]);
}
// add vertical connections
if (i < (trial.square_size - 1)) {
vertical_lines.push([current_item, current_item + trial.square_size]);
}
// add diagonal backslash connections
if (i < (trial.square_size - 1) && j < (trial.square_size - 1)) {
backslash_lines.push([current_item, current_item + trial.square_size + 1]);
}
// add diagonal forwardslash connections
if (i < (trial.square_size - 1) && j > 0) {
forwardslash_lines.push([current_item, current_item + trial.square_size - 1]);
}
}
}
var lines = horizontal_lines.concat(vertical_lines).concat(backslash_lines).concat(forwardslash_lines);
// actually draw the lines
var lineIsVisible = [];
var lineElements = [];
for (var i = 0; i < lines.length; i++) {
var line = paper.path("M" + circles[lines[i][0]].attr("cx") + " " + circles[lines[i][0]].attr("cy") + "L" + circles[lines[i][1]].attr("cx") + " " + circles[lines[i][1]].attr("cy")).attr("stroke-width", "8").attr("stroke", "#000");
line.hide();
lineElements.push(line);
lineIsVisible.push(0);
}
// define some helper functions to toggle lines on and off
// this function gets the index of a line based on the two circles it connects
function getLineIndex(start_circle, end_circle) {
var the_line = -1;
for (var i = 0; i < lines.length; i++) {
if ((start_circle == lines[i][0] && end_circle == lines[i][1]) || (start_circle == lines[i][1] && end_circle == lines[i][0])) {
the_line = i;
break;
}
}
return the_line;
}
// this function turns a line on/off based on the index (the_line)
function toggle_line(the_line) {
if (the_line > -1) {
if (lineIsVisible[the_line] === 0) {
lineElements[the_line].show();
lineElements[the_line].toBack();
lineIsVisible[the_line] = 1;
}
else {
lineElements[the_line].hide();
lineElements[the_line].toBack();
lineIsVisible[the_line] = 0;
}
}
}
// this function takes an array of length = num lines, and displays the line whereever there
// is a 1 in the array.
function showConfiguration(configuration) {
for (var i = 0; i < configuration.length; i++) {
if (configuration[i] != lineIsVisible[i]) {
toggle_line(i);
}
}
}
// highlight a line
function highlightLine(line) {
lineElements[line].attr("stroke", "#f00");
}
// start recording the time
var startTime = (new Date()).getTime();
// what kind of trial are we doing?
// if trial.editable is true, then we will let the user interact with the stimulus to create
// something, e.g. for a reconstruction probe.
// need a way for the user to submit when they are done in that case...
if (trial.editable) {
display_element.append($('<button id="jspsych-palmer-submitButton" type="button">Submit Answer</button>'));
$('#jspsych-palmer-submitButton').click(function() {
save_data();
});
}
// if trial.editable is false, then we are just showing a pre-determined configuration.
// for now, the only option will be to display for a fixed amount of time.
// future ideas: allow for key response, to enable things like n-back, same/different, etc..
if (!trial.editable) {
showConfiguration(trial.configurations);
setTimeout(function() {
save_data();
}, trial.timing_item);
}
if (trial.prompt !== "") {
display_element.append($('<div id="jspsych-palmer-prompt">'));
$("#jspsych-palmer-prompt").html(trial.prompt);
}
function arrayDifferences(arr1, arr2) {
var n_diff = 0;
for (var i = 0; i < arr1.length; i++) {
if (arr1[i] != arr2[i]) {
n_diff++;
}
}
return n_diff;
}
// save data
function save_data() {
// measure RT
var endTime = (new Date()).getTime();
var response_time = endTime - startTime;
// check if configuration is correct
// this is meaningless for trials where the user can't edit
var n_diff = arrayDifferences(trial.configurations, lineIsVisible);
var correct = (n_diff === 0);
block.writeData($.extend({}, {
"trial_type": "palmer",
"trial_index": block.trial_idx,
"configuration": JSON.stringify(lineIsVisible),
"target_configuration": JSON.stringify(trial.configurations),
"rt": response_time,
"correct": correct,
"num_wrong": n_diff,
}, trial.data));
if (trial.editable && trial.show_feedback) {
// hide the button
$('#jspsych-palmer-submitButton').hide();
$('#jspsych-palmer-prompt').hide();
showConfiguration(trial.configurations);
var feedback = "";
if (correct) {
feedback = "Correct!";
}
else {
if (n_diff > 1) {
feedback = "You missed " + n_diff + " lines. The correct symbol is shown above.";
}
else {
feedback = "You missed 1 line. The correct symbol is shown above.";
}
}
display_element.append($.parseHTML("<p id='jspsych-palmer-feedback'>" + feedback + "</p>"));
setTimeout(function() {
next_trial();
}, trial.timing_feedback);
}
else {
next_trial();
}
}
function next_trial() {
display_element.html('');
// next trial
if (trial.timing_post_trial > 0) {
setTimeout(function() {
block.next();
}, trial.timing_post_trial);
}
else {
block.next();
}
}
};
// method for drawing palmer stimuli.
// returns the string description of svg element containing the stimulus
// requires raphaeljs library -> www.raphaeljs.com
plugin.generate_stimulus = function(square_size, grid_spacing, circle_radius, configuration) {
// create a div to hold the generated svg object
var stim_div = $('body').append('<div id="jspsych-palmer-temp-stim"></div>');
var size = grid_spacing * (square_size + 1);
// create the svg raphael object
var paper = Raphael("jspsych-palmer-temp-stim", size, size);
// create the circles at the vertices.
var circles = [];
var node_idx = 0;
for (var i = 1; i <= square_size; i++) {
for (var j = 1; j <= square_size; j++) {
var circle = paper.circle(grid_spacing * j, grid_spacing * i, circle_radius);
circle.attr("fill", "#000").attr("stroke-width", "0").attr("stroke", "#000").data("node", node_idx);
node_idx++;
circles.push(circle);
}
}
// create all possible lines that connect circles
var horizontal_lines = [];
var vertical_lines = [];
var backslash_lines = [];
var forwardslash_lines = [];
for (var i = 0; i < square_size; i++) {
for (var j = 0; j < square_size; j++) {
var current_item = (i * square_size) + j;
// add horizontal connections
if (j < (square_size - 1)) {
horizontal_lines.push([current_item, current_item + 1]);
}
// add vertical connections
if (i < (square_size - 1)) {
vertical_lines.push([current_item, current_item + square_size]);
}
// add diagonal backslash connections
if (i < (square_size - 1) && j < (square_size - 1)) {
backslash_lines.push([current_item, current_item + square_size + 1]);
}
// add diagonal forwardslash connections
if (i < (square_size - 1) && j > 0) {
forwardslash_lines.push([current_item, current_item + square_size - 1]);
}
}
}
var lines = horizontal_lines.concat(vertical_lines).concat(backslash_lines).concat(forwardslash_lines);
// actually draw the lines
var lineIsVisible = [];
var lineElements = [];
for (var i = 0; i < lines.length; i++) {
var line = paper.path("M" + circles[lines[i][0]].attr("cx") + " " + circles[lines[i][0]].attr("cy") + "L" + circles[lines[i][1]].attr("cx") + " " + circles[lines[i][1]].attr("cy")).attr("stroke-width", "8").attr("stroke", "#000");
line.hide();
lineElements.push(line);
lineIsVisible.push(0);
}
// define some helper functions to toggle lines on and off
// this function turns a line on/off based on the index (the_line)
function toggle_line(the_line) {
if (the_line > -1) {
if (lineIsVisible[the_line] === 0) {
lineElements[the_line].show();
lineElements[the_line].toBack();
lineIsVisible[the_line] = 1;
}
else {
lineElements[the_line].hide();
lineElements[the_line].toBack();
lineIsVisible[the_line] = 0;
}
}
}
// displays the line wherever there
// is a 1 in the array.
// showConfiguration(configuration)
for (var i = 0; i < configuration.length; i++) {
if (configuration[i] == 1) {
toggle_line(i);
}
}
var svg = $("#jspsych-palmer-temp-stim").html();
$('#jspsych-palmer-temp-stim').remove();
return svg;
};
return plugin;
})();
})(jQuery);

View File

@ -1,148 +0,0 @@
/**
* jspsych-same-different
* Josh de Leeuw
*
* plugin for showing two stimuli sequentially and getting a same / different judgment
*
* documentation: https://github.com/jodeleeuw/jsPsych/wiki/jspsych-same-different
*
*/
(function($) {
jsPsych['same-different'] = (function() {
var plugin = {};
plugin.create = function(params) {
params = jsPsych.pluginAPI.enforceArray(params, ['data','answer'])
var trials = new Array(params.stimuli.length);
for (var i = 0; i < trials.length; i++) {
trials[i] = {};
trials[i].type = "same-different";
trials[i].a_path = params.stimuli[i][0];
trials[i].b_path = params.stimuli[i][1];
trials[i].answer = params.answer[i];
trials[i].same_key = params.same_key || 81; // default is 'q'
trials[i].different_key = params.different_key || 80; // default is 'p'
// timing parameters
trials[i].timing_first_stim = params.timing_first_stim || 1000;
trials[i].timing_second_stim = params.timing_second_stim || 1000; // if -1, then second stim is shown until response.
trials[i].timing_gap = params.timing_gap || 500;
trials[i].timing_post_trial = (typeof params.timing_post_trial === 'undefined') ? 1000 : params.timing_post_trial;
// optional parameters
trials[i].is_html = (typeof params.is_html === 'undefined') ? false : true;
trials[i].prompt = (typeof params.prompt === 'undefined') ? "" : params.prompt;
trials[i].data = (typeof params.data === 'undefined') ? {} : params.data[i];
}
return trials;
};
var sd_trial_complete = false;
plugin.trial = function(display_element, block, trial, part) {
// if any trial variables are functions
// this evaluates the function and replaces
// it with the output of the function
trial = jsPsych.pluginAPI.normalizeTrialVariables(trial);
switch (part) {
case 1:
sd_trial_complete = false;
// show image
if (!trial.is_html) {
display_element.append($('<img>', {
src: trial.a_path,
"class": 'jspsych-same-different-stimulus'
}));
}
else {
display_element.append($('<div>', {
html: trial.a_path,
"class": 'jspsych-same-different-stimulus'
}));
}
setTimeout(function() {
plugin.trial(display_element, block, trial, part + 1);
}, trial.timing_first_stim);
break;
case 2:
$('.jspsych-same-different-stimulus').remove();
setTimeout(function() {
plugin.trial(display_element, block, trial, part + 1);
}, trial.timing_gap);
break;
case 3:
if (!trial.is_html) {
display_element.append($('<img>', {
src: trial.b_path,
"class": 'jspsych-same-different-stimulus',
id: 'jspsych-same-different-second-stimulus'
}));
}
else {
display_element.append($('<div>', {
html: trial.b_path,
"class": 'jspsych-same-different-stimulus',
id: 'jspsych-same-different-second-stimulus'
}));
}
if (trial.timing_second_stim > 0) {
setTimeout(function() {
if (!sd_trial_complete) {
$("#jspsych-same-different-second-stimulus").css('visibility', 'hidden');
}
}, trial.timing_second_stim);
}
//show prompt here
if (trial.prompt !== "") {
display_element.append(trial.prompt);
}
var after_response = function(info){
var correct = false;
if(info.key == trial.same_key && trial.answer == 'same'){
correct = true;
}
if(info.key == trial.different_key && trial.answer == 'different'){
correct = true;
}
var trial_data = {
"trial_type": "same-different",
"trial_index": block.trial_idx,
"rt": info.rt,
"correct": correct,
"stimulus": trial.a_path,
"stimulus_2": trial.b_path,
"key_press": info.key
};
block.writeData($.extend({}, trial_data, trial.data));
display_element.html('');
if(trial.timing_post_trial > 0) {
setTimeout(function() {
block.next();
}, trial.timing_post_trial);
} else {
block.next();
}
}
jsPsych.pluginAPI.getKeyboardResponse(after_response, [trial.same_key, trial.different_key], 'date', false);
break;
}
};
return plugin;
})();
})(jQuery);

View File

@ -1,229 +0,0 @@
/**
* jspsych-similarity.js
* Josh de Leeuw
*
* This plugin create a trial where two images are shown sequentially, and the subject rates their similarity using a slider controlled with the mouse.
*
* documentation: https://github.com/jodeleeuw/jsPsych/wiki/jspsych-similarity
*
*/
(function($) {
jsPsych.similarity = (function() {
var plugin = {};
plugin.create = function(params) {
jsPsych.pluginAPI.enforceArray(params, ['data']);
var trials = new Array(params.stimuli.length);
for (var i = 0; i < trials.length; i++) {
trials[i] = {};
trials[i].type = "similarity";
trials[i].a_path = params.stimuli[i][0];
trials[i].b_path = params.stimuli[i][1];
trials[i].labels = (typeof params.labels === 'undefined') ? ["Not at all similar", "Identical"] : params.labels;
trials[i].intervals = params.intervals || 100;
trials[i].show_ticks = (typeof params.show_ticks === 'undefined') ? false : params.show_ticks;
trials[i].show_response = params.show_response || "SECOND_STIMULUS";
trials[i].timing_first_stim = params.timing_first_stim || 1000; // default 1000ms
trials[i].timing_second_stim = params.timing_second_stim || -1; // -1 = inf time; positive numbers = msec to display second image.
trials[i].timing_image_gap = params.timing_image_gap || 1000; // default 1000ms
trials[i].timing_post_trial = (typeof params.timing_post_trial === 'undefined') ? 1000 : params.timing_post_trial; // default 1000ms
trials[i].is_html = (typeof params.is_html === 'undefined') ? false : params.is_html;
trials[i].prompt = (typeof params.prompt === 'undefined') ? '' : params.prompt;
trials[i].data = (typeof params.data === 'undefined') ? {} : params.data[i];
}
return trials;
};
var sim_trial_complete = false;
plugin.trial = function(display_element, block, trial, part) {
// if any trial variables are functions
// this evaluates the function and replaces
// it with the output of the function
trial = jsPsych.pluginAPI.normalizeTrialVariables(trial);
switch (part) {
case 1:
sim_trial_complete = false;
// show the images
if (!trial.is_html) {
display_element.append($('<img>', {
"src": trial.a_path,
"id": 'jspsych_sim_stim'
}));
}
else {
display_element.append($('<div>', {
"html": trial.a_path,
"id": 'jspsych_sim_stim'
}));
}
if (trial.show_response == "FIRST_STIMULUS") {
show_response_slider(display_element, trial, block);
}
setTimeout(function() {
plugin.trial(display_element, block, trial, part + 1);
}, trial.timing_first_stim);
break;
case 2:
$('#jspsych_sim_stim').css('visibility', 'hidden');
setTimeout(function() {
plugin.trial(display_element, block, trial, part + 1);
}, trial.timing_image_gap);
break;
case 3:
if (!trial.is_html) {
$('#jspsych_sim_stim').attr('src', trial.b_path);
}
else {
$('#jspsych_sim_stim').html(trial.b_path);
}
$('#jspsych_sim_stim').css('visibility', 'visible');
if (trial.show_response == "SECOND_STIMULUS") {
show_response_slider(display_element, trial, block);
}
if (trial.timing_second_stim > 0) {
setTimeout(function() {
if (!sim_trial_complete) {
$("#jspsych_sim_stim").css('visibility', 'hidden');
if (trial.show_response == "POST_STIMULUS") {
show_response_slider(display_element, trial, block);
}
}
}, trial.timing_second_stim);
}
break;
}
};
function show_response_slider(display_element, trial, block) {
var startTime = (new Date()).getTime();
// create slider
display_element.append($('<div>', {
"id": 'slider',
"class": 'sim'
}));
$("#slider").slider({
value: Math.ceil(trial.intervals / 2),
min: 1,
max: trial.intervals,
step: 1,
});
// show tick marks
if (trial.show_ticks) {
for (var j = 1; j < trial.intervals - 1; j++) {
$('#slider').append('<div class="slidertickmark"></div>');
}
$('#slider .slidertickmark').each(function(index) {
var left = (index + 1) * (100 / (trial.intervals - 1));
$(this).css({
'position': 'absolute',
'left': left + '%',
'width': '1px',
'height': '100%',
'background-color': '#222222'
});
});
}
// create labels for slider
display_element.append($('<ul>', {
"id": "sliderlabels",
"class": 'sliderlabels',
"css": {
"width": "100%",
"height": "3em",
"margin": "10px 0px 0px 0px",
"padding": "0px",
"display": "block",
"position": "relative"
}
}));
for (var j = 0; j < trial.labels.length; j++) {
$("#sliderlabels").append('<li>' + trial.labels[j] + '</li>');
}
// position labels to match slider intervals
var slider_width = $("#slider").width();
var num_items = trial.labels.length;
var item_width = slider_width / num_items;
var spacing_interval = slider_width / (num_items - 1);
$("#sliderlabels li").each(function(index) {
$(this).css({
'display': 'inline-block',
'width': item_width + 'px',
'margin': '0px',
'padding': '0px',
'text-align': 'center',
'position': 'absolute',
'left': (spacing_interval * index) - (item_width / 2)
});
});
// create button
display_element.append($('<button>', {
'id': 'next',
'class': 'sim',
'html': 'Submit Answer'
}));
// if prompt is set, show prompt
if (trial.prompt !== "") {
display_element.append(trial.prompt);
}
$("#next").click(function() {
var endTime = (new Date()).getTime();
var response_time = endTime - startTime;
sim_trial_complete = true;
var score = $("#slider").slider("value");
block.writeData($.extend({}, {
"sim_score": score,
"rt": response_time,
"stimulus": trial.a_path,
"stimulus_2": trial.b_path,
"trial_type": "similarity",
"trial_index": block.trial_idx
}, trial.data));
// goto next trial in block
display_element.html('');
if (trial.timing_post_trial > 0) {
setTimeout(function() {
block.next();
}, trial.timing_post_trial);
}
else {
block.next();
}
});
}
return plugin;
})();
})(jQuery);

Some files were not shown because too many files have changed in this diff Show More