]> _ Git - fluidbook-toolbox.git/commitdiff
wait #6765 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 7 Mar 2024 08:36:19 +0000 (09:36 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 7 Mar 2024 08:36:19 +0000 (09:36 +0100)
25 files changed:
app/Elearning/QuizCompiler.php
app/Models/Traits/ToolboxPlayerBranches.php
resources/quiz/assets/banner.jpg [deleted file]
resources/quiz/assets/nok.svg [deleted file]
resources/quiz/assets/ok.svg [deleted file]
resources/quiz/fonts/Roboto-Bold-webfont.woff [deleted file]
resources/quiz/fonts/Roboto-Light-webfont.woff [deleted file]
resources/quiz/fonts/Roboto-Regular-webfont.woff [deleted file]
resources/quiz/fonts/RobotoCondensed-Bold-webfont.woff [deleted file]
resources/quiz/fonts/RobotoCondensed-Light-webfont.woff [deleted file]
resources/quiz/fonts/RobotoCondensed-Regular-webfont.woff [deleted file]
resources/quiz/fonts/fontawesome-webfont.woff [deleted file]
resources/quiz/fonts/fontawesome-webfont.woff2 [deleted file]
resources/quiz/index.html [deleted file]
resources/quiz/js/app.js [deleted file]
resources/quiz/style/000-imports.sass [deleted file]
resources/quiz/style/001-variables.sass [deleted file]
resources/quiz/style/003-reset.sass [deleted file]
resources/quiz/style/004-fonts.sass [deleted file]
resources/quiz/style/010-common.sass [deleted file]
resources/quiz/style/020-header.sass [deleted file]
resources/quiz/style/030-quiz.sass [deleted file]
resources/quiz/style/style.sass [deleted file]
resources/quiz/webpack.mix.js [deleted file]
resources/quiztheme/transparent.png [new file with mode: 0644]

index 5e390a1b05d856361597f3be707c8d72de957fe7..2f2c9cf51eae0316ccfea4e5b627f68265129ccd 100644 (file)
@@ -19,6 +19,7 @@ use Cubist\Util\Files\VirtualDirectory;
 use Cubist\Util\Graphics\Color;
 use Cubist\Util\Text;
 use GrahamCampbell\Markdown\Facades\Markdown;
+use Illuminate\Support\Facades\Log;
 use RyanChandler\Blade\Blade;
 
 class QuizCompiler extends Base
@@ -85,7 +86,7 @@ class QuizCompiler extends Base
         $vdir = new VirtualDirectory($this->dest);
         $vdir->copyDirectory($this->compilePath . '/dist/css', 'css');
         $vdir->copyDirectory($this->compilePath . '/dist/js', 'js');
-        $vdir->copyDirectory($this->compilePath . '/dist/assets', 'assets',false);
+        $vdir->copyDirectory($this->compilePath . '/dist/assets', 'assets', false);
 
         $l10n = $this->data->l10n;
         $blade = new Blade($this->_resourcesPath() . '/views', $this->_resourcesPath() . '/cache/' . md5(rand(100000, 10000000)) . '/');
@@ -315,6 +316,10 @@ class QuizCompiler extends Base
 
         $mix = 'const mix = require("laravel-mix");';
         foreach ($this->mixDirectories as $from => $to) {
+            if (!file_exists($this->compilePath ."/". $from)) {
+                Log::debug('skip ' . $this->compilePath .'/'. $from);
+                continue;
+            }
             $mix .= 'mix.copyDirectory("' . $from . '","' . $to . '");';
         }
         $mix .= 'mix.setPublicPath("dist");';
@@ -332,6 +337,7 @@ class QuizCompiler extends Base
         }
         $cli->setModule('cross-env process.env.local=1 mix' . $arg);
         $cli->execute();
+        $cli->debug();
 
         $requiredFiles = ['js/quiz.js', 'css/style.css'];
 
