Radical answers are now stripped of "-" characters.
This commit is contained in:
parent
7488a5eb7b
commit
84de8f5780
@ -106,10 +106,14 @@ $(document).keypress (e) ->
|
|||||||
|
|
||||||
$("#submit-answer").click (e) ->
|
$("#submit-answer").click (e) ->
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
input_answer = document.getElementById('kana').value;
|
|
||||||
if($("#kana").hasClass("correct"))
|
if($("#kana").hasClass("correct"))
|
||||||
refreshQuestion();
|
refreshQuestion();
|
||||||
else if(selection['answer'].split(/[,\.]/g).map((x) -> x.trim()).indexOf(input_answer) != -1)
|
else
|
||||||
|
input_answer = document.getElementById('kana').value;
|
||||||
|
expected_answer = selection['answer'].split(/[,\.]/g).map((x) -> x.trim())
|
||||||
|
if(selection["item_type"] == "radical")
|
||||||
|
expected_answer = expected_answer.map((x) -> x.replace("-", " "))
|
||||||
|
if(expected_answer.indexOf(input_answer) != -1)
|
||||||
$("#kana").addClass("correct").removeClass("wrong");
|
$("#kana").addClass("correct").removeClass("wrong");
|
||||||
else
|
else
|
||||||
$("#kana").addClass("wrong").removeClass("correct").val('')
|
$("#kana").addClass("wrong").removeClass("correct").val('')
|
||||||
|
@ -155,18 +155,26 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$("#submit-answer").click(function(e) {
|
$("#submit-answer").click(function(e) {
|
||||||
var input_answer;
|
var expected_answer, input_answer;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
input_answer = document.getElementById('kana').value;
|
|
||||||
if ($("#kana").hasClass("correct")) {
|
if ($("#kana").hasClass("correct")) {
|
||||||
return refreshQuestion();
|
return refreshQuestion();
|
||||||
} else if (selection['answer'].split(/[,\.]/g).map(function(x) {
|
} else {
|
||||||
|
input_answer = document.getElementById('kana').value;
|
||||||
|
expected_answer = selection['answer'].split(/[,\.]/g).map(function(x) {
|
||||||
return x.trim();
|
return x.trim();
|
||||||
}).indexOf(input_answer) !== -1) {
|
});
|
||||||
|
if (selection["item_type"] === "radical") {
|
||||||
|
expected_answer = expected_answer.map(function(x) {
|
||||||
|
return x.replace("-", " ");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (expected_answer.indexOf(input_answer) !== -1) {
|
||||||
return $("#kana").addClass("correct").removeClass("wrong");
|
return $("#kana").addClass("correct").removeClass("wrong");
|
||||||
} else {
|
} else {
|
||||||
return $("#kana").addClass("wrong").removeClass("correct").val('');
|
return $("#kana").addClass("wrong").removeClass("correct").val('');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#get-help").click(function(e) {
|
$("#get-help").click(function(e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user