implement question explanation

This commit is contained in:
Astro 2010-11-30 21:58:51 +01:00
parent 888b1f3c08
commit 0b47409f51
2 changed files with 23 additions and 14 deletions

View File

@ -6,7 +6,9 @@
{ "text": "Monatlich auf FTP" },
{ "text": "Nie",
"right": true }
] },
],
"explanation": { "text": "Deshalb ist die Hälfte weg." }
},
{ "text": "Was meint dieses Logo?",
"image": "http://www.c3d2.de/images/ck.png",
"tier": 100,

33
quiz.js
View File

@ -174,19 +174,7 @@ function takeJoker(activePlayer, joker) {
}
}
// Game screen is the one with the question in question
function switchToGame() {
var i, q = questions[currentQuestion];
var activePlayer = null, choice = null; // can be null
var updateTier = function() {
var s = q.tier;
if (activePlayer !== null)
s += ' — ' + playerNames[activePlayer];
$('#tier').text(s);
};
updateTier();
function setQuestionContents(q) {
$('#question').empty();
if (q.text) {
$('#question').append('<p></p>');
@ -200,6 +188,22 @@ function switchToGame() {
$('#question').append('<video controls autoplay>');
$('#question video').attr('src', q.video);
}
}
// Game screen is the one with the question in question
function switchToGame() {
var i, q = questions[currentQuestion];
var activePlayer = null, choice = null; // can be null
var updateTier = function() {
var s = q.tier;
if (activePlayer !== null)
s += ' — ' + playerNames[activePlayer];
$('#tier').text(s);
};
updateTier();
setQuestionContents(q);
for(i = 0; i < 4; i++) {
var answer = q.answers[i];
@ -237,6 +241,9 @@ function switchToGame() {
}
}
updateScores();
timer.halt();
if (q.explanation)
setQuestionContents(q.explanation);
// Hilight all right choices
var i = 0;