diff --git a/resources/javascript/genki.js b/resources/javascript/genki.js
index 8abea29..c89aaa9 100644
--- a/resources/javascript/genki.js
+++ b/resources/javascript/genki.js
@@ -1422,7 +1422,8 @@
''+
''+
'',
- zIndex : 'low'
+ zIndex : 'low',
+ focus : '#save-exercise-data'
});
}, 100);
}
diff --git a/resources/javascript/genki.min.js b/resources/javascript/genki.min.js
index fec9534..8c50b48 100644
--- a/resources/javascript/genki.min.js
+++ b/resources/javascript/genki.min.js
@@ -1 +1 @@
-!function(e,t){"use strict";var a={stats:{problems:0,solved:0,mistakes:0,score:0,exclude:0},canNotify:"Notification"in e,isTouch:"ontouchstart"in e||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0,isTouching:!1,isTimerPausedByPopup:!1,feedbackMode:storageOK&&localStorage.feedbackMode?localStorage.feedbackMode:"classic",dataBackupReminderCount:storageOK&&localStorage.dataBackupReminderCount?+localStorage.dataBackupReminderCount:0,textSelectMode:!1,strokeNumberDisplay:!1,markedItem:null,ed:"lessons",local:"file:"==e.location.protocol?"index.html":"",debug:/debug/.test(e.location.search)?"?debug":"",lang:{std_drag:"Drag the English expression to the Japanese expression that has the same meaning.
TIP: Click an expression to mark it, then click an empty field to drop the answer there.",std_kana:"Drag the Kana to the matching Romaji.
TIP: Click the kana to mark it, then click an empty field to drop the answer there.",std_num:"Drag the Numbers to the matching Kana.
TIP: Click a number to mark it, then click an empty field to drop the answer there.",std_multi:"Solve the problems by choosing the correct answers.",std_questions:"Answer the questions as best as you can.",std_culture:"Answer the questions about Japanese culture as best as you can.",std_stroke_order:"Practice drawing each kanji by following the stroke order.",std_drawing:"Practice drawing the following kanji multiple times.",vocab_multi:"Choose the correct definition for each Japanese expression.",vocab_writing:"Practice spelling the following words/expressions.",vocab_fill:"Write the Japanese definition for the following words/expressions.",kana_multi:"Choose the correct Romaji for the %{KANA}.",kana_writing:"Practice writing the following %{KANA}.",kana_fill:"Complete the chart by filling in the Romaji.",num_multi:"Read the Japanese and choose the correct numbers.",num_writing:"Practice spelling the following numbers.",num_fill:"Write the following numbers in Japanese (hiragana).",kanji_readings_multi:"Choose the correct readings for each kanji.",kanji_readings_drag:"Match each kanji with their readings.",kanji_yomikata:'
▶ indicates the on-yomi (pronunciation originally borrowed from Chinese).
▷ indicates the kun-yomi (native Japanese reading).
'+(y[1]?"":"kanji"==i.format?'':"")+y[0]+(y[1]?"":"kanji"==i.format?"":"")+(o?''+o+"":"")+"",answers:["A"+r]}),(c=h.slice()).splice(T,1),d=3;d-- >0&&c.length;)u=Math.floor(Math.random()*c.length),(l=i.quizlet[c[u]].replace(/\|.*?$/,""))==r?d++:g[x].answers.push("A"==l.charAt(0)?"!"+l:l),c.splice(u,1);p.splice(T,1)}i.quizlet=g}else if("writing"==i.type){var m;g={};for(x in i.quizlet)for(var k,f=(m=x.split("|"))[0].split("/"),v=0,b=f.length;v',p=[];for(x in i.quizlet)p.push(x);for(x=0,q=p.length,T=Math.ceil(q/2);x"}else"kana"==i.format&&(i.quizlet=i.chart)}else if("practice"==i.format){i.quizlet=i.quizlet[e];var z=t.querySelector(".multi-quiz-image");"fill"==i.type&&z?z.style.display="none":"multi"==i.type&&z&&(z.style.display="")}else"hirakata"==i.format&&(i.quizlet=i.quizlet[e]?i.quizlet[e]:i.quizlet[i.quizlet.length-1]);a.generateQuiz(i),a.changingExType=!1}}),!a.changingExType&&(!1!==r||storageOK&&"true"==localStorage.genkiSkipExType)&&(n.callback(),GenkiModal.close()),a.create.exerciseTypeButton(),!1}if(a.active.type=i.type,"drag"==i.type){var d,u,g='":"")+''+i.quizlet[p[x]].replace(/\|.*?$/,"")+"";i.quizlet=g+"
"+(/\|/.test(w)?w.replace("}","|answer}"):w)+"'+i.info+'',p='",u&&(s.className+=" helper-"+(storageOK&&"false"==localStorage.furiganaVisible?"hidden":"present")),g+='',h=[];for(o in i.quizlet)h.push(o);for(d=h.slice(0);h.length;)o=Math.floor(Math.random()*h.length),g+='"+p+"",p+='',h.splice(o,1),++a.stats.problems,!u&&w&&(u=!0);for(g+=""+(w?h[o].replace(/(.*?)\|(.*)/,'$1$2'):h[o])+"';d.length;)g+='",s.innerHTML=g+a.lang.review.replace("",a.lang.toggle_furigana+''),!storageOK||"true"!=localStorage.vocabHorizontal&&localStorage.vocabHorizontal||a.toggle.vocabOrientation(t.getElementById("toggle-orientation"),"false")}else if("kana"==i.type){g='",d.splice(o,1);g+="'+i.quizlet[d[o]].replace(/\|.*?$/,"")+"'+i.info+'';var m,k='"+a.lang.review}else if("writing"==i.type){g='',f=[],v=i.quizlet;for(o=v.length-1;o>-1;o--){g+='"+k+"';for(m in v[o])g+='"}for(;f.length;)k+=f[o=Math.floor(Math.random()*f.length)],f.splice(o,1);s.innerHTML=g+"",f.push(''+v[o][m]+"'+m+""),++a.stats.problems;g+="'+i.info+"
If you don't know how to type in Japanese on your computer, please visit our help page by clicking here.';var b='style="width:'+100/((M=i.columns)+1)+'%;"',y=0,w=!1;for(o in i.quizlet){for(g+='"+a.lang.check_answers.replace("",w?a.lang.toggle_furigana+"":""),i.quiz&&(s.className+=" no-helper"),a.input={map:t.querySelectorAll(".writing-zone-input"),index:0},a.input.map[0].autofocus=!0}else if("multi"==i.type){g='",M=i.columns}/data-helper/.test(g)&&(w=!0,s.className+=" helper-"+(storageOK&&"false"==localStorage.furiganaVisible?"hidden":"present")),s.innerHTML=g+"",l=0;M-- >0;)g+='',++a.stats.problems;g+="'+o+"'+i.info+'
NEW: You can now choose between "Instant" and "Classic" Feedback Mode for multiple choice quizzes in the Site Settings.',k='';var x=65,q=!1,T=(w=!1,/"format":"vocab"/.test(a.exerciseData));for(o=0,l=(E=i.quizlet).length;o",x=65,++a.stats.problems}/class="furigana"|class="inline-furi"|/.test(g)&&(w=!0,s.className+=" helper-"+(storageOK&&"false"==localStorage.furiganaVisible?"hidden":"present")),T&&storageOK&&"true"==localStorage.spoilerMode&&(s.className+=" spoiler-mode"),s.innerHTML=g+''+(a.appendix?"":'')+(w?a.lang.toggle_furigana:"")+"",a.progressQuiz("init")}else if("fill"==i.type){w=!1;/class="furigana"|class="inline-furi"|/.test(i.quizlet)&&(w=!0,s.className+=" helper-"+(storageOK&&"false"==localStorage.furiganaVisible?"hidden":"present")),s.innerHTML=''+i.info+"
If you don't know how to type in Japanese on your computer, please visit our help page by clicking here.'+i.quizlet.replace(/\{.*?\}/g,function(e){var t,i,s,n,r,o=e.slice(1,e.length-1).split("|");return"!IMG"==o[0]?a.parse.image(o):"!GRI"==o[0]?'"+o[1]+"":"!AUDIO"==o[0]?'':"!PLAY"==o[0]?'':(t=o[1]?o[1]:"",i=(o[10]||o[9]||o[8]||o[7]||o[6]||o[5]||o[4]||o[3]||o[2]?o[10]||o[9]||o[8]||o[7]||o[6]||o[5]||o[4]||o[3]||o[2]:"").split(";"),(/\%\((.*?)\)/.test(t)||/\%\((.*?)\)/.test(o[0]))&&(s=[o[0].match(/%\((.*?)\)/),t.match(/%\((.*?)\)/)]),++a.stats.problems,n=/width:/.test(i[0])?i[0].split(":")[1]:i[1]&&/width:/.test(i[1])?i[1].split(":")[1]:i[2]&&/width:/.test(i[2])?i[2].split(":")[1]:s?(t?(s[0]&&s[0][1]||"/").split("/").concat((s[1]&&s[1][1]||"/").split("/")):(s[0]&&s[0][1]||"/").split("/")).sort(function(e,t){return t.length-e.length})[0].length*(14/(/[a-z]/i.test(t||o[0])&&!/[\u3000-\u30FF]/.test(t||o[0])?2:1))+14+[t.replace(/\%\((.*?)\)/g,""),o[0].replace(/\%\((.*?)\)/g,"")].sort(function(e,t){return t.length-e.length})[0].length*(14/(/[a-z]/i.test(t||o[0])&&!/[\u3000-\u30FF]/.test(t||o[0])?2:1)):[t,o[0]].sort(function(e,t){return t.length-e.length})[0].length*(14/(/[a-z]/i.test(t||o[0])&&!/[\u3000-\u30FF]/.test(t||o[0])?2:1))+14,r=/placeholder:/.test(i[0])?i[0].split(":")[1]:i[1]&&/placeholder:/.test(i[1])?i[1].split(":")[1]:i[2]&&/placeholder:/.test(i[2])?i[2].split(":")[1]:null,''+(t&&!/answer|furigana|placeholder/.test(i[0])||i[1]&&/hint:/.test(i[1])||i[2]&&/hint:/.test(i[2])?''+(i[1]&&/hint:/.test(i[1])?i[1].split(":")[1]:i[2]&&/hint:/.test(i[2])?i[2].split(":")[1]:t).replace(/(\!I.*?$)/,function(e,t){if(/^!I/.test(t)){for(var a=t.slice(2).split("/"),i=0,s=a.length,n="";i"+a.lang.check_answers.replace("()","(false, 'fill')").replace("",w?a.lang.toggle_furigana+"":""),t.querySelector(".writing-zone-input").autofocus=!0}else if("stroke"==i.type){g=''+a[i]+"/";return n.slice(0,n.length-1)}})+"":"")+"")})+"'+i.info+'',k='';var z,S=storageOK&&"false"==localStorage.strokeOrderVisible,N=storageOK&&"false"==localStorage.tracingGuideVisible;for(o=0,l=(E=i.quizlet).length;o",++a.stats.problems;s.innerHTML=g+'',S&&(s.className+=" stroke-order-hidden"),a.progressQuiz("init",!1,"stroke")}else if("drawing"==i.type){g=''+i.info+'',N=storageOK&&"false"==localStorage.tracingGuideVisible,b='style="width:'+100/((M=i.columns)+1)+'%;"';var M,E=i.quizlet,j=0;for(o=0,l=i.quizlet.length;o",M=i.columns}s.innerHTML=g+""+a.lang.check_answers.replace("()","(false, 'drawing')").replace("",'');var I=t.querySelectorAll(".kanji-canvas");for(o=0,l=I.length;o ';M-- >0;)g+='"+E[o].kanji+'",++a.stats.problems,++j;g+="'+(a.debug?'':"")+"1?a.stats.mistakes:++a.stats.mistakes):(i.className+=" answer-correct",a.markedItem&&(a.markedItem.className="quiz-item",a.markedItem=null),++a.stats.solved==a.stats.problems&&a.endQuiz()))}),a.drake=B,a.globalEventListenersSet||(a.globalEventListenersSet=!0,["click","keypress"].forEach(function(e){t.addEventListener(e,function(e){if(!("keypress"==e.type&&"Enter"!=e.key||a.quizOver)){for(var i=e.target,s=4,n=s-1;s-- >0&&(s '+(a.stats.solved+1)+"/"+a.stats.problems+""},progressQuiz:function(e,i,s){if(a.textSelectMode||a.quizOver)return!1;if("init"==e)t.getElementById("quiz-q"+a.stats.solved).style.display="",a.incrementProgressBar();else{if(e&&"stroke"==s){var n=KanjiCanvas.recognize(e.dataset.canvas);e=e.parentNode.parentNode.querySelector(".kanji-canvas"),a.debug&&console.log("toDraw: "+e.dataset.kanji),a.debug&&console.log("Results: "+n),a.debug&&console.log("Correct: "+(new RegExp(e.dataset.kanji).test(n)&&e.dataset.strokesAnswer==e.dataset.strokes).toString()),e.dataset.answer=new RegExp(e.dataset.kanji).test(n)&&e.dataset.strokesAnswer==e.dataset.strokes}e.className+=" selected-answer",i&&(e.parentNode.className+=" hidden-answer"),"false"==e.dataset.answer&&(e.parentNode.parentNode.className+=" wrong-answer",++a.stats.mistakes);var r=t.getElementById("quiz-q"+a.stats.solved++),o=t.getElementById("quiz-q"+a.stats.solved);if(o)if("instant"==a.feedbackMode&&"multi"==a.active.type)a.multiNodes||(a.multiNodes={list:t.getElementById("question-list"),button:t.getElementById("next-button"),next:null,last:null}),a.quizOver=!0,a.multiNodes.list.className+=" multi-quiz quiz-over",a.multiNodes.button.style.visibility="visible",a.multiNodes.button.firstChild.focus(),a.multiNodes.next=o,a.multiNodes.last=r;else{o.style.display="",r.style.display="none";(l=o.querySelector(t.querySelector(".spoiler-mode")?".vocab-spoiler-toggle":".quiz-multi-answer"))&&l.focus(),a.incrementProgressBar()}else{a.endQuiz("stroke"==s?s:"multi");for(var l,c=0,d=(l=t.querySelectorAll('[id^="quiz-q"]')).length;c Quiz Complete! ',storageOK&&a.active.exercise.length>0&&!/appendix|study-tools/.test(a.active.exercise[0])){var o=a.active.exercise[0],l=JSON.parse(localStorage.TobiraResults);l||(l={}),l[o]=void 0===l[o]||a.stats.score>l[o]?a.stats.score:l[o],localStorage.TobiraResults=JSON.stringify(l),a.create.removeExerciseList(),a.create.exerciseList(),"true"!=localStorage.dataBackupReminder&&void 0!=localStorage.dataBackupReminder||(++a.dataBackupReminderCount>=10&&(a.dataBackupReminderCount=0,setTimeout(function(){GenkiModal.open({title:"Backup Exercise Score Data?",content:'You\'ve recently completed 10 exercises. Would you like to backup your exercise score data?Problems Solved:'+n+'Answers Wrong:'+a.stats.mistakes+'Score:'+a.stats.score+'%Completion Time:'+r.innerHTML+''+(100==a.stats.score?"PERFECT! Great Job, you have mastered this quiz! Feel free to move on or challenge yourself by trying to beat your completion time.":a.stats.score>70?"Nice work! "+a.lang[i?i+"_mistakes":"mistakes"]:"Keep studying! "+a.lang[i?i+"_mistakes":"mistakes"])+(t.querySelector(".alt-phrase")?"
"+a.lang.sub_answers:"")+''+(/\/vocabulary-index\//.test(e.location)?a.lang.back_to_dict:'')+'Back to Index
',zIndex:"low"})},100)),localStorage.dataBackupReminderCount=a.dataBackupReminderCount)}"stroke"==i&&(t.getElementById("toggle-stroke-numbers").style.display="",t.getElementById("toggle-tracing-guide").style.display="none"),a.drake&&setTimeout(function(){a.drake.destroy(),delete a.drake},100);var c=t.getElementById("change-exercise-type-container");c&&(c.style.display="none"),t.getElementById("exercise").className+=" quiz-over",a.scrollTo("#complete-banner",!0)},reset:function(i){if(e.JSON){if(!i&&/fill-quiz|writing-quiz/.test(t.getElementById("exercise").className)&&a.stats.mistakes>0)return GenkiModal.open({title:"Try again with your current answers?",content:"Would you like to try again with your current answers? This will allow you to correct the answers you got wrong while preserving what you have already written.※ Please note that your answers will be lost if you change the page or exercise type.",buttonText:"Yes",closeButtonText:"No",customButton:'',keepOpen:!0,callback:function(){for(var e=[],i=t.querySelectorAll(".writing-zone-input"),s=0,n=i.length;s'+(n?n.outerHTML:"")+''+t.querySelector(".more-exercises").outerHTML,a.appendix?(s.style.display="none",t.getElementById("appendix-tool").style.display="",a.scrollTo(/\/vocabulary-index\//.test(e.location)?"#practice-words":".title"),/\/vocabulary-index\//.test(e.location)?a.appendix.jisho.launchExercise():/\/map-of-japan\//.test(e.location)?a.appendix.studyMap():/\/numbers-chart\//.test(e.location)?a.appendix.studyChart("numbers"):/\/conjugation-chart\//.test(e.location)&&a.appendix.studyChart("conjugation")):a.tools?(s.style.display="none",t.getElementById("study-tool-editor").style.display="",a.scrollTo(".title")):a.generateQuiz(JSON.parse(a.exerciseData))}else e.location.reload()},breakTime:function(){GenkiModal.open({title:"Take a Break?",content:"Taking a break and waiting before trying again can greatly help with building your memory. 5 to 10 minute breaks are recommended, but you're free to adjust the time to your liking."+(/"format":"vocab"/.test(a.exerciseData)?' Please see this page for more tips on memorizing vocab.':"")+' Wait Minute(s)',buttonText:"Wait",keepOpen:!0,callback:function(){if(a.breakMultiplier60?n=60:n<=0&&(n=1),GenkiModal.open({title:"Taking a Break",content:' 00:'+(n<10?"0":"")+n+":00",buttonText:"End Break Time",keepOpen:!!(a.appendix||!a.tools&&/"format"/.test(a.exerciseData)),callback:function(){a.reset(),t.body.className=t.body.className.replace(" taking-a-break","")}}),t.body.className+=" taking-a-break",s=Math.floor(10*Math.random())+1,t.getElementById("genki-modal-overlay").style.backgroundImage="url(../../../resources/images/backgrounds/bg-"+(s<10?"0":"")+s+".jpg)";var r=new Timer,o=t.getElementById("break-timer");r.start({startValues:{minutes:n},target:{seconds:0},countdown:!0}),r.addEventListener("secondsUpdated",function(i){var s=r.getTimeValues().toString();if(o.innerHTML=s,"00:00:00"==s&&(o.innerHTML='Break time is up!Click the button below to resume your studies.',t.getElementById("genki-modal-ok").style.display="inline-block",!a.local&&a.canNotify&&"granted"==Notification.permission)){new Notification(t.title.replace(/ \| Tobira Study Resources.*$/,""),{body:"Break time is up!",icon:t.querySelector('meta[property="og:image"]').content,tag:"breakTime-"+a.active.index}).onclick=function(){e.focus(),this.close()}}})}})},breakMultiplier:0,breakTimer:[5,10,15,20,30,40,50,60],breakTimerCustom:!1,changeBreakMultiplier:function(e){var t=Number(e.value);t<=5?a.breakMultiplier=0:t<=10?a.breakMultiplier=1:t<=15?a.breakMultiplier=2:t<=20?a.breakMultiplier=3:t<=30?a.breakMultiplier=4:t<=40?a.breakMultiplier=5:t<=50?a.breakMultiplier=6:t<=60&&(a.breakMultiplier=7),a.breakTimerCustom=!0},review:function(){GenkiModal.open({title:"Activate Review Mode?",content:"Are you sure you want to review? Your current progress will be lost.",callback:function(){for(var i=t.querySelectorAll("[data-answer]"),s=0,n=i.length;sRestart')+(t.querySelector(".drag-quiz")?a.lang.toggle_furigana+t.getElementById("toggle-orientation").outerHTML:""),t.getElementById("quiz-info").innerHTML='You are currently in review mode; go ahead and take your time to study. When you are ready to practice this exercise, click the "restart" button.',t.getElementById("quiz-zone").className+=" review-mode";var r=t.getElementById("change-exercise-type-container");r&&(r.style.display="none")}})},toHalfWidth:function(e){return e.replace(/[\uFF01-\uFF5E]/g,function(e){return String.fromCharCode(e.charCodeAt(0)-65248)})},check:{busy:!1,value:function(i){if(a.check.busy||i.value!=i.dataset.answer)a.check.busy&&e.setTimeout(function(){a.check.busy=!1,t.activeElement&&t.activeElement.value&&t.activeElement.value==a.input.map[a.input.index-1].value&&(t.activeElement.value="")},10);else{a.check.busy=!0;var s=a.input.map[a.input.index+1];s?s.focus():e.setTimeout(function(){i.blur(),a.check.answers(!0),a.check.busy=!1},10)}},answers:function(e,i){!a.exerciseComplete&&GenkiModal.open({title:"Check Answers?",content:e?"The last input field has been filled in. Are you ready to check your answers?":"Checking your answers will end the quiz. Do you want to continue?",buttonText:"Yes, check my answers!",callback:function(){if(a.exerciseComplete=!0,t.querySelector("#check-answers button").style.display="none",i&&"drawing"==i)for(var e,s=0,n=(d=t.querySelectorAll(".kanji-canvas")).length;s '+c.answer+(c.answer2||c.furigana?''+(c.answer2||c.furigana)+"":"")+"").replace(/%\((.*?)\)/g,function(e,t){return'('+t.replace(/\//g,'/')+')'}))),++a.stats.solved,g[s].disabled=!0}}a.endQuiz(i||"writing")}})}},toggle:{exerciseList:function(e){e.className="list-open"==e.className?"":"list-open"},list:function(e){var t="lesson-title",a=t+" lesson-open";e.className=e.className==a?t:a;for(var i=e.parentNode.querySelectorAll(".lesson-title"),s=0,n=i.length;s ',s=2;s-- >0;)(e=a.exercises[1==s?a.active.index-1:a.active.index+1])&&!/^\.\.\//.test(e)&&(e=e.split("|"),i+=''+e[1]+"");t.getElementById("quiz-timer").insertAdjacentHTML("afterend",i+"")},removeExerciseList:function(){var e=t.getElementById("exercise-list"),a=t.getElementById("toggle-exercises");e&&e.parentNode.removeChild(e),a&&a.parentNode.removeChild(a)},exerciseList:function(){var i=' ';if(a.exercises){var s,n,r,o='class="lesson-title" onclick="Genki.toggle.list(this);" onkeydown="event.key == \'Enter\' && Genki.toggle.list(this);" tabindex="0"',l='"),a.active.exercise&&(a.toggle.list(t.getElementById(/^appendix|^study-tools/.test(a.active.exercise[0])?"appendix":a.active.exercise[0].replace(/(lesson-\d+)\/.*/,"$1")).previousSibling),(n=t.querySelector('a[href*="'+a.active.exercise[0]+'"]')).className+=" active-lesson",n=n.parentNode,t.getElementById("lessons-list").scrollTop=n.offsetTop-(n.getBoundingClientRect().height+(e.matchMedia&&matchMedia("(pointer:coarse)").matches?0:6)))}else{var v='";t.getElementById("content").insertAdjacentHTML("afterbegin",v)}},exerciseTypeButton:function(){var i=t.getElementById("quiz-timer"),s=t.createElement("DIV"),n=t.createElement("BUTTON");s.id="change-exercise-type-container",s.className="center",n.id="change-exercise-type",n.className="button",n.innerHTML=' Change Exercise Type',n.onclick=function(){GenkiModal.open({title:"Change Exercise Type?",content:"To change the exercise type, you must quit the current exercise. Do you want to quit?",buttonText:"Quit",closeButtonText:"Cancel",keepOpen:!!(/\/vocabulary-index\//.test(e.location)||!a.tools&&/"format"/.test(a.exerciseData)),callback:function(){if(/(?:begin|start)=\d/.test(e.location.search)){if(!e.history||!e.history.pushState)return void(e.location.search="");e.history.pushState({},t.title,e.location.href.replace(e.location.search,"")+a.debug)}a.changingExType=!0,a.reset()}})},s.appendChild(n),i.nextSibling?i.parentNode.insertBefore(s,i.nextSibling):i.parentNode.appendChild(s)}},parse:{image:function(e){var t=/^http/.test(e[1])?e[1]:"../../../resources/images/lesson-images/"+e[1];return''}},quickJisho:{hidden:!0,selectorHidden:!0,tabbing:!1,create:function(){if(!a.quickJisho.cache){var e=t.createElement("DIV"),i=t.createElement("DIV"),s=t.createElement("BUTTON"),n=t.createDocumentFragment();e.id="quick-jisho-toggle",e.innerHTML='',e.title="Toggle Quick Dictionary",e.tabIndex=0,e.onclick=a.quickJisho.toggle,e.onkeypress=function(e){"Enter"==e.key&&a.quickJisho.toggle()},i.id="quick-jisho-window",i.className="quick-jisho-hidden",i.innerHTML='Quick Dictionary
',s.id="quick-jisho-selector",s.className="button",s.style.display="none",s.innerHTML='Look up',s.onclick=a.quickJisho.lookUp,s.tabIndex=0,n.appendChild(i),n.appendChild(e),n.appendChild(s),t.body.appendChild(n);t.querySelector(".footer-right").style.marginRight="40px",a.quickJisho.cache={box:i,search:t.getElementById("quick-jisho-search"),results:t.getElementById("quick-jisho-results"),hits:t.getElementById("quick-jisho-hits"),selector:t.getElementById("quick-jisho-selector")},t.onselectionchange=a.quickJisho.getSelection,t.onmousemove=function(e){a.quickJisho.x=Math.abs(e.pageX-t.body.clientWidth)<100?e.pageX-95:e.pageX,a.quickJisho.y=Math.abs(e.pageY-t.body.clientHeight)<40?e.pageY-32:e.pageY+12},t.onkeydown=function(e){"Tab"!=e.key||a.quickJisho.selectorHidden||t.activeElement==a.quickJisho.cache.selector||(a.quickJisho.tabbing=!0,a.quickJisho.cache.selector.focus(),e.preventDefault())}}},toggle:function(){if(!a.jisho&&!a.quickJisho.loading){a.quickJisho.loading=!0;var e=t.createElement("SCRIPT");e.src=getPaths()+"resources/javascript/jisho.min.js",e.onload=function(){a.quickJisho.cache.search.value&&a.quickJisho.search(a.quickJisho.cache.search.value),a.quickJisho.loading=!1},t.body.appendChild(e)}a.quickJisho.hidden?(a.quickJisho.cache.box.className="",a.quickJisho.hidden=!1,a.quickJisho.cache.search.focus()):(a.quickJisho.cache.box.className="quick-jisho-hidden",a.quickJisho.hidden=!0)},search:function(t,i){a.quickJisho.searchTimeout&&e.clearTimeout(a.quickJisho.searchTimeout),a.quickJisho.searchTimeout=e.setTimeout(function(){var e,s,n,r,o,l="",c=0;if(a.quickJisho.cache.results.innerHTML="",t){t=t.toLowerCase();for(e in a.jisho)for(s=0,n=a.jisho[e].length;s'+o[0]+(o[1]?""+o[1]+"":"")+''+a.jisho[e][s].en+""+(a.jisho[e][s].v?' ['+a.jisho[e][s].v+"]":"")+''+a.jisho[e][s].l+"",c++;break}}if(!i&&!l&&t&&/[\u3400-\u9faf]/.test(t)){var d=t.match(/[\u3400-\u9faf]+/);d&&d[0]&&a.quickJisho.search(d[0],!0)}else a.quickJisho.cache.results.innerHTML=l||(t?' No results found for "'+t+'". ':""),a.quickJisho.cache.hits.innerHTML=c?"("+c+")":"";delete a.quickJisho.searchTimeout},300)},lookUp:function(){a.quickJisho.hidden&&a.quickJisho.toggle(),a.quickJisho.cache.search.value="".trim?a.quickJisho.selectedText.trim():a.quickJisho.selectedText,a.quickJisho.search(a.quickJisho.cache.search.value),this.style.display="none",a.quickJisho.selectorHidden=!0},getSelection:function(){if(storageOK&&"false"==localStorage.genkiJishoLookUp)return!1;if(a.quickJisho.tabbing)return a.quickJisho.tabbingOff||(a.quickJisho.tabbingOff=setTimeout(function(){a.quickJisho.tabbing=!1,delete a.quickJisho.tabbingOff},10)),!1;if(t.getSelection){var e=t.getSelection();"Range"==e.type&&e.toString&&!/quick-jisho/.test(e.focusNode.className)?(a.quickJisho.selectedText=e.toString(),a.quickJisho.cache.selector.style.left=a.quickJisho.x+"px",a.quickJisho.cache.selector.style.top=a.quickJisho.y+"px",a.quickJisho.selectorHidden&&(a.quickJisho.cache.selector.style.display="",a.quickJisho.selectorHidden=!1)):(a.quickJisho.selectedText="",a.quickJisho.selectorHidden||(a.quickJisho.cache.selector.style.display="none",a.quickJisho.selectorHidden=!0))}}},playAudio:function(e,a){var i=t.getElementById(e);i&&(i.currentTime=a,i.play())},viewStrokeOrder:function(e,t,a){var i=getPaths()+"resources/images/stroke-order/"+t+".png";GenkiModal.open({title:e+" Stroke Order",content:''})},getAlts:function(e,t,i){for(var s,n,r,o,l=t.split("|"),c=l.length,d=Math.pow(2,c),u=[],g=0;g',customButton:'View in Grammar Index',customSize:{top:"10%",left:"20%",bottom:"10%",right:"20%"}}),Get(e.href,function(i){var s=t.getElementById("appendix-tool"),n=i.match(new RegExp('( )',"m")),r=i.match(new RegExp("()","m")),o=e.href.replace(/#.*$/,"");n&&n[0]&&r&&r[0]?s&&(s.innerHTML=r[0]+n[0].replace(/\d+\. /,"").replace(/href="#(.*?)"/g,'onclick="Genki.getGrammarPoint(this, \'$1\'); return false;" target="_blank" href="'+o+'#$1"'),s.className=""):s&&(s.innerHTML='
Failed to retrieve grammar point. Click "View in Grammar Index" to try viewing the grammar point directly.',s.className="center")})},randomExercise:function(){if(storageOK&&"lesson"==localStorage.genkiRandomExercise&&/lesson-\d+/.test(e.location.href))var t=new RegExp(e.location.href.replace(/.*?(lesson-\d+).*/,"$1/")),i=a.exercises.filter(function(e){return t.test(e)});else if(storageOK&&"completed"==localStorage.genkiRandomExercise&&localStorage.TobiraResults&&JSON.parse(localStorage.TobiraResults)){var s=JSON.parse(localStorage.TobiraResults);if(!(i=a.exercises.filter(function(e){return e.split("|")[0]in s}))[0])return alert("Cannot select a random exercise, because you have not completed enough exercises yet.")}else i=a.exercises;var n=i[Math.floor(Math.random()*i.length)].split("|");/lesson-\d+/.test(n[0])?e.location.href="../../../"+a.ed+"/"+n[0]+"/"+a.local+a.debug:a.randomExercise()},startOrPauseTimerByVisibility:function(){t.hidden&&a.timer.isRunning()?a.timer.pause():t.hidden||!a.timer.isPaused()||a.isTimerPausedByPopup||a.timer.start()},pauseTimerWhenOpenPopup:function(){a.timer.pause(),a.isTimerPausedByPopup=!0},startTimerWhenClosePopup:function(){a.timer.start(),a.isTimerPausedByPopup=!1},init:function(){if(a.exercises){for(var i,s=0,n=a.exercises.length,r=t.getElementById("quiz-result");s"+("appendix"==i?"巻末":"study-tools"==i?"ツール":"第"+i+"課")+" - "+a.active.exercise[1]+"")):r.insertAdjacentHTML("beforebegin",' '+t.querySelector("TITLE").innerText.replace(/\s\|.*/,"")+"
"),a.isTouch&&(t.ontouchstart=function(){a.isTouching=!0},t.ontouchend=function(){a.isTouching=!1},t.ontouchcancel=function(){a.isTouching=!1}),a.create.exerciseButtons()}a.create.exerciseList(),e.Genki=this}};e.onbeforeunload=function(){var e=!1,i=t.getElementById("exercise");if(i){if(i=i.className,/quiz-over/.test(i)||t.querySelector(".review-mode"))e=!1;else if(/fill-quiz|writing-quiz/.test(i)){for(var s=0,n=(r=t.querySelectorAll(".writing-zone-input")).length;s0&&(e=!0);if(e)return"Your progress will be lost. Do you want to continue?"}},a.init()}(window,document); \ No newline at end of file +!function(e,t){"use strict";var a={stats:{problems:0,solved:0,mistakes:0,score:0,exclude:0},canNotify:"Notification"in e,isTouch:"ontouchstart"in e||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0,isTouching:!1,isTimerPausedByPopup:!1,feedbackMode:storageOK&&localStorage.feedbackMode?localStorage.feedbackMode:"classic",dataBackupReminderCount:storageOK&&localStorage.dataBackupReminderCount?+localStorage.dataBackupReminderCount:0,textSelectMode:!1,strokeNumberDisplay:!1,markedItem:null,ed:"lessons",local:"file:"==e.location.protocol?"index.html":"",debug:/debug/.test(e.location.search)?"?debug":"",lang:{std_drag:"Drag the English expression to the Japanese expression that has the same meaning.
TIP: Click an expression to mark it, then click an empty field to drop the answer there.",std_kana:"Drag the Kana to the matching Romaji.
TIP: Click the kana to mark it, then click an empty field to drop the answer there.",std_num:"Drag the Numbers to the matching Kana.
TIP: Click a number to mark it, then click an empty field to drop the answer there.",std_multi:"Solve the problems by choosing the correct answers.",std_questions:"Answer the questions as best as you can.",std_culture:"Answer the questions about Japanese culture as best as you can.",std_stroke_order:"Practice drawing each kanji by following the stroke order.",std_drawing:"Practice drawing the following kanji multiple times.",vocab_multi:"Choose the correct definition for each Japanese expression.",vocab_writing:"Practice spelling the following words/expressions.",vocab_fill:"Write the Japanese definition for the following words/expressions.",kana_multi:"Choose the correct Romaji for the %{KANA}.",kana_writing:"Practice writing the following %{KANA}.",kana_fill:"Complete the chart by filling in the Romaji.",num_multi:"Read the Japanese and choose the correct numbers.",num_writing:"Practice spelling the following numbers.",num_fill:"Write the following numbers in Japanese (hiragana).",kanji_readings_multi:"Choose the correct readings for each kanji.",kanji_readings_drag:"Match each kanji with their readings.",kanji_yomikata:'▶ indicates the on-yomi (pronunciation originally borrowed from Chinese).
',kanji_meanings_multi:"Choose the correct meanings for each kanji.",kanji_meanings_drag:"Match each kanji with their meanings.",opts:{kana:{kana:"Drag and Drop",multi:"Multiple Choice",writing:"Writing Practice",fill:"Fill in the Chart"},numbers:{drag:"Drag and Drop",multi:"Multiple Choice",writing:"Spelling Practice",fill:"Write the Numbers"},kanji:{multi:"Multiple Choice",drag:"Drag and Drop"},vocab:{drag:"Drag and Drop",multi:"Multiple Choice",writing:"Spelling Practice",fill:"Write the Definition"},practice:{multi:"Multiple Choice",fill:"Written",drag:"Drag and Drop"},hirakata:{fill:"Written",stroke:"Stroke Order Practice",drawing:"Drawing Practice"},stroke:{stroke:"Stroke Order Practice",drawing:"Extended Drawing Practice"}},mistakes:'The items outlined in red were answered wrong before finding the correct answer. Review these problems before trying again.',writing_mistakes:'The items outlined in red were answered wrong. Review these problems before trying again.',multi_mistakes:'The answers you selected that were wrong are outlined in red. The correct answers are outlined in blue. Review these problems before trying again.',stroke_mistakes:'The characters you drew that were wrong are outlined in red. Please review the stroke order and number of strokes for these characters before trying again.
▷ indicates the kun-yomi (native Japanese reading).
Note: Sometimes answers may be marked wrong by mistake, due to a mismatch in the recognition algorithm.
Please use your own discretion if this occurs.',fill_mistakes:'The items underlined in red were answered wrong, the correct answers are listed underneath in green. Review these problems before trying again.',sub_answers:'Note: Answers inside blue parentheses separated by "/" are a list of possible sub-answers; only one can be used.
For example.. (あの/その)ねこ: そのねこ or あのねこ (good) vs あの/そのねこ (bad)
(この/)ねこ means the sub-answer is optional; it can be left out.',review:'',toggle_furigana:'",check_answers:'',back_to_dict:''},active:{type:null,exercise:null,index:0,path:e.location.pathname.replace(/.*?\/lessons.*?\/(.*?\/.*?)\/.*/g,"$1")},exercises:e.GenkiExercises||null,scrollTo:function(e,a){"string"==typeof e&&(e=t.querySelector(e));var i=function(){t.body.scrollTop=e.offsetTop,t.documentElement.scrollTop=e.offsetTop};a?setTimeout(i,100):i()},QuizType:{DRAG:"drag",KANA:"kana",WRITING:"writing",MULTI:"multi",FILL:"fill",STROKE:"stroke",DRAWING:"drawing"},generateQuiz:function(i){!a.exerciseData&&e.JSON&&(a.exerciseData=JSON.stringify(i));var s=t.getElementById("quiz-zone");if("object"==typeof i.type){for(var n,r=!!/(?:begin|start)=\d/.test(e.location.search)&&e.location.search.replace(/.*?(?:begin|start)=(\d).*/,"$1"),o=0,l=i.type.length,c="";o"+a.lang.opts[i.format][i.type[o]]+"";return n=GenkiModal.open({title:"Please Select an Exercise Type",content:'Please select the type of exercise you would like to do, then click "Begin" to start studying. '+(/\/vocabulary-index\/|\/custom-vocab\//.test(e.location)?"":"',buttonText:"Begin",noClose:1,zIndex:"low",callback:function(){var e=t.getElementById("exercise-type").value;if(i.type=i.type[e],i.info="object"==typeof i.info&&i.info[e]?i.info[e]:i.info,storageOK&&(localStorage["genki_pref_"+i.format]=i.type),/vocab|kana|numbers|kanji/.test(i.format)){if("kana"==i.format&&"kana"!=i.type){var s={};for(x in i.quizlet)for(d in i.quizlet[x])s[d]=i.quizlet[x][d];i.quizlet=s,i.info=i.info.replace("%{KANA}",a.active.exercise[1].replace(/.*?(Hiragana|Katakana).*/,"$1"))}if("kanji"==i.format){if(i.readings){for(x in i.quizlet){var n=i.quizlet[x].split("|");i.quizlet[x]=(n[0]?'▶'+n[0]+"Current Exercise
"+t.title.replace(/ \| Tobira Study Resources.*$/,"")+"
")+'Exercise Type
":"")+(n[1]?'▷'+n[1]:"")}i.info+=a.lang.kanji_yomikata}"drag"==i.type&&(t.getElementById("exercise").className+=i.readings?" kanji-readings":i.meanings?" kanji-meanings":"")}if("multi"==i.type){var r,o,l,c,d,u,g=[],p=[],h=[];for(x in i.quizlet)p.push(x),h.push(x);for(x=0,q=p.length;x'+(y[1]?"":"kanji"==i.format?'':"")+y[0]+(y[1]?"":"kanji"==i.format?"":"")+(o?''+o+"":"")+"",answers:["A"+r]}),(c=h.slice()).splice(T,1),d=3;d-- >0&&c.length;)u=Math.floor(Math.random()*c.length),(l=i.quizlet[c[u]].replace(/\|.*?$/,""))==r?d++:g[x].answers.push("A"==l.charAt(0)?"!"+l:l),c.splice(u,1);p.splice(T,1)}i.quizlet=g}else if("writing"==i.type){var m;g={};for(x in i.quizlet)for(var k,f=(m=x.split("|"))[0].split("/"),v=0,b=f.length;v',p=[];for(x in i.quizlet)p.push(x);for(x=0,q=p.length,T=Math.ceil(q/2);x"}else"kana"==i.format&&(i.quizlet=i.chart)}else if("practice"==i.format){i.quizlet=i.quizlet[e];var z=t.querySelector(".multi-quiz-image");"fill"==i.type&&z?z.style.display="none":"multi"==i.type&&z&&(z.style.display="")}else"hirakata"==i.format&&(i.quizlet=i.quizlet[e]?i.quizlet[e]:i.quizlet[i.quizlet.length-1]);a.generateQuiz(i),a.changingExType=!1}}),!a.changingExType&&(!1!==r||storageOK&&"true"==localStorage.genkiSkipExType)&&(n.callback(),GenkiModal.close()),a.create.exerciseTypeButton(),!1}if(a.active.type=i.type,"drag"==i.type){var d,u,g='":"")+''+i.quizlet[p[x]].replace(/\|.*?$/,"")+"";i.quizlet=g+"
"+(/\|/.test(w)?w.replace("}","|answer}"):w)+"'+i.info+'',p='",u&&(s.className+=" helper-"+(storageOK&&"false"==localStorage.furiganaVisible?"hidden":"present")),g+='',h=[];for(o in i.quizlet)h.push(o);for(d=h.slice(0);h.length;)o=Math.floor(Math.random()*h.length),g+='"+p+"",p+='',h.splice(o,1),++a.stats.problems,!u&&w&&(u=!0);for(g+=""+(w?h[o].replace(/(.*?)\|(.*)/,'$1$2'):h[o])+"';d.length;)g+='",s.innerHTML=g+a.lang.review.replace("",a.lang.toggle_furigana+''),!storageOK||"true"!=localStorage.vocabHorizontal&&localStorage.vocabHorizontal||a.toggle.vocabOrientation(t.getElementById("toggle-orientation"),"false")}else if("kana"==i.type){g='",d.splice(o,1);g+="'+i.quizlet[d[o]].replace(/\|.*?$/,"")+"'+i.info+'';var m,k='"+a.lang.review}else if("writing"==i.type){g='',f=[],v=i.quizlet;for(o=v.length-1;o>-1;o--){g+='"+k+"';for(m in v[o])g+='"}for(;f.length;)k+=f[o=Math.floor(Math.random()*f.length)],f.splice(o,1);s.innerHTML=g+"",f.push(''+v[o][m]+"'+m+""),++a.stats.problems;g+="'+i.info+"
If you don't know how to type in Japanese on your computer, please visit our help page by clicking here.';var b='style="width:'+100/((M=i.columns)+1)+'%;"',y=0,w=!1;for(o in i.quizlet){for(g+='"+a.lang.check_answers.replace("",w?a.lang.toggle_furigana+"":""),i.quiz&&(s.className+=" no-helper"),a.input={map:t.querySelectorAll(".writing-zone-input"),index:0},a.input.map[0].autofocus=!0}else if("multi"==i.type){g='",M=i.columns}/data-helper/.test(g)&&(w=!0,s.className+=" helper-"+(storageOK&&"false"==localStorage.furiganaVisible?"hidden":"present")),s.innerHTML=g+"",l=0;M-- >0;)g+='',++a.stats.problems;g+="'+o+"'+i.info+'
NEW: You can now choose between "Instant" and "Classic" Feedback Mode for multiple choice quizzes in the Site Settings.',k='';var x=65,q=!1,T=(w=!1,/"format":"vocab"/.test(a.exerciseData));for(o=0,l=(E=i.quizlet).length;o",x=65,++a.stats.problems}/class="furigana"|class="inline-furi"|/.test(g)&&(w=!0,s.className+=" helper-"+(storageOK&&"false"==localStorage.furiganaVisible?"hidden":"present")),T&&storageOK&&"true"==localStorage.spoilerMode&&(s.className+=" spoiler-mode"),s.innerHTML=g+''+(a.appendix?"":'')+(w?a.lang.toggle_furigana:"")+"",a.progressQuiz("init")}else if("fill"==i.type){w=!1;/class="furigana"|class="inline-furi"|/.test(i.quizlet)&&(w=!0,s.className+=" helper-"+(storageOK&&"false"==localStorage.furiganaVisible?"hidden":"present")),s.innerHTML=''+i.info+"
If you don't know how to type in Japanese on your computer, please visit our help page by clicking here.'+i.quizlet.replace(/\{.*?\}/g,function(e){var t,i,s,n,r,o=e.slice(1,e.length-1).split("|");return"!IMG"==o[0]?a.parse.image(o):"!GRI"==o[0]?'"+o[1]+"":"!AUDIO"==o[0]?'':"!PLAY"==o[0]?'':(t=o[1]?o[1]:"",i=(o[10]||o[9]||o[8]||o[7]||o[6]||o[5]||o[4]||o[3]||o[2]?o[10]||o[9]||o[8]||o[7]||o[6]||o[5]||o[4]||o[3]||o[2]:"").split(";"),(/\%\((.*?)\)/.test(t)||/\%\((.*?)\)/.test(o[0]))&&(s=[o[0].match(/%\((.*?)\)/),t.match(/%\((.*?)\)/)]),++a.stats.problems,n=/width:/.test(i[0])?i[0].split(":")[1]:i[1]&&/width:/.test(i[1])?i[1].split(":")[1]:i[2]&&/width:/.test(i[2])?i[2].split(":")[1]:s?(t?(s[0]&&s[0][1]||"/").split("/").concat((s[1]&&s[1][1]||"/").split("/")):(s[0]&&s[0][1]||"/").split("/")).sort(function(e,t){return t.length-e.length})[0].length*(14/(/[a-z]/i.test(t||o[0])&&!/[\u3000-\u30FF]/.test(t||o[0])?2:1))+14+[t.replace(/\%\((.*?)\)/g,""),o[0].replace(/\%\((.*?)\)/g,"")].sort(function(e,t){return t.length-e.length})[0].length*(14/(/[a-z]/i.test(t||o[0])&&!/[\u3000-\u30FF]/.test(t||o[0])?2:1)):[t,o[0]].sort(function(e,t){return t.length-e.length})[0].length*(14/(/[a-z]/i.test(t||o[0])&&!/[\u3000-\u30FF]/.test(t||o[0])?2:1))+14,r=/placeholder:/.test(i[0])?i[0].split(":")[1]:i[1]&&/placeholder:/.test(i[1])?i[1].split(":")[1]:i[2]&&/placeholder:/.test(i[2])?i[2].split(":")[1]:null,''+(t&&!/answer|furigana|placeholder/.test(i[0])||i[1]&&/hint:/.test(i[1])||i[2]&&/hint:/.test(i[2])?''+(i[1]&&/hint:/.test(i[1])?i[1].split(":")[1]:i[2]&&/hint:/.test(i[2])?i[2].split(":")[1]:t).replace(/(\!I.*?$)/,function(e,t){if(/^!I/.test(t)){for(var a=t.slice(2).split("/"),i=0,s=a.length,n="";i"+a.lang.check_answers.replace("()","(false, 'fill')").replace("",w?a.lang.toggle_furigana+"":""),t.querySelector(".writing-zone-input").autofocus=!0}else if("stroke"==i.type){g=''+a[i]+"/";return n.slice(0,n.length-1)}})+"":"")+"")})+"'+i.info+'',k='';var z,S=storageOK&&"false"==localStorage.strokeOrderVisible,N=storageOK&&"false"==localStorage.tracingGuideVisible;for(o=0,l=(E=i.quizlet).length;o",++a.stats.problems;s.innerHTML=g+'',S&&(s.className+=" stroke-order-hidden"),a.progressQuiz("init",!1,"stroke")}else if("drawing"==i.type){g=''+i.info+'',N=storageOK&&"false"==localStorage.tracingGuideVisible,b='style="width:'+100/((M=i.columns)+1)+'%;"';var M,E=i.quizlet,j=0;for(o=0,l=i.quizlet.length;o",M=i.columns}s.innerHTML=g+""+a.lang.check_answers.replace("()","(false, 'drawing')").replace("",'');var I=t.querySelectorAll(".kanji-canvas");for(o=0,l=I.length;o ';M-- >0;)g+='"+E[o].kanji+'",++a.stats.problems,++j;g+="'+(a.debug?'':"")+"1?a.stats.mistakes:++a.stats.mistakes):(i.className+=" answer-correct",a.markedItem&&(a.markedItem.className="quiz-item",a.markedItem=null),++a.stats.solved==a.stats.problems&&a.endQuiz()))}),a.drake=B,a.globalEventListenersSet||(a.globalEventListenersSet=!0,["click","keypress"].forEach(function(e){t.addEventListener(e,function(e){if(!("keypress"==e.type&&"Enter"!=e.key||a.quizOver)){for(var i=e.target,s=4,n=s-1;s-- >0&&(s '+(a.stats.solved+1)+"/"+a.stats.problems+""},progressQuiz:function(e,i,s){if(a.textSelectMode||a.quizOver)return!1;if("init"==e)t.getElementById("quiz-q"+a.stats.solved).style.display="",a.incrementProgressBar();else{if(e&&"stroke"==s){var n=KanjiCanvas.recognize(e.dataset.canvas);e=e.parentNode.parentNode.querySelector(".kanji-canvas"),a.debug&&console.log("toDraw: "+e.dataset.kanji),a.debug&&console.log("Results: "+n),a.debug&&console.log("Correct: "+(new RegExp(e.dataset.kanji).test(n)&&e.dataset.strokesAnswer==e.dataset.strokes).toString()),e.dataset.answer=new RegExp(e.dataset.kanji).test(n)&&e.dataset.strokesAnswer==e.dataset.strokes}e.className+=" selected-answer",i&&(e.parentNode.className+=" hidden-answer"),"false"==e.dataset.answer&&(e.parentNode.parentNode.className+=" wrong-answer",++a.stats.mistakes);var r=t.getElementById("quiz-q"+a.stats.solved++),o=t.getElementById("quiz-q"+a.stats.solved);if(o)if("instant"==a.feedbackMode&&"multi"==a.active.type)a.multiNodes||(a.multiNodes={list:t.getElementById("question-list"),button:t.getElementById("next-button"),next:null,last:null}),a.quizOver=!0,a.multiNodes.list.className+=" multi-quiz quiz-over",a.multiNodes.button.style.visibility="visible",a.multiNodes.button.firstChild.focus(),a.multiNodes.next=o,a.multiNodes.last=r;else{o.style.display="",r.style.display="none";(l=o.querySelector(t.querySelector(".spoiler-mode")?".vocab-spoiler-toggle":".quiz-multi-answer"))&&l.focus(),a.incrementProgressBar()}else{a.endQuiz("stroke"==s?s:"multi");for(var l,c=0,d=(l=t.querySelectorAll('[id^="quiz-q"]')).length;c Quiz Complete! ',storageOK&&a.active.exercise.length>0&&!/appendix|study-tools/.test(a.active.exercise[0])){var o=a.active.exercise[0],l=JSON.parse(localStorage.TobiraResults);l||(l={}),l[o]=void 0===l[o]||a.stats.score>l[o]?a.stats.score:l[o],localStorage.TobiraResults=JSON.stringify(l),a.create.removeExerciseList(),a.create.exerciseList(),"true"!=localStorage.dataBackupReminder&&void 0!=localStorage.dataBackupReminder||(++a.dataBackupReminderCount>=10&&(a.dataBackupReminderCount=0,setTimeout(function(){GenkiModal.open({title:"Backup Exercise Score Data?",content:'You\'ve recently completed 10 exercises. Would you like to backup your exercise score data?Problems Solved:'+n+'Answers Wrong:'+a.stats.mistakes+'Score:'+a.stats.score+'%Completion Time:'+r.innerHTML+''+(100==a.stats.score?"PERFECT! Great Job, you have mastered this quiz! Feel free to move on or challenge yourself by trying to beat your completion time.":a.stats.score>70?"Nice work! "+a.lang[i?i+"_mistakes":"mistakes"]:"Keep studying! "+a.lang[i?i+"_mistakes":"mistakes"])+(t.querySelector(".alt-phrase")?"
"+a.lang.sub_answers:"")+''+(/\/vocabulary-index\//.test(e.location)?a.lang.back_to_dict:'')+'Back to Index
',zIndex:"low",focus:"#save-exercise-data"})},100)),localStorage.dataBackupReminderCount=a.dataBackupReminderCount)}"stroke"==i&&(t.getElementById("toggle-stroke-numbers").style.display="",t.getElementById("toggle-tracing-guide").style.display="none"),a.drake&&setTimeout(function(){a.drake.destroy(),delete a.drake},100);var c=t.getElementById("change-exercise-type-container");c&&(c.style.display="none"),t.getElementById("exercise").className+=" quiz-over",a.scrollTo("#complete-banner",!0)},reset:function(i){if(e.JSON){if(!i&&/fill-quiz|writing-quiz/.test(t.getElementById("exercise").className)&&a.stats.mistakes>0)return GenkiModal.open({title:"Try again with your current answers?",content:"Would you like to try again with your current answers? This will allow you to correct the answers you got wrong while preserving what you have already written.※ Please note that your answers will be lost if you change the page or exercise type.",buttonText:"Yes",closeButtonText:"No",customButton:'',keepOpen:!0,callback:function(){for(var e=[],i=t.querySelectorAll(".writing-zone-input"),s=0,n=i.length;s'+(n?n.outerHTML:"")+''+t.querySelector(".more-exercises").outerHTML,a.appendix?(s.style.display="none",t.getElementById("appendix-tool").style.display="",a.scrollTo(/\/vocabulary-index\//.test(e.location)?"#practice-words":".title"),/\/vocabulary-index\//.test(e.location)?a.appendix.jisho.launchExercise():/\/map-of-japan\//.test(e.location)?a.appendix.studyMap():/\/numbers-chart\//.test(e.location)?a.appendix.studyChart("numbers"):/\/conjugation-chart\//.test(e.location)&&a.appendix.studyChart("conjugation")):a.tools?(s.style.display="none",t.getElementById("study-tool-editor").style.display="",a.scrollTo(".title")):a.generateQuiz(JSON.parse(a.exerciseData))}else e.location.reload()},breakTime:function(){GenkiModal.open({title:"Take a Break?",content:"Taking a break and waiting before trying again can greatly help with building your memory. 5 to 10 minute breaks are recommended, but you're free to adjust the time to your liking."+(/"format":"vocab"/.test(a.exerciseData)?' Please see this page for more tips on memorizing vocab.':"")+' Wait Minute(s)',buttonText:"Wait",keepOpen:!0,callback:function(){if(a.breakMultiplier60?n=60:n<=0&&(n=1),GenkiModal.open({title:"Taking a Break",content:' 00:'+(n<10?"0":"")+n+":00",buttonText:"End Break Time",keepOpen:!!(a.appendix||!a.tools&&/"format"/.test(a.exerciseData)),callback:function(){a.reset(),t.body.className=t.body.className.replace(" taking-a-break","")}}),t.body.className+=" taking-a-break",s=Math.floor(10*Math.random())+1,t.getElementById("genki-modal-overlay").style.backgroundImage="url(../../../resources/images/backgrounds/bg-"+(s<10?"0":"")+s+".jpg)";var r=new Timer,o=t.getElementById("break-timer");r.start({startValues:{minutes:n},target:{seconds:0},countdown:!0}),r.addEventListener("secondsUpdated",function(i){var s=r.getTimeValues().toString();if(o.innerHTML=s,"00:00:00"==s&&(o.innerHTML='Break time is up!Click the button below to resume your studies.',t.getElementById("genki-modal-ok").style.display="inline-block",!a.local&&a.canNotify&&"granted"==Notification.permission)){new Notification(t.title.replace(/ \| Tobira Study Resources.*$/,""),{body:"Break time is up!",icon:t.querySelector('meta[property="og:image"]').content,tag:"breakTime-"+a.active.index}).onclick=function(){e.focus(),this.close()}}})}})},breakMultiplier:0,breakTimer:[5,10,15,20,30,40,50,60],breakTimerCustom:!1,changeBreakMultiplier:function(e){var t=Number(e.value);t<=5?a.breakMultiplier=0:t<=10?a.breakMultiplier=1:t<=15?a.breakMultiplier=2:t<=20?a.breakMultiplier=3:t<=30?a.breakMultiplier=4:t<=40?a.breakMultiplier=5:t<=50?a.breakMultiplier=6:t<=60&&(a.breakMultiplier=7),a.breakTimerCustom=!0},review:function(){GenkiModal.open({title:"Activate Review Mode?",content:"Are you sure you want to review? Your current progress will be lost.",callback:function(){for(var i=t.querySelectorAll("[data-answer]"),s=0,n=i.length;sRestart')+(t.querySelector(".drag-quiz")?a.lang.toggle_furigana+t.getElementById("toggle-orientation").outerHTML:""),t.getElementById("quiz-info").innerHTML='You are currently in review mode; go ahead and take your time to study. When you are ready to practice this exercise, click the "restart" button.',t.getElementById("quiz-zone").className+=" review-mode";var r=t.getElementById("change-exercise-type-container");r&&(r.style.display="none")}})},toHalfWidth:function(e){return e.replace(/[\uFF01-\uFF5E]/g,function(e){return String.fromCharCode(e.charCodeAt(0)-65248)})},check:{busy:!1,value:function(i){if(a.check.busy||i.value!=i.dataset.answer)a.check.busy&&e.setTimeout(function(){a.check.busy=!1,t.activeElement&&t.activeElement.value&&t.activeElement.value==a.input.map[a.input.index-1].value&&(t.activeElement.value="")},10);else{a.check.busy=!0;var s=a.input.map[a.input.index+1];s?s.focus():e.setTimeout(function(){i.blur(),a.check.answers(!0),a.check.busy=!1},10)}},answers:function(e,i){!a.exerciseComplete&&GenkiModal.open({title:"Check Answers?",content:e?"The last input field has been filled in. Are you ready to check your answers?":"Checking your answers will end the quiz. Do you want to continue?",buttonText:"Yes, check my answers!",callback:function(){if(a.exerciseComplete=!0,t.querySelector("#check-answers button").style.display="none",i&&"drawing"==i)for(var e,s=0,n=(d=t.querySelectorAll(".kanji-canvas")).length;s '+c.answer+(c.answer2||c.furigana?''+(c.answer2||c.furigana)+"":"")+"").replace(/%\((.*?)\)/g,function(e,t){return'('+t.replace(/\//g,'/')+')'}))),++a.stats.solved,g[s].disabled=!0}}a.endQuiz(i||"writing")}})}},toggle:{exerciseList:function(e){e.className="list-open"==e.className?"":"list-open"},list:function(e){var t="lesson-title",a=t+" lesson-open";e.className=e.className==a?t:a;for(var i=e.parentNode.querySelectorAll(".lesson-title"),s=0,n=i.length;s ',s=2;s-- >0;)(e=a.exercises[1==s?a.active.index-1:a.active.index+1])&&!/^\.\.\//.test(e)&&(e=e.split("|"),i+=''+e[1]+"");t.getElementById("quiz-timer").insertAdjacentHTML("afterend",i+"")},removeExerciseList:function(){var e=t.getElementById("exercise-list"),a=t.getElementById("toggle-exercises");e&&e.parentNode.removeChild(e),a&&a.parentNode.removeChild(a)},exerciseList:function(){var i=' ';if(a.exercises){var s,n,r,o='class="lesson-title" onclick="Genki.toggle.list(this);" onkeydown="event.key == \'Enter\' && Genki.toggle.list(this);" tabindex="0"',l='"),a.active.exercise&&(a.toggle.list(t.getElementById(/^appendix|^study-tools/.test(a.active.exercise[0])?"appendix":a.active.exercise[0].replace(/(lesson-\d+)\/.*/,"$1")).previousSibling),(n=t.querySelector('a[href*="'+a.active.exercise[0]+'"]')).className+=" active-lesson",n=n.parentNode,t.getElementById("lessons-list").scrollTop=n.offsetTop-(n.getBoundingClientRect().height+(e.matchMedia&&matchMedia("(pointer:coarse)").matches?0:6)))}else{var v='";t.getElementById("content").insertAdjacentHTML("afterbegin",v)}},exerciseTypeButton:function(){var i=t.getElementById("quiz-timer"),s=t.createElement("DIV"),n=t.createElement("BUTTON");s.id="change-exercise-type-container",s.className="center",n.id="change-exercise-type",n.className="button",n.innerHTML=' Change Exercise Type',n.onclick=function(){GenkiModal.open({title:"Change Exercise Type?",content:"To change the exercise type, you must quit the current exercise. Do you want to quit?",buttonText:"Quit",closeButtonText:"Cancel",keepOpen:!!(/\/vocabulary-index\//.test(e.location)||!a.tools&&/"format"/.test(a.exerciseData)),callback:function(){if(/(?:begin|start)=\d/.test(e.location.search)){if(!e.history||!e.history.pushState)return void(e.location.search="");e.history.pushState({},t.title,e.location.href.replace(e.location.search,"")+a.debug)}a.changingExType=!0,a.reset()}})},s.appendChild(n),i.nextSibling?i.parentNode.insertBefore(s,i.nextSibling):i.parentNode.appendChild(s)}},parse:{image:function(e){var t=/^http/.test(e[1])?e[1]:"../../../resources/images/lesson-images/"+e[1];return''}},quickJisho:{hidden:!0,selectorHidden:!0,tabbing:!1,create:function(){if(!a.quickJisho.cache){var e=t.createElement("DIV"),i=t.createElement("DIV"),s=t.createElement("BUTTON"),n=t.createDocumentFragment();e.id="quick-jisho-toggle",e.innerHTML='',e.title="Toggle Quick Dictionary",e.tabIndex=0,e.onclick=a.quickJisho.toggle,e.onkeypress=function(e){"Enter"==e.key&&a.quickJisho.toggle()},i.id="quick-jisho-window",i.className="quick-jisho-hidden",i.innerHTML='Quick Dictionary
',s.id="quick-jisho-selector",s.className="button",s.style.display="none",s.innerHTML='Look up',s.onclick=a.quickJisho.lookUp,s.tabIndex=0,n.appendChild(i),n.appendChild(e),n.appendChild(s),t.body.appendChild(n);t.querySelector(".footer-right").style.marginRight="40px",a.quickJisho.cache={box:i,search:t.getElementById("quick-jisho-search"),results:t.getElementById("quick-jisho-results"),hits:t.getElementById("quick-jisho-hits"),selector:t.getElementById("quick-jisho-selector")},t.onselectionchange=a.quickJisho.getSelection,t.onmousemove=function(e){a.quickJisho.x=Math.abs(e.pageX-t.body.clientWidth)<100?e.pageX-95:e.pageX,a.quickJisho.y=Math.abs(e.pageY-t.body.clientHeight)<40?e.pageY-32:e.pageY+12},t.onkeydown=function(e){"Tab"!=e.key||a.quickJisho.selectorHidden||t.activeElement==a.quickJisho.cache.selector||(a.quickJisho.tabbing=!0,a.quickJisho.cache.selector.focus(),e.preventDefault())}}},toggle:function(){if(!a.jisho&&!a.quickJisho.loading){a.quickJisho.loading=!0;var e=t.createElement("SCRIPT");e.src=getPaths()+"resources/javascript/jisho.min.js",e.onload=function(){a.quickJisho.cache.search.value&&a.quickJisho.search(a.quickJisho.cache.search.value),a.quickJisho.loading=!1},t.body.appendChild(e)}a.quickJisho.hidden?(a.quickJisho.cache.box.className="",a.quickJisho.hidden=!1,a.quickJisho.cache.search.focus()):(a.quickJisho.cache.box.className="quick-jisho-hidden",a.quickJisho.hidden=!0)},search:function(t,i){a.quickJisho.searchTimeout&&e.clearTimeout(a.quickJisho.searchTimeout),a.quickJisho.searchTimeout=e.setTimeout(function(){var e,s,n,r,o,l="",c=0;if(a.quickJisho.cache.results.innerHTML="",t){t=t.toLowerCase();for(e in a.jisho)for(s=0,n=a.jisho[e].length;s'+o[0]+(o[1]?""+o[1]+"":"")+''+a.jisho[e][s].en+""+(a.jisho[e][s].v?' ['+a.jisho[e][s].v+"]":"")+''+a.jisho[e][s].l+"",c++;break}}if(!i&&!l&&t&&/[\u3400-\u9faf]/.test(t)){var d=t.match(/[\u3400-\u9faf]+/);d&&d[0]&&a.quickJisho.search(d[0],!0)}else a.quickJisho.cache.results.innerHTML=l||(t?' No results found for "'+t+'". ':""),a.quickJisho.cache.hits.innerHTML=c?"("+c+")":"";delete a.quickJisho.searchTimeout},300)},lookUp:function(){a.quickJisho.hidden&&a.quickJisho.toggle(),a.quickJisho.cache.search.value="".trim?a.quickJisho.selectedText.trim():a.quickJisho.selectedText,a.quickJisho.search(a.quickJisho.cache.search.value),this.style.display="none",a.quickJisho.selectorHidden=!0},getSelection:function(){if(storageOK&&"false"==localStorage.genkiJishoLookUp)return!1;if(a.quickJisho.tabbing)return a.quickJisho.tabbingOff||(a.quickJisho.tabbingOff=setTimeout(function(){a.quickJisho.tabbing=!1,delete a.quickJisho.tabbingOff},10)),!1;if(t.getSelection){var e=t.getSelection();"Range"==e.type&&e.toString&&!/quick-jisho/.test(e.focusNode.className)?(a.quickJisho.selectedText=e.toString(),a.quickJisho.cache.selector.style.left=a.quickJisho.x+"px",a.quickJisho.cache.selector.style.top=a.quickJisho.y+"px",a.quickJisho.selectorHidden&&(a.quickJisho.cache.selector.style.display="",a.quickJisho.selectorHidden=!1)):(a.quickJisho.selectedText="",a.quickJisho.selectorHidden||(a.quickJisho.cache.selector.style.display="none",a.quickJisho.selectorHidden=!0))}}},playAudio:function(e,a){var i=t.getElementById(e);i&&(i.currentTime=a,i.play())},viewStrokeOrder:function(e,t,a){var i=getPaths()+"resources/images/stroke-order/"+t+".png";GenkiModal.open({title:e+" Stroke Order",content:''})},getAlts:function(e,t,i){for(var s,n,r,o,l=t.split("|"),c=l.length,d=Math.pow(2,c),u=[],g=0;g',customButton:'View in Grammar Index',customSize:{top:"10%",left:"20%",bottom:"10%",right:"20%"}}),Get(e.href,function(i){var s=t.getElementById("appendix-tool"),n=i.match(new RegExp('( )',"m")),r=i.match(new RegExp("()","m")),o=e.href.replace(/#.*$/,"");n&&n[0]&&r&&r[0]?s&&(s.innerHTML=r[0]+n[0].replace(/\d+\. /,"").replace(/href="#(.*?)"/g,'onclick="Genki.getGrammarPoint(this, \'$1\'); return false;" target="_blank" href="'+o+'#$1"'),s.className=""):s&&(s.innerHTML='
Failed to retrieve grammar point. Click "View in Grammar Index" to try viewing the grammar point directly.',s.className="center")})},randomExercise:function(){if(storageOK&&"lesson"==localStorage.genkiRandomExercise&&/lesson-\d+/.test(e.location.href))var t=new RegExp(e.location.href.replace(/.*?(lesson-\d+).*/,"$1/")),i=a.exercises.filter(function(e){return t.test(e)});else if(storageOK&&"completed"==localStorage.genkiRandomExercise&&localStorage.TobiraResults&&JSON.parse(localStorage.TobiraResults)){var s=JSON.parse(localStorage.TobiraResults);if(!(i=a.exercises.filter(function(e){return e.split("|")[0]in s}))[0])return alert("Cannot select a random exercise, because you have not completed enough exercises yet.")}else i=a.exercises;var n=i[Math.floor(Math.random()*i.length)].split("|");/lesson-\d+/.test(n[0])?e.location.href="../../../"+a.ed+"/"+n[0]+"/"+a.local+a.debug:a.randomExercise()},startOrPauseTimerByVisibility:function(){t.hidden&&a.timer.isRunning()?a.timer.pause():t.hidden||!a.timer.isPaused()||a.isTimerPausedByPopup||a.timer.start()},pauseTimerWhenOpenPopup:function(){a.timer.pause(),a.isTimerPausedByPopup=!0},startTimerWhenClosePopup:function(){a.timer.start(),a.isTimerPausedByPopup=!1},init:function(){if(a.exercises){for(var i,s=0,n=a.exercises.length,r=t.getElementById("quiz-result");s"+("appendix"==i?"巻末":"study-tools"==i?"ツール":"第"+i+"課")+" - "+a.active.exercise[1]+"")):r.insertAdjacentHTML("beforebegin",' '+t.querySelector("TITLE").innerText.replace(/\s\|.*/,"")+"
"),a.isTouch&&(t.ontouchstart=function(){a.isTouching=!0},t.ontouchend=function(){a.isTouching=!1},t.ontouchcancel=function(){a.isTouching=!1}),a.create.exerciseButtons()}a.create.exerciseList(),e.Genki=this}};e.onbeforeunload=function(){var e=!1,i=t.getElementById("exercise");if(i){if(i=i.className,/quiz-over/.test(i)||t.querySelector(".review-mode"))e=!1;else if(/fill-quiz|writing-quiz/.test(i)){for(var s=0,n=(r=t.querySelectorAll(".writing-zone-input")).length;s0&&(e=!0);if(e)return"Your progress will be lost. Do you want to continue?"}},a.init()}(window,document); \ No newline at end of file