index 9f302362962c65988fdcbb0498c06168a5075263..9ccb263194953164b40054f47a12f59ba93d31ec 100644 (file)
@@ -19,6 +19,9 @@ trait ToolboxPlayerBranches
     protected function getActiveBranches()
     {
         $cacheFile = self::getPlayerBaseDirectory() . 'activebranches';
+        if (!file_exists($cacheFile)) {
+            return self::updateAllBranches();
+        }
         $res = json_decode(file_get_contents($cacheFile), true);
         if (!$res) {
             return self::updateAllBranches();
diff --git a/resources/quiz/assets/banner.jpg b/resources/quiz/assets/banner.jpg
deleted file mode 100644 (file)
index 75f2cd5..0000000
Binary files a/resources/quiz/assets/banner.jpg and /dev/null differ
diff --git a/resources/quiz/assets/nok.svg b/resources/quiz/assets/nok.svg
deleted file mode 100644 (file)
index 6f969ab..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 23.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
-<svg version="1.1" id="Calque_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
-        viewBox="0 0 120 120" style="enable-background:new 0 0 120 120;" xml:space="preserve">
-<style type="text/css">
-       .st0{fill:none;stroke:#FFFFFF;stroke-width:18;}
-</style>
-<path class="st0" d="M23.1,101.3l75.3-81.2"/>
-<path class="st0" d="M20.7,22.2l81,75"/>
-</svg>
diff --git a/resources/quiz/assets/ok.svg b/resources/quiz/assets/ok.svg
deleted file mode 100644 (file)
index 10a0e82..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 23.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
-<svg version="1.1" id="Calque_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
-        viewBox="0 0 120 120" style="enable-background:new 0 0 120 120;" xml:space="preserve">
-<style type="text/css">
-       .st0{fill:none;stroke:#FFFFFF;stroke-width:18;}
-</style>
-<path class="st0" d="M23.2,58.9l34,31.6l47-57.5"/>
-</svg>
diff --git a/resources/quiz/fonts/Roboto-Bold-webfont.woff b/resources/quiz/fonts/Roboto-Bold-webfont.woff
deleted file mode 100644 (file)
index 8c9b024..0000000
Binary files a/resources/quiz/fonts/Roboto-Bold-webfont.woff and /dev/null differ
diff --git a/resources/quiz/fonts/Roboto-Light-webfont.woff b/resources/quiz/fonts/Roboto-Light-webfont.woff
deleted file mode 100644 (file)
index 983083c..0000000
Binary files a/resources/quiz/fonts/Roboto-Light-webfont.woff and /dev/null differ
diff --git a/resources/quiz/fonts/Roboto-Regular-webfont.woff b/resources/quiz/fonts/Roboto-Regular-webfont.woff
deleted file mode 100644 (file)
index 7245f5c..0000000
Binary files a/resources/quiz/fonts/Roboto-Regular-webfont.woff and /dev/null differ
diff --git a/resources/quiz/fonts/RobotoCondensed-Bold-webfont.woff b/resources/quiz/fonts/RobotoCondensed-Bold-webfont.woff
deleted file mode 100644 (file)
index f564612..0000000
Binary files a/resources/quiz/fonts/RobotoCondensed-Bold-webfont.woff and /dev/null differ
diff --git a/resources/quiz/fonts/RobotoCondensed-Light-webfont.woff b/resources/quiz/fonts/RobotoCondensed-Light-webfont.woff
deleted file mode 100644 (file)
index 6a8ae66..0000000
Binary files a/resources/quiz/fonts/RobotoCondensed-Light-webfont.woff and /dev/null differ
diff --git a/resources/quiz/fonts/RobotoCondensed-Regular-webfont.woff b/resources/quiz/fonts/RobotoCondensed-Regular-webfont.woff
deleted file mode 100644 (file)
index dd61f24..0000000
Binary files a/resources/quiz/fonts/RobotoCondensed-Regular-webfont.woff and /dev/null differ
diff --git a/resources/quiz/fonts/fontawesome-webfont.woff b/resources/quiz/fonts/fontawesome-webfont.woff
deleted file mode 100644 (file)
index 400014a..0000000
Binary files a/resources/quiz/fonts/fontawesome-webfont.woff and /dev/null differ
diff --git a/resources/quiz/fonts/fontawesome-webfont.woff2 b/resources/quiz/fonts/fontawesome-webfont.woff2
deleted file mode 100644 (file)
index 4d13fc6..0000000
Binary files a/resources/quiz/fonts/fontawesome-webfont.woff2 and /dev/null differ
diff --git a/resources/quiz/index.html b/resources/quiz/index.html
deleted file mode 100644 (file)
index ef0dceb..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, shrink-to-fit=no">
-    <meta name="width" content="1024">
-    <meta name="height" content="768">
-    <title></title>
-    <link type="text/css" rel="stylesheet" href="css/style.css">
-</head>
-<body>
-<div id="holder">
-    <div id="badge"></div>
-    <header>
-        <div class="headerholder">
-            <div class="titleHolder"></div>
-        </div>
-    </header>
-    <main>
-    </main>
-</div>
-<script src="data.js"></script>
-<script src="js/app.js"></script>
-</body>
-</html>
diff --git a/resources/quiz/js/app.js b/resources/quiz/js/app.js
deleted file mode 100644 (file)
index e6431f3..0000000
+++ /dev/null
@@ -1,749 +0,0 @@
-import $ from "jquery";
-import gsap from "gsap";
-import {CubeSCORM} from '../../scorm/scorm';
-
-window.cubeSCORM = new CubeSCORM();
-window.$ = window.jQuery = $;
-
-(function (global) {
-    $(function () {
-        var data;
-        var score;
-        var questionStatus = {};
-        var testMode, quizMode, showReview, threshold, instantReview, logAttempts, displayScore, countQuestions,
-            passedAction, failedAction,
-            logQuestions;
-
-        function initApp() {
-            if (cubeSCORM.SCORM_INITED) {
-                return;
-            }
-
-            let disable = false;
-            try {
-                if (window.parent !== undefined && window.parent.fluidbook !== undefined) {
-                    disable = true;
-                }
-            } catch (e) {
-
-            }
-
-            cubeSCORM.initScorm(disable);
-            init(cubeSCORM.getScormLocation({q: 1}));
-        }
-
-        $(window).on('resize', resize);
-
-        initContents();
-
-        function resize() {
-            // Window size that reserve enough space for all questions and avoid scroll jumps
-            var maxHeight = 0;
-            $(".question").each(function () {
-                var hide = false;
-                if (!$(this).is(':visible')) {
-                    hide = true;
-                    $(this).show();
-                }
-                maxHeight = Math.max(maxHeight, $(this).outerHeight());
-                if (hide) {
-                    $(this).hide();
-                }
-            });
-            if ($("#resultsscreen:visible").length == 1) {
-                maxHeight = Math.max(maxHeight, $("#resultsscreen:visible").outerHeight());
-            }
-            $("main").css('minHeight', Math.max(maxHeight + 100, $(window).outerHeight() - $('header').outerHeight() - 70));
-
-            // Header
-            var ww = $(window).outerWidth();
-            var h1 = $("header .headerholder .titleHolder h1");
-            h1.css('width', '100%');
-            h1.css('font-size', '');
-            if (ww > 640) {
-                var fz = 32;
-                var h1h = h1.outerHeight() - 40;
-                while (h1h > 32) {
-                    fz--;
-                    h1.css('font-size', fz);
-                    h1h = h1.outerHeight() - 40;
-                }
-            }
-
-            // Badge position
-            try {
-                var left = (ww - 220) / 2;
-                var answersBox = $(".question:visible .answers").get(0).getBoundingClientRect();
-                var top = answersBox.top + (answersBox.height - 200) / 2;
-                $("#badge").css({top: top, left: left});
-            } catch (e) {
-
-            }
-        }
-
-        function getTranslation(key) {
-            return DATA.translations[key];
-        }
-
-        function resizeContainer() {
-            try {
-                if (parent.window.fluidbook !== undefined) {
-                    parent.window.fluidbook.links.resizeIframe($(document).outerHeight());
-                }
-                if (parent.window.resize !== undefined) {
-                    parent.window.resize();
-                }
-            } catch (e) {
-
-            }
-        }
-
-        function initContents() {
-            if (DATA.css !== '') {
-                $("head").append('<style type="text/css">' + DATA.css + '</style>');
-            }
-            $("header .headerholder .titleHolder").append('<h1>' + DATA.title + '</h1>');
-            $("header .headerholder .titleHolder h1").css('width', '99%');
-            $("title").text(DATA.title);
-
-            document.documentElement.style.setProperty('--main-color', DATA.mainColor);
-            document.documentElement.style.setProperty('--header-overlay', DATA.overlay);
-            document.documentElement.style.setProperty('--ok-color', DATA.okColor);
-            document.documentElement.style.setProperty('--nok-color', DATA.nokColor);
-            document.documentElement.style.setProperty('--review-background', DATA.reviewBackground);
-            $('head').append('<style>:root{--main-color:' + DATA.mainColor + ';}</style>');
-
-            showReview = DATA.review;
-            threshold = 0;
-            instantReview = DATA.instantReview;
-            logAttempts = DATA.logattempts;
-            displayScore = DATA.display_score;
-            testMode = DATA.type === 'test';
-            quizMode = DATA.type === 'quiz';
-
-            threshold = DATA.threshold;
-            if (threshold > 1) {
-                threshold /= 100;
-            }
-
-            // Create quiz container
-            var results = '<div class="results">';
-            results += '</div>';
-
-            var correction = $('<div id="correction"><h2>' + getTranslation('reviewAnswer') + '</h2></div>');
-
-            var qn = 1;
-            countQuestions = 0;
-            // Create questions
-            $.each(DATA.questions, function (k, question) {
-                if (question.count_for_score) {
-                    countQuestions++;
-                }
-                var multipleClass = question.multiple ? ' multiple' : '';
-                var questionHtml = '<section class="question' + multipleClass + '" data-count="' + (question.count_for_score ? '1' : '0') + '" data-q="' + qn + '" data-min-score="' + question.min_score + '" data-type="' + question.type + '">';
-                questionHtml += '<div class="label"><h3>' + sprintf(getTranslation('question'), qn) + '</h3> ' + question.question + '</div>';
-                questionHtml += '<div class="answers"></div>';
-                if (question.multiple) {
-                    questionHtml += '<a href="#" class="button validatemulti">' + getTranslation('validateAnswer') + '</a>';
-                } else if (question.type !== 'multiple') {
-                    questionHtml += '<a href="#" class="button validatemulti">' + getTranslation('validateAnswerSingular') + '</a>';
-                }
-                questionHtml += '</section>';
-
-                var questionCorrection = question.explaination;
-                if (questionCorrection === '') {
-                    var c = [];
-                    $.each(question.answers, function (kk, answer) {
-                        if (answer.correct == 1) {
-                            c.push(answer.answer);
-                        }
-                    });
-                    questionCorrection = c.join('<br>');
-                }
-
-                var c = '<div class="correction" data-i="' + qn + '"><div class="badge"></div><h4>' + sprintf(getTranslation('question'), qn) + ' ' + question.question + '</h4><p>' + questionCorrection + '</p></div>';
-                $(correction).append(c);
-
-                var q = $(questionHtml);
-                var required = question.required === 1 ? 'required' : '';
-
-                // Append answers
-                var holder = $('<div class="holder"></div>');
-                if (question.type === 'multiple') {
-                    var an = 0;
-                    var correctCount = 0;
-
-                    $.each(question.answers, function (aa, answer) {
-                        var a = $('<div class="answer-holder"><div class="answer" data-a="' + an + '">' + answer.answer + '</div></div>');
-                        // Set correct tag
-                        var correct = answer.correct == 1 ? 1 : 0;
-                        correctCount += correct;
-                        $(a).find('.answer').attr('data-correct', correct);
-                        $(holder).append($(a));
-                        an++;
-                    });
-                } else if (question.type === 'text' || question.type === "email") {
-                    $(holder).append('<input ' + required + ' type="' + question.type + '" name="answer" class="focusme" placeholder="' + question.placeholder + '" />')
-                } else if (question.type === 'textarea') {
-                    $(holder).append('<textarea ' + required + ' name="answer" class="focusme" placeholder="' + question.placeholder + '"></textarea>')
-                } else if (question.type === 'country') {
-                    var select = '<div class="select-holder"><select name="answer" class="focusme"><option value="">--</option>';
-                    $.each(DATA.countriesList, function (code, name) {
-                        select += '<option value="' + code + '">' + name + '</option>';
-                    });
-                    select += '</select></div>';
-                    $(holder).append(select);
-                }
-
-                $(q).find('.answers').append($(holder));
-
-                $("main").append(q);
-
-                qn++;
-            });
-
-            var results;
-            if (testMode) {
-                results = testResults();
-            } else {
-                results = quizResults(correction);
-            }
-
-            $("main").append(results);
-
-            $(document).on('quizinit', function (event, state) {
-                init(state);
-            });
-
-            initApp();
-
-            resizeContainer();
-            resize();
-        }
-
-        function quizResults(correction) {
-            var defaultMessage = DATA.defaultMessage !== '' ? DATA.defaultMessage : 'You have finished the quiz!';
-            var passedMessage = DATA.passedMessage !== '' ? DATA.passedMessage : defaultMessage;
-            var failedMessage = DATA.failedMessage !== '' ? DATA.failedMessage : defaultMessage;
-
-            passedAction = DATA.passedAction !== '' ? DATA.passedAction : null;
-            failedAction = DATA.failedAction !== '' ? DATA.failedAction : null;
-
-            var results = '<section id="resultsscreen">';
-            results += '<div id="results">';
-            results += '<h2 class="defaultMessage">' + defaultMessage + '</h2>';
-            results += '<h2 class="passedMessage">' + passedMessage + '</h2>';
-            results += '<h2 class="failedMessage">' + failedMessage + '</h2>';
-            if (displayScore) {
-                results += '<div class="content">' + getTranslation('totalQuestions') + ' <span id="totalquestions">' + countQuestions + '</span><br />' + getTranslation('correctAnswers') + ' <span id="correctanswers"></span></div>';
-            }
-            results += '</div>';
-            results += '<a href=""  id="restart" class="button">' + getTranslation('restartQuiz') + '</a>';
-            results += '</section>';
-
-            results = $(results);
-            $(results).append(correction);
-            return results;
-        }
-
-        function testResults() {
-            var results = '<section id="resultsscreen">';
-            results += '<div id="results">';
-            $.each(DATA.test_results, function (k, v) {
-                results += '<h2 class="test_result" data-min="' + (Math.min(v.score.first, v.score.second)) + '"  data-max="' + (Math.max(v.score.first, v.score.second)) + '">' + v.text + '</h2>';
-            });
-            results += '</div>';
-            results += '</section>';
-
-            results = $(results);
-            return results;
-        }
-
-        function init(state) {
-            resize();
-            $(document).on('click', ".answer", function () {
-                answer($(this));
-                return false;
-            });
-
-            $(document).on('click', ".validatemulti", function () {
-                validateMulti($(this));
-                return false;
-            });
-
-            if (state.a) {
-                $.each($(state.a), function (k, v) {
-                    var q = $('section.question[data-q="' + (k + 1) + '"]');
-                    $.each(v, function (kk, vv) {
-                        $(q).find('.answer[data-a="' + vv + '"]').addClass('active');
-                    });
-                });
-            }
-            initScreen(state.q - 1);
-        }
-
-        function validateMulti(button) {
-            var question = $(button).closest('.question');
-            if ($(question).find('input').length > 0) {
-                var input = $(question).find('input');
-                if (!$(input).get(0).checkValidity()) {
-                    $(input).get(0).reportValidity()
-                    return;
-                }
-            }
-            updateScore();
-            var ok = null;
-            if ($(question).attr('data-count') == '1') {
-                ok = questionStatus[$(question).data('q')]
-            }
-
-            displayBadge(ok);
-            resizeContainer();
-        }
-
-        function answer(answer) {
-            var multiple = $(answer).closest('.question').hasClass('multiple');
-            if (!multiple && $("section:visible .answer.active").length > 0) {
-                return;
-            }
-
-            if (!multiple) {
-                $(answer).addClass('active');
-                $('section:visible').find('.answer:not(.active)').addClass('inactive');
-                updateScore();
-                if (testMode) {
-                    displayBadge(true);
-                } else {
-                    displayBadge($(answer).attr('data-correct') == 1);
-                }
-                resizeContainer();
-            } else {
-                $(answer).toggleClass('active');
-            }
-        }
-
-        function initScreen(screen) {
-            // When displaying first question
-            setTimeout(function () {
-                $("section").eq(screen).show();
-                resizeContainer();
-            }, 50)
-        }
-
-        function nextScreen() {
-            var prev = $("section:visible");
-            var next = $(prev).next('section');
-            var $this = this;
-
-            // If no screen remaining
-            if ($(next).length == 0) {
-                return;
-            }
-
-
-            if ($(next).is("#resultsscreen")) {
-                updateScore();
-                if (quizMode) {
-                    var show = showReview === 'always' || (showReview === 'passed' && checkScore());
-
-                    if (!show) {
-                        $('#correction').hide();
-                    } else {
-                        $('#correction').show();
-                    }
-                } else {
-                    $('.test_result').each(function () {
-                        var show = score >= $(this).data('min') && score <= $(this).data('max');
-                        console.log(this, show, score, $(this).data('min'), $(this).data('max'));
-                        if (show) {
-                            $(this).show();
-                        } else {
-                            $(this).hide();
-                        }
-                    });
-                }
-                completed();
-            }
-
-            var w = $(prev).outerWidth();
-            $(next).show();
-            resize();
-            gsap.fromTo($(next), {left: w + 50, opacity: 0}, {duration: 0.5, left: 0, opacity: 1});
-            gsap.fromTo($(prev), {left: 0, opacity: 1}, {
-                duration: 0.5, left: -w - 50, opacity: 0, onComplete: function () {
-                    $(prev).hide();
-                    endTransition();
-                }
-            });
-            resizeContainer();
-        }
-
-        function endTransition() {
-            $("section:visible .focusme").focus();
-        }
-
-        function completed() {
-            updateScore();
-
-            var passed = checkScore();
-            if (logAttempts) {
-                logAttempt(passed);
-            }
-
-            if (DATA.scorm) {
-                cubeSCORM.setScormValue('status', 'completed');
-                cubeSCORM.setScormValue('success_status', passed ? 'passed' : 'failed');
-                cubeSCORM.setSCORMScore(getNormalizedScore(true), 100, 0, getNormalizedScore());
-                cubeSCORM.setSCORMLocation({q: 1});
-            }
-        }
-
-        function getNormalizedScore(pct) {
-            var s = score / countQuestions;
-            if (pct === undefined || pct === false) {
-                return s;
-            }
-            return Math.round(100 * s);
-        }
-
-        function logAttempt(passed) {
-            var score = getNormalizedScore(true);
-            if (isNaN(score)) {
-                score = 0;
-            }
-            var logdata = {
-                score: score, passed: passed, questions: logQuestions,
-            };
-
-            $.ajax('https://toolbox.fluidbook.com/quiz/' + DATA.id + '/log', {
-                method: 'POST', data: logdata, crossDomain: true,
-            });
-        }
-
-        function checkScore() {
-            if (quizMode) {
-                var normalizedScore = getNormalizedScore(false);
-                $('#results > h2').hide();
-                var passed;
-                $('#restart').hide();
-                if (threshold === 0) {
-                    $('.defaultMessage').show();
-                    passed = true;
-                } else if (normalizedScore >= threshold) {
-                    $(".passedMessage").show();
-                    execAction(passedAction);
-                    passed = true;
-                } else {
-                    $('.failedMessage').show();
-                    execAction(failedAction);
-                    passed = false;
-                    if ($(data).find('restart_button').text() === "1") {
-                        $('#restart').show();
-                    }
-                }
-                return passed;
-            }
-            return true;
-        }
-
-        function execAction(action) {
-            if (action === undefined || action === null || action === '' || !action) {
-                return;
-            }
-            try {
-                eval(action);
-            } catch (e) {
-                console.error('Error while running code ' + action + ' :: ' + e.message);
-            }
-        }
-
-        function displayBadge(correct) {
-            resize();
-            if (!instantReview || correct === null) {
-                nextScreen();
-                return;
-            }
-            if (correct) {
-                $("#badge").addClass('correct').removeClass('incorrect');
-            } else {
-                $("#badge").addClass('incorrect').removeClass('correct');
-            }
-            $("#badge").fadeIn(350, function () {
-                setTimeout(function () {
-                    $("#badge").fadeOut(350, function () {
-                        nextScreen();
-                    });
-                }, 1000);
-            });
-        }
-
-        function updateScore() {
-            if (testMode) {
-                return updateTestScore();
-            }
-            if (quizMode) {
-                return updateQuizScore();
-            }
-        }
-
-        function updateTestScore() {
-            score = 0;
-            var answers = [];
-            var qn = 1;
-            logQuestions = [];
-
-
-            $('.question').each(function () {
-                var q = $(this);
-                var a = [];
-                var log = {};
-
-                var qScore = null;
-                if ($(this).data('type') === 'multiple') {
-                    $(this).find('.answer.active').each(function () {
-                        a.push($(this).data('a'))
-                        qScore = DATA.questions[q.data('q') - 1].answers[$(this).data('a')].score;
-                    });
-
-                    answers.push(a);
-                    log.answer = a;
-                } else {
-                    log.answer = $(this).find('input,textarea,select').val();
-                }
-
-                questionStatus[qn] = qScore;
-
-                if (qScore !== null) {
-                    score += qScore;
-                }
-                log.score = qScore;
-
-                logQuestions[qn] = log;
-                qn++;
-            });
-
-
-            var state = {
-                q: $(".answer.active").last().closest('.question').data('q') + 1, a: answers
-            };
-
-            if (SCORM) {
-                cubeSCORM.setSCORMLocation(state);
-            }
-            $("#correctanswers").text(score);
-        }
-
-        function updateQuizScore() {
-            score = 0;
-            var answers = [];
-            var qn = 1;
-            logQuestions = [];
-
-            $('.question').each(function () {
-                var a = [];
-                var ok = true;
-                var count = $(this).attr('data-count') == '1';
-                var log = {
-                    'count': count,
-                };
-
-                if ($(this).data('type') === 'multiple') {
-                    var min_score = parseInt($(this).data('min-score'));
-                    if (min_score === 0) {
-                        min_score = $(this).find('.answer[data-correct="1"]').length;
-                    }
-                    var this_score = 0;
-                    $(this).find('.answer').each(function () {
-                        if ($(this).hasClass('active')) {
-                            var correct = $(this).attr('data-correct') == '1';
-                            this_score += correct ? 1 : -1;
-                            a.push($(this).data('a'))
-                        }
-                    });
-                    ok = this_score >= min_score;
-
-                    answers.push(a);
-                    log.answer = a;
-                } else {
-                    log.answer = $(this).find('input,textarea,select').val();
-                }
-
-                if (!count) {
-                    ok = null;
-                }
-
-                questionStatus[qn] = ok;
-
-                var b = $("#correction .correction[data-i='" + qn + "'] .badge");
-                $(b).removeClass('correct').removeClass('incorrect');
-                if (ok === true) {
-                    $(b).addClass('correct');
-                } else if (ok === false) {
-                    $(b).addClass('incorrect');
-                }
-                if (ok && count) {
-                    score++;
-                    log.score = 1;
-                } else {
-                    log.score = 0;
-                }
-                logQuestions[qn] = log;
-                qn++;
-            });
-
-
-            var state = {
-                q: $(".answer.active").last().closest('.question').data('q') + 1, a: answers
-            };
-
-            if (cubeSCORM.SCORM) {
-                cubeSCORM.setSCORMLocation(state);
-            }
-            $("#correctanswers").text(score);
-        }
-
-
-    });
-})(typeof window === 'undefined' ? this : window);
-
-
-(function (global) {
-    'use strict';
-    if (!global.console) {
-        global.console = {};
-    }
-    var con = global.console;
-    var prop, method;
-    var dummy = function () {
-    };
-    var properties = ['memory'];
-    var methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' + 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' + 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(',');
-    while (prop = properties.pop()) if (!con[prop]) con[prop] = {};
-    while (method = methods.pop()) if (typeof con[method] !== 'function') con[method] = dummy;
-    // Using `this` for web workers & supports Browserify / Webpack.
-})(typeof window === 'undefined' ? this : window);
-
-/*! sprintf-js v1.1.2 | Copyright (c) 2007-present, Alexandru Mărășteanu <hello@alexei.ro> | BSD-3-Clause */
-!function () {
-    "use strict";
-    var g = {
-        not_string: /[^s]/,
-        not_bool: /[^t]/,
-        not_type: /[^T]/,
-        not_primitive: /[^v]/,
-        number: /[diefg]/,
-        numeric_arg: /[bcdiefguxX]/,
-        json: /[j]/,
-        not_json: /[^j]/,
-        text: /^[^\x25]+/,
-        modulo: /^\x25{2}/,
-        placeholder: /^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,
-        key: /^([a-z_][a-z_\d]*)/i,
-        key_access: /^\.([a-z_][a-z_\d]*)/i,
-        index_access: /^\[(\d+)\]/,
-        sign: /^[+-]/
-    };
-
-    function y(e) {
-        return function (e, t) {
-            var r, n, i, s, a, o, p, c, l, u = 1, f = e.length, d = "";
-            for (n = 0; n < f; n++) if ("string" == typeof e[n]) d += e[n]; else if ("object" == typeof e[n]) {
-                if ((s = e[n]).keys) for (r = t[u], i = 0; i < s.keys.length; i++) {
-                    if (null == r) throw new Error(y('[sprintf] Cannot access property "%s" of undefined value "%s"', s.keys[i], s.keys[i - 1]));
-                    r = r[s.keys[i]]
-                } else r = s.param_no ? t[s.param_no] : t[u++];
-                if (g.not_type.test(s.type) && g.not_primitive.test(s.type) && r instanceof Function && (r = r()), g.numeric_arg.test(s.type) && "number" != typeof r && isNaN(r)) throw new TypeError(y("[sprintf] expecting number but found %T", r));
-                switch (g.number.test(s.type) && (c = 0 <= r), s.type) {
-                    case"b":
-                        r = parseInt(r, 10).toString(2);
-                        break;
-                    case"c":
-                        r = String.fromCharCode(parseInt(r, 10));
-                        break;
-                    case"d":
-                    case"i":
-                        r = parseInt(r, 10);
-                        break;
-                    case"j":
-                        r = JSON.stringify(r, null, s.width ? parseInt(s.width) : 0);
-                        break;
-                    case"e":
-                        r = s.precision ? parseFloat(r).toExponential(s.precision) : parseFloat(r).toExponential();
-                        break;
-                    case"f":
-                        r = s.precision ? parseFloat(r).toFixed(s.precision) : parseFloat(r);
-                        break;
-                    case"g":
-                        r = s.precision ? String(Number(r.toPrecision(s.precision))) : parseFloat(r);
-                        break;
-                    case"o":
-                        r = (parseInt(r, 10) >>> 0).toString(8);
-                        break;
-                    case"s":
-                        r = String(r), r = s.precision ? r.substring(0, s.precision) : r;
-                        break;
-                    case"t":
-                        r = String(!!r), r = s.precision ? r.substring(0, s.precision) : r;
-                        break;
-                    case"T":
-                        r = Object.prototype.toString.call(r).slice(8, -1).toLowerCase(), r = s.precision ? r.substring(0, s.precision) : r;
-                        break;
-                    case"u":
-                        r = parseInt(r, 10) >>> 0;
-                        break;
-                    case"v":
-                        r = r.valueOf(), r = s.precision ? r.substring(0, s.precision) : r;
-                        break;
-                    case"x":
-                        r = (parseInt(r, 10) >>> 0).toString(16);
-                        break;
-                    case"X":
-                        r = (parseInt(r, 10) >>> 0).toString(16).toUpperCase()
-                }
-                g.json.test(s.type) ? d += r : (!g.number.test(s.type) || c && !s.sign ? l = "" : (l = c ? "+" : "-", r = r.toString().replace(g.sign, "")), o = s.pad_char ? "0" === s.pad_char ? "0" : s.pad_char.charAt(1) : " ", p = s.width - (l + r).length, a = s.width && 0 < p ? o.repeat(p) : "", d += s.align ? l + r + a : "0" === o ? l + a + r : a + l + r)
-            }
-            return d
-        }(function (e) {
-            if (p[e]) return p[e];
-            var t, r = e, n = [], i = 0;
-            for (; r;) {
-                if (null !== (t = g.text.exec(r))) n.push(t[0]); else if (null !== (t = g.modulo.exec(r))) n.push("%"); else {
-                    if (null === (t = g.placeholder.exec(r))) throw new SyntaxError("[sprintf] unexpected placeholder");
-                    if (t[2]) {
-                        i |= 1;
-                        var s = [], a = t[2], o = [];
-                        if (null === (o = g.key.exec(a))) throw new SyntaxError("[sprintf] failed to parse named argument key");
-                        for (s.push(o[1]); "" !== (a = a.substring(o[0].length));) if (null !== (o = g.key_access.exec(a))) s.push(o[1]); else {
-                            if (null === (o = g.index_access.exec(a))) throw new SyntaxError("[sprintf] failed to parse named argument key");
-                            s.push(o[1])
-                        }
-                        t[2] = s
-                    } else i |= 2;
-                    if (3 === i) throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");
-                    n.push({
-                        placeholder: t[0],
-                        param_no: t[1],
-                        keys: t[2],
-                        sign: t[3],
-                        pad_char: t[4],
-                        align: t[5],
-                        width: t[6],
-                        precision: t[7],
-                        type: t[8]
-                    })
-                }
-                r = r.substring(t[0].length)
-            }
-            return p[e] = n
-        }(e), arguments)
-    }
-
-    function e(e, t) {
-        return y.apply(null, [e].concat(t || []))
-    }
-
-    var p = Object.create(null);
-    "undefined" != typeof exports && (exports.sprintf = y, exports.vsprintf = e), "undefined" != typeof window && (window.sprintf = y, window.vsprintf = e, "function" == typeof define && define.amd && define(function () {
-        return {sprintf: y, vsprintf: e}
-    }))
-}();
diff --git a/resources/quiz/style/000-imports.sass b/resources/quiz/style/000-imports.sass
deleted file mode 100644 (file)
index 91ff484..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-@import 001-variables
-@import 003-reset
-@import 004-fonts
diff --git a/resources/quiz/style/001-variables.sass b/resources/quiz/style/001-variables.sass
deleted file mode 100644 (file)
index 9fd5f33..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-$font-base: 'RobotoCondensed'
-$font-condensed: 'RobotoCondensed'
-
-//-- Colors
-$color-back: #fefefe
-$color-text: #575756
-
-$color-answer-back: #575756
-$color-answer-text: #fff
-$color-answer-hover: #000
-
-$color-badge-incorrect-text: #fff
-$color-badge-correct-text: #fff
-
-$color-result-background: #E7007A
-$color-result-text: #fff
-
-$color-review-text: #fff
-
diff --git a/resources/quiz/style/003-reset.sass b/resources/quiz/style/003-reset.sass
deleted file mode 100644 (file)
index 45897f9..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/* http://meyerweb.com/eric/tools/css/reset/
-   v2.0 | 20110126
-   License: none (public domain) */
-
-html, body, div, span, applet, object, iframe,
-h1, h2, h3, h4, h5, h6, p, blockquote, pre,
-a, abbr, acronym, address, big, cite, code,
-del, dfn, em, img, ins, kbd, q, s, samp,
-small, strike, strong, sub, sup, tt, var,
-b, u, i, center,
-dl, dt, dd, ol, ul, li,
-fieldset, form, label, legend,
-table, caption, tbody, tfoot, thead, tr, th, td,
-article, aside, canvas, details, embed,
-figure, figcaption, footer, header, hgroup,
-menu, nav, output, ruby, section, summary,
-time, mark, audio, video, main
-    margin: 0
-    padding: 0
-    border: 0
-    font-size: 100%
-    font: inherit
-    vertical-align: baseline
-    box-sizing: border-box
-
-
-/* HTML5 display-role reset for older browsers */
-article, aside, details, figcaption, figure,
-footer, header, hgroup, menu, nav, section, main
-    display: block
-
-
-body
-    line-height: 1
-
-
-ol, ul
-    list-style: none
-
-
-blockquote, q
-    quotes: none
-
-blockquote:before, blockquote:after,
-q:before, q:after
-    content: ''
-    content: none
-
-table
-    border-collapse: collapse
-    border-spacing: 0
diff --git a/resources/quiz/style/004-fonts.sass b/resources/quiz/style/004-fonts.sass
deleted file mode 100644 (file)
index 1282e60..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-@font-face
-    font-family: 'RobotoCondensed'
-    src: url('../fonts/RobotoCondensed-Regular-webfont.woff') format('woff')
-    font-weight: 400
-    font-style: normal
-
-@font-face
-    font-family: 'RobotoCondensed'
-    src: url('../fonts/RobotoCondensed-Light-webfont.woff') format('woff')
-    font-weight: 300
-    font-style: normal
-
-@font-face
-    font-family: 'RobotoCondensed'
-    src: url('../fonts/RobotoCondensed-Bold-webfont.woff') format('woff')
-    font-weight: 700
-    font-style: normal
diff --git a/resources/quiz/style/010-common.sass b/resources/quiz/style/010-common.sass
deleted file mode 100644 (file)
index a4ffa2f..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-\:root
-    --main-color: #e7007a
-
-#holder
-    max-width: 100%
-    overflow: hidden
-
-body, input, textarea, table
-    font-family: $font-base
-
-body
-    overflow-y: scroll
-    overflow-x: hidden
-    font-size: 18px
-    color: $color-text
-    background-color: $color-back
-    line-height: 1.4em
-    cursor: default
-
-    -webkit-touch-callout: none
-    -webkit-user-select: none
-    -moz-user-select: none
-    -ms-user-select: none
-    user-select: none
-
-.fa
-    font-family: FontAwesome
-
-@mixin badge($width, $border)
-    text-align: center
-    text-transform: lowercase
-    font-family: $font-condensed
-    font-weight: 700
-    letter-spacing: 1px
-    z-index: 1
-    border-radius: 50%
-    line-height: $width
-    width: $width
-    height: $width
-    font-size: $width*0.24
-    border: $border solid #fff
-    position: absolute
-    background-position: 50% 50%
-    background-size: 55% auto
-    background-repeat: no-repeat
-
-    &.correct
-        background-color: var(--ok-color)
-        color: $color-badge-correct-text
-        background-image: url("../assets/ok.svg")
-
-    &.incorrect
-        background-color: var(--nok-color)
-        color: $color-badge-incorrect-text
-        background-image: url("../assets/nok.svg")
diff --git a/resources/quiz/style/020-header.sass b/resources/quiz/style/020-header.sass
deleted file mode 100644 (file)
index f1d0ef5..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-header
-    background-image: url("../assets/banner.jpg")
-    background-position: 50% 50%
-    background-size: cover
-    height: 108px
-    position: relative
-    margin-bottom: 40px
-
-    .headerholder
-        background-color: var(--header-overlay)
-        height: 73px
-        width: 100%
-        position: relative
-
-        @media (max-width: 640px)
-            min-height: 20%
-
-
-        @media (max-width: 320px)
-            min-height: 30%
-
-        .titleHolder
-            width: 100%
-            height: 100%
-            max-width: 800px
-            margin: 0 auto
-            position: relative
-
-            h1
-                text-align: left
-                color: #fff
-                font-family: $font-condensed
-                font-weight: 700
-                font-size: 32px
-                line-height: 1em
-                width: 100%
-                padding: 20px 180px 20px 40px
-
-                @media (max-width: 640px)
-                    text-align: center
-                    font-size: 22px
-                    bottom: 25px
-                    padding: 20px 40px 20px 40px
-
-
-                @media (max-width: 320px)
-                    font-size: 20px
-                    bottom: 15px
-
-            &:after
-                position: absolute
-                content: ''
-                right: 45px
-                top: 20px
-                display: block
-                background-image: url("../assets/logo.png")
-                background-size: contain
-                background-position: 100% 50%
-                background-repeat: no-repeat
-                width: 151px
-                height: 40px
-                z-index: 1
-
-                @media (max-width: 900px)
-                    width: 151px*0.75
-                    height: 38px*0.75
-
-                @media (max-width: 640px)
-                    display: none
-
-    @media (max-width: 1280px)
-        height: 150px
-
-    @media (max-width: 640px)
-        height: 135px
-
-    @media (max-width: 320px)
-        height: 100px
diff --git a/resources/quiz/style/030-quiz.sass b/resources/quiz/style/030-quiz.sass
deleted file mode 100644 (file)
index c0292be..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-main
-    width: 100%
-    max-width: 800px
-    margin: 0 auto -50px
-    position: relative
-
-section
-    display: none
-    position: absolute
-    width: 100%
-    top: 0
-    padding: 0 40px 0 40px
-
-    @media (max-width: 640px)
-        padding: 0 30px 0 30px
-
-    @media (max-width: 480px)
-        padding: 0 20px 0 20px
-
-.button
-    color: var(--main-color)
-    text-decoration: none
-    font-weight: 700
-    font-size: 22px
-    float: right
-    margin-top: 15px
-
-.question
-    .label
-        font-size: 20px
-        @media (max-width: 640px)
-            font-size: 16px
-            line-height: 1.4em
-
-        h3
-            font-family: $font-condensed
-            font-size: 100%
-            font-weight: 700
-            margin-bottom: 10px
-            display: inline
-            @media (max-width: 640px)
-                font-size: 21px
-
-            @media (max-width: 320px)
-                font-size: 21px
-
-    .answers
-        margin-top: 30px
-
-        .select-holder
-            position: relative
-
-            &:after
-                display: block
-                content: ""
-                position: absolute
-                right: 0rem
-                bottom: 1.2rem
-                width: 3rem
-                height: 0.5rem
-                background-image: url("data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iQ2FscXVlXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMjguMiAxNS4xIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAyOC4yIDE1LjE7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxwb2x5bGluZSBzdHlsZT0iZmlsbDpub25lO3N0cm9rZTojRkZGRkZGO3N0cm9rZS13aWR0aDozO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDsiIHBvaW50cz0iMjYuNywxLjUgMTQuMSwxMy42IDEuNSwxLjUgIi8+DQo8L3N2Zz4=")
-                background-size: 100% 100%
-                background-repeat: no-repeat
-                pointer-events: none
-
-        select
-            appearance: none
-
-        input[type="text"], input[type="email"], textarea, select
-            border: 0px
-            border-radius: 5px
-            padding: 15px
-            width: 100%
-            height: 100%
-            font-size: 16px
-            line-height: 1.2em
-            background-color: $color-answer-back
-            color: $color-answer-text
-
-        textarea
-            height: 100px
-
-        .answer-holder
-            width: 50%
-            height: 91px
-            display: inline-block
-            vertical-align: top
-
-            &:nth-child(odd)
-                padding: 5px 5px 5px 0
-
-
-            &:nth-child(even)
-                padding: 5px 0 5px 5px
-
-            @media (max-width: 640px)
-                width: 100%
-                padding: 5px 0px !important
-
-        .answer
-            display: flex /* contexte sur le parent */
-            flex-direction: column /* direction d'affichage verticale */
-            justify-content: center /* alignement vertical */
-            padding: 15px
-            cursor: pointer
-            width: 100%
-            height: 100%
-            font-size: 16px
-            line-height: 1.2em
-            background-color: $color-answer-back
-            color: $color-answer-text
-            border-radius: 5px
-            transition: background-color 150ms
-
-            &:hover
-                background-color: $color-answer-hover
-
-            &.active
-                background-color: var(--main-color) !important
-
-            &.inactive
-                background-color: $color-answer-back !important
-
-#badge
-    @include badge(220px, 4px)
-    display: none
-
-#resultsscreen
-    font-size: 20px
-    line-height: 1.3em
-
-    > div
-        padding: 60px
-        background-color: var(--main-color)
-        color: $color-result-text
-        border-radius: 5px
-        margin-top: 10px
-
-        &#correction
-            @media (max-width: 640px)
-                padding: 30px 30px 30px 60px
-
-    #results
-        text-align: center
-
-        h2
-            font-size: 26px
-            font-weight: 700
-            margin: 0px 0 30px
-            display: none
-
-    #correction
-        background-color: var(--review-background)
-        color: $color-review-text
-
-        @media (max-width: 640px)
-            font-size: 16px
-
-        .correction
-            position: relative
-            padding-left: 40px
-
-            @media (max-width: 640px)
-                padding-left: 20px
-
-            .badge
-                position: absolute
-                left: -20px
-                top: 8px
-                @include badge(40px, 0)
-                font-weight: 400
-
-                @media (max-width: 640px)
-                    left: -39px
-
-            h4
-                font-weight: 600
-                margin-top: 40px
-                margin-bottom: 10px
-                @media (max-width: 640px)
-                    margin-top: 25px
-
-        h2
-            font-size: 26px
-            color: $color-result-text
-            text-align: center
-            font-weight: 700
-            margin-bottom: 40px
-
-            @media (max-width: 640px)
-                font-size: 20px
diff --git a/resources/quiz/style/style.sass b/resources/quiz/style/style.sass
deleted file mode 100644 (file)
index 9758c2f..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-@import 000-imports
-@import 010-common
-@import 020-header
-@import 030-quiz
diff --git a/resources/quiz/webpack.mix.js b/resources/quiz/webpack.mix.js
deleted file mode 100644 (file)
index 50d5044..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-const mix = require("laravel-mix");
-
-mix.setPublicPath('resources/quiz/dist').js('resources/quiz/js/app.js', 'js')
-    .sass('resources/quiz/style/style.sass', 'css').options({processCssUrls: false}).version();
diff --git a/resources/quiztheme/transparent.png b/resources/quiztheme/transparent.png
new file mode 100644 (file)
index 0000000..1914264
Binary files /dev/null and b/resources/quiztheme/transparent.png differ