From: Vincent Vanwaelscappel Date: Thu, 20 Sep 2018 19:09:39 +0000 (+0200) Subject: wip #2217 @2 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=2bac31834f04195bb354e9274d4ddfbb7a9ce33b;p=fluidbook-html5.git wip #2217 @2 --- diff --git a/js/libs/scorm/scorm.js b/js/libs/scorm/scorm.js index ab6601ae..9d48fbeb 100644 --- a/js/libs/scorm/scorm.js +++ b/js/libs/scorm/scorm.js @@ -68,25 +68,28 @@ function initScormEvents() { finishScorm(); }); - var currentLocation = getScormValue('location'); - try { - if (currentLocation.indexOf('page_') === 0) { - var e = currentPage.split('_'); - if (e.length == 2 && e[0] == 'page') { - fluidbook.setCurrentPage(e[1]); - } - } else if (currentLocation.indexOf('{') === 0) { - var location = JSON.parse(currentLocation); - if (location.maxPage) { - fluidbook.setMaxPage(location.maxPage, true); - } - if (location.page) { - fluidbook.setCurrentPage(location.page); + $(fluidbook).on('fluidbook.splash.hide',function(){ + console.log('init scorm events'); + var currentLocation = getScormValue('location'); + try { + if (currentLocation.indexOf('page_') === 0) { + var e = currentPage.split('_'); + if (e.length == 2 && e[0] == 'page') { + fluidbook.setCurrentPage(e[1]); + } + } else if (currentLocation.indexOf('{') === 0) { + var location = JSON.parse(currentLocation); + if (location.maxPage) { + fluidbook.setMaxPage(location.maxPage, true); + } + if (location.page) { + fluidbook.setCurrentPage(location.page); + } } + } catch (err) { + console.log(err); } - } catch (err) { - console.log(err); - } + }); $(fluidbook).on('fluidbook.page.navigation', function (e, page) { scormSaveCurrentPosition(page);