Widget:ExamObjDefinition: Difference between revisions
Jump to navigation
Jump to search
Matt Pijoan (talk | contribs) No edit summary |
Matt Pijoan (talk | contribs) No edit summary |
||
Line 9: | Line 9: | ||
$.each(questions, function (index, value) { | $.each(questions, function (index, value) { | ||
this.questions[value.pagename] = getQuestionMembers(value.pagename); | this.questions[value.pagename] = getQuestionMembers(value.pagename); | ||
//can define other array | //can define other question array member properties as null here as needed. | ||
}); | }); | ||
if (isTimed) { | if (isTimed) { | ||
Line 15: | Line 15: | ||
this.countdownCurrent = null; | this.countdownCurrent = null; | ||
$.getScript("http://wikidoc.org/includes/jquery.timer.js", function () { | $.getScript("http://wikidoc.org/includes/jquery.timer.js", function () { | ||
countdownTimer = $.timer(function () { | |||
var min = parseInt(countdownCurrent / 6000); | |||
var sec = parseInt(countdownCurrent / 100) - (min * 60); | |||
var micro = pad(countdownCurrent - (sec * 100) - (min * 6000), 2); | |||
var output = "00"; | |||
if (min > 0) { | |||
output = pad(min, 2); | |||
} | |||
$('.countdowntime').html(output + ":" + pad(sec, 2)); | |||
if (countdownCurrent == 0) { | |||
countdownTimer.stop(); | |||
endExam(); | |||
} else { | |||
countdownCurrent -= 7; | |||
if (countdownCurrent < 0) { | |||
countdownCurrent = 0; | |||
} | } | ||
} | |||
}, 70, false); | |||
}); | }); | ||
} | } | ||
} | }//End Init | ||
} | } | ||
function getQuestionMembers(pagename) { | function getQuestionMembers(pagename) { |