Deployed b138baa1
to 7.3 with MkDocs 1.3.0 and mike 1.1.2
1917
7.3/404.html
Executable file
2032
7.3/about/about/index.html
Executable file
1989
7.3/about/license/index.html
Executable file
BIN
7.3/assets/images/favicon.png
Executable file
After Width: | Height: | Size: 1.8 KiB |
29
7.3/assets/javascripts/bundle.a6c66575.min.js
vendored
Executable file
8
7.3/assets/javascripts/bundle.a6c66575.min.js.map
Executable file
1
7.3/assets/javascripts/lunr/min/lunr.ar.min.js
vendored
Executable file
18
7.3/assets/javascripts/lunr/min/lunr.da.min.js
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
/*!
|
||||
* Lunr languages, `Danish` language
|
||||
* https://github.com/MihaiValentin/lunr-languages
|
||||
*
|
||||
* Copyright 2014, Mihai Valentin
|
||||
* http://www.mozilla.org/MPL/
|
||||
*/
|
||||
/*!
|
||||
* based on
|
||||
* Snowball JavaScript Library v0.3
|
||||
* http://code.google.com/p/urim/
|
||||
* http://snowball.tartarus.org/
|
||||
*
|
||||
* Copyright 2010, Oleg Mazko
|
||||
* http://www.mozilla.org/MPL/
|
||||
*/
|
||||
|
||||
!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-Za-z",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=f.cursor+3;if(d=f.limit,0<=r&&r<=f.limit){for(a=r;;){if(e=f.cursor,f.in_grouping(w,97,248)){f.cursor=e;break}if(f.cursor=e,e>=f.limit)return;f.cursor++}for(;!f.out_grouping(w,97,248);){if(f.cursor>=f.limit)return;f.cursor++}d=f.cursor,d<a&&(d=a)}}function n(){var e,r;if(f.cursor>=d&&(r=f.limit_backward,f.limit_backward=d,f.ket=f.cursor,e=f.find_among_b(c,32),f.limit_backward=r,e))switch(f.bra=f.cursor,e){case 1:f.slice_del();break;case 2:f.in_grouping_b(p,97,229)&&f.slice_del()}}function t(){var e,r=f.limit-f.cursor;f.cursor>=d&&(e=f.limit_backward,f.limit_backward=d,f.ket=f.cursor,f.find_among_b(l,4)?(f.bra=f.cursor,f.limit_backward=e,f.cursor=f.limit-r,f.cursor>f.limit_backward&&(f.cursor--,f.bra=f.cursor,f.slice_del())):f.limit_backward=e)}function s(){var e,r,i,n=f.limit-f.cursor;if(f.ket=f.cursor,f.eq_s_b(2,"st")&&(f.bra=f.cursor,f.eq_s_b(2,"ig")&&f.slice_del()),f.cursor=f.limit-n,f.cursor>=d&&(r=f.limit_backward,f.limit_backward=d,f.ket=f.cursor,e=f.find_among_b(m,5),f.limit_backward=r,e))switch(f.bra=f.cursor,e){case 1:f.slice_del(),i=f.limit-f.cursor,t(),f.cursor=f.limit-i;break;case 2:f.slice_from("løs")}}function o(){var e;f.cursor>=d&&(e=f.limit_backward,f.limit_backward=d,f.ket=f.cursor,f.out_grouping_b(w,97,248)?(f.bra=f.cursor,u=f.slice_to(u),f.limit_backward=e,f.eq_v_b(u)&&f.slice_del()):f.limit_backward=e)}var a,d,u,c=[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)],l=[new r("gd",-1,-1),new r("dt",-1,-1),new r("gt",-1,-1),new r("kt",-1,-1)],m=[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)],w=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,48,0,128],p=[239,254,42,3,0,0,0,0,0,0,0,0,0,0,0,0,16],f=new i;this.setCurrent=function(e){f.setCurrent(e)},this.getCurrent=function(){return f.getCurrent()},this.stem=function(){var r=f.cursor;return e(),f.limit_backward=r,f.cursor=f.limit,n(),f.cursor=f.limit,t(),f.cursor=f.limit,s(),f.cursor=f.limit,o(),!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")}});
|
18
7.3/assets/javascripts/lunr/min/lunr.de.min.js
vendored
Executable file
18
7.3/assets/javascripts/lunr/min/lunr.du.min.js
vendored
Executable file
18
7.3/assets/javascripts/lunr/min/lunr.es.min.js
vendored
Executable file
18
7.3/assets/javascripts/lunr/min/lunr.fi.min.js
vendored
Executable file
18
7.3/assets/javascripts/lunr/min/lunr.fr.min.js
vendored
Executable file
1
7.3/assets/javascripts/lunr/min/lunr.hi.min.js
vendored
Executable 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.hi=function(){this.pipeline.reset(),this.pipeline.add(e.hi.trimmer,e.hi.stopWordFilter,e.hi.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.hi.stemmer))},e.hi.wordCharacters="ऀ-ःऄ-एऐ-टठ-यर-िी-ॏॐ-य़ॠ-९॰-ॿa-zA-Za-zA-Z0-90-9",e.hi.trimmer=e.trimmerSupport.generateTrimmer(e.hi.wordCharacters),e.Pipeline.registerFunction(e.hi.trimmer,"trimmer-hi"),e.hi.stopWordFilter=e.generateStopWordFilter("अत अपना अपनी अपने अभी अंदर आदि आप इत्यादि इन इनका इन्हीं इन्हें इन्हों इस इसका इसकी इसके इसमें इसी इसे उन उनका उनकी उनके उनको उन्हीं उन्हें उन्हों उस उसके उसी उसे एक एवं एस ऐसे और कई कर करता करते करना करने करें कहते कहा का काफ़ी कि कितना किन्हें किन्हों किया किर किस किसी किसे की कुछ कुल के को कोई कौन कौनसा गया घर जब जहाँ जा जितना जिन जिन्हें जिन्हों जिस जिसे जीधर जैसा जैसे जो तक तब तरह तिन तिन्हें तिन्हों तिस तिसे तो था थी थे दबारा दिया दुसरा दूसरे दो द्वारा न नके नहीं ना निहायत नीचे ने पर पहले पूरा पे फिर बनी बही बहुत बाद बाला बिलकुल भी भीतर मगर मानो मे में यदि यह यहाँ यही या यिह ये रखें रहा रहे ऱ्वासा लिए लिये लेकिन व वग़ैरह वर्ग वह वहाँ वहीं वाले वुह वे वो सकता सकते सबसे सभी साथ साबुत साभ सारा से सो संग ही हुआ हुई हुए है हैं हो होता होती होते होना होने".split(" ")),e.hi.stemmer=function(){return function(e){return"function"==typeof e.update?e.update(function(e){return e}):e}}();var r=e.wordcut;r.init(),e.hi.tokenizer=function(i){if(!arguments.length||null==i||void 0==i)return[];if(Array.isArray(i))return i.map(function(r){return isLunr2?new e.Token(r.toLowerCase()):r.toLowerCase()});var t=i.toString().toLowerCase().replace(/^\s+/,"");return r.cut(t).split("|")},e.Pipeline.registerFunction(e.hi.stemmer,"stemmer-hi"),e.Pipeline.registerFunction(e.hi.stopWordFilter,"stopWordFilter-hi")}});
|
18
7.3/assets/javascripts/lunr/min/lunr.hu.min.js
vendored
Executable file
18
7.3/assets/javascripts/lunr/min/lunr.it.min.js
vendored
Executable file
1
7.3/assets/javascripts/lunr/min/lunr.ja.min.js
vendored
Executable 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.ja=function(){this.pipeline.reset(),this.pipeline.add(e.ja.trimmer,e.ja.stopWordFilter,e.ja.stemmer),r?this.tokenizer=e.ja.tokenizer:(e.tokenizer&&(e.tokenizer=e.ja.tokenizer),this.tokenizerFn&&(this.tokenizerFn=e.ja.tokenizer))};var t=new e.TinySegmenter;e.ja.tokenizer=function(i){var n,o,s,p,a,u,m,l,c,f;if(!arguments.length||null==i||void 0==i)return[];if(Array.isArray(i))return i.map(function(t){return r?new e.Token(t.toLowerCase()):t.toLowerCase()});for(o=i.toString().toLowerCase().replace(/^\s+/,""),n=o.length-1;n>=0;n--)if(/\S/.test(o.charAt(n))){o=o.substring(0,n+1);break}for(a=[],s=o.length,c=0,l=0;c<=s;c++)if(u=o.charAt(c),m=c-l,u.match(/\s/)||c==s){if(m>0)for(p=t.segment(o.slice(l,c)).filter(function(e){return!!e}),f=l,n=0;n<p.length;n++)r?a.push(new e.Token(p[n],{position:[f,p[n].length],index:a.length})):a.push(p[n]),f+=p[n].length;l=c+1}return a},e.ja.stemmer=function(){return function(e){return e}}(),e.Pipeline.registerFunction(e.ja.stemmer,"stemmer-ja"),e.ja.wordCharacters="一二三四五六七八九十百千万億兆一-龠々〆ヵヶぁ-んァ-ヴーア-ン゙a-zA-Za-zA-Z0-90-9",e.ja.trimmer=e.trimmerSupport.generateTrimmer(e.ja.wordCharacters),e.Pipeline.registerFunction(e.ja.trimmer,"trimmer-ja"),e.ja.stopWordFilter=e.generateStopWordFilter("これ それ あれ この その あの ここ そこ あそこ こちら どこ だれ なに なん 何 私 貴方 貴方方 我々 私達 あの人 あのかた 彼女 彼 です あります おります います は が の に を で え から まで より も どの と し それで しかし".split(" ")),e.Pipeline.registerFunction(e.ja.stopWordFilter,"stopWordFilter-ja"),e.jp=e.ja,e.Pipeline.registerFunction(e.jp.stemmer,"stemmer-jp"),e.Pipeline.registerFunction(e.jp.trimmer,"trimmer-jp"),e.Pipeline.registerFunction(e.jp.stopWordFilter,"stopWordFilter-jp")}});
|
1
7.3/assets/javascripts/lunr/min/lunr.jp.min.js
vendored
Executable file
@ -0,0 +1 @@
|
||||
module.exports=require("./lunr.ja");
|
1
7.3/assets/javascripts/lunr/min/lunr.multi.min.js
vendored
Executable file
@ -0,0 +1 @@
|
||||
!function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():t()(e.lunr)}(this,function(){return function(e){e.multiLanguage=function(){for(var t=Array.prototype.slice.call(arguments),i=t.join("-"),r="",n=[],s=[],p=0;p<t.length;++p)"en"==t[p]?(r+="\\w",n.unshift(e.stopWordFilter),n.push(e.stemmer),s.push(e.stemmer)):(r+=e[t[p]].wordCharacters,e[t[p]].stopWordFilter&&n.unshift(e[t[p]].stopWordFilter),e[t[p]].stemmer&&(n.push(e[t[p]].stemmer),s.push(e[t[p]].stemmer)));var o=e.trimmerSupport.generateTrimmer(r);return e.Pipeline.registerFunction(o,"lunr-multi-trimmer-"+i),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))}}}});
|
18
7.3/assets/javascripts/lunr/min/lunr.nl.min.js
vendored
Executable file
18
7.3/assets/javascripts/lunr/min/lunr.no.min.js
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
/*!
|
||||
* Lunr languages, `Norwegian` language
|
||||
* https://github.com/MihaiValentin/lunr-languages
|
||||
*
|
||||
* Copyright 2014, Mihai Valentin
|
||||
* http://www.mozilla.org/MPL/
|
||||
*/
|
||||
/*!
|
||||
* based on
|
||||
* Snowball JavaScript Library v0.3
|
||||
* http://code.google.com/p/urim/
|
||||
* http://snowball.tartarus.org/
|
||||
*
|
||||
* Copyright 2010, Oleg Mazko
|
||||
* http://www.mozilla.org/MPL/
|
||||
*/
|
||||
|
||||
!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-Za-z",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(){function e(){var e,r=w.cursor+3;if(a=w.limit,0<=r||r<=w.limit){for(s=r;;){if(e=w.cursor,w.in_grouping(d,97,248)){w.cursor=e;break}if(e>=w.limit)return;w.cursor=e+1}for(;!w.out_grouping(d,97,248);){if(w.cursor>=w.limit)return;w.cursor++}a=w.cursor,a<s&&(a=s)}}function i(){var e,r,n;if(w.cursor>=a&&(r=w.limit_backward,w.limit_backward=a,w.ket=w.cursor,e=w.find_among_b(m,29),w.limit_backward=r,e))switch(w.bra=w.cursor,e){case 1:w.slice_del();break;case 2:n=w.limit-w.cursor,w.in_grouping_b(c,98,122)?w.slice_del():(w.cursor=w.limit-n,w.eq_s_b(1,"k")&&w.out_grouping_b(d,97,248)&&w.slice_del());break;case 3:w.slice_from("er")}}function t(){var e,r=w.limit-w.cursor;w.cursor>=a&&(e=w.limit_backward,w.limit_backward=a,w.ket=w.cursor,w.find_among_b(u,2)?(w.bra=w.cursor,w.limit_backward=e,w.cursor=w.limit-r,w.cursor>w.limit_backward&&(w.cursor--,w.bra=w.cursor,w.slice_del())):w.limit_backward=e)}function o(){var e,r;w.cursor>=a&&(r=w.limit_backward,w.limit_backward=a,w.ket=w.cursor,e=w.find_among_b(l,11),e?(w.bra=w.cursor,w.limit_backward=r,1==e&&w.slice_del()):w.limit_backward=r)}var s,a,m=[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)],u=[new r("dt",-1,-1),new r("vt",-1,-1)],l=[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)],d=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,48,0,128],c=[119,125,149,1],w=new n;this.setCurrent=function(e){w.setCurrent(e)},this.getCurrent=function(){return w.getCurrent()},this.stem=function(){var r=w.cursor;return e(),w.limit_backward=r,w.cursor=w.limit,i(),w.cursor=w.limit,t(),w.cursor=w.limit,o(),!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")}});
|
18
7.3/assets/javascripts/lunr/min/lunr.pt.min.js
vendored
Executable file
18
7.3/assets/javascripts/lunr/min/lunr.ro.min.js
vendored
Executable file
18
7.3/assets/javascripts/lunr/min/lunr.ru.min.js
vendored
Executable file
1
7.3/assets/javascripts/lunr/min/lunr.stemmer.support.min.js
vendored
Executable 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(;;){var _=t[s];if(o>=_.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,_=t[a],m=_.s_size-1-l;m>=0;m--){if(n-l==u){f=-1;break}if(f=r.charCodeAt(n-1-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(;;){var _=t[s];if(o>=_.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}},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,"")}}}}});
|
18
7.3/assets/javascripts/lunr/min/lunr.sv.min.js
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
/*!
|
||||
* Lunr languages, `Swedish` language
|
||||
* https://github.com/MihaiValentin/lunr-languages
|
||||
*
|
||||
* Copyright 2014, Mihai Valentin
|
||||
* http://www.mozilla.org/MPL/
|
||||
*/
|
||||
/*!
|
||||
* based on
|
||||
* Snowball JavaScript Library v0.3
|
||||
* http://code.google.com/p/urim/
|
||||
* http://snowball.tartarus.org/
|
||||
*
|
||||
* Copyright 2010, Oleg Mazko
|
||||
* http://www.mozilla.org/MPL/
|
||||
*/
|
||||
|
||||
!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-Za-z",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(){function e(){var e,r=w.cursor+3;if(o=w.limit,0<=r||r<=w.limit){for(a=r;;){if(e=w.cursor,w.in_grouping(l,97,246)){w.cursor=e;break}if(w.cursor=e,w.cursor>=w.limit)return;w.cursor++}for(;!w.out_grouping(l,97,246);){if(w.cursor>=w.limit)return;w.cursor++}o=w.cursor,o<a&&(o=a)}}function t(){var e,r=w.limit_backward;if(w.cursor>=o&&(w.limit_backward=o,w.cursor=w.limit,w.ket=w.cursor,e=w.find_among_b(u,37),w.limit_backward=r,e))switch(w.bra=w.cursor,e){case 1:w.slice_del();break;case 2:w.in_grouping_b(d,98,121)&&w.slice_del()}}function i(){var e=w.limit_backward;w.cursor>=o&&(w.limit_backward=o,w.cursor=w.limit,w.find_among_b(c,7)&&(w.cursor=w.limit,w.ket=w.cursor,w.cursor>w.limit_backward&&(w.bra=--w.cursor,w.slice_del())),w.limit_backward=e)}function s(){var e,r;if(w.cursor>=o){if(r=w.limit_backward,w.limit_backward=o,w.cursor=w.limit,w.ket=w.cursor,e=w.find_among_b(m,5))switch(w.bra=w.cursor,e){case 1:w.slice_del();break;case 2:w.slice_from("lös");break;case 3:w.slice_from("full")}w.limit_backward=r}}var a,o,u=[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)],c=[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)],m=[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)],l=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,24,0,32],d=[119,127,149],w=new n;this.setCurrent=function(e){w.setCurrent(e)},this.getCurrent=function(){return w.getCurrent()},this.stem=function(){var r=w.cursor;return e(),w.limit_backward=r,w.cursor=w.limit,t(),w.cursor=w.limit,i(),w.cursor=w.limit,s(),!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")}});
|
1
7.3/assets/javascripts/lunr/min/lunr.th.min.js
vendored
Executable 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.th=function(){this.pipeline.reset(),this.pipeline.add(e.th.trimmer),r?this.tokenizer=e.th.tokenizer:(e.tokenizer&&(e.tokenizer=e.th.tokenizer),this.tokenizerFn&&(this.tokenizerFn=e.th.tokenizer))},e.th.wordCharacters="[-]",e.th.trimmer=e.trimmerSupport.generateTrimmer(e.th.wordCharacters),e.Pipeline.registerFunction(e.th.trimmer,"trimmer-th");var t=e.wordcut;t.init(),e.th.tokenizer=function(i){if(!arguments.length||null==i||void 0==i)return[];if(Array.isArray(i))return i.map(function(t){return r?new e.Token(t):t});var n=i.toString().replace(/^\s+/,"");return t.cut(n).split("|")}}});
|
18
7.3/assets/javascripts/lunr/min/lunr.tr.min.js
vendored
Executable file
1
7.3/assets/javascripts/lunr/min/lunr.vi.min.js
vendored
Executable 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.vi=function(){this.pipeline.reset(),this.pipeline.add(e.vi.stopWordFilter,e.vi.trimmer)},e.vi.wordCharacters="[A-Za-ẓ̀͐́͑̉̃̓ÂâÊêÔôĂ-ăĐ-đƠ-ơƯ-ư]",e.vi.trimmer=e.trimmerSupport.generateTrimmer(e.vi.wordCharacters),e.Pipeline.registerFunction(e.vi.trimmer,"trimmer-vi"),e.vi.stopWordFilter=e.generateStopWordFilter("là cái nhưng mà".split(" "))}});
|
1
7.3/assets/javascripts/lunr/min/lunr.zh.min.js
vendored
Executable file
@ -0,0 +1 @@
|
||||
!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r(require("nodejieba")):r()(e.lunr)}(this,function(e){return function(r,t){if(void 0===r)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===r.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");var i="2"==r.version[0];r.zh=function(){this.pipeline.reset(),this.pipeline.add(r.zh.trimmer,r.zh.stopWordFilter,r.zh.stemmer),i?this.tokenizer=r.zh.tokenizer:(r.tokenizer&&(r.tokenizer=r.zh.tokenizer),this.tokenizerFn&&(this.tokenizerFn=r.zh.tokenizer))},r.zh.tokenizer=function(n){if(!arguments.length||null==n||void 0==n)return[];if(Array.isArray(n))return n.map(function(e){return i?new r.Token(e.toLowerCase()):e.toLowerCase()});t&&e.load(t);var o=n.toString().trim().toLowerCase(),s=[];e.cut(o,!0).forEach(function(e){s=s.concat(e.split(" "))}),s=s.filter(function(e){return!!e});var u=0;return s.map(function(e,t){if(i){var n=o.indexOf(e,u),s={};return s.position=[n,e.length],s.index=t,u=n,new r.Token(e,s)}return e})},r.zh.wordCharacters="\\w一-龥",r.zh.trimmer=r.trimmerSupport.generateTrimmer(r.zh.wordCharacters),r.Pipeline.registerFunction(r.zh.trimmer,"trimmer-zh"),r.zh.stemmer=function(){return function(e){return e}}(),r.Pipeline.registerFunction(r.zh.stemmer,"stemmer-zh"),r.zh.stopWordFilter=r.generateStopWordFilter("的 一 不 在 人 有 是 为 以 于 上 他 而 后 之 来 及 了 因 下 可 到 由 这 与 也 此 但 并 个 其 已 无 小 我 们 起 最 再 今 去 好 只 又 或 很 亦 某 把 那 你 乃 它 吧 被 比 别 趁 当 从 到 得 打 凡 儿 尔 该 各 给 跟 和 何 还 即 几 既 看 据 距 靠 啦 了 另 么 每 们 嘛 拿 哪 那 您 凭 且 却 让 仍 啥 如 若 使 谁 虽 随 同 所 她 哇 嗡 往 哪 些 向 沿 哟 用 于 咱 则 怎 曾 至 致 着 诸 自".split(" ")),r.Pipeline.registerFunction(r.zh.stopWordFilter,"stopWordFilter-zh")}});
|
206
7.3/assets/javascripts/lunr/tinyseg.js
Executable file
@ -0,0 +1,206 @@
|
||||
/**
|
||||
* export the module via AMD, CommonJS or as a browser global
|
||||
* Export code from https://github.com/umdjs/umd/blob/master/returnExports.js
|
||||
*/
|
||||
;(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(factory)
|
||||
} else if (typeof exports === 'object') {
|
||||
/**
|
||||
* Node. Does not work with strict CommonJS, but
|
||||
* only CommonJS-like environments that support module.exports,
|
||||
* like Node.
|
||||
*/
|
||||
module.exports = factory()
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
factory()(root.lunr);
|
||||
}
|
||||
}(this, function () {
|
||||
/**
|
||||
* Just return a value to define the module export.
|
||||
* This example returns an object, but the module
|
||||
* can return a function as the exported value.
|
||||
*/
|
||||
|
||||
return function(lunr) {
|
||||
// TinySegmenter 0.1 -- Super compact Japanese tokenizer in Javascript
|
||||
// (c) 2008 Taku Kudo <taku@chasen.org>
|
||||
// TinySegmenter is freely distributable under the terms of a new BSD licence.
|
||||
// For details, see http://chasen.org/~taku/software/TinySegmenter/LICENCE.txt
|
||||
|
||||
function TinySegmenter() {
|
||||
var patterns = {
|
||||
"[一二三四五六七八九十百千万億兆]":"M",
|
||||
"[一-龠々〆ヵヶ]":"H",
|
||||
"[ぁ-ん]":"I",
|
||||
"[ァ-ヴーア-ン゙ー]":"K",
|
||||
"[a-zA-Za-zA-Z]":"A",
|
||||
"[0-90-9]":"N"
|
||||
}
|
||||
this.chartype_ = [];
|
||||
for (var i in patterns) {
|
||||
var regexp = new RegExp(i);
|
||||
this.chartype_.push([regexp, patterns[i]]);
|
||||
}
|
||||
|
||||
this.BIAS__ = -332
|
||||
this.BC1__ = {"HH":6,"II":2461,"KH":406,"OH":-1378};
|
||||
this.BC2__ = {"AA":-3267,"AI":2744,"AN":-878,"HH":-4070,"HM":-1711,"HN":4012,"HO":3761,"IA":1327,"IH":-1184,"II":-1332,"IK":1721,"IO":5492,"KI":3831,"KK":-8741,"MH":-3132,"MK":3334,"OO":-2920};
|
||||
this.BC3__ = {"HH":996,"HI":626,"HK":-721,"HN":-1307,"HO":-836,"IH":-301,"KK":2762,"MK":1079,"MM":4034,"OA":-1652,"OH":266};
|
||||
this.BP1__ = {"BB":295,"OB":304,"OO":-125,"UB":352};
|
||||
this.BP2__ = {"BO":60,"OO":-1762};
|
||||
this.BQ1__ = {"BHH":1150,"BHM":1521,"BII":-1158,"BIM":886,"BMH":1208,"BNH":449,"BOH":-91,"BOO":-2597,"OHI":451,"OIH":-296,"OKA":1851,"OKH":-1020,"OKK":904,"OOO":2965};
|
||||
this.BQ2__ = {"BHH":118,"BHI":-1159,"BHM":466,"BIH":-919,"BKK":-1720,"BKO":864,"OHH":-1139,"OHM":-181,"OIH":153,"UHI":-1146};
|
||||
this.BQ3__ = {"BHH":-792,"BHI":2664,"BII":-299,"BKI":419,"BMH":937,"BMM":8335,"BNN":998,"BOH":775,"OHH":2174,"OHM":439,"OII":280,"OKH":1798,"OKI":-793,"OKO":-2242,"OMH":-2402,"OOO":11699};
|
||||
this.BQ4__ = {"BHH":-3895,"BIH":3761,"BII":-4654,"BIK":1348,"BKK":-1806,"BMI":-3385,"BOO":-12396,"OAH":926,"OHH":266,"OHK":-2036,"ONN":-973};
|
||||
this.BW1__ = {",と":660,",同":727,"B1あ":1404,"B1同":542,"、と":660,"、同":727,"」と":1682,"あっ":1505,"いう":1743,"いっ":-2055,"いる":672,"うし":-4817,"うん":665,"から":3472,"がら":600,"こう":-790,"こと":2083,"こん":-1262,"さら":-4143,"さん":4573,"した":2641,"して":1104,"すで":-3399,"そこ":1977,"それ":-871,"たち":1122,"ため":601,"った":3463,"つい":-802,"てい":805,"てき":1249,"でき":1127,"です":3445,"では":844,"とい":-4915,"とみ":1922,"どこ":3887,"ない":5713,"なっ":3015,"など":7379,"なん":-1113,"にし":2468,"には":1498,"にも":1671,"に対":-912,"の一":-501,"の中":741,"ませ":2448,"まで":1711,"まま":2600,"まる":-2155,"やむ":-1947,"よっ":-2565,"れた":2369,"れで":-913,"をし":1860,"を見":731,"亡く":-1886,"京都":2558,"取り":-2784,"大き":-2604,"大阪":1497,"平方":-2314,"引き":-1336,"日本":-195,"本当":-2423,"毎日":-2113,"目指":-724,"B1あ":1404,"B1同":542,"」と":1682};
|
||||
this.BW2__ = {"..":-11822,"11":-669,"――":-5730,"−−":-13175,"いう":-1609,"うか":2490,"かし":-1350,"かも":-602,"から":-7194,"かれ":4612,"がい":853,"がら":-3198,"きた":1941,"くな":-1597,"こと":-8392,"この":-4193,"させ":4533,"され":13168,"さん":-3977,"しい":-1819,"しか":-545,"した":5078,"して":972,"しな":939,"その":-3744,"たい":-1253,"たた":-662,"ただ":-3857,"たち":-786,"たと":1224,"たは":-939,"った":4589,"って":1647,"っと":-2094,"てい":6144,"てき":3640,"てく":2551,"ては":-3110,"ても":-3065,"でい":2666,"でき":-1528,"でし":-3828,"です":-4761,"でも":-4203,"とい":1890,"とこ":-1746,"とと":-2279,"との":720,"とみ":5168,"とも":-3941,"ない":-2488,"なが":-1313,"など":-6509,"なの":2614,"なん":3099,"にお":-1615,"にし":2748,"にな":2454,"によ":-7236,"に対":-14943,"に従":-4688,"に関":-11388,"のか":2093,"ので":-7059,"のに":-6041,"のの":-6125,"はい":1073,"はが":-1033,"はず":-2532,"ばれ":1813,"まし":-1316,"まで":-6621,"まれ":5409,"めて":-3153,"もい":2230,"もの":-10713,"らか":-944,"らし":-1611,"らに":-1897,"りし":651,"りま":1620,"れた":4270,"れて":849,"れば":4114,"ろう":6067,"われ":7901,"を通":-11877,"んだ":728,"んな":-4115,"一人":602,"一方":-1375,"一日":970,"一部":-1051,"上が":-4479,"会社":-1116,"出て":2163,"分の":-7758,"同党":970,"同日":-913,"大阪":-2471,"委員":-1250,"少な":-1050,"年度":-8669,"年間":-1626,"府県":-2363,"手権":-1982,"新聞":-4066,"日新":-722,"日本":-7068,"日米":3372,"曜日":-601,"朝鮮":-2355,"本人":-2697,"東京":-1543,"然と":-1384,"社会":-1276,"立て":-990,"第に":-1612,"米国":-4268,"11":-669};
|
||||
this.BW3__ = {"あた":-2194,"あり":719,"ある":3846,"い.":-1185,"い。":-1185,"いい":5308,"いえ":2079,"いく":3029,"いた":2056,"いっ":1883,"いる":5600,"いわ":1527,"うち":1117,"うと":4798,"えと":1454,"か.":2857,"か。":2857,"かけ":-743,"かっ":-4098,"かに":-669,"から":6520,"かり":-2670,"が,":1816,"が、":1816,"がき":-4855,"がけ":-1127,"がっ":-913,"がら":-4977,"がり":-2064,"きた":1645,"けど":1374,"こと":7397,"この":1542,"ころ":-2757,"さい":-714,"さを":976,"し,":1557,"し、":1557,"しい":-3714,"した":3562,"して":1449,"しな":2608,"しま":1200,"す.":-1310,"す。":-1310,"する":6521,"ず,":3426,"ず、":3426,"ずに":841,"そう":428,"た.":8875,"た。":8875,"たい":-594,"たの":812,"たり":-1183,"たる":-853,"だ.":4098,"だ。":4098,"だっ":1004,"った":-4748,"って":300,"てい":6240,"てお":855,"ても":302,"です":1437,"でに":-1482,"では":2295,"とう":-1387,"とし":2266,"との":541,"とも":-3543,"どう":4664,"ない":1796,"なく":-903,"など":2135,"に,":-1021,"に、":-1021,"にし":1771,"にな":1906,"には":2644,"の,":-724,"の、":-724,"の子":-1000,"は,":1337,"は、":1337,"べき":2181,"まし":1113,"ます":6943,"まっ":-1549,"まで":6154,"まれ":-793,"らし":1479,"られ":6820,"るる":3818,"れ,":854,"れ、":854,"れた":1850,"れて":1375,"れば":-3246,"れる":1091,"われ":-605,"んだ":606,"んで":798,"カ月":990,"会議":860,"入り":1232,"大会":2217,"始め":1681,"市":965,"新聞":-5055,"日,":974,"日、":974,"社会":2024,"カ月":990};
|
||||
this.TC1__ = {"AAA":1093,"HHH":1029,"HHM":580,"HII":998,"HOH":-390,"HOM":-331,"IHI":1169,"IOH":-142,"IOI":-1015,"IOM":467,"MMH":187,"OOI":-1832};
|
||||
this.TC2__ = {"HHO":2088,"HII":-1023,"HMM":-1154,"IHI":-1965,"KKH":703,"OII":-2649};
|
||||
this.TC3__ = {"AAA":-294,"HHH":346,"HHI":-341,"HII":-1088,"HIK":731,"HOH":-1486,"IHH":128,"IHI":-3041,"IHO":-1935,"IIH":-825,"IIM":-1035,"IOI":-542,"KHH":-1216,"KKA":491,"KKH":-1217,"KOK":-1009,"MHH":-2694,"MHM":-457,"MHO":123,"MMH":-471,"NNH":-1689,"NNO":662,"OHO":-3393};
|
||||
this.TC4__ = {"HHH":-203,"HHI":1344,"HHK":365,"HHM":-122,"HHN":182,"HHO":669,"HIH":804,"HII":679,"HOH":446,"IHH":695,"IHO":-2324,"IIH":321,"III":1497,"IIO":656,"IOO":54,"KAK":4845,"KKA":3386,"KKK":3065,"MHH":-405,"MHI":201,"MMH":-241,"MMM":661,"MOM":841};
|
||||
this.TQ1__ = {"BHHH":-227,"BHHI":316,"BHIH":-132,"BIHH":60,"BIII":1595,"BNHH":-744,"BOHH":225,"BOOO":-908,"OAKK":482,"OHHH":281,"OHIH":249,"OIHI":200,"OIIH":-68};
|
||||
this.TQ2__ = {"BIHH":-1401,"BIII":-1033,"BKAK":-543,"BOOO":-5591};
|
||||
this.TQ3__ = {"BHHH":478,"BHHM":-1073,"BHIH":222,"BHII":-504,"BIIH":-116,"BIII":-105,"BMHI":-863,"BMHM":-464,"BOMH":620,"OHHH":346,"OHHI":1729,"OHII":997,"OHMH":481,"OIHH":623,"OIIH":1344,"OKAK":2792,"OKHH":587,"OKKA":679,"OOHH":110,"OOII":-685};
|
||||
this.TQ4__ = {"BHHH":-721,"BHHM":-3604,"BHII":-966,"BIIH":-607,"BIII":-2181,"OAAA":-2763,"OAKK":180,"OHHH":-294,"OHHI":2446,"OHHO":480,"OHIH":-1573,"OIHH":1935,"OIHI":-493,"OIIH":626,"OIII":-4007,"OKAK":-8156};
|
||||
this.TW1__ = {"につい":-4681,"東京都":2026};
|
||||
this.TW2__ = {"ある程":-2049,"いった":-1256,"ころが":-2434,"しょう":3873,"その後":-4430,"だって":-1049,"ていた":1833,"として":-4657,"ともに":-4517,"もので":1882,"一気に":-792,"初めて":-1512,"同時に":-8097,"大きな":-1255,"対して":-2721,"社会党":-3216};
|
||||
this.TW3__ = {"いただ":-1734,"してい":1314,"として":-4314,"につい":-5483,"にとっ":-5989,"に当た":-6247,"ので,":-727,"ので、":-727,"のもの":-600,"れから":-3752,"十二月":-2287};
|
||||
this.TW4__ = {"いう.":8576,"いう。":8576,"からな":-2348,"してい":2958,"たが,":1516,"たが、":1516,"ている":1538,"という":1349,"ました":5543,"ません":1097,"ようと":-4258,"よると":5865};
|
||||
this.UC1__ = {"A":484,"K":93,"M":645,"O":-505};
|
||||
this.UC2__ = {"A":819,"H":1059,"I":409,"M":3987,"N":5775,"O":646};
|
||||
this.UC3__ = {"A":-1370,"I":2311};
|
||||
this.UC4__ = {"A":-2643,"H":1809,"I":-1032,"K":-3450,"M":3565,"N":3876,"O":6646};
|
||||
this.UC5__ = {"H":313,"I":-1238,"K":-799,"M":539,"O":-831};
|
||||
this.UC6__ = {"H":-506,"I":-253,"K":87,"M":247,"O":-387};
|
||||
this.UP1__ = {"O":-214};
|
||||
this.UP2__ = {"B":69,"O":935};
|
||||
this.UP3__ = {"B":189};
|
||||
this.UQ1__ = {"BH":21,"BI":-12,"BK":-99,"BN":142,"BO":-56,"OH":-95,"OI":477,"OK":410,"OO":-2422};
|
||||
this.UQ2__ = {"BH":216,"BI":113,"OK":1759};
|
||||
this.UQ3__ = {"BA":-479,"BH":42,"BI":1913,"BK":-7198,"BM":3160,"BN":6427,"BO":14761,"OI":-827,"ON":-3212};
|
||||
this.UW1__ = {",":156,"、":156,"「":-463,"あ":-941,"う":-127,"が":-553,"き":121,"こ":505,"で":-201,"と":-547,"ど":-123,"に":-789,"の":-185,"は":-847,"も":-466,"や":-470,"よ":182,"ら":-292,"り":208,"れ":169,"を":-446,"ん":-137,"・":-135,"主":-402,"京":-268,"区":-912,"午":871,"国":-460,"大":561,"委":729,"市":-411,"日":-141,"理":361,"生":-408,"県":-386,"都":-718,"「":-463,"・":-135};
|
||||
this.UW2__ = {",":-829,"、":-829,"〇":892,"「":-645,"」":3145,"あ":-538,"い":505,"う":134,"お":-502,"か":1454,"が":-856,"く":-412,"こ":1141,"さ":878,"ざ":540,"し":1529,"す":-675,"せ":300,"そ":-1011,"た":188,"だ":1837,"つ":-949,"て":-291,"で":-268,"と":-981,"ど":1273,"な":1063,"に":-1764,"の":130,"は":-409,"ひ":-1273,"べ":1261,"ま":600,"も":-1263,"や":-402,"よ":1639,"り":-579,"る":-694,"れ":571,"を":-2516,"ん":2095,"ア":-587,"カ":306,"キ":568,"ッ":831,"三":-758,"不":-2150,"世":-302,"中":-968,"主":-861,"事":492,"人":-123,"会":978,"保":362,"入":548,"初":-3025,"副":-1566,"北":-3414,"区":-422,"大":-1769,"天":-865,"太":-483,"子":-1519,"学":760,"実":1023,"小":-2009,"市":-813,"年":-1060,"強":1067,"手":-1519,"揺":-1033,"政":1522,"文":-1355,"新":-1682,"日":-1815,"明":-1462,"最":-630,"朝":-1843,"本":-1650,"東":-931,"果":-665,"次":-2378,"民":-180,"気":-1740,"理":752,"発":529,"目":-1584,"相":-242,"県":-1165,"立":-763,"第":810,"米":509,"自":-1353,"行":838,"西":-744,"見":-3874,"調":1010,"議":1198,"込":3041,"開":1758,"間":-1257,"「":-645,"」":3145,"ッ":831,"ア":-587,"カ":306,"キ":568};
|
||||
this.UW3__ = {",":4889,"1":-800,"−":-1723,"、":4889,"々":-2311,"〇":5827,"」":2670,"〓":-3573,"あ":-2696,"い":1006,"う":2342,"え":1983,"お":-4864,"か":-1163,"が":3271,"く":1004,"け":388,"げ":401,"こ":-3552,"ご":-3116,"さ":-1058,"し":-395,"す":584,"せ":3685,"そ":-5228,"た":842,"ち":-521,"っ":-1444,"つ":-1081,"て":6167,"で":2318,"と":1691,"ど":-899,"な":-2788,"に":2745,"の":4056,"は":4555,"ひ":-2171,"ふ":-1798,"へ":1199,"ほ":-5516,"ま":-4384,"み":-120,"め":1205,"も":2323,"や":-788,"よ":-202,"ら":727,"り":649,"る":5905,"れ":2773,"わ":-1207,"を":6620,"ん":-518,"ア":551,"グ":1319,"ス":874,"ッ":-1350,"ト":521,"ム":1109,"ル":1591,"ロ":2201,"ン":278,"・":-3794,"一":-1619,"下":-1759,"世":-2087,"両":3815,"中":653,"主":-758,"予":-1193,"二":974,"人":2742,"今":792,"他":1889,"以":-1368,"低":811,"何":4265,"作":-361,"保":-2439,"元":4858,"党":3593,"全":1574,"公":-3030,"六":755,"共":-1880,"円":5807,"再":3095,"分":457,"初":2475,"別":1129,"前":2286,"副":4437,"力":365,"動":-949,"務":-1872,"化":1327,"北":-1038,"区":4646,"千":-2309,"午":-783,"協":-1006,"口":483,"右":1233,"各":3588,"合":-241,"同":3906,"和":-837,"員":4513,"国":642,"型":1389,"場":1219,"外":-241,"妻":2016,"学":-1356,"安":-423,"実":-1008,"家":1078,"小":-513,"少":-3102,"州":1155,"市":3197,"平":-1804,"年":2416,"広":-1030,"府":1605,"度":1452,"建":-2352,"当":-3885,"得":1905,"思":-1291,"性":1822,"戸":-488,"指":-3973,"政":-2013,"教":-1479,"数":3222,"文":-1489,"新":1764,"日":2099,"旧":5792,"昨":-661,"時":-1248,"曜":-951,"最":-937,"月":4125,"期":360,"李":3094,"村":364,"東":-805,"核":5156,"森":2438,"業":484,"氏":2613,"民":-1694,"決":-1073,"法":1868,"海":-495,"無":979,"物":461,"特":-3850,"生":-273,"用":914,"町":1215,"的":7313,"直":-1835,"省":792,"県":6293,"知":-1528,"私":4231,"税":401,"立":-960,"第":1201,"米":7767,"系":3066,"約":3663,"級":1384,"統":-4229,"総":1163,"線":1255,"者":6457,"能":725,"自":-2869,"英":785,"見":1044,"調":-562,"財":-733,"費":1777,"車":1835,"軍":1375,"込":-1504,"通":-1136,"選":-681,"郎":1026,"郡":4404,"部":1200,"金":2163,"長":421,"開":-1432,"間":1302,"関":-1282,"雨":2009,"電":-1045,"非":2066,"駅":1620,"1":-800,"」":2670,"・":-3794,"ッ":-1350,"ア":551,"グ":1319,"ス":874,"ト":521,"ム":1109,"ル":1591,"ロ":2201,"ン":278};
|
||||
this.UW4__ = {",":3930,".":3508,"―":-4841,"、":3930,"。":3508,"〇":4999,"「":1895,"」":3798,"〓":-5156,"あ":4752,"い":-3435,"う":-640,"え":-2514,"お":2405,"か":530,"が":6006,"き":-4482,"ぎ":-3821,"く":-3788,"け":-4376,"げ":-4734,"こ":2255,"ご":1979,"さ":2864,"し":-843,"じ":-2506,"す":-731,"ず":1251,"せ":181,"そ":4091,"た":5034,"だ":5408,"ち":-3654,"っ":-5882,"つ":-1659,"て":3994,"で":7410,"と":4547,"な":5433,"に":6499,"ぬ":1853,"ね":1413,"の":7396,"は":8578,"ば":1940,"ひ":4249,"び":-4134,"ふ":1345,"へ":6665,"べ":-744,"ほ":1464,"ま":1051,"み":-2082,"む":-882,"め":-5046,"も":4169,"ゃ":-2666,"や":2795,"ょ":-1544,"よ":3351,"ら":-2922,"り":-9726,"る":-14896,"れ":-2613,"ろ":-4570,"わ":-1783,"を":13150,"ん":-2352,"カ":2145,"コ":1789,"セ":1287,"ッ":-724,"ト":-403,"メ":-1635,"ラ":-881,"リ":-541,"ル":-856,"ン":-3637,"・":-4371,"ー":-11870,"一":-2069,"中":2210,"予":782,"事":-190,"井":-1768,"人":1036,"以":544,"会":950,"体":-1286,"作":530,"側":4292,"先":601,"党":-2006,"共":-1212,"内":584,"円":788,"初":1347,"前":1623,"副":3879,"力":-302,"動":-740,"務":-2715,"化":776,"区":4517,"協":1013,"参":1555,"合":-1834,"和":-681,"員":-910,"器":-851,"回":1500,"国":-619,"園":-1200,"地":866,"場":-1410,"塁":-2094,"士":-1413,"多":1067,"大":571,"子":-4802,"学":-1397,"定":-1057,"寺":-809,"小":1910,"屋":-1328,"山":-1500,"島":-2056,"川":-2667,"市":2771,"年":374,"庁":-4556,"後":456,"性":553,"感":916,"所":-1566,"支":856,"改":787,"政":2182,"教":704,"文":522,"方":-856,"日":1798,"時":1829,"最":845,"月":-9066,"木":-485,"来":-442,"校":-360,"業":-1043,"氏":5388,"民":-2716,"気":-910,"沢":-939,"済":-543,"物":-735,"率":672,"球":-1267,"生":-1286,"産":-1101,"田":-2900,"町":1826,"的":2586,"目":922,"省":-3485,"県":2997,"空":-867,"立":-2112,"第":788,"米":2937,"系":786,"約":2171,"経":1146,"統":-1169,"総":940,"線":-994,"署":749,"者":2145,"能":-730,"般":-852,"行":-792,"規":792,"警":-1184,"議":-244,"谷":-1000,"賞":730,"車":-1481,"軍":1158,"輪":-1433,"込":-3370,"近":929,"道":-1291,"選":2596,"郎":-4866,"都":1192,"野":-1100,"銀":-2213,"長":357,"間":-2344,"院":-2297,"際":-2604,"電":-878,"領":-1659,"題":-792,"館":-1984,"首":1749,"高":2120,"「":1895,"」":3798,"・":-4371,"ッ":-724,"ー":-11870,"カ":2145,"コ":1789,"セ":1287,"ト":-403,"メ":-1635,"ラ":-881,"リ":-541,"ル":-856,"ン":-3637};
|
||||
this.UW5__ = {",":465,".":-299,"1":-514,"E2":-32768,"]":-2762,"、":465,"。":-299,"「":363,"あ":1655,"い":331,"う":-503,"え":1199,"お":527,"か":647,"が":-421,"き":1624,"ぎ":1971,"く":312,"げ":-983,"さ":-1537,"し":-1371,"す":-852,"だ":-1186,"ち":1093,"っ":52,"つ":921,"て":-18,"で":-850,"と":-127,"ど":1682,"な":-787,"に":-1224,"の":-635,"は":-578,"べ":1001,"み":502,"め":865,"ゃ":3350,"ょ":854,"り":-208,"る":429,"れ":504,"わ":419,"を":-1264,"ん":327,"イ":241,"ル":451,"ン":-343,"中":-871,"京":722,"会":-1153,"党":-654,"務":3519,"区":-901,"告":848,"員":2104,"大":-1296,"学":-548,"定":1785,"嵐":-1304,"市":-2991,"席":921,"年":1763,"思":872,"所":-814,"挙":1618,"新":-1682,"日":218,"月":-4353,"査":932,"格":1356,"機":-1508,"氏":-1347,"田":240,"町":-3912,"的":-3149,"相":1319,"省":-1052,"県":-4003,"研":-997,"社":-278,"空":-813,"統":1955,"者":-2233,"表":663,"語":-1073,"議":1219,"選":-1018,"郎":-368,"長":786,"間":1191,"題":2368,"館":-689,"1":-514,"E2":-32768,"「":363,"イ":241,"ル":451,"ン":-343};
|
||||
this.UW6__ = {",":227,".":808,"1":-270,"E1":306,"、":227,"。":808,"あ":-307,"う":189,"か":241,"が":-73,"く":-121,"こ":-200,"じ":1782,"す":383,"た":-428,"っ":573,"て":-1014,"で":101,"と":-105,"な":-253,"に":-149,"の":-417,"は":-236,"も":-206,"り":187,"る":-135,"を":195,"ル":-673,"ン":-496,"一":-277,"中":201,"件":-800,"会":624,"前":302,"区":1792,"員":-1212,"委":798,"学":-960,"市":887,"広":-695,"後":535,"業":-697,"相":753,"社":-507,"福":974,"空":-822,"者":1811,"連":463,"郎":1082,"1":-270,"E1":306,"ル":-673,"ン":-496};
|
||||
|
||||
return this;
|
||||
}
|
||||
TinySegmenter.prototype.ctype_ = function(str) {
|
||||
for (var i in this.chartype_) {
|
||||
if (str.match(this.chartype_[i][0])) {
|
||||
return this.chartype_[i][1];
|
||||
}
|
||||
}
|
||||
return "O";
|
||||
}
|
||||
|
||||
TinySegmenter.prototype.ts_ = function(v) {
|
||||
if (v) { return v; }
|
||||
return 0;
|
||||
}
|
||||
|
||||
TinySegmenter.prototype.segment = function(input) {
|
||||
if (input == null || input == undefined || input == "") {
|
||||
return [];
|
||||
}
|
||||
var result = [];
|
||||
var seg = ["B3","B2","B1"];
|
||||
var ctype = ["O","O","O"];
|
||||
var o = input.split("");
|
||||
for (i = 0; i < o.length; ++i) {
|
||||
seg.push(o[i]);
|
||||
ctype.push(this.ctype_(o[i]))
|
||||
}
|
||||
seg.push("E1");
|
||||
seg.push("E2");
|
||||
seg.push("E3");
|
||||
ctype.push("O");
|
||||
ctype.push("O");
|
||||
ctype.push("O");
|
||||
var word = seg[3];
|
||||
var p1 = "U";
|
||||
var p2 = "U";
|
||||
var p3 = "U";
|
||||
for (var i = 4; i < seg.length - 3; ++i) {
|
||||
var score = this.BIAS__;
|
||||
var w1 = seg[i-3];
|
||||
var w2 = seg[i-2];
|
||||
var w3 = seg[i-1];
|
||||
var w4 = seg[i];
|
||||
var w5 = seg[i+1];
|
||||
var w6 = seg[i+2];
|
||||
var c1 = ctype[i-3];
|
||||
var c2 = ctype[i-2];
|
||||
var c3 = ctype[i-1];
|
||||
var c4 = ctype[i];
|
||||
var c5 = ctype[i+1];
|
||||
var c6 = ctype[i+2];
|
||||
score += this.ts_(this.UP1__[p1]);
|
||||
score += this.ts_(this.UP2__[p2]);
|
||||
score += this.ts_(this.UP3__[p3]);
|
||||
score += this.ts_(this.BP1__[p1 + p2]);
|
||||
score += this.ts_(this.BP2__[p2 + p3]);
|
||||
score += this.ts_(this.UW1__[w1]);
|
||||
score += this.ts_(this.UW2__[w2]);
|
||||
score += this.ts_(this.UW3__[w3]);
|
||||
score += this.ts_(this.UW4__[w4]);
|
||||
score += this.ts_(this.UW5__[w5]);
|
||||
score += this.ts_(this.UW6__[w6]);
|
||||
score += this.ts_(this.BW1__[w2 + w3]);
|
||||
score += this.ts_(this.BW2__[w3 + w4]);
|
||||
score += this.ts_(this.BW3__[w4 + w5]);
|
||||
score += this.ts_(this.TW1__[w1 + w2 + w3]);
|
||||
score += this.ts_(this.TW2__[w2 + w3 + w4]);
|
||||
score += this.ts_(this.TW3__[w3 + w4 + w5]);
|
||||
score += this.ts_(this.TW4__[w4 + w5 + w6]);
|
||||
score += this.ts_(this.UC1__[c1]);
|
||||
score += this.ts_(this.UC2__[c2]);
|
||||
score += this.ts_(this.UC3__[c3]);
|
||||
score += this.ts_(this.UC4__[c4]);
|
||||
score += this.ts_(this.UC5__[c5]);
|
||||
score += this.ts_(this.UC6__[c6]);
|
||||
score += this.ts_(this.BC1__[c2 + c3]);
|
||||
score += this.ts_(this.BC2__[c3 + c4]);
|
||||
score += this.ts_(this.BC3__[c4 + c5]);
|
||||
score += this.ts_(this.TC1__[c1 + c2 + c3]);
|
||||
score += this.ts_(this.TC2__[c2 + c3 + c4]);
|
||||
score += this.ts_(this.TC3__[c3 + c4 + c5]);
|
||||
score += this.ts_(this.TC4__[c4 + c5 + c6]);
|
||||
// score += this.ts_(this.TC5__[c4 + c5 + c6]);
|
||||
score += this.ts_(this.UQ1__[p1 + c1]);
|
||||
score += this.ts_(this.UQ2__[p2 + c2]);
|
||||
score += this.ts_(this.UQ3__[p3 + c3]);
|
||||
score += this.ts_(this.BQ1__[p2 + c2 + c3]);
|
||||
score += this.ts_(this.BQ2__[p2 + c3 + c4]);
|
||||
score += this.ts_(this.BQ3__[p3 + c2 + c3]);
|
||||
score += this.ts_(this.BQ4__[p3 + c3 + c4]);
|
||||
score += this.ts_(this.TQ1__[p2 + c1 + c2 + c3]);
|
||||
score += this.ts_(this.TQ2__[p2 + c2 + c3 + c4]);
|
||||
score += this.ts_(this.TQ3__[p3 + c1 + c2 + c3]);
|
||||
score += this.ts_(this.TQ4__[p3 + c2 + c3 + c4]);
|
||||
var p = "O";
|
||||
if (score > 0) {
|
||||
result.push(word);
|
||||
word = "";
|
||||
p = "B";
|
||||
}
|
||||
p1 = p2;
|
||||
p2 = p3;
|
||||
p3 = p;
|
||||
word += seg[i];
|
||||
}
|
||||
result.push(word);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
lunr.TinySegmenter = TinySegmenter;
|
||||
};
|
||||
|
||||
}));
|
6708
7.3/assets/javascripts/lunr/wordcut.js
Executable file
48
7.3/assets/javascripts/workers/search.2a1c317c.min.js
vendored
Executable file
8
7.3/assets/javascripts/workers/search.2a1c317c.min.js.map
Executable file
1
7.3/assets/stylesheets/main.c382b1dc.min.css
vendored
Executable file
1
7.3/assets/stylesheets/main.c382b1dc.min.css.map
Executable file
1
7.3/assets/stylesheets/palette.cc9b2e1e.min.css
vendored
Executable file
1
7.3/assets/stylesheets/palette.cc9b2e1e.min.css.map
Executable file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["src/assets/stylesheets/palette/_accent.scss","../../../src/assets/stylesheets/palette.scss","src/assets/stylesheets/palette/_primary.scss","src/assets/stylesheets/utilities/_break.scss","src/assets/stylesheets/palette/_scheme.scss"],"names":[],"mappings":"AA8CE,2BACE,4BAAA,CACA,oDAAA,CAOE,yBAAA,CACA,8CCnDN,CDyCE,4BACE,4BAAA,CACA,mDAAA,CAOE,yBAAA,CACA,8CC5CN,CDkCE,8BACE,4BAAA,CACA,qDAAA,CAOE,yBAAA,CACA,8CCrCN,CD2BE,mCACE,4BAAA,CACA,qDAAA,CAOE,yBAAA,CACA,8CC9BN,CDoBE,8BACE,4BAAA,CACA,qDAAA,CAOE,yBAAA,CACA,8CCvBN,CDaE,4BACE,4BAAA,CACA,qDAAA,CAOE,yBAAA,CACA,8CChBN,CDME,kCACE,4BAAA,CACA,oDAAA,CAOE,yBAAA,CACA,8CCTN,CDDE,4BACE,4BAAA,CACA,oDAAA,CAOE,yBAAA,CACA,8CCFN,CDRE,4BACE,4BAAA,CACA,oDAAA,CAOE,yBAAA,CACA,8CCKN,CDfE,6BACE,4BAAA,CACA,mDAAA,CAOE,yBAAA,CACA,8CCYN,CDtBE,mCACE,4BAAA,CACA,oDAAA,CAOE,yBAAA,CACA,8CCmBN,CD7BE,4BACE,4BAAA,CACA,oDAAA,CAIE,oCAAA,CACA,2CC6BN,CDpCE,8BACE,4BAAA,CACA,oDAAA,CAIE,oCAAA,CACA,2CCoCN,CD3CE,6BACE,yBAAA,CACA,oDAAA,CAIE,oCAAA,CACA,2CC2CN,CDlDE,8BACE,4BAAA,CACA,oDAAA,CAIE,oCAAA,CACA,2CCkDN,CDzDE,mCACE,4BAAA,CACA,qDAAA,CAOE,yBAAA,CACA,8CCsDN,CC3DE,4BACE,6BAAA,CACA,oCAAA,CACA,mCAAA,CAOE,0BAAA,CACA,+CDwDN,CCnEE,6BACE,6BAAA,CACA,oCAAA,CACA,mCAAA,CAOE,0BAAA,CACA,+CDgEN,CC3EE,+BACE,6BAAA,CACA,oCAAA,CACA,mCAAA,CAOE,0BAAA,CACA,+CDwEN,CCnFE,oCACE,6BAAA,CACA,oCAAA,CACA,mCAAA,CAOE,0BAAA,CACA,+CDgFN,CC3FE,+BACE,6BAAA,CACA,oCAAA,CACA,mCAAA,CAOE,0BAAA,CACA,+CDwFN,CCnGE,6BACE,6BAAA,CACA,oCAAA,CACA,mCAAA,CAOE,0BAAA,CACA,+CDgGN,CC3GE,mCACE,6BAAA,CACA,oCAAA,CACA,mCAAA,CAOE,0BAAA,CACA,+CDwGN,CCnHE,6BACE,6BAAA,CACA,oCAAA,CACA,mCAAA,CAOE,0BAAA,CACA,+CDgHN,CC3HE,6BACE,6BAAA,CACA,oCAAA,CACA,mCAAA,CAOE,0BAAA,CACA,+CDwHN,CCnIE,8BACE,6BAAA,CACA,oCAAA,CACA,mCAAA,CAOE,0BAAA,CACA,+CDgIN,CC3IE,oCACE,6BAAA,CACA,oCAAA,CACA,mCAAA,CAOE,0BAAA,CACA,+CDwIN,CCnJE,6BACE,6BAAA,CACA,oCAAA,CACA,mCAAA,CAIE,qCAAA,CACA,4CDmJN,CC3JE,+BACE,6BAAA,CACA,oCAAA,CACA,mCAAA,CAIE,qCAAA,CACA,4CD2JN,CCnKE,8BACE,6BAAA,CACA,oCAAA,CACA,mCAAA,CAIE,qCAAA,CACA,4CDmKN,CC3KE,+BACE,6BAAA,CACA,oCAAA,CACA,mCAAA,CAIE,qCAAA,CACA,4CD2KN,CCnLE,oCACE,6BAAA,CACA,oCAAA,CACA,mCAAA,CAOE,0BAAA,CACA,+CDgLN,CC3LE,8BACE,6BAAA,CACA,oCAAA,CACA,mCAAA,CAOE,0BAAA,CACA,+CDwLN,CCnME,6BACE,6BAAA,CACA,oCAAA,CACA,mCAAA,CAOE,0BAAA,CACA,+CDgMN,CC3ME,kCACE,6BAAA,CACA,oCAAA,CACA,mCAAA,CAOE,0BAAA,CACA,+CDwMN,CC9LA,8BACE,0BAAA,CACA,+CAAA,CACA,2CAAA,CACA,qCAAA,CACA,4CAAA,CAGA,4BD+LF,CE9EI,mCD3GA,+CACE,gCD4LJ,CCzLI,qDACE,gCD2LN,CCtLE,iEACE,qBDwLJ,CACF,CEzFI,sCDxFA,uCACE,0CDoLJ,CACF,CC3KA,8BACE,0BAAA,CACA,4CAAA,CACA,gCAAA,CACA,0BAAA,CACA,+CAAA,CAGA,4BD4KF,CCzKE,yCACE,qBD2KJ,CEvFI,wCD7EA,8CACE,gCDuKJ,CACF,CE/GI,mCDjDA,+CACE,oCDmKJ,CChKI,qDACE,mCDkKN,CACF,CEpGI,wCDtDA,iFACE,qBD6JJ,CACF,CE5HI,sCD1BA,uCACE,qBDyJJ,CACF,CGvSA,cAGE,6BAKE,YAAA,CAGA,mDAAA,CACA,6DAAA,CACA,+DAAA,CACA,gEAAA,CACA,mDAAA,CACA,6DAAA,CACA,+DAAA,CACA,gEAAA,CAGA,gDAAA,CACA,gDAAA,CAGA,uCAAA,CACA,iCAAA,CACA,kCAAA,CACA,mCAAA,CACA,mCAAA,CACA,kCAAA,CACA,iCAAA,CACA,+CAAA,CACA,6DAAA,CACA,gEAAA,CACA,4DAAA,CACA,4DAAA,CACA,6DAAA,CAGA,6CAAA,CAGA,+CAAA,CAGA,2CAAA,CAGA,uDAAA,CACA,6DAAA,CACA,2DAAA,CAGA,yDAAA,CAGA,0DAAA,CAGA,qDAAA,CACA,wDHgRF,CG7QE,oHAIE,4BH4QJ,CGxQE,kHAEE,YH0QJ,CGtQE,gHAEE,eHwQJ,CGnQA,+FAGE,iCHsQF,CACF","file":"palette.css"}
|
52
7.3/demos/docs-demo-timeline.js
Executable file
@ -0,0 +1,52 @@
|
||||
function generateDocsDemoTimeline(timeline, setup_timeline) {
|
||||
let setup;
|
||||
if (setup_timeline) {
|
||||
setup = {
|
||||
timeline: setup_timeline,
|
||||
};
|
||||
}
|
||||
|
||||
const start = {
|
||||
type: jsPsychHtmlButtonResponse,
|
||||
stimulus: "",
|
||||
choices: ["Run demo"],
|
||||
};
|
||||
|
||||
let run = 0;
|
||||
|
||||
let trial = {
|
||||
timeline: timeline,
|
||||
data: {
|
||||
run: () => {
|
||||
return run;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const show_data = {
|
||||
type: jsPsychHtmlButtonResponse,
|
||||
stimulus: `
|
||||
<p style="margin-bottom:0px; font-weight: bold;">Trial data:</p>
|
||||
<pre style="margin-top:0px; text-align:left; font-size:14px; line-height:1.3em;"></pre>`,
|
||||
on_load: function () {
|
||||
const trial_data = jsPsych.data.get().filter({ run: run }).ignore("run").values();
|
||||
const trial_json = JSON.stringify(trial_data, null, 2);
|
||||
jsPsych.getDisplayElement().querySelector("pre").innerText = trial_json;
|
||||
},
|
||||
choices: ["Repeat demo"],
|
||||
};
|
||||
|
||||
const trial_loop = {
|
||||
timeline: [trial, show_data],
|
||||
loop_function: function () {
|
||||
run++;
|
||||
return true;
|
||||
},
|
||||
};
|
||||
|
||||
if (setup_timeline) {
|
||||
return [setup, start, trial_loop];
|
||||
} else {
|
||||
return [start, trial_loop];
|
||||
}
|
||||
}
|
1
7.3/demos/docs-demo.css
Executable file
@ -0,0 +1 @@
|
||||
.jspsych-btn {margin-bottom: 10px;}
|
12
7.3/demos/external_page.html
Executable file
@ -0,0 +1,12 @@
|
||||
<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>
|
171
7.3/demos/eye-tracking-with-webgazer.html
Executable file
@ -0,0 +1,171 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="https://unpkg.com/jspsych@7.3.0"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-preload@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-html-keyboard-response@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-image-keyboard-response@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-webgazer-init-camera@1.0.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-webgazer-calibrate@1.0.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-webgazer-validate@1.0.1"></script>
|
||||
<script src="js/webgazer/webgazer.js"></script>
|
||||
<script src="https://unpkg.com/@jspsych/extension-webgazer@1.0.1"></script>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://unpkg.com/jspsych@7.3.0/css/jspsych.css"
|
||||
/>
|
||||
<link rel="stylesheet" href="docs-demo.css" type="text/css">
|
||||
</head>
|
||||
<body></body>
|
||||
<script>
|
||||
|
||||
var jsPsych = initJsPsych({
|
||||
extensions: [
|
||||
{type: jsPsychExtensionWebgazer}
|
||||
]
|
||||
});
|
||||
|
||||
var preload = {
|
||||
type: jsPsychPreload,
|
||||
images: ['img/blue.png']
|
||||
}
|
||||
|
||||
var camera_instructions = {
|
||||
type: jsPsychHtmlButtonResponse,
|
||||
stimulus: `
|
||||
<p>In order to participate you must allow the experiment to use your camera.</p>
|
||||
<p>You will be prompted to do this on the next screen.</p>
|
||||
<p>If you do not wish to allow use of your camera, you cannot participate in this experiment.<p>
|
||||
<p>It may take up to 30 seconds for the camera to initialize after you give permission.</p>
|
||||
`,
|
||||
choices: ['Got it'],
|
||||
}
|
||||
|
||||
var init_camera = {
|
||||
type: jsPsychWebgazerInitCamera
|
||||
}
|
||||
|
||||
var calibration_instructions = {
|
||||
type: jsPsychHtmlButtonResponse,
|
||||
stimulus: `
|
||||
<p>Now you'll calibrate the eye tracking, so that the software can use the image of your eyes to predict where you are looking.</p>
|
||||
<p>You'll see a series of dots appear on the screen. Look at each dot and click on it.</p>
|
||||
`,
|
||||
choices: ['Got it'],
|
||||
}
|
||||
|
||||
var calibration = {
|
||||
type: jsPsychWebgazerCalibrate,
|
||||
calibration_points: [
|
||||
[25,25],[75,25],[50,50],[25,75],[75,75]
|
||||
],
|
||||
repetitions_per_point: 2,
|
||||
randomize_calibration_order: true
|
||||
}
|
||||
|
||||
var validation_instructions = {
|
||||
type: jsPsychHtmlButtonResponse,
|
||||
stimulus: `
|
||||
<p>Now we'll measure the accuracy of the calibration.</p>
|
||||
<p>Look at each dot as it appears on the screen.</p>
|
||||
<p style="font-weight: bold;">You do not need to click on the dots this time.</p>
|
||||
`,
|
||||
choices: ['Got it'],
|
||||
post_trial_gap: 1000
|
||||
}
|
||||
|
||||
var validation = {
|
||||
type: jsPsychWebgazerValidate,
|
||||
validation_points: [
|
||||
[25,25],[75,25],[50,50],[25,75],[75,75]
|
||||
],
|
||||
roi_radius: 200,
|
||||
time_to_saccade: 1000,
|
||||
validation_duration: 2000,
|
||||
data: {
|
||||
task: 'validate'
|
||||
}
|
||||
}
|
||||
|
||||
var recalibrate_instructions = {
|
||||
type: jsPsychHtmlButtonResponse,
|
||||
stimulus: `
|
||||
<p>The accuracy of the calibration is a little lower than we'd like.</p>
|
||||
<p>Let's try calibrating one more time.</p>
|
||||
<p>On the next screen, look at the dots and click on them.<p>
|
||||
`,
|
||||
choices: ['OK'],
|
||||
}
|
||||
|
||||
var recalibrate = {
|
||||
timeline: [recalibrate_instructions, calibration, validation_instructions, validation],
|
||||
conditional_function: function(){
|
||||
var validation_data = jsPsych.data.get().filter({task: 'validate'}).values()[0];
|
||||
return validation_data.percent_in_roi.some(function(x){
|
||||
var minimum_percent_acceptable = 50;
|
||||
return x < minimum_percent_acceptable;
|
||||
});
|
||||
},
|
||||
data: {
|
||||
phase: 'recalibration'
|
||||
}
|
||||
}
|
||||
|
||||
var calibration_done = {
|
||||
type: jsPsychHtmlButtonResponse,
|
||||
stimulus: `
|
||||
<p>Great, we're done with calibration!</p>
|
||||
`,
|
||||
choices: ['OK']
|
||||
}
|
||||
|
||||
var begin = {
|
||||
type: jsPsychHtmKeyboardResponse,
|
||||
stimulus: `<p>The next screen will show an image to demonstrate adding the webgazer extension to a trial.</p>
|
||||
<p>Just look at the image while eye tracking data is collected. The trial will end automatically.</p>
|
||||
<p>Press any key to start.</p>
|
||||
`
|
||||
}
|
||||
|
||||
const trial = {
|
||||
type: jsPsychImageKeyboardResponse,
|
||||
stimulus: 'img/blue.png',
|
||||
choices: "NO_KEYS",
|
||||
trial_duration: 2000,
|
||||
extensions: [
|
||||
{
|
||||
type: jsPsychExtensionWebgazer,
|
||||
params: {targets: ['#jspsych-image-keyboard-response-stimulus']}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
var show_data = {
|
||||
type: jsPsychHtmKeyboardResponse,
|
||||
stimulus: function() {
|
||||
var trial_data = jsPsych.data.getLastTrialData().values();
|
||||
var trial_json = JSON.stringify(trial_data, null, 2);
|
||||
return `<p style="margin-bottom:0px;"><strong>Trial data:</strong></p>
|
||||
<pre style="margin-top:0px;text-align:left;">${trial_json}</pre>`;
|
||||
},
|
||||
choices: "NO_KEYS"
|
||||
};
|
||||
|
||||
jsPsych.run([
|
||||
preload,
|
||||
camera_instructions,
|
||||
init_camera,
|
||||
calibration_instructions,
|
||||
calibration,
|
||||
validation_instructions,
|
||||
validation,
|
||||
recalibrate,
|
||||
calibration_done,
|
||||
begin,
|
||||
trial,
|
||||
show_data
|
||||
]);
|
||||
|
||||
</script>
|
||||
</html>
|
BIN
7.3/demos/img/1.gif
Executable file
After Width: | Height: | Size: 3.7 KiB |
BIN
7.3/demos/img/10.gif
Executable file
After Width: | Height: | Size: 4.2 KiB |
BIN
7.3/demos/img/11.gif
Executable file
After Width: | Height: | Size: 4.6 KiB |
BIN
7.3/demos/img/12.gif
Executable file
After Width: | Height: | Size: 1.8 KiB |
BIN
7.3/demos/img/2.gif
Executable file
After Width: | Height: | Size: 2.5 KiB |
BIN
7.3/demos/img/3.gif
Executable file
After Width: | Height: | Size: 3.9 KiB |
BIN
7.3/demos/img/4.gif
Executable file
After Width: | Height: | Size: 3.0 KiB |
BIN
7.3/demos/img/5.gif
Executable file
After Width: | Height: | Size: 2.5 KiB |
BIN
7.3/demos/img/6.gif
Executable file
After Width: | Height: | Size: 2.1 KiB |
BIN
7.3/demos/img/7.gif
Executable file
After Width: | Height: | Size: 2.9 KiB |
BIN
7.3/demos/img/8.gif
Executable file
After Width: | Height: | Size: 3.1 KiB |
BIN
7.3/demos/img/9.gif
Executable file
After Width: | Height: | Size: 3.7 KiB |
BIN
7.3/demos/img/backwardN.gif
Executable file
After Width: | Height: | Size: 1.9 KiB |
BIN
7.3/demos/img/blue.png
Executable file
After Width: | Height: | Size: 5.1 KiB |
BIN
7.3/demos/img/card.png
Executable file
After Width: | Height: | Size: 60 KiB |
BIN
7.3/demos/img/con2.png
Executable file
After Width: | Height: | Size: 2.0 KiB |
BIN
7.3/demos/img/elephant.png
Executable file
After Width: | Height: | Size: 12 KiB |
BIN
7.3/demos/img/fixation.gif
Executable file
After Width: | Height: | Size: 1.5 KiB |
BIN
7.3/demos/img/happy_face_1.jpg
Executable file
After Width: | Height: | Size: 6.5 KiB |
BIN
7.3/demos/img/happy_face_2.jpg
Executable file
After Width: | Height: | Size: 6.6 KiB |
BIN
7.3/demos/img/happy_face_3.jpg
Executable file
After Width: | Height: | Size: 8.3 KiB |
BIN
7.3/demos/img/happy_face_4.jpg
Executable file
After Width: | Height: | Size: 6.5 KiB |
BIN
7.3/demos/img/iat_old_face.jpg
Executable file
After Width: | Height: | Size: 7.7 KiB |
BIN
7.3/demos/img/lion.png
Executable file
After Width: | Height: | Size: 16 KiB |
BIN
7.3/demos/img/monkey.png
Executable file
After Width: | Height: | Size: 18 KiB |
BIN
7.3/demos/img/navarro_burst_03.jpg
Executable file
After Width: | Height: | Size: 3.0 MiB |
BIN
7.3/demos/img/normalN.gif
Executable file
After Width: | Height: | Size: 1.9 KiB |
BIN
7.3/demos/img/orange.png
Executable file
After Width: | Height: | Size: 5.2 KiB |
BIN
7.3/demos/img/sad_face_1.jpg
Executable file
After Width: | Height: | Size: 24 KiB |
BIN
7.3/demos/img/sad_face_2.jpg
Executable file
After Width: | Height: | Size: 36 KiB |
BIN
7.3/demos/img/sad_face_3.jpg
Executable file
After Width: | Height: | Size: 29 KiB |
BIN
7.3/demos/img/sad_face_4.jpg
Executable file
After Width: | Height: | Size: 20 KiB |
4451
7.3/demos/js/snap.svg-min.js
vendored
Executable file
136
7.3/demos/js/webgazer/ridgeWorker.mjs
Executable file
@ -0,0 +1,136 @@
|
||||
"use strict";
|
||||
|
||||
console.log("thread starting");
|
||||
|
||||
// Add src/util.mjs and src/mat.mjs to the same directory as your html file
|
||||
importScripts("./worker_scripts/util.js", "./worker_scripts/mat.js"); // [20200708] Figure out how to make all of this wrap up neatly
|
||||
var ridgeParameter = Math.pow(10, -5);
|
||||
var resizeWidth = 10;
|
||||
var resizeHeight = 6;
|
||||
var dataWindow = 700;
|
||||
var trailDataWindow = 10;
|
||||
var trainInterval = 500;
|
||||
|
||||
var screenXClicksArray = new self.webgazer.util.DataWindow(dataWindow);
|
||||
var screenYClicksArray = new self.webgazer.util.DataWindow(dataWindow);
|
||||
var eyeFeaturesClicks = new self.webgazer.util.DataWindow(dataWindow);
|
||||
var dataClicks = new self.webgazer.util.DataWindow(dataWindow);
|
||||
|
||||
var screenXTrailArray = new self.webgazer.util.DataWindow(trailDataWindow);
|
||||
var screenYTrailArray = new self.webgazer.util.DataWindow(trailDataWindow);
|
||||
var eyeFeaturesTrail = new self.webgazer.util.DataWindow(trailDataWindow);
|
||||
var dataTrail = new self.webgazer.util.DataWindow(trailDataWindow);
|
||||
|
||||
/**
|
||||
* Performs ridge regression, according to the Weka code.
|
||||
* @param {Array} y - corresponds to screen coordinates (either x or y) for each of n click events
|
||||
* @param {Array.<Array.<Number>>} X - corresponds to gray pixel features (120 pixels for both eyes) for each of n clicks
|
||||
* @param {Array} k - ridge parameter
|
||||
* @return{Array} regression coefficients
|
||||
*/
|
||||
function ridge(y, X, k) {
|
||||
var nc = X[0].length;
|
||||
var m_Coefficients = new Array(nc);
|
||||
var xt = self.webgazer.mat.transpose(X);
|
||||
var solution = new Array();
|
||||
var success = true;
|
||||
do {
|
||||
var ss = self.webgazer.mat.mult(xt, X);
|
||||
// Set ridge regression adjustment
|
||||
for (var i = 0; i < nc; i++) {
|
||||
ss[i][i] = ss[i][i] + k;
|
||||
}
|
||||
|
||||
// Carry out the regression
|
||||
var bb = self.webgazer.mat.mult(xt, y);
|
||||
for (var i = 0; i < nc; i++) {
|
||||
m_Coefficients[i] = bb[i][0];
|
||||
}
|
||||
try {
|
||||
var n = m_Coefficients.length !== 0 ? m_Coefficients.length / m_Coefficients.length : 0;
|
||||
if (m_Coefficients.length * n !== m_Coefficients.length) {
|
||||
console.log("Array length must be a multiple of m");
|
||||
}
|
||||
solution =
|
||||
ss.length === ss[0].length
|
||||
? self.webgazer.mat.LUDecomposition(ss, bb)
|
||||
: self.webgazer.mat.QRDecomposition(ss, bb);
|
||||
|
||||
for (var i = 0; i < nc; i++) {
|
||||
m_Coefficients[i] = solution[i][0];
|
||||
}
|
||||
success = true;
|
||||
} catch (ex) {
|
||||
k *= 10;
|
||||
console.log(ex);
|
||||
success = false;
|
||||
}
|
||||
} while (!success);
|
||||
return m_Coefficients;
|
||||
}
|
||||
|
||||
//TODO: still usefull ???
|
||||
/**
|
||||
*
|
||||
* @returns {Number}
|
||||
*/
|
||||
function getCurrentFixationIndex() {
|
||||
var index = 0;
|
||||
var recentX = this.screenXTrailArray.get(0);
|
||||
var recentY = this.screenYTrailArray.get(0);
|
||||
for (var i = this.screenXTrailArray.length - 1; i >= 0; i--) {
|
||||
var currX = this.screenXTrailArray.get(i);
|
||||
var currY = this.screenYTrailArray.get(i);
|
||||
var euclideanDistance = Math.sqrt(Math.pow(currX - recentX, 2) + Math.pow(currY - recentY, 2));
|
||||
if (euclideanDistance > 72) {
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event handler, it store screen position to allow training
|
||||
* @param {Event} event - the receive event
|
||||
*/
|
||||
self.onmessage = function (event) {
|
||||
var data = event.data;
|
||||
var screenPos = data["screenPos"];
|
||||
var eyes = data["eyes"];
|
||||
var type = data["type"];
|
||||
if (type === "click") {
|
||||
self.screenXClicksArray.push([screenPos[0]]);
|
||||
self.screenYClicksArray.push([screenPos[1]]);
|
||||
|
||||
self.eyeFeaturesClicks.push(eyes);
|
||||
} else if (type === "move") {
|
||||
self.screenXTrailArray.push([screenPos[0]]);
|
||||
self.screenYTrailArray.push([screenPos[1]]);
|
||||
|
||||
self.eyeFeaturesTrail.push(eyes);
|
||||
self.dataTrail.push({ eyes: eyes, screenPos: screenPos, type: type });
|
||||
}
|
||||
self.needsTraining = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Compute coefficient from training data
|
||||
*/
|
||||
function retrain() {
|
||||
if (self.screenXClicksArray.length === 0) {
|
||||
return;
|
||||
}
|
||||
if (!self.needsTraining) {
|
||||
return;
|
||||
}
|
||||
var screenXArray = self.screenXClicksArray.data.concat(self.screenXTrailArray.data);
|
||||
var screenYArray = self.screenYClicksArray.data.concat(self.screenYTrailArray.data);
|
||||
var eyeFeatures = self.eyeFeaturesClicks.data.concat(self.eyeFeaturesTrail.data);
|
||||
|
||||
var coefficientsX = ridge(screenXArray, eyeFeatures, ridgeParameter);
|
||||
var coefficientsY = ridge(screenYArray, eyeFeatures, ridgeParameter);
|
||||
self.postMessage({ X: coefficientsX, Y: coefficientsY });
|
||||
self.needsTraining = false;
|
||||
}
|
||||
|
||||
setInterval(retrain, trainInterval);
|
99912
7.3/demos/js/webgazer/webgazer.js
Executable file
299
7.3/demos/js/webgazer/worker_scripts/mat.js
Executable file
@ -0,0 +1,299 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
self.webgazer = self.webgazer || {};
|
||||
self.webgazer.mat = self.webgazer.mat || {};
|
||||
|
||||
/**
|
||||
* Transposes an mxn array
|
||||
* @param {Array.<Array.<Number>>} matrix - of 'M x N' dimensionality
|
||||
* @return {Array.<Array.<Number>>} transposed matrix
|
||||
*/
|
||||
self.webgazer.mat.transpose = function (matrix) {
|
||||
var m = matrix.length;
|
||||
var n = matrix[0].length;
|
||||
var transposedMatrix = new Array(n);
|
||||
|
||||
for (var i = 0; i < m; i++) {
|
||||
for (var j = 0; j < n; j++) {
|
||||
if (i === 0) transposedMatrix[j] = new Array(m);
|
||||
transposedMatrix[j][i] = matrix[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
return transposedMatrix;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a sub-matrix of matrix
|
||||
* @param {Array.<Array.<Number>>} matrix - original matrix
|
||||
* @param {Array.<Number>} r - Array of row indices
|
||||
* @param {Number} j0 - Initial column index
|
||||
* @param {Number} j1 - Final column index
|
||||
* @returns {Array} The sub-matrix matrix(r(:),j0:j1)
|
||||
*/
|
||||
self.webgazer.mat.getMatrix = function (matrix, r, j0, j1) {
|
||||
var X = new Array(r.length),
|
||||
m = j1 - j0 + 1;
|
||||
|
||||
for (var i = 0; i < r.length; i++) {
|
||||
X[i] = new Array(m);
|
||||
for (var j = j0; j <= j1; j++) {
|
||||
X[i][j - j0] = matrix[r[i]][j];
|
||||
}
|
||||
}
|
||||
return X;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a submatrix of matrix
|
||||
* @param {Array.<Array.<Number>>} matrix - original matrix
|
||||
* @param {Number} i0 - Initial row index
|
||||
* @param {Number} i1 - Final row index
|
||||
* @param {Number} j0 - Initial column index
|
||||
* @param {Number} j1 - Final column index
|
||||
* @return {Array} The sub-matrix matrix(i0:i1,j0:j1)
|
||||
*/
|
||||
self.webgazer.mat.getSubMatrix = function (matrix, i0, i1, j0, j1) {
|
||||
var size = j1 - j0 + 1,
|
||||
X = new Array(i1 - i0 + 1);
|
||||
|
||||
for (var i = i0; i <= i1; i++) {
|
||||
var subI = i - i0;
|
||||
|
||||
X[subI] = new Array(size);
|
||||
|
||||
for (var j = j0; j <= j1; j++) {
|
||||
X[subI][j - j0] = matrix[i][j];
|
||||
}
|
||||
}
|
||||
return X;
|
||||
};
|
||||
|
||||
/**
|
||||
* Linear algebraic matrix multiplication, matrix1 * matrix2
|
||||
* @param {Array.<Array.<Number>>} matrix1
|
||||
* @param {Array.<Array.<Number>>} matrix2
|
||||
* @return {Array.<Array.<Number>>} Matrix product, matrix1 * matrix2
|
||||
*/
|
||||
self.webgazer.mat.mult = function (matrix1, matrix2) {
|
||||
if (matrix2.length != matrix1[0].length) {
|
||||
console.log("Matrix inner dimensions must agree:");
|
||||
}
|
||||
|
||||
var X = new Array(matrix1.length),
|
||||
Bcolj = new Array(matrix1[0].length);
|
||||
|
||||
for (var j = 0; j < matrix2[0].length; j++) {
|
||||
for (var k = 0; k < matrix1[0].length; k++) {
|
||||
Bcolj[k] = matrix2[k][j];
|
||||
}
|
||||
for (var i = 0; i < matrix1.length; i++) {
|
||||
if (j === 0) X[i] = new Array(matrix2[0].length);
|
||||
|
||||
var Arowi = matrix1[i];
|
||||
var s = 0;
|
||||
for (var k = 0; k < matrix1[0].length; k++) {
|
||||
s += Arowi[k] * Bcolj[k];
|
||||
}
|
||||
X[i][j] = s;
|
||||
}
|
||||
}
|
||||
return X;
|
||||
};
|
||||
|
||||
/**
|
||||
* LUDecomposition to solve A*X = B, based on WEKA code
|
||||
* @param {Array.<Array.<Number>>} A - left matrix of equation to be solved
|
||||
* @param {Array.<Array.<Number>>} B - right matrix of equation to be solved
|
||||
* @return {Array.<Array.<Number>>} X so that L*U*X = B(piv,:)
|
||||
*/
|
||||
self.webgazer.mat.LUDecomposition = function (A, B) {
|
||||
var LU = new Array(A.length);
|
||||
|
||||
for (var i = 0; i < A.length; i++) {
|
||||
LU[i] = new Array(A[0].length);
|
||||
for (var j = 0; j < A[0].length; j++) {
|
||||
LU[i][j] = A[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
var m = A.length;
|
||||
var n = A[0].length;
|
||||
var piv = new Array(m);
|
||||
for (var i = 0; i < m; i++) {
|
||||
piv[i] = i;
|
||||
}
|
||||
var pivsign = 1;
|
||||
var LUrowi = new Array();
|
||||
var LUcolj = new Array(m);
|
||||
// Outer loop.
|
||||
for (var j = 0; j < n; j++) {
|
||||
// Make a copy of the j-th column to localize references.
|
||||
for (var i = 0; i < m; i++) {
|
||||
LUcolj[i] = LU[i][j];
|
||||
}
|
||||
// Apply previous transformations.
|
||||
for (var i = 0; i < m; i++) {
|
||||
LUrowi = LU[i];
|
||||
// Most of the time is spent in the following dot product.
|
||||
var kmax = Math.min(i, j);
|
||||
var s = 0;
|
||||
for (var k = 0; k < kmax; k++) {
|
||||
s += LUrowi[k] * LUcolj[k];
|
||||
}
|
||||
LUrowi[j] = LUcolj[i] -= s;
|
||||
}
|
||||
// Find pivot and exchange if necessary.
|
||||
var p = j;
|
||||
for (var i = j + 1; i < m; i++) {
|
||||
if (Math.abs(LUcolj[i]) > Math.abs(LUcolj[p])) {
|
||||
p = i;
|
||||
}
|
||||
}
|
||||
if (p != j) {
|
||||
for (var k = 0; k < n; k++) {
|
||||
var t = LU[p][k];
|
||||
LU[p][k] = LU[j][k];
|
||||
LU[j][k] = t;
|
||||
}
|
||||
var k = piv[p];
|
||||
piv[p] = piv[j];
|
||||
piv[j] = k;
|
||||
pivsign = -pivsign;
|
||||
}
|
||||
// Compute multipliers.
|
||||
if ((j < m) & (LU[j][j] != 0)) {
|
||||
for (var i = j + 1; i < m; i++) {
|
||||
LU[i][j] /= LU[j][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (B.length != m) {
|
||||
console.log("Matrix row dimensions must agree.");
|
||||
}
|
||||
for (var j = 0; j < n; j++) {
|
||||
if (LU[j][j] === 0) {
|
||||
console.log("Matrix is singular.");
|
||||
}
|
||||
}
|
||||
var nx = B[0].length;
|
||||
var X = self.webgazer.mat.getMatrix(B, piv, 0, nx - 1);
|
||||
// Solve L*Y = B(piv,:)
|
||||
for (var k = 0; k < n; k++) {
|
||||
for (var i = k + 1; i < n; i++) {
|
||||
for (var j = 0; j < nx; j++) {
|
||||
X[i][j] -= X[k][j] * LU[i][k];
|
||||
}
|
||||
}
|
||||
}
|
||||
// Solve U*X = Y;
|
||||
for (var k = n - 1; k >= 0; k--) {
|
||||
for (var j = 0; j < nx; j++) {
|
||||
X[k][j] /= LU[k][k];
|
||||
}
|
||||
for (var i = 0; i < k; i++) {
|
||||
for (var j = 0; j < nx; j++) {
|
||||
X[i][j] -= X[k][j] * LU[i][k];
|
||||
}
|
||||
}
|
||||
}
|
||||
return X;
|
||||
};
|
||||
|
||||
/**
|
||||
* Least squares solution of A*X = B, based on WEKA code
|
||||
* @param {Array.<Array.<Number>>} A - left side matrix to be solved
|
||||
* @param {Array.<Array.<Number>>} B - a matrix with as many rows as A and any number of columns.
|
||||
* @return {Array.<Array.<Number>>} X - that minimizes the two norms of QR*X-B.
|
||||
*/
|
||||
self.webgazer.mat.QRDecomposition = function (A, B) {
|
||||
// Initialize.
|
||||
var QR = new Array(A.length);
|
||||
|
||||
for (var i = 0; i < A.length; i++) {
|
||||
QR[i] = new Array(A[0].length);
|
||||
for (var j = 0; j < A[0].length; j++) {
|
||||
QR[i][j] = A[i][j];
|
||||
}
|
||||
}
|
||||
var m = A.length;
|
||||
var n = A[0].length;
|
||||
var Rdiag = new Array(n);
|
||||
var nrm;
|
||||
|
||||
// Main loop.
|
||||
for (var k = 0; k < n; k++) {
|
||||
// Compute 2-norm of k-th column without under/overflow.
|
||||
nrm = 0;
|
||||
for (var i = k; i < m; i++) {
|
||||
nrm = Math.hypot(nrm, QR[i][k]);
|
||||
}
|
||||
if (nrm != 0) {
|
||||
// Form k-th Householder vector.
|
||||
if (QR[k][k] < 0) {
|
||||
nrm = -nrm;
|
||||
}
|
||||
for (var i = k; i < m; i++) {
|
||||
QR[i][k] /= nrm;
|
||||
}
|
||||
QR[k][k] += 1;
|
||||
|
||||
// Apply transformation to remaining columns.
|
||||
for (var j = k + 1; j < n; j++) {
|
||||
var s = 0;
|
||||
for (var i = k; i < m; i++) {
|
||||
s += QR[i][k] * QR[i][j];
|
||||
}
|
||||
s = -s / QR[k][k];
|
||||
for (var i = k; i < m; i++) {
|
||||
QR[i][j] += s * QR[i][k];
|
||||
}
|
||||
}
|
||||
}
|
||||
Rdiag[k] = -nrm;
|
||||
}
|
||||
if (B.length != m) {
|
||||
console.log("Matrix row dimensions must agree.");
|
||||
}
|
||||
for (var j = 0; j < n; j++) {
|
||||
if (Rdiag[j] === 0) console.log("Matrix is rank deficient");
|
||||
}
|
||||
// Copy right hand side
|
||||
var nx = B[0].length;
|
||||
var X = new Array(B.length);
|
||||
for (var i = 0; i < B.length; i++) {
|
||||
X[i] = new Array(B[0].length);
|
||||
}
|
||||
for (var i = 0; i < B.length; i++) {
|
||||
for (var j = 0; j < B[0].length; j++) {
|
||||
X[i][j] = B[i][j];
|
||||
}
|
||||
}
|
||||
// Compute Y = transpose(Q)*B
|
||||
for (var k = 0; k < n; k++) {
|
||||
for (var j = 0; j < nx; j++) {
|
||||
var s = 0.0;
|
||||
for (var i = k; i < m; i++) {
|
||||
s += QR[i][k] * X[i][j];
|
||||
}
|
||||
s = -s / QR[k][k];
|
||||
for (var i = k; i < m; i++) {
|
||||
X[i][j] += s * QR[i][k];
|
||||
}
|
||||
}
|
||||
}
|
||||
// Solve R*X = Y;
|
||||
for (var k = n - 1; k >= 0; k--) {
|
||||
for (var j = 0; j < nx; j++) {
|
||||
X[k][j] /= Rdiag[k];
|
||||
}
|
||||
for (var i = 0; i < k; i++) {
|
||||
for (var j = 0; j < nx; j++) {
|
||||
X[i][j] -= X[k][j] * QR[i][k];
|
||||
}
|
||||
}
|
||||
}
|
||||
return self.webgazer.mat.getSubMatrix(X, 0, n - 1, 0, nx - 1);
|
||||
};
|
||||
})();
|
391
7.3/demos/js/webgazer/worker_scripts/util.js
Executable file
@ -0,0 +1,391 @@
|
||||
"use strict";
|
||||
(function () {
|
||||
self.webgazer = self.webgazer || {};
|
||||
self.webgazer.util = self.webgazer.util || {};
|
||||
self.webgazer.mat = self.webgazer.mat || {};
|
||||
|
||||
/**
|
||||
* Eye class, represents an eye patch detected in the video stream
|
||||
* @param {ImageData} patch - the image data corresponding to an eye
|
||||
* @param {Number} imagex - x-axis offset from the top-left corner of the video canvas
|
||||
* @param {Number} imagey - y-axis offset from the top-left corner of the video canvas
|
||||
* @param {Number} width - width of the eye patch
|
||||
* @param {Number} height - height of the eye patch
|
||||
*/
|
||||
self.webgazer.util.Eye = function (patch, imagex, imagey, width, height) {
|
||||
this.patch = patch;
|
||||
this.imagex = imagex;
|
||||
this.imagey = imagey;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
};
|
||||
|
||||
//Data Window class
|
||||
//operates like an array but 'wraps' data around to keep the array at a fixed windowSize
|
||||
/**
|
||||
* DataWindow class - Operates like an array, but 'wraps' data around to keep the array at a fixed windowSize
|
||||
* @param {Number} windowSize - defines the maximum size of the window
|
||||
* @param {Array} data - optional data to seed the DataWindow with
|
||||
**/
|
||||
self.webgazer.util.DataWindow = function (windowSize, data) {
|
||||
this.data = [];
|
||||
this.windowSize = windowSize;
|
||||
this.index = 0;
|
||||
this.length = 0;
|
||||
if (data) {
|
||||
this.data = data.slice(data.length - windowSize, data.length);
|
||||
this.length = this.data.length;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* [push description]
|
||||
* @param {*} entry - item to be inserted. It either grows the DataWindow or replaces the oldest item
|
||||
* @return {DataWindow} this
|
||||
*/
|
||||
self.webgazer.util.DataWindow.prototype.push = function (entry) {
|
||||
if (this.data.length < this.windowSize) {
|
||||
this.data.push(entry);
|
||||
this.length = this.data.length;
|
||||
return this;
|
||||
}
|
||||
|
||||
//replace oldest entry by wrapping around the DataWindow
|
||||
this.data[this.index] = entry;
|
||||
this.index = (this.index + 1) % this.windowSize;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the element at the ind position by wrapping around the DataWindow
|
||||
* @param {Number} ind index of desired entry
|
||||
* @return {*}
|
||||
*/
|
||||
self.webgazer.util.DataWindow.prototype.get = function (ind) {
|
||||
return this.data[this.getTrueIndex(ind)];
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the true this.data array index given an index for a desired element
|
||||
* @param {Number} ind - index of desired entry
|
||||
* @return {Number} index of desired entry in this.data
|
||||
*/
|
||||
self.webgazer.util.DataWindow.prototype.getTrueIndex = function (ind) {
|
||||
if (this.data.length < this.windowSize) {
|
||||
return ind;
|
||||
} else {
|
||||
//wrap around ind so that we can traverse from oldest to newest
|
||||
return (ind + this.index) % this.windowSize;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Append all the contents of data
|
||||
* @param {Array} data - to be inserted
|
||||
*/
|
||||
self.webgazer.util.DataWindow.prototype.addAll = function (data) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
this.push(data[i]);
|
||||
}
|
||||
};
|
||||
|
||||
//Helper functions
|
||||
/**
|
||||
* Grayscales an image patch. Can be used for the whole canvas, detected face, detected eye, etc.
|
||||
*
|
||||
* Code from tracking.js by Eduardo Lundgren, et al.
|
||||
* https://github.com/eduardolundgren/tracking.js/blob/master/src/tracking.js
|
||||
*
|
||||
* Software License Agreement (BSD License) Copyright (c) 2014, Eduardo A. Lundgren Melo. All rights reserved.
|
||||
* Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* The name of Eduardo A. Lundgren Melo may not be used to endorse or promote products derived from this software without specific prior written permission of Eduardo A. Lundgren Melo.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @param {Array} pixels - image data to be grayscaled
|
||||
* @param {Number} width - width of image data to be grayscaled
|
||||
* @param {Number} height - height of image data to be grayscaled
|
||||
* @return {Array} grayscaledImage
|
||||
*/
|
||||
self.webgazer.util.grayscale = function (pixels, width, height) {
|
||||
var gray = new Uint8ClampedArray(pixels.length >> 2);
|
||||
var p = 0;
|
||||
var w = 0;
|
||||
for (var i = 0; i < height; i++) {
|
||||
for (var j = 0; j < width; j++) {
|
||||
var value = pixels[w] * 0.299 + pixels[w + 1] * 0.587 + pixels[w + 2] * 0.114;
|
||||
gray[p++] = value;
|
||||
|
||||
w += 4;
|
||||
}
|
||||
}
|
||||
return gray;
|
||||
};
|
||||
|
||||
/**
|
||||
* Increase contrast of an image.
|
||||
*
|
||||
* Code from Martin Tschirsich, Copyright (c) 2012.
|
||||
* https://github.com/mtschirs/js-objectdetect/blob/gh-pages/js/objectdetect.js
|
||||
*
|
||||
* @param {Array} src - grayscale integer array
|
||||
* @param {Number} step - sampling rate, control performance
|
||||
* @param {Array} dst - array to hold the resulting image
|
||||
*/
|
||||
self.webgazer.util.equalizeHistogram = function (src, step, dst) {
|
||||
var srcLength = src.length;
|
||||
if (!dst) dst = src;
|
||||
if (!step) step = 5;
|
||||
|
||||
// Compute histogram and histogram sum:
|
||||
var hist = [
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
];
|
||||
|
||||
for (var i = 0; i < srcLength; i += step) {
|
||||
++hist[src[i]];
|
||||
}
|
||||
|
||||
// Compute integral histogram:
|
||||
var norm = (255 * step) / srcLength,
|
||||
prev = 0;
|
||||
for (var i = 0; i < 256; ++i) {
|
||||
var h = hist[i];
|
||||
prev = h += prev;
|
||||
hist[i] = h * norm; // For non-integer src: ~~(h * norm + 0.5);
|
||||
}
|
||||
|
||||
// Equalize image:
|
||||
for (var i = 0; i < srcLength; ++i) {
|
||||
dst[i] = hist[src[i]];
|
||||
}
|
||||
return dst;
|
||||
};
|
||||
|
||||
self.webgazer.util.threshold = function (data, threshold) {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
data[i] = data[i] > threshold ? 255 : 0;
|
||||
}
|
||||
return data;
|
||||
};
|
||||
|
||||
self.webgazer.util.correlation = function (data1, data2) {
|
||||
const length = Math.min(data1.length, data2.length);
|
||||
let count = 0;
|
||||
for (let i = 0; i < length; i++) {
|
||||
if (data1[i] === data2[i]) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count / Math.max(data1.length, data2.length);
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets an Eye object and resizes it to the desired resolution
|
||||
* @param {webgazer.util.Eye} eye - patch to be resized
|
||||
* @param {Number} resizeWidth - desired width
|
||||
* @param {Number} resizeHeight - desired height
|
||||
* @return {webgazer.util.Eye} resized eye patch
|
||||
*/
|
||||
self.webgazer.util.resizeEye = function (eye, resizeWidth, resizeHeight) {
|
||||
var canvas = document.createElement("canvas");
|
||||
canvas.width = eye.width;
|
||||
canvas.height = eye.height;
|
||||
|
||||
canvas.getContext("2d").putImageData(eye.patch, 0, 0);
|
||||
|
||||
var tempCanvas = document.createElement("canvas");
|
||||
|
||||
tempCanvas.width = resizeWidth;
|
||||
tempCanvas.height = resizeHeight;
|
||||
|
||||
// save the canvas into temp canvas
|
||||
tempCanvas
|
||||
.getContext("2d")
|
||||
.drawImage(canvas, 0, 0, canvas.width, canvas.height, 0, 0, resizeWidth, resizeHeight);
|
||||
|
||||
return tempCanvas.getContext("2d").getImageData(0, 0, resizeWidth, resizeHeight);
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if the prediction is within the boundaries of the viewport and constrains it
|
||||
* @param {Array} prediction [x,y] - predicted gaze coordinates
|
||||
* @return {Array} constrained coordinates
|
||||
*/
|
||||
self.webgazer.util.bound = function (prediction) {
|
||||
if (prediction.x < 0) prediction.x = 0;
|
||||
if (prediction.y < 0) prediction.y = 0;
|
||||
var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
|
||||
var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
|
||||
if (prediction.x > w) {
|
||||
prediction.x = w;
|
||||
}
|
||||
|
||||
if (prediction.y > h) {
|
||||
prediction.y = h;
|
||||
}
|
||||
return prediction;
|
||||
};
|
||||
|
||||
/**
|
||||
* Write statistics in debug paragraph panel
|
||||
* @param {HTMLElement} para - The <p> tag where write data
|
||||
* @param {Object} stats - The stats data to output
|
||||
*/
|
||||
function debugBoxWrite(para, stats) {
|
||||
var str = "";
|
||||
for (var key in stats) {
|
||||
str += key + ": " + stats[key] + "\n";
|
||||
}
|
||||
para.innerText = str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor of DebugBox object,
|
||||
* it insert an paragraph inside a div to the body, in view to display debug data
|
||||
* @param {Number} interval - The log interval
|
||||
* @constructor
|
||||
*/
|
||||
self.webgazer.util.DebugBox = function (interval) {
|
||||
this.para = document.createElement("p");
|
||||
this.div = document.createElement("div");
|
||||
this.div.appendChild(this.para);
|
||||
document.body.appendChild(this.div);
|
||||
|
||||
this.buttons = {};
|
||||
this.canvas = {};
|
||||
this.stats = {};
|
||||
var updateInterval = interval || 300;
|
||||
(function (localThis) {
|
||||
setInterval(function () {
|
||||
debugBoxWrite(localThis.para, localThis.stats);
|
||||
}, updateInterval);
|
||||
})(this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Add stat data for log
|
||||
* @param {String} key - The data key
|
||||
* @param {*} value - The value
|
||||
*/
|
||||
self.webgazer.util.DebugBox.prototype.set = function (key, value) {
|
||||
this.stats[key] = value;
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize stats in case where key does not exist, else
|
||||
* increment value for key
|
||||
* @param {String} key - The key to process
|
||||
* @param {Number} incBy - Value to increment for given key (default: 1)
|
||||
* @param {Number} init - Initial value in case where key does not exist (default: 0)
|
||||
*/
|
||||
self.webgazer.util.DebugBox.prototype.inc = function (key, incBy, init) {
|
||||
if (!this.stats[key]) {
|
||||
this.stats[key] = init || 0;
|
||||
}
|
||||
this.stats[key] += incBy || 1;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a button and register the given function to the button click event
|
||||
* @param {String} name - The button name to link
|
||||
* @param {Function} func - The onClick callback
|
||||
*/
|
||||
self.webgazer.util.DebugBox.prototype.addButton = function (name, func) {
|
||||
if (!this.buttons[name]) {
|
||||
this.buttons[name] = document.createElement("button");
|
||||
this.div.appendChild(this.buttons[name]);
|
||||
}
|
||||
var button = this.buttons[name];
|
||||
this.buttons[name] = button;
|
||||
button.addEventListener("click", func);
|
||||
button.innerText = name;
|
||||
};
|
||||
|
||||
/**
|
||||
* Search for a canvas elemenet with name, or create on if not exist.
|
||||
* Then send the canvas element as callback parameter.
|
||||
* @param {String} name - The canvas name to send/create
|
||||
* @param {Function} func - The callback function where send canvas
|
||||
*/
|
||||
self.webgazer.util.DebugBox.prototype.show = function (name, func) {
|
||||
if (!this.canvas[name]) {
|
||||
this.canvas[name] = document.createElement("canvas");
|
||||
this.div.appendChild(this.canvas[name]);
|
||||
}
|
||||
var canvas = this.canvas[name];
|
||||
canvas.getContext("2d").clearRect(0, 0, canvas.width, canvas.height);
|
||||
func(canvas);
|
||||
};
|
||||
|
||||
/**
|
||||
* Kalman Filter constructor
|
||||
* Kalman filters work by reducing the amount of noise in a models.
|
||||
* https://blog.cordiner.net/2011/05/03/object-tracking-using-a-kalman-filter-matlab/
|
||||
*
|
||||
* @param {Array.<Array.<Number>>} F - transition matrix
|
||||
* @param {Array.<Array.<Number>>} Q - process noise matrix
|
||||
* @param {Array.<Array.<Number>>} H - maps between measurement vector and noise matrix
|
||||
* @param {Array.<Array.<Number>>} R - defines measurement error of the device
|
||||
* @param {Array} P_initial - the initial state
|
||||
* @param {Array} X_initial - the initial state of the device
|
||||
*/
|
||||
self.webgazer.util.KalmanFilter = function (F, H, Q, R, P_initial, X_initial) {
|
||||
this.F = F; // State transition matrix
|
||||
this.Q = Q; // Process noise matrix
|
||||
this.H = H; // Transformation matrix
|
||||
this.R = R; // Measurement Noise
|
||||
this.P = P_initial; //Initial covariance matrix
|
||||
this.X = X_initial; //Initial guess of measurement
|
||||
};
|
||||
|
||||
/**
|
||||
* Get Kalman next filtered value and update the internal state
|
||||
* @param {Array} z - the new measurement
|
||||
* @return {Array}
|
||||
*/
|
||||
self.webgazer.util.KalmanFilter.prototype.update = function (z) {
|
||||
// Here, we define all the different matrix operations we will need
|
||||
var add = numeric.add,
|
||||
sub = numeric.sub,
|
||||
inv = numeric.inv,
|
||||
identity = numeric.identity;
|
||||
var mult = webgazer.mat.mult,
|
||||
transpose = webgazer.mat.transpose;
|
||||
//TODO cache variables like the transpose of H
|
||||
|
||||
// prediction: X = F * X | P = F * P * F' + Q
|
||||
var X_p = mult(this.F, this.X); //Update state vector
|
||||
var P_p = add(mult(mult(this.F, this.P), transpose(this.F)), this.Q); //Predicted covaraince
|
||||
|
||||
//Calculate the update values
|
||||
var y = sub(z, mult(this.H, X_p)); // This is the measurement error (between what we expect and the actual value)
|
||||
var S = add(mult(mult(this.H, P_p), transpose(this.H)), this.R); //This is the residual covariance (the error in the covariance)
|
||||
|
||||
// kalman multiplier: K = P * H' * (H * P * H' + R)^-1
|
||||
var K = mult(P_p, mult(transpose(this.H), inv(S))); //This is the Optimal Kalman Gain
|
||||
|
||||
//We need to change Y into it's column vector form
|
||||
for (var i = 0; i < y.length; i++) {
|
||||
y[i] = [y[i]];
|
||||
}
|
||||
|
||||
//Now we correct the internal values of the model
|
||||
// correction: X = X + K * (m - H * X) | P = (I - K * H) * P
|
||||
this.X = add(X_p, mult(K, y));
|
||||
this.P = mult(sub(identity(K.length), mult(K, this.H)), P_p);
|
||||
return transpose(mult(this.H, this.X))[0]; //Transforms the predicted state back into it's measurement form
|
||||
};
|
||||
})();
|
51
7.3/demos/jspsych-animation-demo.html
Executable file
@ -0,0 +1,51 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="docs-demo-timeline.js"></script>
|
||||
<script src="https://unpkg.com/jspsych@7.3.0"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-animation@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-preload@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.1"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.0/css/jspsych.css" />
|
||||
<style>
|
||||
#jspsych-animation-image {
|
||||
height: 80% !important;
|
||||
width: 80% !important;
|
||||
}
|
||||
.jspsych-btn {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body></body>
|
||||
<script>
|
||||
|
||||
const jsPsych = initJsPsych();
|
||||
|
||||
var preload_trial = {
|
||||
type: jsPsychPreload,
|
||||
auto_preload: true
|
||||
}
|
||||
|
||||
var animation_trial = {
|
||||
type: jsPsychAnimation,
|
||||
stimuli: [
|
||||
'img/happy_face_1.jpg',
|
||||
'img/happy_face_2.jpg',
|
||||
'img/happy_face_3.jpg',
|
||||
'img/happy_face_4.jpg'
|
||||
],
|
||||
sequence_reps: 3,
|
||||
frame_time: 300,
|
||||
prompt: '<p style="margin-top:0px;">Watch the faces.</p>'
|
||||
};
|
||||
|
||||
const timeline = [animation_trial];
|
||||
|
||||
if (typeof jsPsych !== "undefined") {
|
||||
jsPsych.run(generateDocsDemoTimeline(timeline, [preload_trial]));
|
||||
} else {
|
||||
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
|
||||
}
|
||||
</script>
|
||||
</html>
|
38
7.3/demos/jspsych-audio-button-response-demo-1.html
Executable file
@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="docs-demo-timeline.js"></script>
|
||||
<script src="https://unpkg.com/jspsych@7.3.0"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-audio-button-response@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-preload@1.1.1"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.0/css/jspsych.css" />
|
||||
</head>
|
||||
<body></body>
|
||||
<script>
|
||||
|
||||
const jsPsych = initJsPsych();
|
||||
|
||||
const timeline = [];
|
||||
|
||||
const preload = {
|
||||
type: jsPsychPreload,
|
||||
auto_preload: true
|
||||
};
|
||||
|
||||
const trial = {
|
||||
type: jsPsychAudioButtonResponse,
|
||||
stimulus: 'sound/tone.mp3',
|
||||
choices: ['Low', 'High'],
|
||||
prompt: "<p>Is the pitch high or low?</p>"
|
||||
};
|
||||
|
||||
timeline.push(trial);
|
||||
|
||||
if (typeof jsPsych !== "undefined") {
|
||||
jsPsych.run(generateDocsDemoTimeline(timeline, [preload]));
|
||||
} else {
|
||||
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
|
||||
}
|
||||
</script>
|
||||
</html>
|
44
7.3/demos/jspsych-audio-button-response-demo-2.html
Executable file
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="docs-demo-timeline.js"></script>
|
||||
<script src="https://unpkg.com/jspsych@7.3.0"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-audio-button-response@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-preload@1.1.1"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.0/css/jspsych.css" />
|
||||
</head>
|
||||
<body></body>
|
||||
<script>
|
||||
|
||||
const jsPsych = initJsPsych();
|
||||
|
||||
const timeline = [];
|
||||
|
||||
// sound source: https://www.videvo.net/sound-effect/lion-growl-angry-gene-pe931902/249942/
|
||||
// images source: http://clipart-library.com/cartoon-animal-clipart.html
|
||||
const images = ['img/lion.png', 'img/elephant.png', 'img/monkey.png']
|
||||
|
||||
const preload = {
|
||||
type: jsPsychPreload,
|
||||
auto_preload: true,
|
||||
images: images
|
||||
}
|
||||
|
||||
const trial = {
|
||||
type: jsPsychAudioButtonResponse,
|
||||
stimulus: 'sound/roar.mp3',
|
||||
choices: images,
|
||||
prompt: "<p>Which animal made the sound?</p>",
|
||||
button_html: '<img src="%choice%" />'
|
||||
};
|
||||
|
||||
timeline.push(trial);
|
||||
|
||||
if (typeof jsPsych !== "undefined") {
|
||||
jsPsych.run(generateDocsDemoTimeline(timeline, [preload]));
|
||||
} else {
|
||||
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
|
||||
}
|
||||
</script>
|
||||
</html>
|
37
7.3/demos/jspsych-audio-keyboard-response-demo-1.html
Executable file
@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="docs-demo-timeline.js"></script>
|
||||
<script src="https://unpkg.com/jspsych@7.3.0"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-audio-keyboard-response@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-preload@1.1.1"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.0/css/jspsych.css" />
|
||||
</head>
|
||||
<body></body>
|
||||
<script>
|
||||
|
||||
const jsPsych = initJsPsych();
|
||||
|
||||
const preload = {
|
||||
type: jsPsychPreload,
|
||||
auto_preload: true
|
||||
}
|
||||
|
||||
const trial = {
|
||||
type: jsPsychAudioKeyboardResponse,
|
||||
stimulus: 'sound/tone.mp3',
|
||||
choices: ['e', 'i'],
|
||||
prompt: "<p>Is the pitch high or low? Press 'e' for low and 'i' for high.</p>",
|
||||
response_ends_trial: true
|
||||
};
|
||||
|
||||
const timeline = [trial];
|
||||
|
||||
if (typeof jsPsych !== "undefined") {
|
||||
jsPsych.run(generateDocsDemoTimeline(timeline, [preload]));
|
||||
} else {
|
||||
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
|
||||
}
|
||||
</script>
|
||||
</html>
|
37
7.3/demos/jspsych-audio-keyboard-response-demo-2.html
Executable file
@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="docs-demo-timeline.js"></script>
|
||||
<script src="https://unpkg.com/jspsych@7.3.0"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-audio-keyboard-response@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-preload@1.1.1"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.0/css/jspsych.css" />
|
||||
</head>
|
||||
<body></body>
|
||||
<script>
|
||||
|
||||
const jsPsych = initJsPsych();
|
||||
|
||||
const preload = {
|
||||
type: jsPsychPreload,
|
||||
auto_preload: true
|
||||
}
|
||||
|
||||
|
||||
const trial = {
|
||||
type: jsPsychAudioKeyboardResponse,
|
||||
stimulus: 'sound/tone.mp3',
|
||||
choices: "NO_KEYS",
|
||||
trial_ends_after_audio: true
|
||||
};
|
||||
|
||||
const timeline = [trial];
|
||||
|
||||
if (typeof jsPsych !== "undefined") {
|
||||
jsPsych.run(generateDocsDemoTimeline(timeline, [preload]));
|
||||
} else {
|
||||
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
|
||||
}
|
||||
</script>
|
||||
</html>
|
36
7.3/demos/jspsych-audio-slider-response-demo-1.html
Executable file
@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="docs-demo-timeline.js"></script>
|
||||
<script src="https://unpkg.com/jspsych@7.3.0"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-audio-slider-response@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-preload@1.1.1"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.0/css/jspsych.css" />
|
||||
</head>
|
||||
<body></body>
|
||||
<script>
|
||||
|
||||
const jsPsych = initJsPsych();
|
||||
|
||||
const preload = {
|
||||
type: jsPsychPreload,
|
||||
auto_preload: true
|
||||
};
|
||||
|
||||
const trial = {
|
||||
type: jsPsychAudioSliderResponse,
|
||||
stimulus: 'sound/speech_joke.mp3',
|
||||
labels: ['Not Funny', 'Funny'],
|
||||
prompt: '<p>How funny is the joke?</p>'
|
||||
};
|
||||
|
||||
const timeline = [trial];
|
||||
|
||||
if (typeof jsPsych !== "undefined") {
|
||||
jsPsych.run(generateDocsDemoTimeline(timeline, [preload]));
|
||||
} else {
|
||||
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
|
||||
}
|
||||
</script>
|
||||
</html>
|
38
7.3/demos/jspsych-audio-slider-response-demo-2.html
Executable file
@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="docs-demo-timeline.js"></script>
|
||||
<script src="https://unpkg.com/jspsych@7.3.0"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-audio-slider-response@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-preload@1.1.1"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.0/css/jspsych.css" />
|
||||
</head>
|
||||
<body></body>
|
||||
<script>
|
||||
|
||||
const jsPsych = initJsPsych();
|
||||
|
||||
const preload = {
|
||||
type: jsPsychPreload,
|
||||
auto_preload: true
|
||||
};
|
||||
|
||||
const trial = {
|
||||
type: jsPsychAudioSliderResponse,
|
||||
stimulus: 'sound/speech_joke.mp3',
|
||||
labels: ['Not Funny', 'Funny'],
|
||||
prompt: '<p>How funny is the joke?</p>',
|
||||
response_allowed_while_playing: false,
|
||||
require_movement: true
|
||||
};
|
||||
|
||||
const timeline = [trial];
|
||||
|
||||
if (typeof jsPsych !== "undefined") {
|
||||
jsPsych.run(generateDocsDemoTimeline(timeline, [preload]));
|
||||
} else {
|
||||
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
|
||||
}
|
||||
</script>
|
||||
</html>
|
27
7.3/demos/jspsych-browser-check-demo1.html
Executable file
@ -0,0 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="docs-demo-timeline.js"></script>
|
||||
<script src="https://unpkg.com/jspsych@7.3.0"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-browser-check@1.0.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.1"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.0/css/jspsych.css" />
|
||||
</head>
|
||||
<body></body>
|
||||
<script>
|
||||
|
||||
const jsPsych = initJsPsych();
|
||||
|
||||
const trial = {
|
||||
type: jsPsychBrowserCheck
|
||||
};
|
||||
|
||||
const timeline = [trial];
|
||||
|
||||
if (typeof jsPsych !== "undefined") {
|
||||
jsPsych.run(generateDocsDemoTimeline(timeline));
|
||||
} else {
|
||||
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
|
||||
}
|
||||
</script>
|
||||
</html>
|
31
7.3/demos/jspsych-browser-check-demo2.html
Executable file
@ -0,0 +1,31 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="docs-demo-timeline.js"></script>
|
||||
<script src="https://unpkg.com/jspsych@7.3.0"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-browser-check@1.0.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.1"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.0/css/jspsych.css" />
|
||||
</head>
|
||||
<body></body>
|
||||
<script>
|
||||
|
||||
const jsPsych = initJsPsych();
|
||||
|
||||
const trial = {
|
||||
type: jsPsychBrowserCheck,
|
||||
inclusion_function: (data) => {
|
||||
return ['chrome', 'firefox'].includes(data.browser);
|
||||
},
|
||||
exclusion_message: `<p>You must use Chrome or Firefox to complete this experiment.</p>`
|
||||
};
|
||||
|
||||
const timeline = [trial];
|
||||
|
||||
if (typeof jsPsych !== "undefined") {
|
||||
jsPsych.run(generateDocsDemoTimeline(timeline));
|
||||
} else {
|
||||
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
|
||||
}
|
||||
</script>
|
||||
</html>
|
35
7.3/demos/jspsych-browser-check-demo3.html
Executable file
@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="docs-demo-timeline.js"></script>
|
||||
<script src="https://unpkg.com/jspsych@7.3.0"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-browser-check@1.0.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.1"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.0/css/jspsych.css" />
|
||||
</head>
|
||||
<body></body>
|
||||
<script>
|
||||
|
||||
const jsPsych = initJsPsych();
|
||||
|
||||
const instructions = {
|
||||
type: jsPsychHtmlButtonResponse,
|
||||
stimulus: '<p>If you want to test the interactive resize, make your browser window small before continuing.</p>',
|
||||
choices: ['OK']
|
||||
};
|
||||
|
||||
const trial = {
|
||||
type: jsPsychBrowserCheck,
|
||||
minimum_width: 1000,
|
||||
minimum_height: 600
|
||||
};
|
||||
|
||||
const timeline = [instructions, trial];
|
||||
|
||||
if (typeof jsPsych !== "undefined") {
|
||||
jsPsych.run(generateDocsDemoTimeline(timeline));
|
||||
} else {
|
||||
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
|
||||
}
|
||||
</script>
|
||||
</html>
|
37
7.3/demos/jspsych-browser-check-demo4.html
Executable file
@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="docs-demo-timeline.js"></script>
|
||||
<script src="https://unpkg.com/jspsych@7.3.0"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-browser-check@1.0.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.1"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.0/css/jspsych.css" />
|
||||
</head>
|
||||
<body></body>
|
||||
<script>
|
||||
|
||||
const jsPsych = initJsPsych();
|
||||
|
||||
const trial = {
|
||||
type: jsPsychBrowserCheck,
|
||||
inclusion_function: (data) => {
|
||||
return data.browser == 'chrome' && data.mobile === false
|
||||
},
|
||||
exclusion_message: (data) => {
|
||||
if(data.mobile){
|
||||
return '<p>You must use a desktop/laptop computer to participate in this experiment.</p>';
|
||||
} else if(data.browser !== 'chrome'){
|
||||
return '<p>You must use Chrome as your browser to complete this experiment.</p>'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const timeline = [trial];
|
||||
|
||||
if (typeof jsPsych !== "undefined") {
|
||||
jsPsych.run(generateDocsDemoTimeline(timeline));
|
||||
} else {
|
||||
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
|
||||
}
|
||||
</script>
|
||||
</html>
|
33
7.3/demos/jspsych-call-function-demo1.html
Executable file
@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="docs-demo-timeline.js"></script>
|
||||
<script src="https://unpkg.com/jspsych@7.3.0"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-call-function@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.1"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.0/css/jspsych.css" />
|
||||
<link rel="stylesheet" href="docs-demo.css" type="text/css" />
|
||||
</head>
|
||||
<body></body>
|
||||
<script>
|
||||
|
||||
const jsPsych = initJsPsych();
|
||||
|
||||
const myfunc = function() {
|
||||
return 'you called?';
|
||||
}
|
||||
|
||||
const trial = {
|
||||
type: jsPsychCallFunction,
|
||||
func: myfunc
|
||||
}
|
||||
|
||||
const timeline = [trial];
|
||||
|
||||
if (typeof jsPsych !== "undefined") {
|
||||
jsPsych.run(generateDocsDemoTimeline(timeline));
|
||||
} else {
|
||||
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
|
||||
}
|
||||
</script>
|
||||
</html>
|
38
7.3/demos/jspsych-call-function-demo2.html
Executable file
@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="docs-demo-timeline.js"></script>
|
||||
<script src="https://unpkg.com/jspsych@7.3.0"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-call-function@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.1"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.0/css/jspsych.css" />
|
||||
<link rel="stylesheet" href="docs-demo.css" type="text/css" />
|
||||
</head>
|
||||
<body></body>
|
||||
<script>
|
||||
|
||||
const jsPsych = initJsPsych();
|
||||
|
||||
// Using an anonymous function to pass variables
|
||||
|
||||
const myfunc = function(data){
|
||||
// data contains all the experiment data so far,
|
||||
// so this function could implement code to write
|
||||
// the data to a database.
|
||||
console.log(data.values())
|
||||
}
|
||||
|
||||
const trial = {
|
||||
type: jsPsychCallFunction,
|
||||
func: function(){ myfunc(jsPsych.data.get()) }
|
||||
}
|
||||
|
||||
const timeline = [trial];
|
||||
|
||||
if (typeof jsPsych !== "undefined") {
|
||||
jsPsych.run(generateDocsDemoTimeline(timeline));
|
||||
} else {
|
||||
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
|
||||
}
|
||||
</script>
|
||||
</html>
|
39
7.3/demos/jspsych-call-function-demo3.html
Executable file
@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="docs-demo-timeline.js"></script>
|
||||
<script src="https://unpkg.com/jspsych@7.3.0"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-call-function@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.1"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.0/css/jspsych.css" />
|
||||
<link rel="stylesheet" href="docs-demo.css" type="text/css" />
|
||||
</head>
|
||||
<body></body>
|
||||
<script>
|
||||
|
||||
const jsPsych = initJsPsych();
|
||||
|
||||
const trial = {
|
||||
type: jsPsychCallFunction,
|
||||
async: true,
|
||||
func: function(done){
|
||||
// generate a delay between 1500 and 3000 milliseconds to simulate
|
||||
// waiting for an event to finish after an unknown duration,
|
||||
// then finish the trial
|
||||
const rand_delay = (Math.floor(Math.random() * (3000 - 1500 + 1) + 1500));
|
||||
jsPsych.pluginAPI.setTimeout(function() {
|
||||
// end the trial and save the delay duration to the data
|
||||
done(rand_delay.toString()+"ms");
|
||||
}, rand_delay)
|
||||
}
|
||||
};
|
||||
|
||||
const timeline = [trial];
|
||||
|
||||
if (typeof jsPsych !== "undefined") {
|
||||
jsPsych.run(generateDocsDemoTimeline(timeline));
|
||||
} else {
|
||||
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
|
||||
}
|
||||
</script>
|
||||
</html>
|
58
7.3/demos/jspsych-canvas-button-response-demo1.html
Executable file
@ -0,0 +1,58 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="docs-demo-timeline.js"></script>
|
||||
<script src="https://unpkg.com/jspsych@7.3.0"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-canvas-button-response@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.1"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.0/css/jspsych.css" />
|
||||
<link rel="stylesheet" href="docs-demo.css" type="text/css" />
|
||||
</head>
|
||||
<body></body>
|
||||
<script>
|
||||
|
||||
const jsPsych = initJsPsych();
|
||||
|
||||
// stimulus function that takes the canvas and additional parameters (radius, color)
|
||||
// this can be called inside of an anonymous stimulus function, which takes the canvas (c) as its only argument
|
||||
function filledCirc(canvas, radius, color) {
|
||||
var ctx = canvas.getContext("2d");
|
||||
ctx.beginPath();
|
||||
ctx.arc(150, 150, radius, 0, 2 * Math.PI);
|
||||
ctx.fillStyle = color;
|
||||
ctx.fill();
|
||||
}
|
||||
|
||||
const circle_1 = {
|
||||
type: jsPsychCanvasButtonResponse,
|
||||
stimulus: function(c) {
|
||||
filledCirc(c, 100, 'blue');
|
||||
},
|
||||
canvas_size: [300, 300],
|
||||
choices: ['Red', 'Green', 'Blue'],
|
||||
prompt: '<p>What color is the circle?</p>',
|
||||
data: {color: 'blue', radius: 100}
|
||||
};
|
||||
|
||||
const circle_2 = {
|
||||
type: jsPsychCanvasButtonResponse,
|
||||
stimulus: function(c) {
|
||||
filledCirc(c, 150, 'green');
|
||||
},
|
||||
canvas_size: [300, 300],
|
||||
choices: ['Larger', 'Smaller'],
|
||||
stimulus_duration: 1000,
|
||||
prompt: '<p>Is this circle larger or smaller than the last one?</p>'+
|
||||
'<p>Stimulus will be hidden after 1 second.</p>',
|
||||
data: {color: 'green', radius: 150}
|
||||
};
|
||||
|
||||
const timeline = [circle_1, circle_2];
|
||||
|
||||
if (typeof jsPsych !== "undefined") {
|
||||
jsPsych.run(generateDocsDemoTimeline(timeline));
|
||||
} else {
|
||||
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
|
||||
}
|
||||
</script>
|
||||
</html>
|
51
7.3/demos/jspsych-canvas-button-response-demo2.html
Executable file
@ -0,0 +1,51 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="docs-demo-timeline.js"></script>
|
||||
<script src="https://unpkg.com/jspsych@7.3.0"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-canvas-button-response@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.1"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.0/css/jspsych.css" />
|
||||
<link rel="stylesheet" href="docs-demo.css" type="text/css" />
|
||||
</head>
|
||||
<body></body>
|
||||
<script>
|
||||
|
||||
const jsPsych = initJsPsych();
|
||||
|
||||
// write the canvas stimulus drawing function without using a named function
|
||||
// the anonymous function must take the canvas as an argument
|
||||
const lines = {
|
||||
type: jsPsychCanvasButtonResponse,
|
||||
stimulus: function(c) {
|
||||
const ctx = c.getContext("2d");
|
||||
// first line
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(200, 10);
|
||||
ctx.lineTo(200, 250);
|
||||
ctx.lineWidth = 10;
|
||||
ctx.strokeStyle = 'MediumBlue';
|
||||
ctx.stroke();
|
||||
// second line
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(20, 100);
|
||||
ctx.lineTo(100, 250);
|
||||
ctx.lineWidth = 10;
|
||||
ctx.strokeStyle = 'MediumPurple';
|
||||
ctx.stroke();
|
||||
},
|
||||
canvas_size: [300, 300],
|
||||
choices: ['Blue line', 'Purple line'],
|
||||
prompt: '<p>Which line is longer?</p>',
|
||||
data: {line1_color: 'blue', line1_length: 290, line2_color: "purple", line2_length: 170}
|
||||
};
|
||||
|
||||
const timeline = [lines];
|
||||
|
||||
if (typeof jsPsych !== "undefined") {
|
||||
jsPsych.run(generateDocsDemoTimeline(timeline));
|
||||
} else {
|
||||
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
|
||||
}
|
||||
</script>
|
||||
</html>
|
61
7.3/demos/jspsych-canvas-button-response-demo3.html
Executable file
@ -0,0 +1,61 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="docs-demo-timeline.js"></script>
|
||||
<script src="https://unpkg.com/jspsych@7.3.0"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-canvas-button-response@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.1"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.0/css/jspsych.css" />
|
||||
<link rel="stylesheet" href="docs-demo.css" type="text/css" />
|
||||
</head>
|
||||
<body></body>
|
||||
<script>
|
||||
|
||||
const jsPsych = initJsPsych();
|
||||
|
||||
function filledCirc(canvas, radius, color) {
|
||||
var ctx = canvas.getContext("2d");
|
||||
ctx.beginPath();
|
||||
ctx.arc(150, 150, radius, 0, 2 * Math.PI);
|
||||
ctx.fillStyle = color;
|
||||
ctx.fill();
|
||||
}
|
||||
|
||||
// To use the canvas stimulus function with timeline variables,
|
||||
// the jsPsych.timelineVariable() function can be used inside your stimulus function.
|
||||
// In addition, this code demonstrates how to check whether participants' answers were correct or not.
|
||||
const circle_procedure = {
|
||||
timeline: [{
|
||||
type: jsPsychCanvasButtonResponse,
|
||||
stimulus: function(c) {
|
||||
filledCirc(c, jsPsych.timelineVariable('radius'), jsPsych.timelineVariable('color'));
|
||||
},
|
||||
canvas_size: [300, 300],
|
||||
choices: ['Red', 'Green', 'Blue'],
|
||||
prompt: '<p>What color is the circle?</p>',
|
||||
data: {
|
||||
radius: jsPsych.timelineVariable('radius'),
|
||||
color: jsPsych.timelineVariable('color'),
|
||||
correct_response: jsPsych.timelineVariable('correct_response')
|
||||
},
|
||||
on_finish: function(data){
|
||||
data.correct = (data.response == data.correct_response);
|
||||
}
|
||||
}],
|
||||
timeline_variables: [
|
||||
{radius: 80, color: 'red', correct_response: 0},
|
||||
{radius: 100, color: 'green', correct_response: 1},
|
||||
{radius: 50, color: 'blue', correct_response: 2}
|
||||
],
|
||||
randomize_order: true
|
||||
};
|
||||
|
||||
const timeline = [circle_procedure];
|
||||
|
||||
if (typeof jsPsych !== "undefined") {
|
||||
jsPsych.run(generateDocsDemoTimeline(timeline));
|
||||
} else {
|
||||
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
|
||||
}
|
||||
</script>
|
||||
</html>
|
40
7.3/demos/jspsych-canvas-keyboard-response-demo1.html
Executable file
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="docs-demo-timeline.js"></script>
|
||||
<script src="https://unpkg.com/jspsych@7.3.0"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-canvas-keyboard-response@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.1"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.0/css/jspsych.css" />
|
||||
<link rel="stylesheet" href="docs-demo.css" type="text/css" />
|
||||
</head>
|
||||
<body></body>
|
||||
<script>
|
||||
|
||||
const jsPsych = initJsPsych();
|
||||
|
||||
function drawRect(c){
|
||||
const ctx = c.getContext('2d');
|
||||
ctx.beginPath();
|
||||
ctx.rect(30, 30, 200, 50);
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
const trial = {
|
||||
type: jsPsychCanvasKeyboardResponse,
|
||||
canvas_size: [300, 300],
|
||||
stimulus: drawRect,
|
||||
choices: ['e','i'],
|
||||
prompt: '<p>Is this a circle or a rectangle? Press "e" for circle and "i" for rectangle.</p>',
|
||||
data: {shape: 'rectangle'}
|
||||
}
|
||||
|
||||
const timeline = [trial];
|
||||
|
||||
if (typeof jsPsych !== "undefined") {
|
||||
jsPsych.run(generateDocsDemoTimeline(timeline));
|
||||
} else {
|
||||
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
|
||||
}
|
||||
</script>
|
||||
</html>
|
41
7.3/demos/jspsych-canvas-keyboard-response-demo2.html
Executable file
@ -0,0 +1,41 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="docs-demo-timeline.js"></script>
|
||||
<script src="https://unpkg.com/jspsych@7.3.0"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-canvas-keyboard-response@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.1"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.0/css/jspsych.css" />
|
||||
<link rel="stylesheet" href="docs-demo.css" type="text/css" />
|
||||
</head>
|
||||
<body></body>
|
||||
<script>
|
||||
|
||||
const jsPsych = initJsPsych();
|
||||
|
||||
function drawCirc(c){
|
||||
const ctx = c.getContext('2d');
|
||||
ctx.beginPath();
|
||||
ctx.arc(100, 75, 50, 0, 2 * Math.PI);
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
const trial = {
|
||||
type: jsPsychCanvasKeyboardResponse,
|
||||
canvas_size: [300, 300],
|
||||
stimulus: drawCirc,
|
||||
prompt: '<p>No key response is allowed.</p><p>The stimulus disappears after 3 seconds.</p>',
|
||||
choices: "NO_KEYS",
|
||||
trial_duration: 3000,
|
||||
data: {shape: 'circle', radius: 50}
|
||||
}
|
||||
|
||||
const timeline = [trial];
|
||||
|
||||
if (typeof jsPsych !== "undefined") {
|
||||
jsPsych.run(generateDocsDemoTimeline(timeline));
|
||||
} else {
|
||||
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
|
||||
}
|
||||
</script>
|
||||
</html>
|
45
7.3/demos/jspsych-canvas-slider-response-demo1.html
Executable file
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="docs-demo-timeline.js"></script>
|
||||
<script src="https://unpkg.com/jspsych@7.3.0"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-canvas-slider-response@1.1.1"></script>
|
||||
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.1"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.0/css/jspsych.css" />
|
||||
<link rel="stylesheet" href="docs-demo.css" type="text/css" />
|
||||
</head>
|
||||
<body></body>
|
||||
<script>
|
||||
|
||||
const jsPsych = initJsPsych();
|
||||
|
||||
// Draw two squares
|
||||
|
||||
const colors = ['#FF3333', '#FF6A33'];
|
||||
|
||||
function twoSquares(c) {
|
||||
const ctx = c.getContext('2d');
|
||||
ctx.fillStyle = colors[0];
|
||||
ctx.fillRect(200, 70, 40, 40);
|
||||
ctx.fillStyle = colors[1];
|
||||
ctx.fillRect(260, 70, 40, 40);
|
||||
}
|
||||
|
||||
const trial = {
|
||||
type: jsPsychCanvasSliderResponse,
|
||||
stimulus: twoSquares,
|
||||
labels: ['0','10'],
|
||||
canvas_size: [150, 500],
|
||||
prompt: '<p>How different would you say the colors of these two squares are on a scale from 0 (the same) to 10 (completely different)</p>',
|
||||
data: {color1: colors[0], color2: colors[1]}
|
||||
}
|
||||
|
||||
const timeline = [trial];
|
||||
|
||||
if (typeof jsPsych !== "undefined") {
|
||||
jsPsych.run(generateDocsDemoTimeline(timeline));
|
||||
} else {
|
||||
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
|
||||
}
|
||||
</script>
|
||||
</html>
|