From bc07c5e3eadf5d73cbafc72210dfde9aad726dbd Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 9 Jun 2020 09:00:31 +0200 Subject: [PATCH] wait #3677 @1 --- js/libs/fluidbook/fluidbook.scorm.js | 12 ++++--- js/libs/fluidbook/fluidbook.splash.js | 3 -- js/libs/scorm/scorm.js | 52 +++++++++++++++------------ 3 files changed, 37 insertions(+), 30 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.scorm.js b/js/libs/fluidbook/fluidbook.scorm.js index 5e3329bc..d3d2628e 100644 --- a/js/libs/fluidbook/fluidbook.scorm.js +++ b/js/libs/fluidbook/fluidbook.scorm.js @@ -34,11 +34,13 @@ FluidbookScorm.prototype = { // Mark complete when the user reaches the last page - $(this.fluidbook).on('fluidbook.page.change.end', function () { - if ($this.fluidbook.settings.scorm_complete_on_last_page && $this.fluidbook.currentPage === $this.fluidbook.settings.pages) { - scormMarkAsComplete(); - } - }); + if (this.fluidbook.settings.scorm_complete_on_last_page) { + $(this.fluidbook).on('fluidbook.page.change.end', function () { + if ($this.fluidbook.currentPage === $this.fluidbook.settings.pages) { + scormMarkAsComplete(); + } + }); + } }, hideScormLinks: function () { diff --git a/js/libs/fluidbook/fluidbook.splash.js b/js/libs/fluidbook/fluidbook.splash.js index 7d97f4bd..f970349e 100644 --- a/js/libs/fluidbook/fluidbook.splash.js +++ b/js/libs/fluidbook/fluidbook.splash.js @@ -42,9 +42,6 @@ FluidbookSplash.prototype = { this.fluidbook.pagetransitions.flip3d.performancesTest(function () { $this.fluidbook.networkControl.resume(); var timeout = $this.hideSplashTimeout; - if (window.SCORM_OK !== undefined && window.SCORM_OK === true) { - timeout += 5; - } setTimeout(function () { $this.hideIfPossible(); }, timeout * 1000); diff --git a/js/libs/scorm/scorm.js b/js/libs/scorm/scorm.js index f559492c..a4adc34b 100644 --- a/js/libs/scorm/scorm.js +++ b/js/libs/scorm/scorm.js @@ -43,6 +43,14 @@ function initScorm() { } + try { + if (FORCE_SCORM) { + SCORM_OK = true; + } + }catch (e) { + + } + if (SCORM_OK) { $(document).on('fluidbook.ready', function () { scormExit(); @@ -50,7 +58,7 @@ function initScorm() { initScormEvents(); initScormInteractions(); }); - }else{ + } else { console.log('SCORM nok'); } return SCORM_OK; @@ -90,30 +98,30 @@ function initScormEvents() { } SCORM_LOCATION_INITED = true; var currentLocation = getScormValue('location'); - try { - var changePage = false; - if (currentLocation.indexOf('page_') === 0) { - var e = currentPage.split('_'); - if (e.length === 2 && e[0] === 'page') { - fluidbook.setCurrentPage(e[1]); - changePage = true; - } - } else if (currentLocation.indexOf('{') === 0) { - var location = JSON.parse(currentLocation); - if (location.maxPage) { - fluidbook.contentlock.setMaxPage(location.maxPage, true); + console.log(currentLocation, 'null'); + if (currentLocation !== 'null') { + try { + var changePage = false; + if (currentLocation.indexOf('page_') === 0) { + var e = currentPage.split('_'); + if (e.length === 2 && e[0] === 'page') { + fluidbook.setCurrentPage(e[1]); + changePage = true; + } + } else if (currentLocation.indexOf('{') === 0) { + var location = JSON.parse(currentLocation); + if (location.maxPage) { + fluidbook.contentlock.setMaxPage(location.maxPage, true); + } + if (location.page) { + fluidbook.setCurrentPage(location.page); + changePage = true; + } } - if (location.page) { - fluidbook.setCurrentPage(location.page); - changePage = true; - } - } - if (changePage) { - fluidbook.splash.hideSplashTimeout = 6; + } catch (err) { + console.log(err); } - } catch (err) { - console.log(err); } -- 2.39.5