import PluginBase from 'chrome-extension://lnnmjmalakahagblkkcnjkoaihlfglon/dist/modules/plugin-base.js';import ExtensionUtil from 'chrome-extension://lnnmjmalakahagblkkcnjkoaihlfglon/dist/modules/extension-util.js';const activePages=/^https:\/\/kaniwani.com\/(lessons|reviews)\/session$/;let previousLanguage=PluginBase.util.getLanguage();function katakanaToHiragana(s){const lower="゠".codePointAt(0),upper="ヿ".codePointAt(0),diff="ア".codePointAt(0)-"あ".codePointAt(0);return s.split("").map(c=>{const point=c.codePointAt(0);return point>=lower&&point<=upper?String.fromCodePoint(point-diff):c}).join("")}var matchedAnswer="";function markWrong(){const answer=document.getElementById("answer");null!==answer&&(answer.value="あああ",clickNext()),window.setTimeout(()=>{let info=document.querySelectorAll("#app > div > main > div > div > div > section.sc-1y6l0g0-1.cvbtyw > div.rsmiak-0.fjUYuW > button:nth-child(2)");info.length>0&&info[0].click();},100);}function matchAnswer(transcript){const answers=function(){let hidden=document.querySelectorAll("div[data-ruby]");if(null===hidden||0===hidden.length)return [];let answer=hidden[0].getAttribute("data-ruby");if(null===answer)return [];let parts=answer.split(" ");return [{answer:parts[0],kana:parts[1]}]}();transcript=transcript.toLowerCase();for(var i=0;i0&&nextButtons.item(0).click();}function exitKaniWaniContext(){PluginBase.util.enterContext(["Normal"]),PluginBase.util.setLanguage(previousLanguage);}function locationChangeHandler(){document.location.href.match(activePages)?(PluginBase.util.enterContext(["KaniWani Review"]),previousLanguage=PluginBase.util.getLanguage(),PluginBase.util.setLanguage("ja")):PluginBase.util.getContext().includes("KaniWani Review")&&exitKaniWaniContext();}var KaniWani={...PluginBase,niceName:"KaniWani",languages:{},description:"",match:/^https:\/\/kaniwani.com\/.*$/,version:"0.0.1",init:()=>{var head=document.getElementsByTagName("head")[0],script=document.createElement("script");script.type="text/javascript",script.innerHTML="history.pushState = ( f => function pushState(){\n var ret = f.apply(this, arguments);\n window.dispatchEvent(new Event('locationchange'));\n return ret;\n })(history.pushState);\n history.replaceState = ( f => function replaceState(){\n var ret = f.apply(this, arguments);\n window.dispatchEvent(new Event('locationchange'));\n return ret;\n })(history.replaceState);",head.appendChild(script),window.addEventListener("locationchange",locationChangeHandler),locationChangeHandler();},destroy:()=>{window.removeEventListener("locationchange",locationChangeHandler),exitKaniWaniContext();},contexts:{"KaniWani Review":{commands:["LipSurf.Change Language to Japanese","LipSurf.Normal Mode","LipSurf.Turn off LipSurf","Answer","Next","Wrong"]}},commands:[{name:"Answer",description:"Submit an English answer for a KaniWani review",match:{description:"[English answer]",fn:matchAnswer},context:"KaniWani Review",normal:!1,pageFn:function(transcript){if(matchedAnswer.length<1)return;const answer=document.getElementById("answer");null!==answer&&(answer.value=matchedAnswer,clickNext());}},{name:"Next",description:"Go to the next item in a KaniWani review",match:"next",context:"KaniWani Review",normal:!1,pageFn:clickNext},{name:"Wrong",description:"Mark a card wrong",match:"wrong",context:"KaniWani Review",normal:!1,pageFn:markWrong}]};KaniWani.languages.ja={niceName:"KaniWani",description:"KaniWani",commands:{Answer:{name:"答え (answer)",match:{description:"[KaniWaniの答え]",fn:matchAnswer}},Next:{name:"次へ (next)",match:["つぎ","ねくすと","ていしゅつ","すすむ","ちぇっく"]},Wrong:{name:"バツ (wrong)",match:["だめ","ばつ"]}}}; export default KaniWani; export { markWrong, matchAnswer }; LS-SPLITallPlugins.KaniWani = (() => { const activePages=/^https:\/\/kaniwani.com\/(lessons|reviews)\/session$/;let previousLanguage=PluginBase.util.getLanguage();function katakanaToHiragana(s){const lower="゠".codePointAt(0),upper="ヿ".codePointAt(0),diff="ア".codePointAt(0)-"あ".codePointAt(0);return s.split("").map(c=>{const point=c.codePointAt(0);return point>=lower&&point<=upper?String.fromCodePoint(point-diff):c}).join("")}var matchedAnswer="";function matchAnswer(transcript){const answers=function(){let hidden=document.querySelectorAll("div[data-ruby]");if(null===hidden||0===hidden.length)return [];let answer=hidden[0].getAttribute("data-ruby");if(null===answer)return [];let parts=answer.split(" ");return [{answer:parts[0],kana:parts[1]}]}();transcript=transcript.toLowerCase();for(var i=0;i0&&nextButtons.item(0).click();}function exitKaniWaniContext(){PluginBase.util.enterContext(["Normal"]),PluginBase.util.setLanguage(previousLanguage);}function locationChangeHandler(){document.location.href.match(activePages)?(PluginBase.util.enterContext(["KaniWani Review"]),previousLanguage=PluginBase.util.getLanguage(),PluginBase.util.setLanguage("ja")):PluginBase.util.getContext().includes("KaniWani Review")&&exitKaniWaniContext();}var KaniWani={...PluginBase,init:()=>{var head=document.getElementsByTagName("head")[0],script=document.createElement("script");script.type="text/javascript",script.innerHTML="history.pushState = ( f => function pushState(){\n var ret = f.apply(this, arguments);\n window.dispatchEvent(new Event('locationchange'));\n return ret;\n })(history.pushState);\n history.replaceState = ( f => function replaceState(){\n var ret = f.apply(this, arguments);\n window.dispatchEvent(new Event('locationchange'));\n return ret;\n })(history.replaceState);",head.appendChild(script),window.addEventListener("locationchange",locationChangeHandler),locationChangeHandler();},destroy:()=>{window.removeEventListener("locationchange",locationChangeHandler),exitKaniWaniContext();},commands:{Answer:{match:{en:matchAnswer,ja:matchAnswer},normal:!1,pageFn:function(transcript){if(matchedAnswer.length<1)return;const answer=document.getElementById("answer");null!==answer&&(answer.value=matchedAnswer,clickNext());}},Next:{normal:!1,pageFn:clickNext},Wrong:{normal:!1,pageFn:function(){const answer=document.getElementById("answer");null!==answer&&(answer.value="あああ",clickNext()),window.setTimeout(()=>{let info=document.querySelectorAll("#app > div > main > div > div > div > section.sc-1y6l0g0-1.cvbtyw > div.rsmiak-0.fjUYuW > button:nth-child(2)");info.length>0&&info[0].click();},100);}}}}; return KaniWani; })() LS-SPLITallPlugins.KaniWani = (() => { const activePages=/^https:\/\/kaniwani.com\/(lessons|reviews)\/session$/;let previousLanguage=PluginBase.util.getLanguage();function exitKaniWaniContext(){PluginBase.util.enterContext(["Normal"]),PluginBase.util.setLanguage(previousLanguage);}function locationChangeHandler(){document.location.href.match(activePages)?(PluginBase.util.enterContext(["KaniWani Review"]),previousLanguage=PluginBase.util.getLanguage(),PluginBase.util.setLanguage("ja")):PluginBase.util.getContext().includes("KaniWani Review")&&exitKaniWaniContext();}var KaniWani={...PluginBase,init:()=>{var head=document.getElementsByTagName("head")[0],script=document.createElement("script");script.type="text/javascript",script.innerHTML="history.pushState = ( f => function pushState(){\n var ret = f.apply(this, arguments);\n window.dispatchEvent(new Event('locationchange'));\n return ret;\n })(history.pushState);\n history.replaceState = ( f => function replaceState(){\n var ret = f.apply(this, arguments);\n window.dispatchEvent(new Event('locationchange'));\n return ret;\n })(history.replaceState);",head.appendChild(script),window.addEventListener("locationchange",locationChangeHandler),locationChangeHandler();},destroy:()=>{window.removeEventListener("locationchange",locationChangeHandler),exitKaniWaniContext();},commands:{}}; return KaniWani; })()