$('[aria-keyshortcuts="' + key + '"]').each(function () {
if ($this.quiz.utils.isEnabled($(this))) {
- console.log('click ', $(this));
$(this).get(0).click();
return true;
}
$('#quiz').addClass('ready');
}
- console.log(state);
+ console.log('init state : ', state);
if (state.q === undefined || state.q === -1) {
// Afficher l'écran d'introduction et lancer l'animation
for (i = 0; i - 1 < state.q; i++) {
this.score.setAnswer(i, state.a[i]);
}
- this.screens.showScreen('q-' + i, callback);
+ this.screens.showScreen('q-' + (state.q + 1), callback);
}
this.progressbar.update();
},
QuizResize.prototype = {
+ /**
+ * If the quiz is opened in a popup (it occurs often in LMS), try to resize it to its natural desktop size
+ */
resizePopup: function () {
if (window.opener === null) {
return;
let decorationHeight = window.outerHeight - window.innerHeight;
let decorationWidth = window.outerWidth - window.innerWidth;
- window.resizeTo(Math.min(screen.width, this.desktopWidth+decorationWidth), Math.min(screen.height, this.desktopHeight + decorationHeight));
+ window.resizeTo(Math.min(screen.width, this.desktopWidth + decorationWidth), Math.min(screen.height, this.desktopHeight + decorationHeight));
},
measureSizes: function () {
this.ww = $(window).width();
this.hh = $(window).height();
this.ratio = this.ww / this.hh;
- }, resize: function () {
- this.measureSizes();
-
+ },
+ resize: function () {
+ this.measureSizes();
this.updateViewport();
if (this.isMobile()) {
getCurrentState: function () {
return {
- q: this.lastAnsweredQuestion + 1, a: this.answers
+ q: this.lastAnsweredQuestion, a: this.answers
};
}
};
if ($(e).hasClass('disabled') || $(e).closest('.disabled').length > 0) {
return false;
}
- console.log('is enabled', e);
return true;
},