From: Vincent Vanwaelscappel Date: Thu, 12 Oct 2023 16:43:32 +0000 (+0200) Subject: wip #6396 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=1beb4367bfdd6e4851ef4847a0c4aa1b438a881c;p=fluidbook-toolbox-quiz.git wip #6396 @0.5 --- diff --git a/js/quiz.js b/js/quiz.js index 5cfdcdd..abc41e8 100644 --- a/js/quiz.js +++ b/js/quiz.js @@ -112,6 +112,7 @@ Quiz.prototype = { restart: function () { this.score.reset(); this.score.init(); + this.screens.reset(); this.screens.intro.show(); this.progressbar.update(); } diff --git a/js/quiz.screens.js b/js/quiz.screens.js index 7453ede..59ee8ca 100644 --- a/js/quiz.screens.js +++ b/js/quiz.screens.js @@ -1,5 +1,4 @@ import gsap from "gsap"; -import SimpleBar from 'simplebar' import 'simplebar/dist/simplebar.css' import QuizScreenIntro from './quiz.screen.intro'; @@ -17,6 +16,9 @@ function QuizScreens(quiz) { this.intro = new QuizScreenIntro(this); this.outro = new QuizScreenOutro(this); + + this.screensHTML = $('#screens').html(); + this.initEvents(); } @@ -237,7 +239,7 @@ QuizScreens.prototype = { } }, - showExplaination: function() { + showExplaination: function () { const el = this.getActiveScreen().find(".explaination") let explaination = this.quiz.question.current().explaination el.toggleClass("active") @@ -322,6 +324,9 @@ QuizScreens.prototype = { validateEmail: function (email) { let re = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i; return re.test(email); + }, + reset: function () { + $("#screens").html(this.screensHTML); } }; diff --git a/views/index.blade.php b/views/index.blade.php index 49f40f0..54678a9 100644 --- a/views/index.blade.php +++ b/views/index.blade.php @@ -18,12 +18,14 @@
@include('components.background',['data'=>$data,'name'=>'background','fit'=>'cover']) - @include('screens.intro', ['data'=> $data]) - @foreach($data->questions as $key => $question) - @php($info = $question['explaination']) - @include('screens.question_'.$question['type'], ['info' => $info,'theme' => $data->theme,'data'=> $data, 'question' => $question, 'max' => $totalQuestion, 'position' => $key, 'alphabet' => $alphabet, 'countdown' => isset($question['countdown_enable']) && $question["countdown_enable"]]) - @endforeach - @include('screens.outro', ['data'=> $data]) +
+ @include('screens.intro', ['data'=> $data]) + @foreach($data->questions as $key => $question) + @php($info = $question['explaination']) + @include('screens.question_'.$question['type'], ['info' => $info,'theme' => $data->theme,'data'=> $data, 'question' => $question, 'max' => $totalQuestion, 'position' => $key, 'alphabet' => $alphabet, 'countdown' => isset($question['countdown_enable']) && $question["countdown_enable"]]) + @endforeach + @include('screens.outro', ['data'=> $data]) +
{!! $data->credits !!}