-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.xhtml
307 lines (296 loc) · 10.4 KB
/
index.xhtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
<?xml version='1.0'?>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
<head>
<script type='text/javascript' src='javascripts/prototype.js'></script>
<script type='text/javascript' src='javascripts/language%3ajapanese.js'></script>
<script type='text/javascript' src='javascripts/application.js'></script>
<link rel='stylesheet' href='stylesheets/application.css' type='text/css'/>
<title>Kotobator</title>
</head>
<body>
<div class='disclaimer alpha-version'>
This is alpha version and contains bugs. <strong>Do not use it for learning!</strong>
Albeit you can send me bug reports (see contacts on <a href='http://mcv.mulabs.org/'>mcv.mulabs.org</a>).
</div>
<div id='form'>
<form>
<div class='word'>
<input type='text' id='word'/>
<button id='conjugate' type='submit'>Conjugate</button>
<p id='error'></p>
</div>
<div class='options'>
<div class='option'>
<input type='checkbox' id='detect-type' checked='checked'/><label for='detect-type'>Detect verb type</label>
</div>
<div class='option'>
<input type='checkbox' id='romanize'/><label for='romanize'>Roomaji results</label>
</div>
</div>
<div class='options'>
<div class='option'>
<input type='radio' name='word-type' id='word-type:u-verb' checked='checked'/><label for='word-type:u-verb'>U-verb (godan verb)</label>
</div>
<div class='option'>
<input type='radio' name='word-type' id='word-type:ru-verb'/><label for='word-type:ru-verb'>RU-verb (ichidan verb)</label>
</div>
<div class='option'>
<input type='radio' name='word-type' id='word-type:suru-verb'/><label for='word-type:suru-verb'>SURU-verb</label>
</div>
</div>
</form>
</div>
<table class='results'>
<col/><col/><col/><col/>
<tr>
<td colspan='2'></td>
<th scope='col'>Affirmative</th>
<th scope='col'>Negative</th>
</tr>
<tr>
<th scope='row' rowspan='2'>Present:</th>
<th scope='row'>Plain</th>
<td id='plain-form'></td>
<td id='plain-negative-form'></td>
</tr>
<tr>
<th scope='row'>Polite</th>
<td id='masu-form'></td>
<td id='masu-negative-form'></td>
</tr>
<tr class='separated'>
<th scope='row' rowspan='2'>Past:</th>
<th scope='row'>Plain</th>
<td id='plain-past-form'></td>
<td id='plain-past-negative-form'></td>
</tr>
<tr>
<th scope='row'>Polite</th>
<td id='masu-past-form'></td>
<td id='masu-past-negative-form'></td>
</tr>
<tr class='separated'>
<th scope='row' rowspan='3'>~te form:</th>
<th scope='row'>Simple</th>
<td id='te-form'></td>
<td id='te-negative-form'></td>
</tr>
<tr>
<td></td>
<td></td>
<td id='te-negative-form-2'></td>
</tr>
<tr>
<th scope='row'>Continuous</th>
<td id='teiru-form'></td>
<td id='teiru-negative-form'></td>
</tr>
<tr class='separated'>
<th scope='row' rowspan='4'>Volitional:</th>
<th scope='row'>Plain</th>
<td id='volitional-form'></td>
<td id='volitional-negative-form'></td>
</tr>
<tr>
<th scope='row'>Polite</th>
<td id='volitional-masu-form'></td>
</tr>
<tr class='separated'>
<th scope='row'>Plain</th>
<td id='volitional-da-form'></td>
<td id='volitional-da-negative-form'></td>
</tr>
<tr>
<th scope='row'>Polite</th>
<td id='volitional-da-masu-form'></td>
<td id='volitional-da-masu-negative-form'></td>
</tr>
<tr class='separated'>
<th scope='row' rowspan='2'>Imperative:</th>
<th scope='row'>Plain</th>
<td id='imperative-form'></td>
<td id='imperative-negative-form'></td>
</tr>
<tr>
<th scope='row'>Polite</th>
<td id='imperative-masu-form'></td>
<td id='imperative-masu-negative-form'></td>
</tr>
<tr class='separated'>
<th scope='row' rowspan='2' colspan='2'>Conditional:</th>
<td id='conditional-ba-form'></td>
<td id='conditional-ba-negative-form'></td>
</tr>
<tr>
<td id='conditional-ra-form'></td>
<td id='conditional-ra-negative-form'></td>
</tr>
<tr class='separated'>
<th scope='row' colspan='2'>~tai form:</th>
<td id='tai-form'></td>
<td id='tai-negative-form'></td>
</tr>
<tr class='separator'>
<td colspan='4'></td>
</tr>
<tr class='separated'>
<th scope='row' colspan='2'>Potential:</th>
<td id='potential-form'></td>
<td id='potential-negative-form'></td>
</tr>
<tr>
<th scope='row' colspan='2'>Passive:</th>
<td id='passive-form'></td>
<td id='passive-negative-form'></td>
</tr>
<tr>
<th scope='row' colspan='2'>Causative:</th>
<td id='causative-form'></td>
<td id='causative-negative-form'></td>
</tr>
<tr>
<th scope='row' colspan='2'>Causative passive:</th>
<td id='causative-passive-form'></td>
<td id='causative-passive-negative-form'></td>
</tr>
<tr class='separator'>
<td colspan='4'></td>
</tr>
<tr class='separated'>
<th colspan='2' scope='row'>Honorific:</th>
<td colspan='2' id='honorific-form'></td>
</tr>
<tr>
<th colspan='2' scope='row'>Humble:</th>
<td colspan='2' id='humble-form'></td>
</tr>
</table>
<p style='display: inline-block; color: silver; font-size: 75%'>Stworzone przez <a href='http://mcv.mulabs.org/'>mcv</a> przy konsultacji z Pekka; wersja 2. <a href='https://github.com/mcvsama/kotobator'>Source code</a></p>
<script type='text/javascript'>
// <![CDATA[
function clear_results()
{
$$('.results td[id*=form]').each (function (e) { e.innerHTML = '–' })
}
function parse_hash (hash)
{
var word, type, roomaji
;[word, type, roomaji] = hash.split ('/')
autohiraganize.set (word)
$('detect-type').checked = false
if (type == '1')
$('word-type:u-verb').checked = true
else if (type == '2')
$('word-type:ru-verb').checked = true
else
$('word-type:suru-verb').checked = true
$('romanize').checked = roomaji == '1'
conjugate()
}
function setup_hash()
{
var x = [Japanese.Hiragana.romanize ($('word').value, true)]
if ($('word-type:u-verb').checked)
x.push ('1')
else if ($('word-type:ru-verb').checked)
x.push ('2')
else
x.push ('3')
x.push ($('romanize').checked ? '1' : '0')
document.location.hash = x.join ('/')
}
function detect_and_conjugate (event)
{
if ($('detect-type').checked)
{
var t = Japanese.Verb.guess_type ($('word').value)
console.log(t)
if (t)
$$('[name=word-type]').each (function (i) {
if (i.Word == t)
i.checked = true
})
}
conjugate (event)
}
function conjugate (event)
{
if (event)
event.stop()
try {
var Word = $$('[name=word-type]').find (function (o) { return o.checked }).Word
var word = new Word ($('word').value)
setup_hash();
$('plain-form').innerHTML = word.plain_form()
$('plain-negative-form').innerHTML = word.plain_negative_form()
$('plain-past-form').innerHTML = word.plain_past_form()
$('plain-past-negative-form').innerHTML = word.plain_past_negative_form()
$('masu-form').innerHTML = word.masu_form();
$('masu-negative-form').innerHTML = word.masu_negative_form()
$('masu-past-form').innerHTML = word.masu_past_form()
$('masu-past-negative-form').innerHTML = word.masu_past_negative_form()
$('causative-form').innerHTML = word.causative_form()
$('causative-negative-form').innerHTML = word.causative_negative_form()
$('causative-passive-form').innerHTML = word.causative_passive_form()
$('causative-passive-negative-form').innerHTML = word.causative_passive_negative_form()
$('volitional-form').innerHTML = word.volitional_form()
$('volitional-negative-form').innerHTML = word.volitional_negative_form()
$('volitional-masu-form').innerHTML = word.volitional_masu_form()
$('volitional-da-form').innerHTML = word.plain_form() + ' だろう'
$('volitional-da-negative-form').innerHTML = word.plain_negative_form() + ' だろう'
$('volitional-da-masu-form').innerHTML = word.plain_form() + ' でしょう'
$('volitional-da-masu-negative-form').innerHTML = word.plain_negative_form() + ' でしょう'
$('imperative-form').innerHTML = word.imperative_form()
$('imperative-negative-form').innerHTML = word.imperative_negative_form()
$('imperative-masu-form').innerHTML = word.imperative_masu_form()
$('imperative-masu-negative-form').innerHTML = word.imperative_masu_negative_form()
$('conditional-ba-form').innerHTML = word.conditional_ba_form()
$('conditional-ba-negative-form').innerHTML = word.conditional_ba_negative_form()
$('conditional-ra-form').innerHTML = word.conditional_ra_form()
$('conditional-ra-negative-form').innerHTML = word.conditional_ra_negative_form()
$('te-form').innerHTML = word.te_form()
$('te-negative-form').innerHTML = word.te_negative_form()
$('te-negative-form-2').innerHTML = word.te_negative_2_form()
$('tai-form').innerHTML = word.tai_form()
$('tai-negative-form').innerHTML = word.tai_negative_form()
$('teiru-form').innerHTML = word.teiru_form()
$('teiru-negative-form').innerHTML = word.teiru_negative_form()
$('passive-form').innerHTML = word.passive_form()
$('passive-negative-form').innerHTML = word.passive_negative_form()
$('potential-form').innerHTML = word.potential_form()
$('potential-negative-form').innerHTML = word.potential_negative_form()
$('honorific-form').innerHTML = word.honorific_form()
$('humble-form').innerHTML = word.humble_form()
$('word').focus()
if ($('romanize').checked)
$$('.results td').each (function (td) {
td.innerHTML = Japanese.Hiragana.romanize (td.innerHTML, false)
})
$('error').innerHTML = ''
}
catch (exception)
{
if (exception instanceof Japanese.InvalidWord)
{
clear_results()
$('error').innerHTML = exception.message.capitalize().escapeHTML()
}
else
alert (exception)
}
}
$('word').focus()
var autohiraganize = new Japanese.AutoHiraganize ('word')
$('word-type:u-verb').Word = Japanese.UVerb
$('word-type:ru-verb').Word = Japanese.RuVerb
$('word-type:suru-verb').Word = Japanese.SuruVerb
$('conjugate').observe ('click', detect_and_conjugate)
$('romanize').observe ('change', conjugate)
$$('[name=word-type]').invoke ('observe', 'change', conjugate)
clear_results()
if (document.location.hash)
parse_hash (document.location.hash.substr (1))
// ]]>
</script>
</body>
</html>