From: Vincent Vanwaelscappel Date: Tue, 14 Dec 2021 11:08:53 +0000 (+0100) Subject: wip #4907 @2 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=680c31695b1d450cae8cf2bdca23920241d5767a;p=hf-scorm-package.git wip #4907 @2 --- diff --git a/.idea/deployment.xml b/.idea/deployment.xml index 4921b12..44ca711 100644 --- a/.idea/deployment.xml +++ b/.idea/deployment.xml @@ -1,6 +1,6 @@ - + @@ -12,7 +12,7 @@ - + @@ -304,5 +304,6 @@ + \ No newline at end of file diff --git a/.idea/laravel-query-settings.xml b/.idea/laravel-query-settings.xml new file mode 100644 index 0000000..7d5ef0a --- /dev/null +++ b/.idea/laravel-query-settings.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/watcherTasks.xml b/.idea/watcherTasks.xml new file mode 100644 index 0000000..560ddd1 --- /dev/null +++ b/.idea/watcherTasks.xml @@ -0,0 +1,25 @@ + + + + + + + + \ No newline at end of file diff --git a/index.html b/index.html index dddc6e3..4c9c631 100644 --- a/index.html +++ b/index.html @@ -3,14 +3,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + +
TypeMandatoryValidatedScore
+ +
+

