!function(e,a){"use strict";var s={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"+(/lessons-3rd/.test(e.location.pathname)?"-3rd":""),local:"file:"==e.location.protocol||/localhost/.test(e.location.href)?"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_written:'Complete the following problems.次の質問に答えなさい。',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}のローマ字を選択しなさい。',kana_writing:'Practice writing the following %{KANA}.%{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"==t.format?'':"")+y[0]+(y[1]?"":"kanji"==t.format?"":"")+(r?''+r+"":"")+"",answers:["A"+l]}),(c=h.slice()).splice(j,1),d=3;d-- >0&&c.length;)p=Math.floor(Math.random()*c.length),(o=t.quizlet[c[p]].replace(/\|.*?$/,""))==l?d++:u[x].answers.push("A"==o.charAt(0)?"!"+o:o),c.splice(p,1);g.splice(j,1)}t.quizlet=u}else if("writing"==t.type){var m;u={};for(x in t.quizlet)for(var k,f=(m=x.split("|"))[0].split("/"),v=0,b=f.length;v',g=[];for(x in t.quizlet)g.push(x);for(x=0,q=g.length,j=Math.ceil(q/2);x"}else"kana"==t.format&&(t.quizlet=t.chart)}else if("practice"==t.format){t.quizlet=t.quizlet[e];var z=a.querySelector(".multi-quiz-image");"fill"==t.type&&z?z.style.display="none":"multi"==t.type&&z&&(z.style.display="")}else"hirakata"==t.format&&(t.quizlet=t.quizlet[e]?t.quizlet[e]:t.quizlet[t.quizlet.length-1]);s.generateQuiz(t),s.changingExType=!1}}),!s.changingExType&&(!1!==l||storageOK&&"true"==localStorage.genkiSkipExType)&&(n.callback(),GenkiModal.close()),s.create.exerciseTypeButton(),!1}if(s.active.type=t.type,/\!GRI/.test(t.info)&&(t.info=t.info.replace(/\{.*?\}/g,function(e){var a=e.slice(1,e.length-1).split("|");return'"+a[1]+""})),"drag"==t.type){var d,p,u='":"")+''+t.quizlet[g[x]].replace(/\|.*?$/,"")+"";t.quizlet=u+"
"+(/\|/.test(w)?w.replace("}","|answer}"):w)+"'+t.info+'',g='",p&&(i.className+=" helper-"+(storageOK&&"false"==localStorage.furiganaVisible?"hidden":"present")),u+='',h=[];for(r in t.quizlet)h.push(r);for(d=h.slice(0);h.length;)r=Math.floor(Math.random()*h.length),u+='"+g+"",g+='',h.splice(r,1),++s.stats.problems,!p&&w&&(p=!0);for(u+=""+(w?h[r].replace(/(.*?)\|(.*)/,'$1$2'):h[r])+"';d.length;)u+='",i.innerHTML=u+s.lang.review.replace("",s.lang.toggle_furigana+''),storageOK&&"true"==localStorage.vocabHorizontal&&s.toggle.vocabOrientation(a.getElementById("toggle-orientation"),"false")}else if("kana"==t.type){u='",d.splice(r,1);u+="'+t.quizlet[d[r]].replace(/\|.*?$/,"")+"'+t.info+'';var m,k='"+s.lang.review}else if("writing"==t.type){u='',f=[],v=t.quizlet;for(r=v.length-1;r>-1;r--){u+='"+k+"';for(m in v[r])u+='"}for(;f.length;)k+=f[r=Math.floor(Math.random()*f.length)],f.splice(r,1);i.innerHTML=u+"",f.push(''+v[r][m]+"'+m+""),++s.stats.problems;u+="'+t.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/((N=t.columns)+1)+'%;"',y=0,w=!1;for(r in t.quizlet){for(u+='"+s.lang.check_answers.replace("",w?s.lang.toggle_furigana+"":""),t.quiz&&(i.className+=" no-helper"),s.input={map:a.querySelectorAll(".writing-zone-input"),index:0},s.input.map[0].autofocus=!0}else if("multi"==t.type){u='",N=t.columns}/data-helper/.test(u)&&(w=!0,i.className+=" helper-"+(storageOK&&"false"==localStorage.furiganaVisible?"hidden":"present")),i.innerHTML=u+"",o=0;N-- >0;)u+='',++s.stats.problems;u+="'+r+"'+t.info+'',k='';var x=65,q=!1,j=(w=!1,/"format":"vocab"/.test(s.exerciseData));for(r=0,o=(M=t.quizlet).length;r",x=65,++s.stats.problems}/class="furigana"|class="inline-furi"|/.test(u)&&(w=!0,i.className+=" helper-"+(storageOK&&"false"==localStorage.furiganaVisible?"hidden":"present")),j&&storageOK&&"true"==localStorage.spoilerMode&&(i.className+=" spoiler-mode"),i.innerHTML=u+''+(s.appendix?"":'')+(w?s.lang.toggle_furigana:"")+"",s.progressQuiz("init")}else if("fill"==t.type){w=!1;/class="furigana"|class="inline-furi"|/.test(t.quizlet)&&(w=!0,i.className+=" helper-"+(storageOK&&"false"==localStorage.furiganaVisible?"hidden":"present")),i.innerHTML=''+t.info+'
If you don\'t know how to type in Japanese on your computer, please visit our help page by clicking here.パソコンで日本語を入力する方法がわからない場合は、ヘルプページをご覧ください。'+t.quizlet.replace(/\{.*?\}/g,function(e){var a,t,i,n,l,r=e.slice(1,e.length-1).split("|");return"!IMG"==r[0]?s.parse.image(r):"!GRI"==r[0]?'"+r[1]+"":"!AUDIO"==r[0]?'':"!PLAY"==r[0]?'':(a=r[1]?r[1]:"",t=(r[10]||r[9]||r[8]||r[7]||r[6]||r[5]||r[4]||r[3]||r[2]?r[10]||r[9]||r[8]||r[7]||r[6]||r[5]||r[4]||r[3]||r[2]:"").split(";"),(/\%\((.*?)\)/.test(a)||/\%\((.*?)\)/.test(r[0]))&&(i=[r[0].match(/%\((.*?)\)/),a.match(/%\((.*?)\)/)]),++s.stats.problems,n=/width:/.test(t[0])?t[0].split(":")[1]:t[1]&&/width:/.test(t[1])?t[1].split(":")[1]:t[2]&&/width:/.test(t[2])?t[2].split(":")[1]:i?(a?(i[0]&&i[0][1]||"/").split("/").concat((i[1]&&i[1][1]||"/").split("/")):(i[0]&&i[0][1]||"/").split("/")).sort(function(e,a){return a.length-e.length})[0].length*(14/(/[a-z]/i.test(a||r[0])&&!/[\u3000-\u30FF]/.test(a||r[0])?2:1))+14+[a.replace(/\%\((.*?)\)/g,""),r[0].replace(/\%\((.*?)\)/g,"")].sort(function(e,a){return a.length-e.length})[0].length*(14/(/[a-z]/i.test(a||r[0])&&!/[\u3000-\u30FF]/.test(a||r[0])?2:1)):[a,r[0]].sort(function(e,a){return a.length-e.length})[0].length*(14/(/[a-z]/i.test(a||r[0])&&!/[\u3000-\u30FF]/.test(a||r[0])?2:1))+14,l=/placeholder:/.test(t[0])?t[0].split(":")[1]:t[1]&&/placeholder:/.test(t[1])?t[1].split(":")[1]:t[2]&&/placeholder:/.test(t[2])?t[2].split(":")[1]:null,''+(a&&!/answer|furigana|placeholder/.test(t[0])||t[1]&&/hint:/.test(t[1])||t[2]&&/hint:/.test(t[2])?''+(t[1]&&/hint:/.test(t[1])?t[1].split(":")[1]:t[2]&&/hint:/.test(t[2])?t[2].split(":")[1]:a)+"":"")+"")})+""+s.lang.check_answers.replace("()","(false, 'fill')").replace("",w?s.lang.toggle_furigana+"":""),a.querySelector(".writing-zone-input").autofocus=!0}else if("stroke"==t.type){u=''+t.info+'',k='';var z,T=storageOK&&"false"==localStorage.strokeOrderVisible,S=storageOK&&"false"==localStorage.tracingGuideVisible;for(r=0,o=(M=t.quizlet).length;r",++s.stats.problems;i.innerHTML=u+'',T&&(i.className+=" stroke-order-hidden"),s.progressQuiz("init",!1,"stroke")}else if("drawing"==t.type){u=''+t.info+'',S=storageOK&&"false"==localStorage.tracingGuideVisible,b='style="width:'+100/((N=t.columns)+1)+'%;"';var N,M=t.quizlet,E=0;for(r=0,o=t.quizlet.length;r",N=t.columns}i.innerHTML=u+""+s.lang.check_answers.replace("()","(false, 'drawing')").replace("",'');var L=a.querySelectorAll(".kanji-canvas");for(r=0,o=L.length;r ';N-- >0;)u+='"+M[r].kanji+'",++s.stats.problems,++E;u+="'+(s.debug?'':"")+"1?s.stats.mistakes:++s.stats.mistakes):(t.className+=" answer-correct",s.markedItem&&(s.markedItem.className="quiz-item",s.markedItem=null),++s.stats.solved==s.stats.problems&&s.endQuiz()))}),s.drake=I,s.globalEventListenersSet||(s.globalEventListenersSet=!0,["click","keypress"].forEach(function(e){a.addEventListener(e,function(e){if(!("keypress"==e.type&&"Enter"!=e.key||s.quizOver)){for(var t=e.target,i=4,n=i-1;i-- >0&&(i '+(s.stats.solved+1)+"/"+s.stats.problems+""},progressQuiz:function(e,t,i){if(s.textSelectMode||s.quizOver)return!1;if("init"==e)a.getElementById("quiz-q"+s.stats.solved).style.display="",s.incrementProgressBar();else{if(e&&"stroke"==i){var n=KanjiCanvas.recognize(e.dataset.canvas);e=e.parentNode.parentNode.querySelector(".kanji-canvas"),s.debug&&console.log("toDraw: "+e.dataset.kanji),s.debug&&console.log("Results: "+n),s.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",t&&(e.parentNode.className+=" hidden-answer"),"false"==e.dataset.answer&&(e.parentNode.parentNode.className+=" wrong-answer",++s.stats.mistakes);var l=a.getElementById("quiz-q"+s.stats.solved++),r=a.getElementById("quiz-q"+s.stats.solved);if(r)if("instant"==s.feedbackMode&&"multi"==s.active.type)s.multiNodes||(s.multiNodes={list:a.getElementById("question-list"),button:a.getElementById("next-button"),next:null,last:null}),s.quizOver=!0,s.multiNodes.list.className+=" multi-quiz quiz-over",s.multiNodes.button.style.visibility="visible",s.multiNodes.button.firstChild.focus(),s.multiNodes.next=r,s.multiNodes.last=l;else{r.style.display="",l.style.display="none";(o=r.querySelector(a.querySelector(".spoiler-mode")?".vocab-spoiler-toggle":".quiz-multi-answer"))&&o.focus(),s.incrementProgressBar()}else{s.endQuiz(i==s.QuizType.STROKE?i:s.QuizType.MULTI);for(var o,c=0,d=(o=a.querySelectorAll('[id^="quiz-q"]')).length;c Quiz Complete!テスト終了! ',storageOK&&s.active.exercise.length>0&&!/appendix|study-tools/.test(s.active.exercise[0])){var r=s.active.exercise[0],o=localStorage.GenkiEdition,c=JSON.parse(localStorage.Results);c[o]||(c[o]={});var d=c[o];d[r]=void 0===d[r]||s.stats.score>d[r]?s.stats.score:d[r],localStorage.Results=JSON.stringify(c),s.create.removeExerciseList(),s.create.exerciseList(),"true"!=localStorage.dataBackupReminder&&void 0!=localStorage.dataBackupReminder||(++s.dataBackupReminderCount>=10&&(s.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?練習が10回終わりました。練習の得点データを保存しますか?Problems Solved:問題を解いた:'+n+'Answers Wrong:不正解の問題:'+s.stats.mistakes+'Score:得点:'+s.stats.score+'%Completion Time:かかった時間:'+l.innerHTML+''+(100==s.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.満点!たいへんよくできました!':s.stats.score>70?'Nice work!よくできました! '+s.lang[t?t+"_mistakes":"mistakes"]:'Keep studying!頑張りましょう! '+s.lang[t?t+"_mistakes":"mistakes"])+(a.querySelector(".alt-phrase")?"
"+s.lang.sub_answers:"")+''+(/\/dictionary\//.test(e.location)?s.lang.back_to_dict:'')+'Back to Indexトップページに戻るSave Dataセーブする',zIndex:"low",focus:"#save-exercise-data"})},100)),localStorage.dataBackupReminderCount=s.dataBackupReminderCount)}"stroke"==t&&(a.getElementById("toggle-stroke-numbers").style.display="",a.getElementById("toggle-tracing-guide").style.display="none"),s.drake&&setTimeout(function(){s.drake.destroy(),delete s.drake},100);var p=a.getElementById("change-exercise-type-container");p&&(p.style.display="none"),a.getElementById("exercise").className+=" quiz-over",s.scrollTo("#complete-banner",!0)},reset:function(t){if(e.JSON){if(!t&&/fill-quiz|writing-quiz/.test(a.getElementById("exercise").className)&&s.stats.mistakes>0)return GenkiModal.open({title:'Try again with your current answers?前の答えを保存してやり直しますか?',content:'If Genki Study Resources has helped you with your studies, please also consider making a donation if you can, to help support the continued development and maintenance of these resources. Your support is greatly appreciated!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.※ページや練習型を変更すると、答えは失われますのでご注意ください。',buttonHTML:'Yesはい',closeButtonText:'Noいいえ',customButton:'',keepOpen:!0,callback:function(){for(var e=[],t=a.querySelectorAll(".writing-zone-input"),i=0,n=t.length;i'+(n?n.outerHTML:"")+''+a.querySelector(".more-exercises").outerHTML,s.appendix?(i.style.display="none",a.getElementById("appendix-tool").style.display="",s.scrollTo(/\/dictionary\//.test(e.location)?"#practice-words":".title"),/\/dictionary\//.test(e.location)?s.appendix.jisho.launchExercise():/\/map-of-japan\//.test(e.location)?s.appendix.studyMap():/\/numbers-chart\//.test(e.location)?s.appendix.studyChart("numbers"):/\/conjugation-chart\//.test(e.location)&&s.appendix.studyChart("conjugation")):s.tools?(i.style.display="none",a.getElementById("study-tool-editor").style.display="",s.scrollTo(".title")):s.generateQuiz(JSON.parse(s.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(s.exerciseData)?' Please see this page for more tips on memorizing vocab.':"")+'休憩してからもう一度やってみると記憶力のために役立ちます。5、10分の休憩がおすすめですが、お好みの時間が調整できます。'+(/"format":"vocab"/.test(s.exerciseData)?'単語を暗記するためのヒントにはこのページをご覧ください。':"")+' Wait 待つ時間: Minute(s)分',buttonHTML:'Wait待つ',keepOpen:!0,callback:function(){if(s.breakMultiplier60?n=60:n<=0&&(n=1),GenkiModal.open({title:'Taking a Break休憩中',content:' 00:'+(n<10?"0":"")+n+":00",buttonHTML:'End Break Time休憩を終了する',keepOpen:!!(s.appendix||!s.tools&&/"format"/.test(s.exerciseData)),callback:function(){s.reset(),a.body.className=a.body.className.replace(" taking-a-break","")}}),a.body.className+=" taking-a-break",i=Math.floor(10*Math.random())+1,a.getElementById("genki-modal-overlay").style.backgroundImage="url(../../../resources/images/backgrounds/bg-"+(i<10?"0":"")+i+".jpg)";var l=new Timer,r=a.getElementById("break-timer");l.start({startValues:{minutes:n},target:{seconds:0},countdown:!0}),l.addEventListener("secondsUpdated",function(t){var i=l.getTimeValues().toString();if(r.innerHTML=i,"00:00:00"==i&&(r.innerHTML='Break time is up!休憩が終了しました!Click the button below to resume your studies.勉強を続けるために下のボタンをクリックしてください。',a.getElementById("genki-modal-ok").style.display="inline-block",!s.local&&s.canNotify&&"granted"==Notification.permission)){new Notification(a.title.replace(/ \| Genki Study Resources.*$/,""),{body:"ja"==GenkiLang?"休憩が終了しました!":"Break time is up!",icon:a.querySelector('meta[property="og:image"]').content,tag:"breakTime-"+s.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 a=Number(e.value);a<=5?s.breakMultiplier=0:a<=10?s.breakMultiplier=1:a<=15?s.breakMultiplier=2:a<=20?s.breakMultiplier=3:a<=30?s.breakMultiplier=4:a<=40?s.breakMultiplier=5:a<=50?s.breakMultiplier=6:a<=60&&(s.breakMultiplier=7),s.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 t=a.querySelectorAll("[data-answer]"),i=0,n=t.length;iRestartリセットする')+(a.querySelector(".drag-quiz")?s.lang.toggle_furigana+a.getElementById("toggle-orientation").outerHTML:""),a.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.復習モードになっていますので、ゆっくり勉強してください。復習し終わったら「リセットする」をクリックしてください。',a.getElementById("quiz-zone").className+=" review-mode";var l=a.getElementById("change-exercise-type-container");l&&(l.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(t){if(s.check.busy||t.value!=t.dataset.answer)s.check.busy&&e.setTimeout(function(){s.check.busy=!1,a.activeElement&&a.activeElement.value&&a.activeElement.value==s.input.map[s.input.index-1].value&&(a.activeElement.value="")},10);else{s.check.busy=!0;var i=s.input.map[s.input.index+1];i?i.focus():e.setTimeout(function(){t.blur(),s.check.answers(!0),s.check.busy=!1},10)}},answers:function(e,t){!s.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?答え合わせをするとテストが終了します。よろしいですか?',buttonHTML:'Yes, check my answers!はい、答え合わせをしよう!',callback:function(){if(s.exerciseComplete=!0,a.querySelector("#check-answers button").style.display="none",t&&"drawing"==t)for(var e,i=0,n=(d=a.querySelectorAll(".kanji-canvas")).length;i '+c.answer+(c.answer2||c.furigana?''+(c.answer2||c.furigana)+"":"")+"").replace(/%\((.*?)\)/g,function(e,a){return'('+a.replace(/\//g,'/')+')'}))),++s.stats.solved,u[i].disabled=!0}}s.endQuiz(t||s.QuizType.WRITING)}})}},toggle:{exerciseList:function(e){e.className="list-open"==e.className?"":"list-open"},list:function(e){var a="lesson-title",s=a+" lesson-open";e.className=e.className==s?a:s;for(var t=e.parentNode.querySelectorAll(".lesson-title"),i=0,n=t.length;i ',i=2;i-- >0;)(e=s.exercises[1==i?s.active.index-1:s.active.index+1])&&!/^\.\.\//.test(e)&&(e=e.split("|"),t+=''+e[1]+"");a.getElementById("quiz-timer").insertAdjacentHTML("afterend",t+"")},removeExerciseList:function(){var e=a.getElementById("exercise-list"),s=a.getElementById("toggle-exercises");e&&e.parentNode.removeChild(e),s&&s.parentNode.removeChild(s)},exerciseList:function(){var t=' ';if(s.exercises){var i,n,l,r='class="lesson-title" onclick="Genki.toggle.list(this);" onkeydown="event.key == \'Enter\' && Genki.toggle.list(this);" tabindex="0"',o='"),s.active.exercise&&(s.toggle.list(a.getElementById(/^appendix/.test(s.active.exercise[0])?"appendix":/^study-tools/.test(s.active.exercise[0])?"study-tools":s.active.exercise[0].replace(/(lesson-\d+)\/.*/,"$1")).previousSibling),(n=a.querySelector('a[href*="'+s.active.exercise[0]+'"]:not(#link-grammar)')).className+=" active-lesson",n=n.parentNode,a.getElementById("lessons-list").scrollTop=n.offsetTop-(n.getBoundingClientRect().height+(e.matchMedia&&matchMedia("(pointer:coarse)").matches?0:6)))}else{var y='";a.getElementById("content").insertAdjacentHTML("afterbegin",y)}},exerciseTypeButton:function(){var t=a.getElementById("quiz-timer"),i=a.createElement("DIV"),n=a.createElement("BUTTON");i.id="change-exercise-type-container",i.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?練習型を変更するためにテストが終了しなければいけません。よろしいですか?',buttonHTML:'Quit終了する',closeButtonText:'Cancel戻る',keepOpen:!!(/\/dictionary\//.test(e.location)||!s.tools&&/"format"/.test(s.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({},a.title,e.location.href.replace(e.location.search,"")+s.debug)}s.changingExType=!0,s.reset()}})},i.appendChild(n),t.nextSibling?t.parentNode.insertBefore(i,t.nextSibling):t.parentNode.appendChild(i)}},parse:{image:function(e){var a=/^http/.test(e[1])?e[1]:"../../../resources/images/lesson-images/"+e[1];return''}},quickJisho:{hidden:!0,selectorHidden:!0,tabbing:!1,create:function(){if(!s.quickJisho.cache){var e=a.createElement("DIV"),t=a.createElement("DIV"),i=a.createElement("BUTTON"),n=a.createDocumentFragment();e.id="quick-jisho-toggle",e.innerHTML='',e.title="ja"==GenkiLang?"クイック辞書をトグルする":"Toggle Quick Dictionary",e.tabIndex=0,e.onclick=s.quickJisho.toggle,e.onkeypress=function(e){"Enter"==e.key&&s.quickJisho.toggle()},t.id="quick-jisho-window",t.className="quick-jisho-hidden",t.innerHTML='
Quick Dictionaryクイック辞書
',i.id="quick-jisho-selector",i.className="button",i.style.display="none",i.innerHTML='Look up辞書で調べる',i.onclick=s.quickJisho.lookUp,i.tabIndex=0,n.appendChild(t),n.appendChild(e),n.appendChild(i),a.body.appendChild(n);a.querySelector(".footer-right").style.marginRight="40px",s.quickJisho.cache={box:t,search:a.getElementById("quick-jisho-search"),results:a.getElementById("quick-jisho-results"),hits:a.getElementById("quick-jisho-hits"),selector:a.getElementById("quick-jisho-selector")},a.onselectionchange=s.quickJisho.getSelection,a.onmousemove=function(e){s.quickJisho.x=Math.abs(e.pageX-a.body.clientWidth)<100?e.pageX-95:e.pageX,s.quickJisho.y=Math.abs(e.pageY-a.body.clientHeight)<40?e.pageY-32:e.pageY+12},a.onkeydown=function(e){"Tab"!=e.key||s.quickJisho.selectorHidden||a.activeElement==s.quickJisho.cache.selector||(s.quickJisho.tabbing=!0,s.quickJisho.cache.selector.focus(),e.preventDefault())}}},toggle:function(){if(!s.jisho&&!s.quickJisho.loading){s.quickJisho.loading=!0;var e=a.createElement("SCRIPT");e.src=getPaths()+"resources/javascript/jisho.min.js",e.onload=function(){s.quickJisho.cache.search.value&&s.quickJisho.search(s.quickJisho.cache.search.value),s.quickJisho.loading=!1},a.body.appendChild(e)}s.quickJisho.hidden?(s.quickJisho.cache.box.className="",s.quickJisho.hidden=!1,s.quickJisho.cache.search.focus()):(s.quickJisho.cache.box.className="quick-jisho-hidden",s.quickJisho.hidden=!0)},search:function(a,t){s.quickJisho.searchTimeout&&e.clearTimeout(s.quickJisho.searchTimeout),s.quickJisho.searchTimeout=e.setTimeout(function(){var e,i,n,l,r,o="",c=0;if(s.quickJisho.cache.results.innerHTML="",a){a=a.toLowerCase();for(e in s.jisho)for(i=0,n=s.jisho[e].length;i'+r[0]+(r[1]?""+r[1]+"":"")+''+s.jisho[e][i].en+""+(s.jisho[e][i].v?' ['+s.jisho[e][i].v+"]":"")+''+s.jisho[e][i].l+"",c++;break}}if(!t&&!o&&a&&/[\u3400-\u9faf]/.test(a)){var d=a.match(/[\u3400-\u9faf]+/);d&&d[0]&&s.quickJisho.search(d[0],!0)}else s.quickJisho.cache.results.innerHTML=o||(a?' No results found for "'+a+'".「'+a+"」が見つかりませんでした。 ":""),s.quickJisho.cache.hits.innerHTML=c?"("+c+")":"";delete s.quickJisho.searchTimeout},300)},lookUp:function(){s.quickJisho.hidden&&s.quickJisho.toggle(),s.quickJisho.cache.search.value="".trim?s.quickJisho.selectedText.trim():s.quickJisho.selectedText,s.quickJisho.search(s.quickJisho.cache.search.value),this.style.display="none",s.quickJisho.selectorHidden=!0},getSelection:function(){if(storageOK&&"false"==localStorage.genkiJishoLookUp)return!1;if(s.quickJisho.tabbing)return s.quickJisho.tabbingOff||(s.quickJisho.tabbingOff=setTimeout(function(){s.quickJisho.tabbing=!1,delete s.quickJisho.tabbingOff},10)),!1;if(a.getSelection){var e=a.getSelection();"Range"==e.type&&e.toString&&!/quick-jisho/.test(e.focusNode.className)?(s.quickJisho.selectedText=e.toString(),s.quickJisho.cache.selector.style.left=s.quickJisho.x+"px",s.quickJisho.cache.selector.style.top=s.quickJisho.y+"px",s.quickJisho.selectorHidden&&(s.quickJisho.cache.selector.style.display="",s.quickJisho.selectorHidden=!1)):(s.quickJisho.selectedText="",s.quickJisho.selectorHidden||(s.quickJisho.cache.selector.style.display="none",s.quickJisho.selectorHidden=!0))}}},playAudio:function(e,s){var t=a.getElementById(e);t&&(t.currentTime=s,t.play())},viewStrokeOrder:function(e,a,s){var t=getPaths()+"resources/images/stroke-order/"+a+".png";GenkiModal.open({title:e+' Stroke Orderの書き順',content:''})},getAlts:function(e,a,t){for(var i,n,l,r,o=a.split("|"),c=o.length,d=Math.pow(2,c),p=[],u=0;u',customButton:(s.grammarPointHistory.length?'':"")+'View in Grammar Index文法索引で見る',customSize:{top:"10%",left:"20%",bottom:"10%",right:"20%"},zIndex:"low",closeCallback:function(){s.grammarPointHistory=[]}}),Get(e.href,function(s){var i=a.querySelector("#genki-modal #appendix-tool"),n=s.match(new RegExp('(
)',"m")),l=e.href.replace(/#.*$/,"");n&&n[0]?i&&(i.innerHTML=n[0].replace(/\d+\. /,"").replace(/href="#(.*?)"/g,'onclick="Genki.getGrammarPoint(this, \'$1\'); return false;" target="_blank" href="'+l+'#$1"'),i.className="grammar-index third-ed"):i&&(i.innerHTML='
Failed to retrieve grammar point. Click "View in Grammar Index" to try viewing the grammar point directly.文法ノートが見つかりませんでした。「文法索引で見る」をクリックして文法索引で見てみます。',i.className="center")})},grammarPointHistory:[],grammarPointBack:function(e){if(s.grammarPointHistory.length){var t=a.getElementById("genki-modal-content");t.innerHTML=s.grammarPointHistory.pop(),t.scrollTop=0,s.grammarPointHistory.length||(e.style.display="none")}},randomExercise:function(){if(storageOK&&"lesson"==localStorage.genkiRandomExercise&&/lesson-\d+/.test(e.location.href))var a=new RegExp(e.location.href.replace(/.*?(lesson-\d+).*/,"$1/")),t=s.exercises.filter(function(e){return a.test(e)});else if(storageOK&&"completed"==localStorage.genkiRandomExercise&&localStorage.Results&&JSON.parse(localStorage.Results)[localStorage.GenkiEdition]){var i=JSON.parse(localStorage.Results)[localStorage.GenkiEdition];if(!(t=s.exercises.filter(function(e){return e.split("|")[0]in i}))[0])return alert("ja"==GenkiLang?"完成した練習が足りませんのでランダム練習はできません。":"Cannot select a random exercise, because you have not completed enough exercises yet.")}else if(storageOK&&"custom"==localStorage.genkiRandomExercise&&GenkiRandomList.length)t=GenkiRandomList;else t=s.exercises;var n=t[Math.floor(Math.random()*t.length)].split("|");/lesson-\d+/.test(n[0])?e.location.href="../../../"+s.ed+"/"+n[0]+"/"+s.local+s.debug:s.randomExercise()},startOrPauseTimerByVisibility:function(){a.hidden&&s.timer.isRunning()?s.timer.pause():a.hidden||!s.timer.isPaused()||s.isTimerPausedByPopup||s.timer.start()},pauseTimerWhenOpenPopup:function(){s.timer.pause(),s.isTimerPausedByPopup=!0},startTimerWhenClosePopup:function(){s.timer.start(),s.isTimerPausedByPopup=!1},init:function(){if(s.exercises){for(var t,i=0,n=s.exercises.length,l=a.getElementById("quiz-result");i"+("appendix"==t?"巻末":"study-tools"==t?"ツール":"第"+t+"課")+" - "+s.active.exercise[1]+"")):l.insertAdjacentHTML("beforebegin",' '+a.querySelector("TITLE").innerText.replace(/\s\|.*/,"")+"
"),s.isTouch&&(a.ontouchstart=function(){s.isTouching=!0},a.addEventListener("touchmove",function(e){s.isTouching&&/hidden/i.test(a.body.style.overflow)&&e.preventDefault()},{passive:!1}),a.ontouchend=function(){s.isTouching=!1},a.ontouchcancel=function(){s.isTouching=!1}),s.create.exerciseButtons()}s.create.exerciseList(),e.Genki=this}};e.onbeforeunload=function(){var e=!1,t=a.getElementById("exercise");if(t){if(t=t.className,/quiz-over/.test(t)||a.querySelector(".review-mode"))e=!1;else if(/fill-quiz|writing-quiz/.test(t)){for(var i=0,n=(l=a.querySelectorAll(".writing-zone-input")).length;i0&&(e=!0);if(e)return"ja"==GenkiLang?"進み具合は失われます。よろしいですか?":"Your progress will be lost. Do you want to continue?"}},s.init(),storageOK&&"true"!=localStorage.surveySeen&&GenkiModal.open({title:"New Project Survey",content:' Hello!
We just published a survey for our new Japanese language learning project and we\'d like to hear from you! If you\'d like to take the survey, please click here.
You can find more information on this new project and the survey here.
Thank you and we look forward to hearing from you!
',closeCallback:function(){localStorage.surveySeen=!0}})}(window,document);