Implemented conjugation type options.

This commit is contained in:
doncr 2016-12-25 15:30:53 +00:00
parent 8d4c49ab71
commit fbaff068ea
3 changed files with 137 additions and 96 deletions

View File

@ -139,6 +139,22 @@ div#history table th {
text-align: left; text-align: left;
} }
div.options > * {
display: inline-block;
vertical-align: top;
margin: 20px;
}
div#splash > * {
margin-left: auto;
margin-right: auto;
display: table;
}
input#numQuestions {
width: 60px;
}
/* Tooltip from http://jsfiddle.net/AndreaLigios/jtLbpy62/ */ /* Tooltip from http://jsfiddle.net/AndreaLigios/jtLbpy62/ */
[tooltip]:before { [tooltip]:before {

View File

@ -10,45 +10,44 @@
<body> <body>
<div id="splash"> <div id="splash">
<h1>Don's Japanese Conjugation Drill</h1> <h1>Don's Japanese Conjugation Drill</h1>
<div> <div>
<span>Number of Questions</span> <span>Number of Questions</span>
<input id="numQuestions" value="10"> <input id="numQuestions" value="10">
<button id="go">Go</button>
</div> </div>
<div> <div class="options">
<h2>Conjugation types</h2> <div>
<ul> <h2>Conjugation types</h2>
<li><label><input type="checkbox" id="polite" checked="true"> Polite</label></li> <ul>
<li><label><input type="checkbox" id="negative" checked="true"> Negative</label></li> <li><label><input type="checkbox" id="polite" checked> Polite</label></li>
<li><label><input type="checkbox" id="te-form"> て form</label></li> <li><label><input type="checkbox" id="negative" checked> Negative</label></li>
<!-- <li><label><input type="checkbox" id="past" checked> Past</label></li>
<li><label><input type="checkbox" id="potential"> Potential</label></li> <li><label><input type="checkbox" id="te-form" checked> て form</label></li>
<li><label><input type="checkbox" id="imperative"> Imperative</label></li> <li><label><input type="checkbox" id="potential"> Potential</label></li>
<li><label><input type="checkbox" id="passive"> Passive</label></li> <li><label><input type="checkbox" id="imperative"> Imperative</label></li>
<li><label><input type="checkbox" id="causative"> Causative</label></li> <li><label><input type="checkbox" id="passive"> Passive</label></li>
--> <li><label><input type="checkbox" id="causative"> Causative</label></li>
</ul> </ul>
</div> </div>
<div> <div>
<h2>Verb classes</h2> <h2>Verb classes</h2>
<ul> <ul>
<li><label><input type="checkbox" id="godan" checked="true"> Godan verbs</label></li> <li><label><input type="checkbox" id="godan" checked> Group 1 verbs</label></li>
<li><label><input type="checkbox" id="godan-mu" checked="true"> Godan verbs with a mu ending</label></li> <li><label><input type="checkbox" id="ichidan" checked> Group 2 verbs</label></li>
<li><label><input type="checkbox" id="godan-ru" checked="true"> Godan verbs with a ru ending</label></li> <li><label><input type="checkbox" id="iku" checked> いく verb</label></li>
<li><label><input type="checkbox" id="godan-u" checked="true"> Godan verbs with an u ending</label></li> <li><label><input type="checkbox" id="kuru" checked> くる verb</label></li>
<li><label><input type="checkbox" id="ichidan" checked="true"> Ichidan verbs</label></li> <li><label><input type="checkbox" id="suru" checked> する verbs</label></li>
<li><label><input type="checkbox" id="kuru" checked="true"> Kuru verb</label></li> </ul>
<li><label><input type="checkbox" id="iku" checked="true"> Iku verb</label></li> </div>
<li><label><input type="checkbox" id="suru" checked="true"> Suru verbs</label></li>
</ul>
</div> </div>
<button id="go">Go</button>
<div><small> <div><small>
The quiz refers to negative て forms. In this test, they are assumed to be ~なくて and not ~ないで . When the test refers to negative て forms, they are assumed to be ~なくて and not ~ないで .
</small></div> </small></div>
</div> </div>

View File

@ -470,6 +470,8 @@ var conjugations = {
}, },
}; };
var log; var log;
Array.prototype.randomElement = function () { Array.prototype.randomElement = function () {
@ -649,71 +651,71 @@ var verb_relative_form = {
"negative" : "て", "negative" : "て",
}, },
// "potential" : { "potential" : {
//
// "plain" : "potential", "plain" : "potential",
// "potential negative" : "affirmative", "potential negative" : "affirmative",
// }, },
//
// "potential negative" : { "potential negative" : {
//
// "potential" : "negative", "potential" : "negative",
// "negative" : "potential", "negative" : "potential",
// }, },
//
// "imperative" : { "imperative" : {
//
// "plain" : "imperative", "plain" : "imperative",
// "imperative negative" : "affirmative", "imperative negative" : "affirmative",
// }, },
//
// "imperative negative" : { "imperative negative" : {
//
// "imperative" : "negative", "imperative" : "negative",
// "negative" : "imperative", "negative" : "imperative",
// }, },
//
// "causative" : { "causative" : {
//
// "plain" : "causative", "plain" : "causative",
// "causative negative" : "affirmative", "causative negative" : "affirmative",
// "causative passive" : "active", "causative passive" : "active",
// }, },
//
// "causative negative" : { "causative negative" : {
//
// "causative" : "negative", "causative" : "negative",
// "negative" : "causative", "negative" : "causative",
// "causative passive negative" : "active", "causative passive negative" : "active",
// }, },
//
// "passive" : { "passive" : {
//
// "plain" : "passive", "plain" : "passive",
// "passive negative" : "affirmative", "passive negative" : "affirmative",
// "causative passive" : "non-causative", "causative passive" : "non-causative",
// }, },
//
// "passive negative" : { "passive negative" : {
//
// "passive" : "negative", "passive" : "negative",
// "negative" : "passive", "negative" : "passive",
// "causative passive negative" : "non-causative" "causative passive negative" : "non-causative"
// }, },
//
// "causative passive" : { "causative passive" : {
//
// "causative" : "passive", "causative" : "passive",
// "passive" : "causative", "passive" : "causative",
// "causative passive negative" : "affirmative", "causative passive negative" : "affirmative",
// }, },
//
// "causative passive negative" : { "causative passive negative" : {
//
// "causative negative" : "passive", "causative negative" : "passive",
// "passive negative" : "causative", "passive negative" : "causative",
// "causative passive" : "negative", "causative passive" : "negative",
// }, },
}; };
function wordWithFurigana(word) { function wordWithFurigana(word) {
@ -861,15 +863,39 @@ function generateVerbQuestion() {
var from_form; var from_form;
var forms; var forms;
var count = 0;
while (true) { while (true) {
if (count++ == 100) {
showSplash();
return;
}
entry = Object.keys(conjugations).randomElement(); entry = Object.keys(conjugations).randomElement();
to_form = Object.keys(verb_relative_form).randomElement(); to_form = Object.keys(verb_relative_form).randomElement();
from_form = Object.keys(verb_relative_form[to_form]).randomElement(); from_form = Object.keys(verb_relative_form[to_form]).randomElement();
forms = getVerbForms(entry); forms = getVerbForms(entry);
if ((forms["furigana"][from_form]) && (forms["furigana"][to_form])) { var valid = true;
var types = from_form.split(" ").concat(to_form.split(" "));
types.forEach(function (type) {
if (type != 'plain') {
if ($('#' + type).is(':checked') == false) {
valid = false;
}
}
});
if (!forms["furigana"][from_form])
valid = false;
if (!forms["furigana"][to_form])
valid = false;
if (valid) {
break; break;
} }
} }