From: soufiane Date: Tue, 22 Aug 2023 10:38:22 +0000 (+0200) Subject: wip #6194 @1:30 compte à rebours X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=8d2cc784eda4ac7bc80b85dc8028453fe1d8374b;p=fluidbook-toolbox-quiz.git wip #6194 @1:30 compte à rebours --- diff --git a/js/quiz.screens.js b/js/quiz.screens.js index 30fd123..570068b 100644 --- a/js/quiz.screens.js +++ b/js/quiz.screens.js @@ -32,7 +32,10 @@ QuizScreens.prototype = { // Cliquer sur le bouton suivant $(document).on("click", ".next .action", function () { - if ($this.currentQuestionAnswers.length === 0) { + console.log("countdown_enable",parseInt($this.quiz.question.current().countdown_enable)) + console.log("intervalCountDown",$this.intervalCountDown) + if (($this.currentQuestionAnswers.length === 0 && !parseInt($this.quiz.question.current().countdown_enable)) + || (parseInt($this.quiz.question.current().countdown_enable) && $this.intervalCountDown !== 0 && $this.currentQuestionAnswers.length === 0)) { alert('Please select at least one answer'); return false; } @@ -139,8 +142,10 @@ QuizScreens.prototype = { $this.quiz.progressbar.update(); // if countdown enable - if(parseInt($this.quiz.question.current().countdown_enable)) { - $this.countdown() + if($this.quiz.question.current() !== undefined) { + if (parseInt($this.quiz.question.current().countdown_enable)) { + $this.countdown() + } } if (screen === 'outro') { @@ -200,6 +205,8 @@ QuizScreens.prototype = { document.documentElement.style.setProperty("--width-bg-countdown", value + "%") if(value <= 0) { clearInterval($this.intervalCountDown) + $this.intervalCountDown = 0; + $this.currentQuestionAnswers = [] /** * * provisoire