(function(b){var a=function(d){this._options={checkOnLoad:false,resetOnEnd:false,loopCheckTime:50,loopMaxNumber:5,baitClass:"pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links",baitStyle:"width: 1px !important; height: 1px !important; position: absolute !important; left: -10000px !important; top: -1000px !important;",debug:false};this._var={version:"3.2.1",bait:null,checking:false,loop:null,loopNumber:0,event:{detected:[],notDetected:[]}};if(d!==undefined){this.setOption(d)}var c=this;var e=function(){setTimeout(function(){if(c._options.checkOnLoad===true){if(c._options.debug===true){c._log("onload->eventCallback","A check loading is launched")}if(c._var.bait===null){c._creatBait()}setTimeout(function(){c.check()},1)}},1)};if(b.addEventListener!==undefined){b.addEventListener("load",e,false)}else{b.attachEvent("onload",e)}};a.prototype._options=null;a.prototype._var=null;a.prototype._bait=null;a.prototype._log=function(d,c){console.log("[BlockAdBlock]["+d+"] "+c)};a.prototype.setOption=function(c,f){if(f!==undefined){var d=c;c={};c[d]=f}for(var e in c){this._options[e]=c[e];if(this._options.debug===true){this._log("setOption",'The option "'+e+'" he was assigned to "'+c[e]+'"')}}return this};a.prototype._creatBait=function(){var c=document.createElement("div");c.setAttribute("class",this._options.baitClass);c.setAttribute("style",this._options.baitStyle);this._var.bait=b.document.body.appendChild(c);this._var.bait.offsetParent;this._var.bait.offsetHeight;this._var.bait.offsetLeft;this._var.bait.offsetTop;this._var.bait.offsetWidth;this._var.bait.clientHeight;this._var.bait.clientWidth;if(this._options.debug===true){this._log("_creatBait","Bait has been created")}};a.prototype._destroyBait=function(){b.document.body.removeChild(this._var.bait);this._var.bait=null;if(this._options.debug===true){this._log("_destroyBait","Bait has been removed")}};a.prototype.check=function(c){if(c===undefined){c=true}if(this._options.debug===true){this._log("check","An audit was requested "+(c===true?"with a":"without")+" loop")}if(this._var.checking===true){if(this._options.debug===true){this._log("check","A check was canceled because there is already an ongoing")}return false}this._var.checking=true;if(this._var.bait===null){this._creatBait()}var d=this;this._var.loopNumber=0;if(c===true){this._var.loop=setInterval(function(){d._checkBait(c)},this._options.loopCheckTime)}setTimeout(function(){d._checkBait(c)},1);if(this._options.debug===true){this._log("check","A check is in progress ...")}return true};a.prototype._checkBait=function(c){var d=false;if(this._var.bait===null){this._creatBait()}if(b.document.body.getAttribute("abp")!==null||this._var.bait.offsetParent===null||this._var.bait.offsetHeight==0||this._var.bait.offsetLeft==0||this._var.bait.offsetTop==0||this._var.bait.offsetWidth==0||this._var.bait.clientHeight==0||this._var.bait.clientWidth==0){d=true}if(b.getComputedStyle!==undefined){var e=b.getComputedStyle(this._var.bait,null);if(e&&(e.getPropertyValue("display")=="none"||e.getPropertyValue("visibility")=="hidden")){d=true}}if(this._options.debug===true){this._log("_checkBait","A check ("+(this._var.loopNumber+1)+"/"+this._options.loopMaxNumber+" ~"+(1+this._var.loopNumber*this._options.loopCheckTime)+"ms) was conducted and detection is "+(d===true?"positive":"negative"))}if(c===true){this._var.loopNumber++;if(this._var.loopNumber>=this._options.loopMaxNumber){this._stopLoop()}}if(d===true){this._stopLoop();this._destroyBait();this.emitEvent(true);if(c===true){this._var.checking=false}}else{if(this._var.loop===null||c===false){this._destroyBait();this.emitEvent(false);if(c===true){this._var.checking=false}}}};a.prototype._stopLoop=function(c){clearInterval(this._var.loop);this._var.loop=null;this._var.loopNumber=0;if(this._options.debug===true){this._log("_stopLoop","A loop has been stopped")}};a.prototype.emitEvent=function(c){if(this._options.debug===true){this._log("emitEvent","An event with a "+(c===true?"positive":"negative")+" detection was called")}var e=this._var.event[(c===true?"detected":"notDetected")];for(var d in e){if(this._options.debug===true){this._log("emitEvent","Call function "+(parseInt(d)+1)+"/"+e.length)}if(e.hasOwnProperty(d)){e[d]()}}if(this._options.resetOnEnd===true){this.clearEvent()}return this};a.prototype.clearEvent=function(){this._var.event.detected=[];this._var.event.notDetected=[];if(this._options.debug===true){this._log("clearEvent","The event list has been cleared")}};a.prototype.on=function(c,d){this._var.event[(c===true?"detected":"notDetected")].push(d);if(this._options.debug===true){this._log("on",'A type of event "'+(c===true?"detected":"notDetected")+'" was added')}return this};a.prototype.onDetected=function(c){return this.on(true,c)};a.prototype.onNotDetected=function(c){return this.on(false,c)};b.BlockAdBlock=a;if(b.blockAdBlock===undefined){b.blockAdBlock=new a({checkOnLoad:true,resetOnEnd:true})}})(window);RealKana=function(){var t,p,i,K,G=-1,l,Q,f,P,x,A,I,O,R,m,v,N,M=-1,w,j,C={し:"_si_",ち:"_ti_",つ:"_tu_",ふ:"_hu_",を:"_wo_",じ:"_zi_",ぢ:"_di_",づ:"_du_",シ:"_si_",チ:"_ti_",ツ:"_tu_",フ:"_hu_",ヲ:"_wo_",ジ:"_zi_",ヂ:"_di_",ヅ:"_du_",しゃ:"_sya_",しゅ:"_syu_",しょ:"_syo_",ちゃ:"_tya_",ちゅ:"_tyu_",ちょ:"_tyo_",じゃ:"_zya_jya_",じゅ:"_zyu_jyu_",じょ:"_zyo_jyo_",ぢゃ:"_zya_dya_",ぢゅ:"_zyu_dyu_",ぢょ:"_zyo_dyo_",シャ:"_sya_",シュ:"_syu_",ショ:"_syo_",チャ:"_tya_",チュ:"_tyu_",チョ:"_tyo_",ジャ:"_zya_jya_",ジュ:"_zyu_jyu_",ジョ:"_zyo_jyo_",ヂャ:"_zya_dya_",ヂュ:"_zyu_dyu_",ヂョ:"_zyo_dyo_"},B={1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,10:"a",11:"b",12:"c",13:"d",14:"e",15:"f",16:"g",17:"h",18:"i"},h={あ:[0,0],い:[1,0],う:[2,0],え:[3,0],お:[4,0],か:[5,0],が:[6,0],き:[7,0],ぎ:[8,0],く:[9,0],ぐ:[0,1],け:[1,1],げ:[2,1],こ:[3,1],ご:[4,1],さ:[5,1],ざ:[6,1],し:[7,1],じ:[8,1],す:[9,1],ず:[0,2],せ:[1,2],ぜ:[2,2],そ:[3,2],ぞ:[4,2],た:[5,2],だ:[6,2],ち:[7,2],ぢ:[8,2],つ:[9,2],づ:[0,3],て:[1,3],で:[2,3],と:[3,3],ど:[4,3],な:[5,3],に:[6,3],ぬ:[7,3],ね:[8,3],の:[9,3],は:[0,4],ば:[1,4],ぱ:[2,4],ひ:[3,4],び:[4,4],ぴ:[5,4],ふ:[6,4],ぶ:[7,4],ぷ:[8,4],へ:[9,4],べ:[0,5],ぺ:[1,5],ほ:[2,5],ぼ:[3,5],ぽ:[4,5],ま:[5,5],み:[6,5],む:[7,5],め:[8,5],も:[9,5],ゃ:[0,6],や:[1,6],ゅ:[2,6],ゆ:[3,6],ょ:[4,6],よ:[5,6],ら:[6,6],り:[7,6],る:[8,6],れ:[9,6],ろ:[0,7],わ:[1,7],を:[2,7],ん:[3,7],ァ:[4,7],ア:[5,7],ィ:[6,7],イ:[7,7],ゥ:[8,7],ウ:[9,7],ェ:[0,8],エ:[1,8],ォ:[2,8],オ:[3,8],カ:[4,8],ガ:[5,8],キ:[6,8],ギ:[7,8],ク:[8,8],グ:[9,8],ケ:[0,9],ゲ:[1,9],コ:[2,9],ゴ:[3,9],サ:[4,9],ザ:[5,9],シ:[6,9],ジ:[7,9],ス:[8,9],ズ:[9,9],セ:[0,10],ゼ:[1,10],ソ:[2,10],ゾ:[3,10],タ:[4,10],ダ:[5,10],チ:[6,10],ヂ:[7,10],ツ:[8,10],ヅ:[9,10],テ:[0,11],デ:[1,11],ト:[2,11],ド:[3,11],ナ:[4,11],ニ:[5,11],ヌ:[6,11],ネ:[7,11],ノ:[8,11],ハ:[9,11],バ:[0,12],パ:[1,12],ヒ:[2,12],ビ:[3,12],ピ:[4,12],フ:[5,12],ブ:[6,12],プ:[7,12],ヘ:[8,12],ベ:[9,12],ペ:[0,13],ホ:[1,13],ボ:[2,13],ポ:[3,13],マ:[4,13],ミ:[5,13],ム:[6,13],メ:[7,13],モ:[8,13],ャ:[9,13],ヤ:[0,14],ュ:[1,14],ユ:[2,14],ョ:[3,14],ヨ:[4,14],ラ:[5,14],リ:[6,14],ル:[7,14],レ:[8,14],ロ:[9,14],ワ:[0,15],ヲ:[1,15],ン:[2,15],ヴ:[3,15]},q=[[["あ","a"],["い","i"],["う","u"],["え","e"],["お","o"]],[["か","ka"],["き","ki"],["く","ku"],["け","ke"],["こ","ko"]],[["さ","sa"],["し","shi"],["す","su"],["せ","se"],["そ","so"]],[["た","ta"],["ち","chi"],["つ","tsu"],["て","te"],["と","to"]],[["な","na"],["に","ni"],["ぬ","nu"],["ね","ne"],["の","no"]],[["は","ha"],["ひ","hi"],["ふ","fu"],["へ","he"],["ほ","ho"]],[["ま","ma"],["み","mi"],["む","mu"],["め","me"],["も","mo"]],[["や","ya"],["ゆ","yu"],["よ","yo"]],[["ら","ra"],["り","ri"],["る","ru"],["れ","re"],["ろ","ro"]],[["わ","wa"],["を","o"]],[["ん","n"]],[["が","ga"],["ぎ","gi"],["ぐ","gu"],["げ","ge"],["ご","go"]],[["ざ","za"],["じ","ji"],["ず","zu"],["ぜ","ze"],["ぞ","zo"]],[["だ","da"],["ぢ","ji"],["づ","zu"],["で","de"],["ど","do"]],[["ば","ba"],["び","bi"],["ぶ","bu"],["べ","be"],["ぼ","bo"]],[["ぱ","pa"],["ぴ","pi"],["ぷ","pu"],["ぺ","pe"],["ぽ","po"]],[["きゃ","kya"],["きゅ","kyu"],["きょ","kyo"]],[["しゃ","sha"],["しゅ","shu"],["しょ","sho"]],[["ちゃ","cha"],["ちゅ","chu"],["ちょ","cho"]],[["にゃ","nya"],["にゅ","nyu"],["にょ","nyo"]],[["ひゃ","hya"],["ひゅ","hyu"],["ひょ","hyo"]],[["みゃ","mya"],["みゅ","myu"],["みょ","myo"]],[["りゃ","rya"],["りゅ","ryu"],["りょ","ryo"]],[["ぎゃ","gya"],["ぎゅ","gyu"],["ぎょ","gyo"]],[["じゃ","ja"],["じゅ","ju"],["じょ","jo"]],[["ぢゃ","ja"],["ぢゅ","ju"],["ぢょ","jo"]],[["びゃ","bya"],["びゅ","byu"],["びょ","byo"]],[["ぴゃ","pya"],["ぴゅ","pyu"],["ぴょ","pyo"]],[["ア","a"],["イ","i"],["ウ","u"],["エ","e"],["オ","o"]],[["カ","ka"],["キ","ki"],["ク","ku"],["ケ","ke"],["コ","ko"]],[["サ","sa"],["シ","shi"],["ス","su"],["セ","se"],["ソ","so"]],[["タ","ta"],["チ","chi"],["ツ","tsu"],["テ","te"],["ト","to"]],[["ナ","na"],["ニ","ni"],["ヌ","nu"],["ネ","ne"],["ノ","no"]],[["ハ","ha"],["ヒ","hi"],["フ","fu"],["ヘ","he"],["ホ","ho"]],[["マ","ma"],["ミ","mi"],["ム","mu"],["メ","me"],["モ","mo"]],[["ヤ","ya"],["ユ","yu"],["ヨ","yo"]],[["ラ","ra"],["リ","ri"],["ル","ru"],["レ","re"],["ロ","ro"]],[["ワ","wa"],["ヲ","o"]],[["ン","n"]],[["ガ","ga"],["ギ","gi"],["グ","gu"],["ゲ","ge"],["ゴ","go"]],[["ザ","za"],["ジ","ji"],["ズ","zu"],["ゼ","ze"],["ゾ","zo"]],[["ダ","da"],["ヂ","ji"],["ヅ","zu"],["デ","de"],["ド","do"]],[["バ","ba"],["ビ","bi"],["ブ","bu"],["ベ","be"],["ボ","bo"]],[["パ","pa"],["ピ","pi"],["プ","pu"],["ペ","pe"],["ポ","po"]],[["キャ","kya"],["キュ","kyu"],["キョ","kyo"]],[["シャ","sha"],["シュ","shu"],["ショ","sho"]],[["チャ","cha"],["チュ","chu"],["チョ","cho"]],[["ニャ","nya"],["ニュ","nyu"],["ニョ","nyo"]],[["ヒャ","hya"],["ヒュ","hyu"],["ヒョ","hyo"]],[["ミャ","mya"],["ミュ","myu"],["ミョ","myo"]],[["リャ","rya"],["リュ","ryu"],["リョ","ryo"]],[["ギャ","gya"],["ギュ","gyu"],["ギョ","gyo"]],[["ジャ","ja"],["ジュ","ju"],["ジョ","jo"]],[["ヂャ","ja"],["ヂュ","ju"],["ヂョ","jo"]],[["ビャ","bya"],["ビュ","byu"],["ビョ","byo"]],[["ピャ","pya"],["ピュ","pyu"],["ピョ","pyo"]],[["イェ","ye"]],[["ウィ","wi"],["ウェ","we"],["ウォ","wo"]],[["ヴァ","va"],["ヴィ","vi"],["ヴ","vu"],["ヴェ","ve"],["ヴォ","vo"]],[["シェ","she"]],[["ジェ","je"]],[["チェ","che"]],[["ティ","ti"],["トゥ","tu"]],[["ディ","di"],["ドゥ","du"]],[["ツァ","tsa"],["ツィ","tsi"],["ツェ","tse"],["ツォ","tso"]],[["ファ","fa"],["フィ","fi"],["フェ","fe"],["フォ","fo"]],[["ヴャ","vya"],["ヴュ","vyu"],["ヴョ","vyo"]],[["テュ","tyu"]],[["デュ","dyu"]],[["フュ","fyu"]]],k={h:{columns:16,offset:0},hd:{columns:12,offset:16},k:{columns:16,offset:28},kd:{columns:12,offset:44},ke:{columns:14,offset:56}},n={78:1,110:1},r={Enter:13,"U+0020":32,"U+0041":97,"U+0045":101,"U+0049":105,"U+004E":110,"U+004F":111,"U+0055":117},b={32:1},u={13:1,32:1},c={65:1,69:1,73:1,79:1,85:1,97:1,101:1,105:1,111:1,117:1};function L(){var S=$("#b td").index($(this).parent())+1;$("#all").removeClass("b-1 b-2 b-3 b-4 b-5 b-6 b-7 b-8 b-9 b-a b-b b-c b-d b-e b-f b-g b-h b-i").addClass("b-"+B[S]);K=K.replace(/b./,("b"+B[S]));H()}function o(){var S=$("#preview td").index($(this).parent())+1;K=K.replace(/p\d/,("p"+S));H();e()}function J(S){var U=l.val(),T=(S.which==229);if(T){S.which=r[S.originalEvent.keyIdentifier]}if(b[S.which]){S.preventDefault()}if(N&&(c[S.which]||((p.text()=="n")&&n[S.which]))){if(!T){U+=String.fromCharCode(S.which)}S.which=13}U=U.toLowerCase();if(u[S.which]){if(p.is(":visible")){d()}else{if((U==p.text())||(C[x[0]]&&C[x[0]].match("_"+U+"_"))){S.preventDefault();if(!P){R.text(R.text()-0+1)}$("#intro").fadeOut(200);$("#top").addClass("fade");d()}else{if(U==P){j.hide();p.show()}else{P=U;j.show()}}}}else{if(S.which==27){F()}}}function E(){var V,U,S,T;if($("body").hasClass("kana")){e();S=new RegExp(f+"(\\d+)");K.match(S);T=RegExp.$1;V=k[f].columns;while(V){if(T>=(U=Math.pow(2,--V))){T-=U;$("#kana input").eq(V).prop("checked",true)}}$("#kana td").click(function(){$("#kana input").eq($(this).siblings().andSelf().index($(this))).click()});$("#kana input").click(z);$("#preview td > span").click(o);$("#bottom ul:first-child a").click(function(){$("#kana input").prop("checked",$(this).parent().is(":first-child"));z()})}}function s(){var U,T,S;if(f=="o"){$("#b span").click(L);K.match(/t(\d+)/);S=RegExp.$1;U=9;while(U){if(S>=(T=Math.pow(2,--U))){S-=T;$("#t input").eq(U).prop("checked",true)}}$("#t span").click(function(){$("#t input").eq($("#t td").index($(this).parent())).click()});$("#t input").click(z);$("#continuous input").click(function(){K=K.replace(/c./,this.checked?"c1":"c0");H()});$("#random input").click(function(){K=K.replace(/r./,this.checked?"r1":"r0");H()});$("#speed input").click(function(){K=K.replace(/s./,this.checked?"s1":"s0");H()})}}function y(){if(f=="p"){if(!window._local){ga("send","event","interaction","blocked")}$("#circle, #intro, #question").remove();$("#tab input").hide();$("#top").append('<div id="blocked"><p>Please turn off your ad blocker to use Real Kana.</p><p>I am a solo developer and rely upon advertising to support the site.</p><p>Thank you for your understanding.</p><p>Feedback: <a href="mailto:info@realkana.com">info@realkana.com</a></p></div>')}else{$("#ad-left").replaceWith('<a href="http://zig.iffy.studio/" id="zig-left" target="_blank"></a>');$("#ad-right").replaceWith('<a href="http://zig.iffy.studio/" id="zig-right" target="_blank"></a>')}}function a(){var Y,S,Z,V,U,W,X,T,aa;if(f=="p"){i=K.match(/c1/);I=K.match(/r1/);N=K.match(/s1/);$(document).keydown(J);if(K.search(/h0hd0k0kd0ke0/)!=-1){K=K.replace(/h0/,"h1");H()}if(K.search(/t0/)!=-1){K=K.replace(/t0/,"t64");H()}p=$("#answer");l=$("#tab input");A=$("#question");R=$("#right");m=$("#score");v=$("#shown");j=$("#x");A.on("mouseover","span",F);t=0;Q=w=[];S=K.match(/(h\d+)(hd\d+)(k\d+)(kd\d+)(ke\d+)/);S.shift();for(V=4;V>=0;V--){W=S[V].match(/([dehk]+)(\d+)/);W.shift();W[1]-=0;if(W[1]){U=k[W[0]].columns;while(U){if(W[1]>=(X=Math.pow(2,--U))){W[1]-=X;Q=q[U+k[W[0]].offset].concat(Q)}}}}if(T=localStorage.getItem("state")){T=JSON.parse(T);if(I){do{if(Q.length==1){break}D(Q)}while(Q[0][0]==T.kana)}M=T.typeface;localStorage.clear()}else{if(I){D(Q)}}K.match(/t(\d+)/);aa=RegExp.$1;V=9;while(V){if(aa>=(X=Math.pow(2,--V))){aa-=X;w.push(V+1)}}d()}}function d(){var S,T,U;if((!i)&&m.hasClass("finished")){m.removeClass("finished");R.text(R.text()-O);v.text(1)}else{v.text(v.text()-0+1);if(v.text()=="1"){$("#download").fadeOut(200);$("#score").fadeIn(200)}}if((!i)&&m.is(":visible")&&!(v.text()%Q.length)){m.addClass("finished");O=R.text()-0}P="";l.attr("name","g-"+Math.floor(Math.random()*1000000000)).val("").focus();p.hide();j.hide();if(++G==Q.length){G=0;if((!window._ipad)&&(t>24)){if(!window._local){ga("send","event","interaction","refresh")}K=K.replace(/$/,"r"+R.text()+"s"+(v.text()-1));H();g();return}if(I){T=Q[Q.length-1][0];do{if(Q.length==1){break}D(Q)}while(Q[0][0]==T)}}x=Q[G];S=-1;do{S=Math.floor(Math.random()*w.length);if(w.length==1){break}}while(S==M);M=S;U=w[M]-1;A.empty();t++;for(_i=0;_i<x[0].length;_i++){_char=x[0].charAt(_i);_glyph=$("<span>").css("background-position",("-"+((h[_char][0]*50)+(U*500))+"px -"+(h[_char][1]*50)+"px"));A.append(_glyph)}p.text(x[1]);if(!window._local){ga("send","event","interaction","show")}}function g(){var S={kana:Q[Q.length-1][0],typeface:M};localStorage.setItem("state",JSON.stringify(S));location.href="/practice/"}function e(){var S,T;K.match(/p(\d)/);T=RegExp.$1-1;$("#kana span").each(function(){S=h[$(this).text()];$(this).css("background-position",("-"+((S[0]*19)+(T*190))+"px -"+(S[1]*19)+"px"))});$("#kana span").css("visibility","visible")}function z(T){var W,V,S,U;if(T){T.stopPropagation()}W=U=0;$("table input").each(function(){if($(this).prop("checked")){U+=Math.pow(2,W)}W++});V=((f=="o")?"t":f);S=new RegExp(V+"\\d+");K=K.replace(S,V+U);H()}function F(){j.hide();p.show()}function D(T){var V,U,S;for(V=T.length-1;V>0;V--){U=Math.floor(Math.random()*(V+1));S=T[V];T[V]=T[U];T[U]=S}}function H(){document.cookie=("a="+K+"; expires=Mon, 27-Apr-2026 14:52:49 GMT; path=/")}return{init:function(){f=$("body").attr("id");if(document.cookie.search(/a=(b[1-9a-i]c[01]h\d+hd\d+k\d+kd\d+ke\d+p\dr[01]s[01]t\d+)/)!=-1){K=RegExp.$1}else{K="bhc1h1hd0k0kd0ke0p7r1s0t64"}if(window.devicePixelRatio>1){$("<img>")[0].src="/img/k/19/kana@2x.png";$("<img>")[0].src="/img/k/50/kana@2x.png"}else{$("<img>")[0].src="/img/k/19/kana.png";$("<img>")[0].src="/img/k/50/kana.png"}E();s();a();if(typeof blockAdBlock=="undefined"){y()}else{blockAdBlock.onDetected(y)}}}}();$(RealKana.init);