Added basic splash screen and score chart.

This commit is contained in:
doncr 2016-12-23 18:05:37 +00:00
parent 88d5e099e7
commit 6cb5ec31d0
2 changed files with 57 additions and 7 deletions

View File

@ -9,7 +9,26 @@
</head> </head>
<body> <body>
<div class="quizSection"> <div id="splash">
<h1>Don's Japanese Conjugation Drill</h1>
<div>
<span>Number of Questions</span>
<input id="numQuestions" value="10">
</div>
<button id="go">Go</button>
</div>
<div id="scoreSection">
終わり
<div id="history">
</div>
<button id="backToStart">Back to Start</button>
</div>
<div id="quizSection">
<div class="questionOuter"> <div class="questionOuter">
<div id="question"></div> <div id="question"></div>
@ -41,9 +60,6 @@
</div> </div>
<div id="history">
</div>
<!-- <!--
<div id="explanation"> <div id="explanation">
<h2>Conjugations for group 1 verbs (godan)</h2> <h2>Conjugations for group 1 verbs (godan)</h2>

View File

@ -274,7 +274,7 @@ var conjugations = {
}, },
}; };
var log = { "history": [] }; var log;
Array.prototype.randomElement = function () { Array.prototype.randomElement = function () {
return this[Math.floor(Math.random() * this.length)] return this[Math.floor(Math.random() * this.length)]
@ -319,6 +319,10 @@ new function($) {
} }
}(jQuery); }(jQuery);
function resetLog() {
log = { "history": [] };
}
function getVerbForms(entry) { function getVerbForms(entry) {
function kanaForm(word) { function kanaForm(word) {
@ -706,12 +710,42 @@ function updateHistoryView(log) {
} }
function proceed() { function proceed() {
if (log.history.length == 10) { if (log.history.length == $('#numQuestions').val()) {
endQuiz();
} else { } else {
generateVerbQuestion(); generateVerbQuestion();
} }
} }
$('window').ready(function() { function showSplash() {
$('#splash').show();
$('#quizSection').hide();
$('#scoreSection').hide();
$('#go').focus();
}
function startQuiz() {
$('#splash').hide();
$('#quizSection').show();
$('#scoreSection').hide();
resetLog();
generateVerbQuestion(); generateVerbQuestion();
}
function endQuiz() {
$('#splash').hide();
$('#quizSection').hide();
$('#scoreSection').show();
$('#backToStart').focus();
}
$('window').ready(function() {
$('#go').click(startQuiz);
$('#backToStart').click(showSplash);
showSplash();
}); });