]> _ Git - fluidbook-html5.git/commitdiff
wip #2217 @2
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 20 Sep 2018 19:09:39 +0000 (21:09 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 20 Sep 2018 19:09:39 +0000 (21:09 +0200)
js/libs/scorm/scorm.js

index ab6601ae448491107368f1cda43c8e9d3e2f4ca7..9d48fbeb487b0821bc43b1f43e7effa3f55bc5ab 100644 (file)
@@ -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);