]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6180 @4
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 26 Jul 2023 18:25:17 +0000 (20:25 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 26 Jul 2023 18:25:17 +0000 (20:25 +0200)
12 files changed:
app/Elearning/QuizCompiler.php [new file with mode: 0644]
app/Models/Quiz.php
package.json
resources/quizv2/js/quiz.data.js [new file with mode: 0644]
resources/quizv2/js/quiz.js [new file with mode: 0644]
resources/quizv2/style/001-global-variables.sass [new file with mode: 0644]
resources/quizv2/style/002-item-variables.sass [new file with mode: 0644]
resources/quizv2/style/003-reset.sass [new file with mode: 0644]
resources/quizv2/style/style.sass [new file with mode: 0644]
resources/views/quizv2/icons.blade.php [new file with mode: 0644]
resources/views/quizv2/index.blade.php [new file with mode: 0644]
webpack.mix.js

diff --git a/app/Elearning/QuizCompiler.php b/app/Elearning/QuizCompiler.php
new file mode 100644 (file)
index 0000000..ecf067b
--- /dev/null
@@ -0,0 +1,106 @@
+<?php
+
+namespace App\Elearning;
+
+use App\Jobs\Base;
+use App\Models\Quiz;
+use Cubist\Scorm\Manifest;
+use Cubist\Scorm\Version;
+use Cubist\Util\CommandLine\Npx;
+use Cubist\Util\Files\VirtualDirectory;
+
+class QuizCompiler extends Base
+{
+
+    /**
+     * @var Quiz
+     */
+    protected $quiz;
+
+    protected $dest;
+    protected $forceScorm = false;
+
+    protected $sassVariables = [];
+
+    public function __construct($quiz, $dest, $forceScorm = false)
+    {
+        $this->quiz = Quiz::withoutGlobalScopes()->find($quiz);
+        $this->compilePath = protected_path('quiz/compile/' . $this->quiz->id);
+        $this->dest = $dest;
+        $this->forceScorm = $forceScorm;
+    }
+
+    public function handle()
+    {
+        $this->copyFilesFromResources();
+        // Add data related to the current quiz in the "to compile" files
+        $this->writeStyles();
+        $this->writeData($data);
+        // Run the compiler
+        $this->runWebpack();
+
+        $vdir = new VirtualDirectory($this->dest);
+
+        $html = view('quizv2.index', ['quiz' => $this->quiz, 'data' => $data])->render();
+
+        $vdir->file_put_contents('index.html', $html);
+
+
+        if ($this->forceScorm || $this->getAttribute('scorm')) {
+            $scormVersion = $this->quiz->getAttribute('scorm_version') ?: Version::SCORM_1_2;
+            $manifest = new Manifest($this->quiz->getAttribute('title'), $scormVersion, $this->quiz->getAttribute('client') ?: backpack_user()->getCompanyNameAttribute(), $this->quiz->getAttribute('project') ?: 'Quiz');
+            $vdir->file_put_contents('imsmanifest.xml', $manifest);
+        }
+        $vdir->sync(true);
+    }
+
+    protected function writeStyles()
+    {
+
+        $this->writeSass();
+    }
+
+    protected function writeData(&$data)
+    {
+        $data = $this->quiz->getData();
+        $json = json_encode($data, JSON_THROW_ON_ERROR);
+        $dataSource = $this->compilePath . '/js/quiz.data.js';
+        file_put_contents($dataSource, str_replace('this.data = data;', 'this.data = ' . $json . ';', file_get_contents($dataSource)));
+    }
+
+    protected function writeSass()
+    {
+        $sass = '';
+        foreach ($this->sassVariables as $key => $value) {
+            $sass .= '$' . $key . ': ' . $value . "\n";
+        }
+        file_put_contents($this->compilePath . '/style/002-item-variables.sass', $sass);
+    }
+
+
+    protected function copyFilesFromResources()
+    {
+        // Copy base files from resources
+        $compile = new VirtualDirectory($this->compilePath);
+        $compile->copyDirectory(resource_path('quizv2/js'), 'js');
+        $compile->copyDirectory(resource_path('quizv2/style'), 'style');
+        $mix = 'const mix = require("laravel-mix");
+mix.setPublicPath("dist").js("js/quiz.js", "js")
+    .sass("style/style.sass", "css").options({processCssUrls: false}).version();
+';
+        $compile->file_put_contents('webpack.mix.js', $mix);
+        $compile->sync(true);
+    }
+
+    protected function runWebpack()
+    {
+        $cli = new Npx();
+        $cli->cd($this->compilePath);
+        $cli->setModule('cross-env process.env.local=1 mix --production');
+        $cli->execute();
+
+        if (!file_exists($this->compilePath . '/dist/quiz.js')) {
+            $cli->dd();
+        }
+    }
+}
index c518fe94dfc1b4369b2d8553ae0ab9e36b7294b8..40939d4e66d856e5784f615f7e9549f6d3b5bde7 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace App\Models;
 
+use App\Elearning\QuizCompiler;
 use App\Fields\SCORMVersion;
 use App\Http\Controllers\Admin\Operations\ChangeownerOperation;
 use App\Http\Controllers\Admin\Operations\Quiz\DownloadOperation;
@@ -21,9 +22,11 @@ use Cubist\Backpack\Magic\Fields\SelectFromArray;
 use Cubist\Backpack\Magic\Fields\Text;
 use Cubist\Backpack\Magic\Fields\Textarea;
 use Cubist\Scorm\Manifest;
+use Cubist\Util\CommandLine\Npx;
 use Cubist\Util\Files\VirtualDirectory;
 use Spatie\Image\Manipulations;
 use Spatie\MediaLibrary\MediaCollections\Models\Media;
+use Cubist\Scorm\Version;
 
 // __('!! e-Learning')
 class Quiz extends ToolboxModel
@@ -238,8 +241,6 @@ class Quiz extends ToolboxModel
         ]);
 
 
