djtkana: recognize kana shortcuts
This commit is contained in:
parent
69fd68b0c5
commit
8d0b3df329
|
@ -184,3 +184,8 @@ ul#tools li a {
|
||||||
#explanation {
|
#explanation {
|
||||||
line-height:1.6em;
|
line-height:1.6em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.help {
|
||||||
|
cursor:help;
|
||||||
|
border-bottom:1px dotted #aaa;
|
||||||
|
}
|
|
@ -120,10 +120,16 @@ var kana = {
|
||||||
var show_tools = ['あ', 'い', 'う', 'え', 'お', 'か', 'き', 'く', 'け', 'こ', 'さ', 'し', 'す', 'せ', 'そ', 'た', 'ち', 'つ', 'て', 'と', 'な', 'に', 'ぬ', 'ね', 'の', 'は', 'ひ', 'ふ', 'へ', 'ほ', 'ま', 'み', 'む', 'め', 'も', 'や', 'ゆ', 'よ', 'ら', 'り', 'る', 'れ', 'ろ', 'わ', 'を', 'ん', 'ア', 'イ', 'ウ', 'エ', 'オ', 'カ', 'キ', 'ク', 'ケ', 'コ', 'サ', 'シ', 'ス', 'セ', 'ソ', 'タ', 'チ', 'ツ', 'テ', 'ト', 'ナ', 'ニ', 'ヌ', 'ネ', 'ノ', 'ハ', 'ヒ', 'フ', 'ヘ', 'ホ', 'マ', 'ミ', 'ム', 'メ', 'モ', 'ヤ', 'ユ', 'ヨ', 'ラ', 'リ', 'ル', 'レ', 'ロ', 'ワ', 'ヲ', 'ン'];
|
var show_tools = ['あ', 'い', 'う', 'え', 'お', 'か', 'き', 'く', 'け', 'こ', 'さ', 'し', 'す', 'せ', 'そ', 'た', 'ち', 'つ', 'て', 'と', 'な', 'に', 'ぬ', 'ね', 'の', 'は', 'ひ', 'ふ', 'へ', 'ほ', 'ま', 'み', 'む', 'め', 'も', 'や', 'ゆ', 'よ', 'ら', 'り', 'る', 'れ', 'ろ', 'わ', 'を', 'ん', 'ア', 'イ', 'ウ', 'エ', 'オ', 'カ', 'キ', 'ク', 'ケ', 'コ', 'サ', 'シ', 'ス', 'セ', 'ソ', 'タ', 'チ', 'ツ', 'テ', 'ト', 'ナ', 'ニ', 'ヌ', 'ネ', 'ノ', 'ハ', 'ヒ', 'フ', 'ヘ', 'ホ', 'マ', 'ミ', 'ム', 'メ', 'モ', 'ヤ', 'ユ', 'ヨ', 'ラ', 'リ', 'ル', 'レ', 'ロ', 'ワ', 'ヲ', 'ン'];
|
||||||
|
|
||||||
var replacements = {
|
var replacements = {
|
||||||
'tu' : 'tsu',
|
'o': ['wo'],
|
||||||
'ti' : 'chi',
|
'chi': ['ci'],
|
||||||
'ci' : 'chi',
|
'shi': ['si'],
|
||||||
'wo' : 'o'
|
'tsu': ['tu'],
|
||||||
|
'zu': ['du'],
|
||||||
|
'ji': ['di', 'zi'],
|
||||||
|
'fu': ['hu'],
|
||||||
|
'ja': ['dya'],
|
||||||
|
'jo': ['dyo'],
|
||||||
|
'ju': ['dyu']
|
||||||
};
|
};
|
||||||
|
|
||||||
var active = [];
|
var active = [];
|
||||||
|
@ -281,20 +287,33 @@ function check_answer() {
|
||||||
answer = 'x';
|
answer = 'x';
|
||||||
}
|
}
|
||||||
|
|
||||||
for (orig in replacements) {
|
|
||||||
if(answer == orig) {
|
|
||||||
answer = replacements[orig];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
chars = answer.split('');
|
chars = answer.split('');
|
||||||
chars_correct = cur_reading.split('');
|
|
||||||
|
possible = [cur_reading];
|
||||||
|
if(cur_reading in replacements) {
|
||||||
|
possible = possible.concat(replacements[cur_reading]);
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < chars.length; i++) {
|
for (i = 0; i < chars.length; i++) {
|
||||||
if(chars[i] != chars_correct[i] && answer != 'w') {
|
var err = true;
|
||||||
document.getElementById('message').innerHTML = '<span id="wrong">' + cur_kana + ' = ' + cur_reading + '</span>';
|
|
||||||
wrong = true;
|
for (x = 0; x < possible.length; x++) {
|
||||||
|
if(chars[i] == possible[x].charAt(i)) {
|
||||||
|
err = false;
|
||||||
}
|
}
|
||||||
|
if(answer == possible[x]) {
|
||||||
|
answer = cur_reading;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(err) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(err) {
|
||||||
|
wrong = true;
|
||||||
|
document.getElementById('message').innerHTML = '<span id="wrong">' + cur_kana + ' = ' + cur_reading + '</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if(answer == cur_reading) {
|
if(answer == cur_reading) {
|
||||||
|
|
|
@ -8,10 +8,10 @@ Word audio from JapanesePod101: http://assets.languagepod101.com/dictionary/japa
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>DJT Kana</title>
|
<title>DJT Kana</title>
|
||||||
<link rel="stylesheet" href="djtkana.css?5" />
|
<link rel="stylesheet" href="djtkana.css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script src="djtkana.js?5"></script>
|
<script src="djtkana.js"></script>
|
||||||
|
|
||||||
<h1>DJT Kana</h1>
|
<h1>DJT Kana</h1>
|
||||||
|
|
||||||
|
@ -432,7 +432,7 @@ Word audio from JapanesePod101: http://assets.languagepod101.com/dictionary/japa
|
||||||
|
|
||||||
<h3>Explanation</h3>
|
<h3>Explanation</h3>
|
||||||
<div id="explanation">
|
<div id="explanation">
|
||||||
<p>Grind a row of kana until you stop making mistakes, then add another row. Press the <code>Play sound</code> link to make sure you are pronouncing the kana correctly. If you wish to write, the <code>Stroke order</code> link will show you the proper form.</p>
|
<p>Grind a row of kana until you stop making mistakes, then add another row. Press the <code>Play sound</code> link to make sure you are pronouncing the kana correctly. If you wish to write, the <code>Stroke order</code> link will show you the proper form. You can save a few keystrokes on DJT Kana and your <span class="help" title="Input Method Editor: program that converts romaji keyboard input to kana">IME</span> with <a href="shortcuts.png">these shortcuts</a>.</p>
|
||||||
|
|
||||||
<p>The two dots (<a href="https://en.wikipedia.org/wiki/Dakuten">dakuten</a>) next to certain kana indicate that the consonant is "muddied". For example, か (ka) becomes が (ga). The consonants transform as follows:
|
<p>The two dots (<a href="https://en.wikipedia.org/wiki/Dakuten">dakuten</a>) next to certain kana indicate that the consonant is "muddied". For example, か (ka) becomes が (ga). The consonants transform as follows:
|
||||||
<ul>
|
<ul>
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
Loading…
Reference in New Issue