+ +
+ diff --git a/js/scormpackage.js b/js/scormpackage.js index a6ddeff..549f365 100644 --- a/js/scormpackage.js +++ b/js/scormpackage.js @@ -1,11 +1,75 @@ (function (global) { $(function () { + initEvents(); + setContents(); }); })(typeof window === 'undefined' ? this : window); +function initEvents() { + $(document).on('click', '[data-id]', function () { + openSubSCO($(this).data('id')); + return false; + }); + + $(document).on('click', '#scobar a.close', function () { + closeSubSCO(); + return false; + }); +} + +function closeSubSCO() { + $("#scowin").removeClass('show'); + $('#sco').attr('src', ''); +} + +function openSubSCO(id) { + var module = getModuleData(id); + var path = module.path; + + var e = path.split('.'); + var ext = e.pop().toLowerCase(); + + if (ext === 'pdf') { + path = 'js/libs/pdfjs/web/viewer.html?file=../../../../' + path; + } + + $("#scowin").addClass('show'); + $("#scowin h2").text(module.title); + $("#scobar #scoicon").html(getSpriteIcon('icon-' + module.type)); + $("#scobar .close").html(getSpriteIcon('interface-close')); + $("#sco").attr('src', path); +} + +function getModuleData(id) { + for (var k in DATA.modules) { + var m = DATA.modules[k]; + if (m.id == id) { + return m; + } + } + return null; +} + +function setContents() { + var vcheck = ''; + var xcheck = ''; + var types = {IN: 'Infographic PDF', AN: 'Animation', VI: 'Video', FB: 'Fluidbook', PC: 'Podcast HTML', QZ: 'Quiz'}; + $('header h1').text(DATA.title); + $('title').text(DATA.title); + $.each(DATA.modules, function (k, v) { + var tr = $(''); + $('tbody').append(tr); + tr.append('' + v.title + ''); + tr.append('' + types[v.type] + ''); + tr.append('' + (v.mandatory ? vcheck : xcheck) + ''); + tr.append('' + ''); + tr.append('' + ''); + }); +} + (function (global) { 'use strict'; if (!global.console) { @@ -88,4 +152,44 @@ function setScormValue(elementName, value) { var result = doLMSSetValue(elementName, value); doLMSCommit(); return result; +} + +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) { + //console.warn('Unable to find sprite icon: ' + icon); + 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 ''; } \ No newline at end of file diff --git a/style/open-sans-v27-latin-300.woff2 b/style/open-sans-v27-latin-300.woff2 new file mode 100644 index 0000000..b7c278a Binary files /dev/null and b/style/open-sans-v27-latin-300.woff2 differ diff --git a/style/open-sans-v27-latin-500.woff2 b/style/open-sans-v27-latin-500.woff2 new file mode 100644 index 0000000..3cd29e1 Binary files /dev/null and b/style/open-sans-v27-latin-500.woff2 differ diff --git a/style/open-sans-v27-latin-600.woff2 b/style/open-sans-v27-latin-600.woff2 new file mode 100644 index 0000000..d3eaed3 Binary files /dev/null and b/style/open-sans-v27-latin-600.woff2 differ diff --git a/style/open-sans-v27-latin-700.woff2 b/style/open-sans-v27-latin-700.woff2 new file mode 100644 index 0000000..e866070 Binary files /dev/null and b/style/open-sans-v27-latin-700.woff2 differ diff --git a/style/open-sans-v27-latin-800.woff2 b/style/open-sans-v27-latin-800.woff2 new file mode 100644 index 0000000..1806943 Binary files /dev/null and b/style/open-sans-v27-latin-800.woff2 differ diff --git a/style/open-sans-v27-latin-regular.woff2 b/style/open-sans-v27-latin-regular.woff2 new file mode 100644 index 0000000..6354811 Binary files /dev/null and b/style/open-sans-v27-latin-regular.woff2 differ diff --git a/style/style.css b/style/style.css new file mode 100644 index 0000000..fe2334c --- /dev/null +++ b/style/style.css @@ -0,0 +1,117 @@ +body, html { + min-height: 100%; +} + +* { + padding: 0; + margin: 0; + box-sizing: border-box; + font-family: "Open Sans", Arial, Helvetica, sans-serif; +} + +[data-id] { + cursor: pointer; +} + +#scowin { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 100; + display: none; + opacity: 0; + transition: 500ms opacity; + background-color: #fff; +} +#scowin.show { + opacity: 1; + display: block; + transition: 500ms opacity; +} +#scowin #scobar { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 30px; + background: #8b276d; + color: #fff; +} +#scowin #scobar a.close { + position: absolute; + top: 5px; + right: 5px; +} +#scowin #scobar a.close svg { + width: 20px; + height: 20px; + color: #fff; +} +#scowin #scobar #scoicon { + position: absolute; + top: 4px; + left: 2px; + height: 26px; + width: 26px; +} +#scowin #scobar h2 { + margin-left: 40px; + font-size: 18px; + margin-top: 3px; + font-weight: 400; +} +#scowin #sco { + position: absolute; + width: 100%; + height: calc(100% - 30px); + top: 30px; + left: 0; + background-color: #000; +} + +/* open-sans-300 - latin */ +@font-face { + font-family: "Open Sans"; + font-style: normal; + font-weight: 300; + src: url("open-sans-v27-latin-300.woff2") format("woff2"); +} +/* open-sans-regular - latin */ +@font-face { + font-family: "Open Sans"; + font-style: normal; + font-weight: 400; + src: url("open-sans-v27-latin-regular.woff2") format("woff2"); +} +/* open-sans-500 - latin */ +@font-face { + font-family: "Open Sans"; + font-style: normal; + font-weight: 500; + src: url("open-sans-v27-latin-500.woff2") format("woff2"); +} +/* open-sans-600 - latin */ +@font-face { + font-family: "Open Sans"; + font-style: normal; + font-weight: 600; + src: url("open-sans-v27-latin-600.woff2") format("woff2"); +} +/* open-sans-700 - latin */ +@font-face { + font-family: "Open Sans"; + font-style: normal; + font-weight: 700; + src: url("open-sans-v27-latin-700.woff2") format("woff2"); +} +/* open-sans-800 - latin */ +@font-face { + font-family: "Open Sans"; + font-style: normal; + font-weight: 800; + src: url("open-sans-v27-latin-800.woff2") format("woff2"); +} + +/*# sourceMappingURL=style.css.map */ diff --git a/style/style.css.map b/style/style.css.map new file mode 100644 index 0000000..3e219a1 --- /dev/null +++ b/style/style.css.map @@ -0,0 +1 @@ +{"version":3,"sourceRoot":"","sources":["style.sass"],"names":[],"mappings":"AAAA;EACE;;;AAEF;EACE;EACA;EACA;EACA;;;AAGF;EACE;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;AACA;EACE;EACA;EACA;;AAEJ;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;;AAEJ;EACE;EACA;EACA;EACA;EACA;EACA;;;AAEJ;AACA;EACE;EACA;EACA;EACA;;AAGF;AACA;EACE;EACA;EACA;EACA;;AAGF;AACA;EACE;EACA;EACA;EACA;;AAGF;AACA;EACE;EACA;EACA;EACA;;AAGF;AACA;EACE;EACA;EACA;EACA;;AAGF;AACA;EACE;EACA;EACA;EACA","file":"style.css"} \ No newline at end of file diff --git a/style/style.sass b/style/style.sass new file mode 100644 index 0000000..adacb1c --- /dev/null +++ b/style/style.sass @@ -0,0 +1,117 @@ +body, html + min-height: 100% + +* + padding: 0 + margin: 0 + box-sizing: border-box + font-family: 'Open Sans', Arial, Helvetica, sans-serif + + +[data-id] + cursor: pointer + +#scowin + position: fixed + top: 0 + left: 0 + width: 100% + height: 100% + z-index: 100 + display: none + opacity: 0 + transition: 500ms opacity + background-color: #fff + &.show + opacity: 1 + display: block + transition: 500ms opacity + + + #scobar + position: absolute + top: 0 + left: 0 + width: 100% + height: 30px + background: #8b276d + color: #fff + + a.close + position: absolute + top: 5px + right: 5px + svg + width: 20px + height: 20px + color: #fff + + #scoicon + position: absolute + top: 4px + left: 2px + height: 26px + width: 26px + + + h2 + margin-left: 40px + font-size: 18px + margin-top: 3px + font-weight: 400 + + #sco + position: absolute + width: 100% + height: calc(100% - 30px) + top: 30px + left: 0 + background-color: #000 + +/* open-sans-300 - latin */ +@font-face + font-family: 'Open Sans' + font-style: normal + font-weight: 300 + src: url('open-sans-v27-latin-300.woff2') format('woff2') + + +/* open-sans-regular - latin */ +@font-face + font-family: 'Open Sans' + font-style: normal + font-weight: 400 + src: url('open-sans-v27-latin-regular.woff2') format('woff2') + + +/* open-sans-500 - latin */ +@font-face + font-family: 'Open Sans' + font-style: normal + font-weight: 500 + src: url('open-sans-v27-latin-500.woff2') format('woff2') + + +/* open-sans-600 - latin */ +@font-face + font-family: 'Open Sans' + font-style: normal + font-weight: 600 + src: url('open-sans-v27-latin-600.woff2') format('woff2') + + +/* open-sans-700 - latin */ +@font-face + font-family: 'Open Sans' + font-style: normal + font-weight: 700 + src: url('open-sans-v27-latin-700.woff2') format('woff2') + + +/* open-sans-800 - latin */ +@font-face + font-family: 'Open Sans' + font-style: normal + font-weight: 800 + src: url('open-sans-v27-latin-800.woff2') format('woff2') +