From 8d2cc784eda4ac7bc80b85dc8028453fe1d8374b Mon Sep 17 00:00:00 2001 From: soufiane Date: Tue, 22 Aug 2023 12:38:22 +0200 Subject: [PATCH] =?utf8?q?wip=20#6194=20@1:30=20compte=20=C3=A0=20rebours?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- js/quiz.screens.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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 -- 2.39.5