From d529672a314e188d9effdc14a30c37a990f80ebe Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Sun, 4 Aug 2013 17:05:20 +0200 Subject: Some changes to the way reviews work - custom styles! --- js/liststudy.js | 4 ++-- js/reviewdesu.js | 44 ++++++++++++++++++++++++++++++++------------ 2 files changed, 34 insertions(+), 14 deletions(-) (limited to 'js') diff --git a/js/liststudy.js b/js/liststudy.js index 4d715b8..d4a74c8 100644 --- a/js/liststudy.js +++ b/js/liststudy.js @@ -49,7 +49,7 @@ function show_contents_table() { var html = ''; for (var i = 0; i < batch_data.columns.length; i++) { var c = batch_data.columns[i]; - html += ''; + html += ''; } html += ''; for (var i = 0; i < items.length; i++) { @@ -91,7 +91,7 @@ function show_reviews_table() { var color = ''; if (reviews_data[i].score == 100) color = '#00aa00'; - else if (reviews_data[i].score >= 90) + else if (reviews_data[i].score >= 80) color = '#55FF55'; else if (reviews_data[i].score >= 50) color = '#FFFF00'; diff --git a/js/reviewdesu.js b/js/reviewdesu.js index 45726dd..79bae82 100644 --- a/js/reviewdesu.js +++ b/js/reviewdesu.js @@ -26,24 +26,41 @@ function start_review() { } function prepare_questions() { - for (var i = 0; i < batch_data.items.length; i++) { - for (var j = 0; j < batch_data.columns.length; j++) { - if (batch_data.columns[j].question == true) { + for (var j = 0; j < batch_data.questions.length; j++) { + var tq = []; + + var q = batch_data.questions[j]; + for (var i = 0; i < batch_data.items.length; i++) { + if (q.col) { var answer = ''; for (var k = 0; k < batch_data.items[i].length; k++) { - if (k != j) - answer += '

' + batch_data.items[i][k] + "

"; + answer += '

' + batch_data.columns[k] + '' + batch_data.items[i][k] + "

"; } - questions.push({ - "question": batch_data.items[i][j], + tq.push({ + "question": '

' + batch_data.items[i][q.col] + '

', "answer": answer, "key": batch_data.items[i][0], }); + } else { + var qu = q.q; + var an = q.a; + for (var k = 0; k < batch_data.items[i].length; k++) { + qu = qu.replace('%' + k, batch_data.items[i][k]); + an = an.replace('%' + k, batch_data.items[i][k]); + } + tq.push({ + "question": qu, + "answer": an, + "key": batch_data.items[i][0], + }); } } + + tq.shuffle(); + // first question asked is the last in array questions, so just put them in reverse order. + questions = tq.concat(questions); } total = questions.length; - questions.shuffle(); } function next_question() { @@ -66,8 +83,10 @@ function next_question() { question_nb++; html = '

Question ' + question_nb + ' of ' + total + '

'; - html += '

' + question.question + '

'; + html += '
'; + html += '
' + question.question + '
'; html += '

'; + html += '
'; $("core").innerHTML = html; $("flipbtn").focus(); } @@ -75,11 +94,12 @@ function next_question() { function show_answer() { html = '

Question ' + question_nb + ' of ' + total + '

'; - html += '

' + question.question + '

'; - html += question.answer; + html += '
'; + html += '
' + question.answer + '
'; html += '

'; html += ''; - html += '

'; + html += '

'; + html += '
'; $("core").innerHTML = html; $("dunnobtn").focus(); } -- cgit v1.2.3
' + c.name + ' - hide' + c + ' - hidewinfailscore