]> _ Git - fluidbook-toolbox-quiz.git/commitdiff
wip #6186 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 25 Sep 2023 14:51:07 +0000 (16:51 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 25 Sep 2023 14:51:41 +0000 (16:51 +0200)
js/quiz.accessibility.js
js/quiz.js
js/quiz.resize.js
js/quiz.score.js
js/quiz.utils.js

index 852ac5723dc86aee8067d9adee992d6afb7942d0..c0380fc9c565bd2c7ac22bd55eaafa2605fd6357 100644 (file)
@@ -15,7 +15,6 @@ QuizAccessibility.prototype = {
 
             $('[aria-keyshortcuts="' + key + '"]').each(function () {
                 if ($this.quiz.utils.isEnabled($(this))) {
-                    console.log('click ', $(this));
                     $(this).get(0).click();
                     return true;
                 }
index 0d08fe47464ef981f197b005a7c5321bafa6c911..2eae95b4c75dac6a05b6268b299f26989750ecfa 100644 (file)
@@ -58,7 +58,7 @@ Quiz.prototype = {
             $('#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
@@ -70,7 +70,7 @@ Quiz.prototype = {
             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();
     },
index 91da404a07505c5451676e853f4add2ae83f64e9..1584e88f1b571e822ebcb5a2d08b02027946de42 100644 (file)
@@ -11,6 +11,9 @@ function QuizResize(quiz) {
 
 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;
@@ -22,17 +25,17 @@ QuizResize.prototype = {
         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()) {
index 972d0acd382c2c077641f2c30f282ada0eadeced..dec9675797caff2bc3ef44c2eb883de392731030 100644 (file)
@@ -150,7 +150,7 @@ QuizScore.prototype = {
 
     getCurrentState: function () {
         return {
-            q: this.lastAnsweredQuestion + 1, a: this.answers
+            q: this.lastAnsweredQuestion, a: this.answers
         };
     }
 };
index 473512e2507f7bf8e71a12ccf6f1eec329c9cc7b..66a32158faf846db1e2f07befeb9294f4f01ab35 100644 (file)
@@ -24,7 +24,6 @@ QuizUtils.prototype = {
         if ($(e).hasClass('disabled') || $(e).closest('.disabled').length > 0) {
             return false;
         }
-        console.log('is enabled', e);
         return true;
     },