'].join(""));
function updateWordList() {
len = list_of_test.length;
blk = len - $("#test-list-b").val();
red = blk - $("#test-list-r").val();
$("#test-listed").children().remove();
for (i = 0; i < list_of_test.length; i++) {
col = "#999";
if (i < red) {
col = "#d50";
} else if (i < blk) {
col = "#000";
}
$("#test-listed").prepend('
' + list_of_test[i][1] + "
");
}
}
function tellAnswer(what) {
if (what == "correct") {
$("#test-tell-c").show();
$("#test-tell-c").fadeOut("slow");
} else {
$("#test-tell-r").show();
$("#test-tell-r").fadeOut("slow");
}
}
function tellAdd(what) {
if (what == "ok") {
$("#test-tell-o").show();
$("#test-tell-o").fadeOut("slow");
} else {
$("#test-tell-p").show();
$("#test-tell-p").fadeOut("slow");
}
}
$("#test-add").click(function() {
if ($("h1.content").length) {
wo = $("h1.content").clone().children().remove().end().text().trim();
an = $("#review-definitions span.text").text().trim().replace("\n", " | ");
hi = $("#test-h").val();
list_of_test.push([wo, an, hi, 1]);
tellAdd("ok");
updateWordList();
} else {
tellAdd("problem");
}
$("#test-h").val("");
});
$(document).keyup(function(e){
if (e.which == 192) {
$("#test-add").click();
} else if (e.which == 27) {
if ($("#test-a").is(":focus")) {
$("#test-a").blur();
} else {
$("#test-a").focus();
}
}
});
$("#test-check").click(function() {
if ($("#test-a").val() == list_of_test[0][0]) {
tellAnswer("correct");
enter_cont = 0;
} else {
tellAnswer("wrong");
}
});
$("#test-a").keyup(function(e){
if (e.which == 13) {
if (enter_cont == 1) {
$("#test-check").click();
} else {
$("#test-next").click();
}
}
});
$("#test-hint").click(function() {
if (list_of_test[0][2] == "") {
$("#test-a").val(list_of_test[0][0].substring(0, list_of_test[0][3]));
list_of_test[0][3]++;
} else {
$("#test-listed").append('