-
-
         $this->addField('section_qa', FormBigSection::class, __('Question & réponses'));
         $this->addField([
             'name' => 'questions',
@@ -249,8 +250,8 @@ class Quiz extends ToolboxModel
             'add_label' => __('Nouvelle question'),
         ]);
 
-        $this->addField('section_advanced',FormSuperSection::class,__('Paramètres avancés'));
-        $this->addField('section_advanced_',FormSection::class);
+        $this->addField('section_advanced', FormSuperSection::class, __('Paramètres avancés'));
+        $this->addField('section_advanced_', FormSection::class);
         $this->addField(['name' => 'logattempts',
             'label' => __('Activer l\'enregistrement des tentatives'),
             'hint' => __('Les tentatives seront enregistrées sur le serveur de la Toolbox'),
@@ -307,43 +308,8 @@ class Quiz extends ToolboxModel
      */
     public function compile($dest, $forceScorm = false, $user = null)
     {
-        $wdir = resource_path('quiz');
-        $vdir = new VirtualDirectory($dest);
-
-
-        $data = $this->getData();
-        $json = json_encode($data, JSON_THROW_ON_ERROR);
-        $vdir->file_put_contents('data.js', 'var DATA=' . $json . ';');
-        $vdir->copy($wdir . '/index.html', 'index.html');
-        $vdir->copyDirectory($wdir . '/dist/css', 'css');
-        $vdir->copyDirectory($wdir . '/dist/js', 'js');
-        $vdir->copyDirectory($wdir . '/fonts', 'fonts');
-        $vdir->copyDirectory($wdir . '/assets', 'assets');
-
-        // Copy assets
-        $assets = ['banner' => 'banner.jpg', 'logo' => 'logo.png'];
-        foreach ($assets as $asset => $filename) {
-            $coll = $this->getAttribute($asset);
-            if ($coll) {
-                $media = $this->getFirstMedia($coll);
-
-                if ($media) {
-                    $conversionName = $asset . '_compile';
-
-                    $path = $media->getPath($conversionName);
-                    if (file_exists($path)) {
-                        $vdir->copy($path, 'assets/' . $filename);
-                    }
-                }
-            }
-        }
-
-        if ($forceScorm || $this->getAttribute('scorm')) {
-            $scormVersion = $this->getAttribute('scorm_version') ?: '1.2';
-            $manifest = new Manifest($this->getAttribute('title'), $scormVersion, $this->getAttribute('client') ?: backpack_user()->getCompanyNameAttribute(), $this->getAttribute('project') ?: 'Quiz');
-            $vdir->file_put_contents('imsmanifest.xml', $manifest);
-        }
-        $vdir->sync(true);
+        $job = new QuizCompiler($this->id, $dest, $forceScorm);
+        $job->handle();
     }
 
     public function getData()
index 2c3d43708bd451bfd604bd554fe433ef261781c8..4370ad872d2e60e002a269441dcba54cbf267ebb 100644 (file)
@@ -1,7 +1,7 @@
 {
     "private": true,
     "scripts": {
-        "all": "npm run elearningmedia;npm run elearningpackage;npm run quiz;npm run linkeditor",
+        "all": "npm run elearningmedia;npm run elearningpackage;npm run quiz;npm run quizv2;npm run linkeditor",
         "elearningmedia-dev": "cross-env process.env.section=elearningmedia mix",
         "elearningmedia-watch": "cross-env process.env.section=elearningmedia mix watch",
         "elearningmedia": "cross-env process.env.section=elearningmedia mix --production",
diff --git a/resources/quizv2/js/quiz.data.js b/resources/quizv2/js/quiz.data.js
new file mode 100644 (file)
index 0000000..89bf278
--- /dev/null
@@ -0,0 +1,7 @@
+function QuizData(quiz) {
+    this.quiz = quiz;
+    // Data will be populated at compile time
+    this.data = data;
+}
+
+module.exports = QuizData;
diff --git a/resources/quizv2/js/quiz.js b/resources/quizv2/js/quiz.js
new file mode 100644 (file)
index 0000000..0e8cca3
--- /dev/null
@@ -0,0 +1,166 @@
+import $ from "jquery";
+import gsap from "gsap";
+import {CubeSCORM} from '/application/resources/scorm/scorm';
+
+import QuizData from "./quiz.data";
+
+window.cubeSCORM = new CubeSCORM();
+window.$ = window.jQuery = $;
+
+function Quiz() {
+}
+
+Quiz.prototype = {
+    init: function () {
+        this.data = new QuizData(this);
+    },
+}
+
+(function (global) {
+    $(function () {
+        window.quiz = new Quiz();
+        window.quiz.init();
+    });
+})(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/quizv2/style/001-global-variables.sass b/resources/quizv2/style/001-global-variables.sass
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/resources/quizv2/style/002-item-variables.sass b/resources/quizv2/style/002-item-variables.sass
new file mode 100644 (file)
index 0000000..9e5f8fc
--- /dev/null
@@ -0,0 +1 @@
+// Do not edit this file, quiz variables will be populated at compile time
diff --git a/resources/quizv2/style/003-reset.sass b/resources/quizv2/style/003-reset.sass
new file mode 100644 (file)
index 0000000..45897f9
--- /dev/null
@@ -0,0 +1,51 @@
+/* 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/quizv2/style/style.sass b/resources/quizv2/style/style.sass
new file mode 100644 (file)
index 0000000..87b33b2
--- /dev/null
@@ -0,0 +1,3 @@
+@import 001-global-variables
+@import 002-item-variables
+@import 003-reset
diff --git a/resources/views/quizv2/icons.blade.php b/resources/views/quizv2/icons.blade.php
new file mode 100644 (file)
index 0000000..2f8b0fe
--- /dev/null
@@ -0,0 +1,47 @@
+{{--
+
+Downloaded from https://toolbox.fluidbook.com/tool-sprite/9/download
+Edit here : https://toolbox.fluidbook.com/tool-sprite/9/edit
+
+--}}<div class="svg-sprite" style="height: 0;width: 0;position: absolute;" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><symbol id="quizrunning-man" viewBox="0 0 18.998 26.45"><path d="M11.885 0.079 C 11.224 0.223,10.624 0.685,10.312 1.291 C 10.114 1.677,10.069 1.851,10.049 2.327 C 10.023 2.909,10.115 3.295,10.390 3.759 C 10.528 3.991,10.956 4.419,11.190 4.557 C 11.582 4.789,12.186 4.935,12.585 4.892 C 13.559 4.788,14.347 4.157,14.648 3.239 C 14.733 2.980,14.739 2.927,14.738 2.470 C 14.736 1.897,14.696 1.702,14.497 1.305 C 14.266 0.842,13.786 0.401,13.289 0.195 C 12.912 0.038,12.303 -0.012,11.885 0.079 M9.258 5.570 C 9.028 5.627,5.801 7.361,5.296 7.700 C 4.734 8.077,4.216 8.758,3.975 9.436 C 3.775 9.997,3.766 10.075,3.747 11.415 C 3.729 12.789,3.751 13.179,3.864 13.411 C 3.958 13.606,4.252 13.900,4.451 13.998 C 4.640 14.090,5.110 14.122,5.342 14.057 C 5.662 13.967,6.049 13.575,6.134 13.255 C 6.164 13.141,6.186 12.685,6.207 11.716 L 6.238 10.339 6.320 10.171 C 6.472 9.859,6.750 9.646,7.551 9.224 C 7.726 9.132,7.880 9.057,7.895 9.056 C 7.927 9.056,7.916 9.144,7.753 10.227 C 7.298 13.256,6.639 17.234,6.455 18.064 C 6.358 18.506,6.199 18.717,5.844 18.874 C 5.495 19.028,5.448 19.019,3.499 18.397 C 2.785 18.169,2.087 17.953,1.947 17.917 C 1.615 17.831,1.252 17.845,1.045 17.952 C 0.574 18.195,0.343 18.560,0.343 19.062 C 0.343 19.342,0.413 19.552,0.586 19.786 C 0.696 19.936,0.767 19.994,0.947 20.085 C 1.317 20.270,4.279 21.234,4.860 21.358 C 5.480 21.490,6.308 21.366,6.982 21.040 C 7.601 20.740,8.121 20.256,8.480 19.647 C 8.749 19.190,8.813 18.953,9.106 17.331 C 9.203 16.794,9.293 16.343,9.305 16.330 C 9.345 16.289,11.264 17.958,11.472 18.215 C 11.532 18.288,11.613 18.412,11.652 18.489 L 11.723 18.629 11.739 22.051 L 11.756 25.473 11.864 25.689 C 12.151 26.263,12.740 26.525,13.333 26.345 C 13.533 26.285,13.592 26.248,13.776 26.070 C 13.894 25.956,14.032 25.783,14.087 25.681 L 14.185 25.496 14.185 21.951 L 14.185 18.406 14.062 18.029 C 13.905 17.547,13.757 17.228,13.537 16.889 C 13.325 16.564,13.102 16.339,12.270 15.606 C 11.921 15.299,11.604 15.013,11.564 14.970 L 11.493 14.892 11.685 13.945 C 11.935 12.712,12.279 11.098,12.324 10.948 C 12.343 10.882,12.368 10.829,12.380 10.829 C 12.392 10.829,12.536 11.053,12.700 11.328 C 13.303 12.338,13.528 12.635,13.942 12.967 C 14.285 13.242,14.642 13.448,14.957 13.554 C 15.199 13.635,16.357 13.909,17.098 14.060 C 17.520 14.146,17.750 14.132,18.023 14.004 C 18.274 13.886,18.410 13.771,18.539 13.569 C 18.856 13.070,18.815 12.526,18.427 12.086 C 18.201 11.830,18.040 11.773,16.657 11.461 C 15.790 11.266,15.693 11.231,15.495 11.044 C 15.275 10.836,15.118 10.588,14.122 8.882 C 13.185 7.277,12.828 6.693,12.688 6.533 C 12.505 6.325,12.152 6.192,10.892 5.856 C 9.955 5.607,9.462 5.520,9.258 5.570 " stroke="none" fill-rule="evenodd" fill="currentColor"></path></symbol><symbol id="quizarrow" viewBox="0 0 14.253 17.6"><path d="M6.919 0.033 C 6.667 0.116,6.729 0.045,3.891 3.450 C 0.974 6.949,0.450 7.585,0.388 7.704 C 0.325 7.822,0.330 8.174,0.397 8.320 C 0.459 8.455,0.644 8.646,0.787 8.721 C 0.875 8.768,0.926 8.776,1.128 8.776 C 1.332 8.776,1.381 8.768,1.471 8.721 C 1.658 8.622,1.466 8.845,4.835 4.811 L 6.283 3.078 6.298 4.039 C 6.306 4.568,6.314 7.689,6.316 10.975 L 6.319 16.949 6.387 17.092 C 6.474 17.272,6.601 17.418,6.742 17.502 C 6.846 17.563,6.871 17.567,7.127 17.567 C 7.382 17.567,7.407 17.563,7.511 17.502 C 7.652 17.418,7.779 17.272,7.866 17.092 L 7.934 16.949 7.938 10.892 C 7.939 7.560,7.947 4.431,7.955 3.939 L 7.970 3.044 8.328 3.476 C 9.914 5.388,11.624 7.439,12.087 7.988 C 12.747 8.768,12.760 8.778,13.125 8.777 C 13.385 8.777,13.509 8.728,13.678 8.559 C 13.854 8.382,13.907 8.252,13.907 7.994 C 13.906 7.841,13.895 7.758,13.866 7.705 C 13.787 7.556,11.352 4.599,8.958 1.746 C 7.713 0.262,7.616 0.153,7.474 0.084 C 7.318 0.007,7.068 -0.016,6.919 0.033 " stroke="none" fill-rule="evenodd" fill="currentColor"></path></symbol><symbol id="quizwrong" viewBox="0 0 70.711 70.711"><path d="M4.184 4.243 L -0.058 8.486 13.376 21.921 L 26.811 35.356 13.405 48.762 L -0.000 62.168 4.243 66.409 L 8.486 70.651 21.891 57.246 L 35.297 43.841 48.732 57.276 L 62.166 70.711 66.409 66.468 L 70.652 62.226 57.217 48.791 L 43.782 35.355 57.247 21.891 L 70.711 8.426 66.468 4.184 L 62.225 -0.058 48.761 13.406 L 35.297 26.870 21.861 13.435 L 8.426 -0.000 4.184 4.243 " stroke="none" fill-rule="evenodd" fill="currentColor"></path></symbol><symbol id="quizok" viewBox="0 0 91.924 65.054"><path d="M59.367 24.054 L 35.315 48.107 21.865 34.663 L 8.416 21.219 4.219 25.509 L 0.023 29.799 15.600 45.397 C 24.168 53.976,32.128 61.898,33.290 63.001 L 35.403 65.007 44.607 55.829 C 49.669 50.781,62.385 38.066,72.864 27.572 L 91.917 8.493 87.668 4.247 L 83.420 0.001 59.367 24.054 " stroke="none" fill-rule="evenodd" fill="currentColor"></path></symbol><symbol id="quizreset" viewBox="0 0 26 26.213"><path d="M4.371 0.282 C 4.057 0.383,3.851 0.615,3.734 0.998 C 3.601 1.440,2.930 4.136,2.837 4.604 C 2.744 5.071,2.788 5.280,3.042 5.568 C 3.180 5.724,3.268 5.779,3.502 5.851 C 4.185 6.062,7.111 6.769,7.388 6.789 C 7.663 6.810,7.714 6.800,7.929 6.687 C 8.498 6.386,8.618 5.607,8.166 5.141 C 7.997 4.967,7.725 4.869,6.703 4.612 C 6.365 4.527,6.072 4.441,6.052 4.422 C 5.974 4.345,7.034 3.721,7.933 3.314 C 8.902 2.875,9.833 2.593,11.028 2.378 C 11.668 2.263,13.404 2.216,14.178 2.292 C 15.716 2.444,17.341 2.997,18.742 3.844 C 19.687 4.417,20.776 5.368,21.499 6.252 C 22.823 7.872,23.698 9.939,23.918 11.969 C 23.986 12.600,23.975 14.037,23.896 14.634 C 23.639 16.602,22.892 18.378,21.631 20.020 C 21.276 20.483,20.246 21.512,19.760 21.889 C 18.207 23.096,16.369 23.861,14.343 24.143 C 13.667 24.237,12.105 24.214,11.397 24.100 C 8.545 23.639,6.157 22.250,4.380 20.020 C 2.934 18.204,2.159 16.097,2.014 13.585 C 1.971 12.828,1.892 12.637,1.524 12.393 C 1.029 12.065,0.340 12.276,0.088 12.832 C -0.013 13.054,-0.026 13.508,0.045 14.300 C 0.336 17.548,1.776 20.504,4.143 22.713 C 6.018 24.463,8.130 25.516,10.833 26.051 C 11.301 26.144,11.435 26.150,13.022 26.149 L 14.712 26.147 15.362 26.011 C 18.082 25.440,20.320 24.259,22.156 22.426 C 24.114 20.471,25.282 18.215,25.836 15.318 C 25.928 14.835,25.935 14.686,25.935 13.217 C 25.935 11.478,25.918 11.319,25.604 10.075 C 24.717 6.558,22.474 3.636,19.283 1.841 C 16.417 0.229,12.870 -0.194,9.468 0.671 C 8.281 0.972,7.360 1.330,6.160 1.956 C 5.794 2.147,5.488 2.296,5.479 2.287 C 5.470 2.278,5.504 2.106,5.554 1.904 C 5.604 1.703,5.647 1.389,5.650 1.206 C 5.655 0.903,5.644 0.858,5.524 0.687 C 5.258 0.309,4.796 0.146,4.371 0.282 " stroke="none" fill-rule="evenodd" fill="currentColor"></path></symbol><symbol id="quizhelp" viewBox="0 0 26 26"><path d="M11.787 0.068 C 10.395 0.217,9.377 0.463,8.199 0.936 C 7.042 1.400,5.820 2.106,4.897 2.843 C 4.415 3.228,3.213 4.429,2.842 4.897 C 0.606 7.715,-0.365 11.275,0.134 14.820 C 0.820 19.690,4.214 23.758,8.900 25.326 C 11.789 26.292,14.892 26.207,17.781 25.081 C 21.033 23.814,23.761 21.101,25.048 17.855 C 25.392 16.988,25.696 15.919,25.857 15.015 C 25.970 14.378,25.970 11.622,25.857 10.985 C 25.666 9.908,25.299 8.697,24.874 7.735 C 23.103 3.726,19.441 0.907,15.051 0.174 C 14.625 0.102,12.759 -0.015,12.393 0.006 C 12.358 0.008,12.085 0.036,11.787 0.068 M14.733 2.144 C 15.817 2.317,16.792 2.631,17.832 3.141 C 21.044 4.718,23.273 7.729,23.863 11.288 C 23.976 11.975,23.976 14.025,23.863 14.712 C 23.549 16.607,22.789 18.331,21.609 19.821 C 21.202 20.336,20.367 21.176,19.847 21.594 C 18.317 22.825,16.256 23.693,14.322 23.922 C 13.762 23.988,12.235 23.988,11.678 23.921 C 9.767 23.693,7.683 22.825,6.224 21.650 C 4.387 20.171,3.064 18.215,2.444 16.061 C 2.154 15.054,2.072 14.484,2.048 13.315 C 2.034 12.675,2.045 12.083,2.075 11.799 C 2.278 9.874,3.051 7.940,4.263 6.327 C 4.628 5.840,5.642 4.805,6.132 4.419 C 7.782 3.116,9.680 2.332,11.830 2.064 C 12.212 2.017,14.294 2.074,14.733 2.144 M12.610 6.504 C 11.103 6.638,9.751 7.794,9.367 9.276 C 9.259 9.692,9.212 10.129,9.249 10.373 C 9.285 10.614,9.483 10.916,9.704 11.070 C 10.068 11.322,10.660 11.237,10.967 10.888 C 11.134 10.697,11.161 10.623,11.246 10.130 C 11.373 9.388,11.696 8.917,12.263 8.649 C 12.522 8.526,12.582 8.515,13.000 8.515 C 13.418 8.515,13.478 8.526,13.737 8.649 C 14.098 8.820,14.407 9.129,14.578 9.490 C 14.701 9.749,14.712 9.808,14.712 10.227 C 14.712 10.634,14.699 10.709,14.591 10.939 C 14.354 11.446,14.001 11.758,13.485 11.918 C 13.332 11.965,13.125 12.003,13.024 12.003 C 12.786 12.003,12.351 12.219,12.207 12.408 C 12.148 12.485,12.077 12.626,12.051 12.720 C 11.991 12.937,11.988 14.913,12.047 15.126 C 12.070 15.211,12.160 15.363,12.246 15.463 C 12.667 15.956,13.329 15.959,13.747 15.472 C 13.953 15.231,13.997 15.047,13.997 14.423 L 13.997 13.884 14.333 13.746 C 15.277 13.359,16.001 12.685,16.401 11.819 C 16.669 11.238,16.744 10.888,16.739 10.227 C 16.735 9.539,16.649 9.153,16.380 8.596 C 15.697 7.185,14.212 6.361,12.610 6.504 M12.554 17.696 C 12.192 17.832,11.863 18.143,11.714 18.489 C 11.608 18.737,11.616 19.294,11.730 19.543 C 11.944 20.011,12.375 20.314,12.884 20.355 C 13.963 20.442,14.695 19.371,14.228 18.386 C 14.122 18.161,13.815 17.864,13.585 17.762 C 13.329 17.649,12.774 17.614,12.554 17.696 " stroke="none" fill-rule="evenodd" fill="currentColor"></path></symbol><symbol id="quizhourglass" viewBox="0 0 22 26.004"><path d="M1.302 0.034 C 0.590 0.058,0.481 0.093,0.241 0.374 C -0.135 0.813,-0.042 1.470,0.443 1.806 C 0.690 1.976,0.892 2.017,1.503 2.017 L 1.969 2.017 1.992 3.382 C 2.005 4.134,2.032 4.875,2.053 5.030 C 2.134 5.626,2.421 6.393,2.777 6.963 C 3.067 7.429,3.186 7.559,6.795 11.345 L 7.735 12.332 7.433 12.647 C 6.927 13.175,3.775 16.498,3.463 16.832 C 2.819 17.523,2.496 18.059,2.243 18.854 C 2.019 19.558,2.007 19.697,1.989 21.931 L 1.973 23.970 1.370 23.988 C 0.794 24.006,0.758 24.011,0.559 24.113 C 0.189 24.302,-0.040 24.717,0.013 25.102 C 0.058 25.431,0.304 25.754,0.620 25.901 L 0.788 25.978 11.000 25.978 L 21.212 25.978 21.380 25.901 C 21.583 25.806,21.787 25.609,21.898 25.400 C 22.011 25.185,22.012 24.794,21.900 24.581 C 21.773 24.341,21.645 24.211,21.430 24.106 C 21.248 24.017,21.180 24.006,20.634 23.985 L 20.038 23.962 20.015 21.957 C 20.003 20.855,19.981 19.857,19.967 19.739 C 19.881 19.026,19.475 18.007,19.047 17.436 C 18.836 17.153,18.216 16.486,16.049 14.210 L 14.270 12.342 14.514 12.081 C 14.648 11.938,15.635 10.897,16.707 9.769 C 17.778 8.641,18.737 7.619,18.836 7.498 C 19.253 6.993,19.546 6.460,19.751 5.833 C 19.951 5.223,19.984 4.910,20.009 3.382 L 20.031 2.017 20.497 2.017 C 21.108 2.017,21.310 1.976,21.557 1.806 C 22.078 1.445,22.140 0.785,21.697 0.309 C 21.517 0.116,21.490 0.102,21.267 0.066 C 21.008 0.025,2.429 -0.005,1.302 0.034 M18.001 2.723 C 18.000 3.111,17.985 3.775,17.969 4.198 C 17.943 4.893,17.931 4.997,17.841 5.262 C 17.725 5.606,17.528 5.951,17.287 6.233 C 17.129 6.417,16.048 7.562,13.805 9.918 C 12.575 11.211,12.036 11.806,11.963 11.952 C 11.866 12.147,11.875 12.548,11.982 12.765 C 12.039 12.881,12.598 13.493,13.721 14.672 C 17.553 18.691,17.544 18.681,17.784 19.247 C 17.844 19.387,17.909 19.614,17.929 19.752 C 17.949 19.889,17.976 20.897,17.990 21.991 L 18.015 23.980 11.000 23.980 L 3.985 23.980 4.009 21.918 C 4.035 19.705,4.041 19.636,4.235 19.198 C 4.288 19.078,4.402 18.872,4.488 18.739 C 4.677 18.450,4.782 18.337,7.702 15.271 C 9.762 13.107,10.008 12.831,10.083 12.600 C 10.144 12.409,10.115 12.115,10.013 11.904 C 9.953 11.781,9.365 11.139,8.001 9.706 C 5.726 7.316,5.045 6.596,4.741 6.259 C 4.490 5.981,4.270 5.587,4.127 5.161 C 4.034 4.883,4.032 4.859,4.008 3.448 L 3.985 2.017 10.994 2.017 L 18.003 2.017 18.001 2.723 M10.578 13.819 C 10.372 13.913,10.095 14.221,10.059 14.397 C 10.020 14.582,10.020 15.854,10.058 16.037 C 10.095 16.213,10.372 16.520,10.578 16.615 C 10.779 16.706,11.221 16.706,11.422 16.615 C 11.502 16.578,11.645 16.465,11.739 16.364 C 11.972 16.113,12.005 15.943,11.981 15.088 C 11.970 14.711,11.944 14.381,11.919 14.318 C 11.854 14.154,11.628 13.936,11.422 13.838 C 11.188 13.727,10.798 13.718,10.578 13.819 M10.682 17.530 C 10.619 17.549,10.412 17.702,10.224 17.871 C 9.693 18.347,6.376 21.698,6.194 21.942 C 6.033 22.158,6.032 22.162,6.033 22.456 C 6.033 22.688,6.051 22.784,6.114 22.903 C 6.224 23.112,6.487 23.333,6.712 23.406 C 6.946 23.481,7.048 23.482,7.288 23.411 C 7.510 23.345,7.765 23.109,9.744 21.141 L 11.000 19.892 12.274 21.159 C 13.947 22.822,14.469 23.318,14.616 23.379 C 14.793 23.453,15.239 23.443,15.419 23.361 C 15.640 23.261,15.896 22.957,15.951 22.731 C 16.028 22.409,15.986 22.184,15.805 21.938 C 15.718 21.821,14.745 20.824,13.644 19.722 C 11.439 17.516,11.406 17.488,11.018 17.494 C 10.897 17.495,10.746 17.512,10.682 17.530 " stroke="none" fill-rule="evenodd" fill="currentColor"></path></symbol></svg></div>
+<script>
+    function getSpriteIcon(icon, attrs, dimensions) {
+        var a = [];
+        var iconSymbol = $('svg symbol[id="' + icon + '"]');
+        if (iconSymbol.length > 1) {
+            $('svg symbol[id="' + icon + '"]:not(:last)').remove();
+            iconSymbol = $('svg symbol[id="' + icon + '"]');
+        }
+
+        if (iconSymbol.length == 0) {
+            return ''; // Bail out because symbol doesn't exist
+        }
+
+        if (attrs == undefined) {
+            attrs = {};
+        }
+        if (attrs.viewBox == null) {
+            attrs.viewBox = iconSymbol.get(0).attributes.viewBox.value;
+        }
+        if (dimensions === true) {
+            var vb = attrs.viewBox.split(' ');
+            attrs.x = vb[0];
+            attrs.y = vb[1];
+            attrs.width = vb[2];
+            attrs.height = vb[3];
+        }
+        if (attrs.class == null) {
+            attrs.class = icon;
+        } else {
+            attrs.class += ' ' + icon;
+        }
+
+        attrs.class += ' nav-icon svg-icon'; // Common class for all icons
+
+        $.each(attrs, function (k, v) {
+            a.push(k + '="' + v + '"');
+        });
+        return '<svg ' + a.join(' ') + ' aria-hidden="true"><use xlink:href="#' + icon + '" /></svg>';
+    }
+
+</script>
diff --git a/resources/views/quizv2/index.blade.php b/resources/views/quizv2/index.blade.php
new file mode 100644 (file)
index 0000000..1c0f204
--- /dev/null
@@ -0,0 +1,19 @@
+<!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>
+@include("quizv2.icons")
+<div id="quiz">
+</div>
+<script src="data.js"></script>
+<script></script>
+</body>
+</html>
index 9b8411d80dea203f7034ef1ddba121897ee8f576..5fb3f8caeefa62bed5eb495833738d6dfaaf66a4 100644 (file)
@@ -3,3 +3,6 @@ const mix = require('laravel-mix');
 if (process.env.section) {
     require(`${__dirname}/resources/${process.env.section}/webpack.mix.js`);
 }
+if(process.env.local){
+    require(`${process.env.custom}/webpack.mix.js`);
+}