$(window).on('resize', resize);
-
function resize() {
// Window size that reserve enough space for all questions and avoid scroll jumps
var maxHeight = 0;
var rev = $(data).find('review');
showReview = (rev.length === 0 || rev.text() === '1');
threshold = 0;
+ instantReview = $(data).find('instantReview').text() === '1';
+ logAttempts = $(data).find('logattempts').text() === '1';
if ($(data).find('threshold').length > 0 && !isNaN(parseFloat($(data).find('threshold').text()))) {
threshold = parseFloat($(data).find('threshold').text());
var type = $(this).attr('type');
var multiple = $(this).attr('multiple') == '1';
var multipleclass = multiple ? ' multiple' : '';
- var question = '<section class="question' + multipleclass + '" data-q="' + qn + ' data-type="' + type + '">';
+ var question = '<section class="question' + multipleclass + '" data-q="' + qn + '" data-type="' + type + '">';
question += '<div class="label"><h3>' + sprintf(getTranslation('question'), qn) + '</h3> ' + $(this).find('label').text() + '</div>';
question += '<div class="answers">';
question += '</div>';
if (multiple) {
- question += '<a href="#" class="validatemulti">' + getTranslation('validateAnswers') + '</a>';
- } else if (type !== 'multiple') {
question += '<a href="#" class="validatemulti">' + getTranslation('validateAnswer') + '</a>';
+ } else if (type !== 'multiple') {
+ question += '<a href="#" class="validatemulti">' + getTranslation('validateAnswerSingular') + '</a>';
}
question += '</section>';
TweenMax.fromTo($(prev), 0.5, {left: 0, opacity: 1}, {
left: -w - 50, opacity: 0, onComplete: function () {
$(prev).hide();
- endTransition();
+ endTransition();
}
});
resizeContainer();
setScormValue('cmi.core.lesson_status', 'completed');
setSCORMLocation({q: 1});
- checkScore();
+ var passed = checkScore();
+ if (logAttempts) {
+ $.ajax('https://toolbox.fluidbook.com/quizlog/',
+ {
+ method: 'post',
+ data: logdata,
+ }
+ );
+ }
}
function checkScore() {
-
var normalizedScore = score / totalQuestions;
$('#results > h2').hide();
+ var passed;
if (threshold === 0) {
$('.defaultMessage').show();
+ passed = true;
} else if (normalizedScore >= threshold) {
$(".passedMessage").show();
execAction(passedAction);
+ passed = true;
} else {
$('.failedMessage').show();
execAction(failedAction);
+ passed = false;
}
}
function displayBadge(correct) {
resize();
+ if (!instantReview) {
+ nextScreen();
+ return;
+ }
if (correct) {
$("#badge").addClass('correct').removeClass('incorrect');
} else {