From 8d0b3df32929b9ee96da022f47fa1b0801372ff1 Mon Sep 17 00:00:00 2001 From: postautistic Date: Thu, 4 May 2017 19:31:19 -0400 Subject: [PATCH] djtkana: recognize kana shortcuts --- kana/djtkana.css | 5 +++++ kana/djtkana.js | 49 +++++++++++++++++++++++++++++++-------------- kana/index.html | 6 +++--- kana/shortcuts.png | Bin 0 -> 5035 bytes 4 files changed, 42 insertions(+), 18 deletions(-) create mode 100644 kana/shortcuts.png diff --git a/kana/djtkana.css b/kana/djtkana.css index fd4ef63..3c97704 100644 --- a/kana/djtkana.css +++ b/kana/djtkana.css @@ -183,4 +183,9 @@ ul#tools li a { #explanation { line-height:1.6em; +} + +.help { + cursor:help; + border-bottom:1px dotted #aaa; } \ No newline at end of file diff --git a/kana/djtkana.js b/kana/djtkana.js index 7161a60..69869fd 100644 --- a/kana/djtkana.js +++ b/kana/djtkana.js @@ -120,10 +120,16 @@ var kana = { var show_tools = ['あ', 'い', 'う', 'え', 'お', 'か', 'き', 'く', 'け', 'こ', 'さ', 'し', 'す', 'せ', 'そ', 'た', 'ち', 'つ', 'て', 'と', 'な', 'に', 'ぬ', 'ね', 'の', 'は', 'ひ', 'ふ', 'へ', 'ほ', 'ま', 'み', 'む', 'め', 'も', 'や', 'ゆ', 'よ', 'ら', 'り', 'る', 'れ', 'ろ', 'わ', 'を', 'ん', 'ア', 'イ', 'ウ', 'エ', 'オ', 'カ', 'キ', 'ク', 'ケ', 'コ', 'サ', 'シ', 'ス', 'セ', 'ソ', 'タ', 'チ', 'ツ', 'テ', 'ト', 'ナ', 'ニ', 'ヌ', 'ネ', 'ノ', 'ハ', 'ヒ', 'フ', 'ヘ', 'ホ', 'マ', 'ミ', 'ム', 'メ', 'モ', 'ヤ', 'ユ', 'ヨ', 'ラ', 'リ', 'ル', 'レ', 'ロ', 'ワ', 'ヲ', 'ン']; var replacements = { - 'tu' : 'tsu', - 'ti' : 'chi', - 'ci' : 'chi', - 'wo' : 'o' + 'o': ['wo'], + 'chi': ['ci'], + 'shi': ['si'], + 'tsu': ['tu'], + 'zu': ['du'], + 'ji': ['di', 'zi'], + 'fu': ['hu'], + 'ja': ['dya'], + 'jo': ['dyo'], + 'ju': ['dyu'] }; var active = []; @@ -281,20 +287,33 @@ function check_answer() { answer = 'x'; } - for (orig in replacements) { - if(answer == orig) { - answer = replacements[orig]; + chars = answer.split(''); + + possible = [cur_reading]; + if(cur_reading in replacements) { + possible = possible.concat(replacements[cur_reading]); + } + + for (i = 0; i < chars.length; i++) { + var err = 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; } } - chars = answer.split(''); - chars_correct = cur_reading.split(''); - - for (i = 0; i < chars.length; i++) { - if(chars[i] != chars_correct[i] && answer != 'w') { - document.getElementById('message').innerHTML = '' + cur_kana + ' = ' + cur_reading + ''; - wrong = true; - } + if(err) { + wrong = true; + document.getElementById('message').innerHTML = '' + cur_kana + ' = ' + cur_reading + ''; } if(answer == cur_reading) { diff --git a/kana/index.html b/kana/index.html index 6e96658..b3a6a4d 100644 --- a/kana/index.html +++ b/kana/index.html @@ -8,10 +8,10 @@ Word audio from JapanesePod101: http://assets.languagepod101.com/dictionary/japa DJT Kana - + - +

DJT Kana

@@ -432,7 +432,7 @@ Word audio from JapanesePod101: http://assets.languagepod101.com/dictionary/japa

Explanation

-

Grind a row of kana until you stop making mistakes, then add another row. Press the Play sound link to make sure you are pronouncing the kana correctly. If you wish to write, the Stroke order link will show you the proper form.

+

Grind a row of kana until you stop making mistakes, then add another row. Press the Play sound link to make sure you are pronouncing the kana correctly. If you wish to write, the Stroke order link will show you the proper form. You can save a few keystrokes on DJT Kana and your IME with these shortcuts.

The two dots (dakuten) next to certain kana indicate that the consonant is "muddied". For example, か (ka) becomes が (ga). The consonants transform as follows: