]> _ Git - fluidbook-html5.git/commitdiff
#1701
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 25 Oct 2017 14:40:11 +0000 (16:40 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 25 Oct 2017 14:40:11 +0000 (16:40 +0200)
js/libs/fluidbook/fluidbook.audiodescription.js
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.resize.js
js/libs/fluidbook/fluidbook.video.js
js/libs/fluidbook/forms/fluidbook.form.bulle.js
js/libs/gal/gal.filesystem.js
js/libs/gal/gal.js
js/libs/scorm/apiwrapper.js
js/main.js

index d3caaafbb6e08210278628d5b854c6032102c804..95ea0614fe45d28c3bf7d26b102944c75b0136a4 100644 (file)
@@ -74,7 +74,7 @@ FluidbookAudioDescription.prototype = {
             // Play normally
             $this.pauseAllPlayers();
             button.addClass('playing');
-            //fb('currently playing: ' + player.src);
+            //console.log('currently playing: ' + player.src);
             player.play();
 
             e.preventDefault();
index 12ef158457b56fb67815f7e87e9609ece5b821b5..caaf05e4831a97c1be3e866352db45b7c3abf4fd 100644 (file)
@@ -890,17 +890,17 @@ Fluidbook.prototype = {
 
         if (this.datas.phonegap == 'android') {
             if (types_android[type] != undefined) {
-                fb('open pdf file');
+                console.log('open pdf file');
                 this.displayLoader();
                 window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, function (fileSystem) {
-                    fb('got local file system');
-                    fb('try to resolve url');
+                    console.log('got local file system');
+                    console.log('try to resolve url');
                     window.resolveLocalFileSystemURL(url, function (entry) {
-                        fb('resolved from file');
+                        console.log('resolved from file');
                         window.resolveLocalFileSystemURL(cordova.file.externalDataDirectory, function (dirEntry) {
-                            fb('resolved to dir');
+                            console.log('resolved to dir');
                             entry.copyTo(dirEntry, 'document.pdf', function (copyEntry) {
-                                fb('copied file');
+                                console.log('copied file');
                                 window.plugins.webintent.startActivity({
                                     action: window.plugins.webintent.ACTION_VIEW,
                                     type: types_android[type],
index 426675d05b76e0b234ca0ce1a8f48180dcc8cd8c..71593f531d69a8375899a24bebc049e72855e39c 100644 (file)
@@ -284,7 +284,7 @@ FluidbookResize.prototype = {
         // If there is a full screen video playing, we must abort any orientation change
         // because it will destroy the player and interrupt the video playback.
         if (this.fluidbook.video.isVideoFullscreen()) {
-            //fb('### Full screen video detected -- aborting Fluidbook orientation change...');
+            //console.log('### Full screen video detected -- aborting Fluidbook orientation change...');
             this.fluidbook.video.resizeControls();
             return false;
         }
index 1a1e0175c1154c18e027d963fc894490c83931f4..9cd918e3916a3dec0fe60e65c5cb09906a07b4ed 100644 (file)
@@ -8,7 +8,7 @@ function FluidbookVideo(fluidbook) {
     // Remove videos before page transition so we can properly handle page turns
     // and orientation changes (switching from dual page to single page layout and vice-versa)
     $(fluidbook).on('fluidbook.beforePageTransition', function () {
-        //fb('triggered beforePageTransition -- ' + $this.fluidbook.resize.orientation + ' --- REMOVING VIDEOS...');
+        //console.log('triggered beforePageTransition -- ' + $this.fluidbook.resize.orientation + ' --- REMOVING VIDEOS...');
         $this.removeAllVideos();
     });
 
@@ -17,12 +17,12 @@ function FluidbookVideo(fluidbook) {
     });
 
     $(window).on('videoFullscreenEntered', function() {
-        //fb('>>> Video player entered full screen mode...');
+        //console.log('>>> Video player entered full screen mode...');
         $this.fullscreenActive = true;
     });
 
     $(window).on('videoFullscreenExited', function() {
-        //fb('<<< Video player exited full screen mode.');
+        //console.log('<<< Video player exited full screen mode.');
 
         // Try resizing after a short delay. Depending on the system and the speed of the
         setTimeout(function() {
@@ -104,11 +104,11 @@ FluidbookVideo.prototype = {
             html,
             player;
 
-        //fb('Initialising video ID: ' + id);
+        //console.log('Initialising video ID: ' + id);
 
         // Player might be active but not visible so we need to dispose of it before re-initialising the element
         if (videojs.players[id]) {
-            //fb(id + ' player already active. Disposing...');
+            //console.log(id + ' player already active. Disposing...');
             try {
                 videojs(id).dispose();
             }
@@ -165,8 +165,8 @@ FluidbookVideo.prototype = {
 
         // if (setup) {
         //     html += "data-setup='" + setup + "' ";
-        //     fb('SETUP...');
-        //     fb(setup);
+        //     console.log('SETUP...');
+        //     console.log(setup);
         // }
         //html += 'src="' + path + '.' + this.preferedFormat + '"';
         html += '>';
@@ -184,12 +184,12 @@ FluidbookVideo.prototype = {
 
         player = videojs(id, setup);
         player.ready(function () {
-            //fb(id + ' player is ready');
+            //console.log(id + ' player is ready');
 
             $this.resizeControls(); // Make sure player controls are the right size
 
             if (fluidbook.video.players[id]) {
-                //fb('found saved settings for player ID ' + id);
+                //console.log('found saved settings for player ID ' + id);
                 var settings = fluidbook.video.players[id];
                 //console.log(settings);
 
@@ -209,11 +209,11 @@ FluidbookVideo.prototype = {
                 }, 50);
 
                 player.one('play', function () {
-                    //fb('Player has started playing... ID: ' + id);
+                    //console.log('Player has started playing... ID: ' + id);
                     // Handle pause in here if needed.. Better than using the timeout...
 
                     if (settings.paused) {
-                        //fb(id + ' should be paused');
+                        //console.log(id + ' should be paused');
                         setTimeout(function () {
                             player.pause();
                         }, 100);
@@ -242,7 +242,7 @@ FluidbookVideo.prototype = {
         });
 
         player.on('pause', function () {
-            // fb(id + ' player paused');
+            // console.log(id + ' player paused');
 
             // Show play button (ref: http://stackoverflow.com/a/25296575)
             this.bigPlayButton.show();
@@ -255,7 +255,7 @@ FluidbookVideo.prototype = {
         });
 
         // player.on('fullscreenchange', function() {
-        //     fb('Entering or exiting fullscreen... resetting control sizes #' + player.id());
+        //     console.log('Entering or exiting fullscreen... resetting control sizes #' + player.id());
         // Note: this doesn't work because the fluidbookresize gets called multiple times after this fires and that overrides this change
         //     $('#' + player.id()).attr('style', ''); // Reset inline styles
         // });
@@ -393,7 +393,7 @@ FluidbookVideo.prototype = {
             };
         }
 
-        //fb('Disposing video ID ' + id);
+        //console.log('Disposing video ID ' + id);
         player.dispose();
         return id;
     },
@@ -422,7 +422,7 @@ FluidbookVideo.prototype = {
         // var fullscreenPlayerFound = false;
         //
         // this.getActivePlayers().forEach(function(p) {
-        //     fb('Video ID: ' + p.id(), 'Fullscreen: ' + p.isFullscreen());
+        //     console.log('Video ID: ' + p.id(), 'Fullscreen: ' + p.isFullscreen());
         //
         //     if (p.isFullscreen()) {
         //         fullscreenPlayerFound = true;
index b0ed90d4505434424085cf5ac1a4532f2cab36ef..2c57d76cf8463938f258eda8f04ce60cfae8d336 100644 (file)
@@ -55,7 +55,7 @@ FluidbookBulleForm.prototype = {
                        return false;
                });
                $('#formBulle form').submit(function() {
-                       fb('submit');
+                       console.log('submit');
                        $(this).ajaxSubmit({
                                url: 'https://workshop.fluidbook.com/services/bulle',
                                success: function(data) {
index 4dc0e3663a46bcab2078c075d3aa97e1f481504c..e3c53cd1bab1c35da9c3598f86d790158f524f19 100644 (file)
@@ -64,7 +64,7 @@
                                message = 'path exists';
                                break;
                }
-               fb('Filesystem error:', error.code + ' :: ' + message);
+               console.log('Filesystem error:', error.code + ' :: ' + message);
        }
 
 
@@ -78,7 +78,7 @@
         * @return DirectoryEntry to the directory that was just created.
         */
        function createDir_(root, folders, callback) {
-               fb('createDir_ :: ' + root.toURL() + " ;; " + folders.join('/'));
+               console.log('createDir_ :: ' + root.toURL() + " ;; " + folders.join('/'));
                // Throw out './' or '/' and move on to prevent something like '/foo/.//bar'.
                if (folders.length && (folders[0] === '.' || folders[0] === '')) {
                        folders = folders.slice(1);
@@ -99,7 +99,7 @@
                }, 1000);
 
                root.getDirectory(f, {create: true}, function (dirEntry) {
-                       fb('dirCreated !! ' + folders.join('/') + ' :: ' + folders.length);
+                       console.log('dirCreated !! ' + folders.join('/') + ' :: ' + folders.length);
                        clearTimeout(timeout);
                        if (folders.length > 0) {
                                createDir_(dirEntry, folders, callback);
         * @param {string} opt_quota The quota (in bytes) to request (optional).
         */
        GALFS.prototype.init = function (fsprefix, callback, opt_quota) {
-               fb('gal fs init');
+               console.log('gal fs init');
                if (fsprefix == undefined) {
                        fsprefix = '';
                }
                var that = this;
                // Callback when the filesystem has been initialized
                var onInitFs = function (fs) {
-                       fb('fs inited');
+                       console.log('fs inited');
                        that.fs = fs;
                        that.regenerate(callback);
                };
 
-               fb('request file system');
+               console.log('request file system');
                requestFileSystem(LocalFileSystem.PERSISTENT, 0, onInitFs, onError);
                var interval = setInterval(function () {
                        if (that.fs) {
                                clearInterval(interval);
                        } else {
-                               fb('request file system again');
+                               console.log('request file system again');
                                requestFileSystem(LocalFileSystem.PERSISTENT, 0, onInitFs, onError);
                        }
                }, 500);
                                        u = cordova.file.dataDirectory + fileEntry.fullPath;
                                }
 
-                               fb('download to ' + u)
+                               console.log('download to ' + u)
 
                                fileTransfer.download(url, u, function (entry) {
                                        var e = entry.toURL();
        };
 
        GALFS.prototype.regenerate = function (callback) {
-               fb('gal fs regenerate');
+               console.log('gal fs regenerate');
                var that = this;
                // And then recreate it
                var fs = this.fs;
 
                createDir_(fs.root, ROOT_DIR.split('/'), function (res) {
-                       fb('root dir created :: ' + res.toURL());
+                       console.log('root dir created :: ' + res.toURL());
                        // Create a directory for the root of the GAL
                        that.root = res;
                        callback();
index 44634e0e43f28dda4dc63b6de216852c072692bd..a1049e0d649826f941b7d4b7a501487886576506 100644 (file)
@@ -49,9 +49,9 @@
         * manifest.
         */
        GAL.prototype.init = function (callback) {
-               fb('gal init');
+               console.log('gal init');
                var that = this;
-               fb(this._manifest);
+               console.log(this._manifest);
                finishInit_.call(that, this._manifest, callback)
        };
 
        };
 
        GAL.prototype.downloadAndCall = function (bundleName, callback) {
-               fb('download and call ' + bundleName);
+               console.log('download and call ' + bundleName);
                var $this = this;
                var timeout = setTimeout(function () {
                        $this.downloadAndCall(bundleName, callback)
                this.check(bundleName, function (info) {
                        clearTimeout(timeout);
                        if (info.success) {
-                               fb('already downloaded');
+                               console.log('already downloaded');
                                callback();
                        } else {
-                               fb('i download');
+                               console.log('i download');
                                $this.download(bundleName, callback);
                        }
                });
        };
 
        GAL.prototype.initAdapter_ = function (callback) {
-               fb('gal init adapter');
+               console.log('gal init adapter');
                var $this = this;
 
                if (this.adapter != null) {
 
                this.adapter = new GAL.adapterClass();
                this.adapter.init(this._fsprefix, function () {
-                       fb('gal adapter inited');
+                       console.log('gal adapter inited');
                        callback($this.adapter);
                });
        };
         * @param {object} manifest The manifest object.
         */
        function setManifest_(manifest) {
-               fb('gal set manifest');
+               console.log('gal set manifest');
                this.manifest = manifest;
                // Set this.bundles object and this.bundleOrder array
                for (var i = 0, bundle; bundle = manifest.bundles[i]; ++i) {
         * @param {function} callback Called when the initialization is finished.
         */
        function finishInit_(manifest, callback) {
-               fb('gal finish init');
+               console.log('gal finish init');
                var context = this;
                this.initAdapter_.call(context, function () {
-                       fb('gal set manifest');
+                       console.log('gal set manifest');
                        setManifest_.call(context, manifest);
                        // Optionally, start auto-download.
                        if (manifest.autoDownload) {
index 113feee0959a6be1e4e481e8061a4087b3da6194..6afa2c69688e1a557d03c9d627bc7f697cd5fc8c 100644 (file)
@@ -62,7 +62,7 @@ function doLMSInitialize() {
 \r
     var api = getAPIHandle();\r
     if (api == null) {\r
-        fb("Unable to locate the LMS's API Implementation.\nLMSInitialize was not successful.");\r
+        console.log("Unable to locate the LMS's API Implementation.\nLMSInitialize was not successful.");\r
         return "false";\r
     }\r
 \r
@@ -93,7 +93,7 @@ function doLMSFinish() {
 \r
     var api = getAPIHandle();\r
     if (api == null) {\r
-        fb("Unable to locate the LMS's API Implementation.\nLMSFinish was not successful.");\r
+        console.log("Unable to locate the LMS's API Implementation.\nLMSFinish was not successful.");\r
         return "false";\r
     }\r
     else {\r
@@ -125,7 +125,7 @@ function doLMSFinish() {
 function doLMSGetValue(name) {\r
     var api = getAPIHandle();\r
     if (api == null) {\r
-        fb("Unable to locate the LMS's API Implementation.\nLMSGetValue was not successful.");\r
+        console.log("Unable to locate the LMS's API Implementation.\nLMSGetValue was not successful.");\r
         return "";\r
     }\r
     else {\r
@@ -134,7 +134,7 @@ function doLMSGetValue(name) {
         if (errCode != _NoError) {\r
             // an error was encountered so display the error description\r
             var errDescription = api.LMSGetErrorString(errCode);\r
-            fb("LMSGetValue(" + name + ") failed. \n" + errDescription);\r
+            console.log("LMSGetValue(" + name + ") failed. \n" + errDescription);\r
             return "";\r
         }\r
         else {\r
@@ -159,7 +159,7 @@ function doLMSGetValue(name) {
 function doLMSSetValue(name, value) {\r
     var api = getAPIHandle();\r
     if (api == null) {\r
-        fb("Unable to locate the LMS's API Implementation.\nLMSSetValue was not successful.");\r
+        console.log("Unable to locate the LMS's API Implementation.\nLMSSetValue was not successful.");\r
         return;\r
     }\r
     else {\r
@@ -185,7 +185,7 @@ function doLMSSetValue(name, value) {
 function doLMSCommit() {\r
     var api = getAPIHandle();\r
     if (api == null) {\r
-        fb("Unable to locate the LMS's API Implementation.\nLMSCommit was not successful.");\r
+        console.log("Unable to locate the LMS's API Implementation.\nLMSCommit was not successful.");\r
         return "false";\r
     }\r
     else {\r
@@ -211,7 +211,7 @@ function doLMSCommit() {
 function doLMSGetLastError() {\r
     var api = getAPIHandle();\r
     if (api == null) {\r
-        fb("Unable to locate the LMS's API Implementation.\nLMSGetLastError was not successful.");\r
+        console.log("Unable to locate the LMS's API Implementation.\nLMSGetLastError was not successful.");\r
         //since we can't get the error code from the LMS, return a general error\r
         return _GeneralError;\r
     }\r
@@ -232,7 +232,7 @@ function doLMSGetLastError() {
 function doLMSGetErrorString(errorCode) {\r
     var api = getAPIHandle();\r
     if (api == null) {\r
-        fb("Unable to locate the LMS's API Implementation.\nLMSGetErrorString was not successful.");\r
+        console.log("Unable to locate the LMS's API Implementation.\nLMSGetErrorString was not successful.");\r
     }\r
 \r
     return api.LMSGetErrorString(errorCode).toString();\r
@@ -252,7 +252,7 @@ function doLMSGetErrorString(errorCode) {
 function doLMSGetDiagnostic(errorCode) {\r
     var api = getAPIHandle();\r
     if (api == null) {\r
-        fb("Unable to locate the LMS's API Implementation.\nLMSGetDiagnostic was not successful.");\r
+        console.log("Unable to locate the LMS's API Implementation.\nLMSGetDiagnostic was not successful.");\r
     }\r
 \r
     return api.LMSGetDiagnostic(errorCode).toString();\r
@@ -275,7 +275,7 @@ function LMSIsInitialized() {
 \r
     var api = getAPIHandle();\r
     if (api == null) {\r
-        fb("Unable to locate the LMS's API Implementation.\nLMSIsInitialized() failed.");\r
+        console.log("Unable to locate the LMS's API Implementation.\nLMSIsInitialized() failed.");\r
         return false;\r
     }\r
     else {\r
@@ -305,7 +305,7 @@ function LMSIsInitialized() {
 function ErrorHandler() {\r
     var api = getAPIHandle();\r
     if (api == null) {\r
-        fb("Unable to locate the LMS's API Implementation.\nCannot determine LMS error code.");\r
+        console.log("Unable to locate the LMS's API Implementation.\nCannot determine LMS error code.");\r
         return;\r
     }\r
 \r
@@ -322,7 +322,7 @@ function ErrorHandler() {
             // on the previous error.\r
         }\r
 \r
-        fb(errDescription);\r
+        console.log(errDescription);\r
     }\r
 \r
     return errCode;\r
@@ -363,7 +363,7 @@ function findAPI(win) {
         findAPITries++;\r
         // Note: 7 is an arbitrary number, but should be more than sufficient\r
         if (findAPITries > 7) {\r
-            fb("Error finding API -- too deeply nested.");\r
+            console.log("Error finding API -- too deeply nested.");\r
             return null;\r
         }\r
 \r
@@ -392,7 +392,7 @@ function getAPI() {
         theAPI = findAPI(window.opener);\r
     }\r
     if (theAPI == null) {\r
-        fb("Unable to find an API adapter");\r
+        console.log("Unable to find an API adapter");\r
     }\r
     return theAPI\r
 }\r
index ce822dd6753cdfe8d307982b02328d564326541c..4250f11a718e715092a596c9e600b143ef3de564 100644 (file)
@@ -37,27 +37,6 @@ try {
         $_GET = parseGet();
         INITED = false;
 
-        if (Modernizr.applicationcache) {
-            applicationCache.addEventListener('updateready', cacheUpdated, false);
-            applicationCache.addEventListener('downloading', function (e) {
-                fb('cache downloading');
-            }, false);
-            applicationCache.addEventListener('cached', function (e) {
-                fb('cache completed');
-                fluidbook.video.initCache();
-            }, false);
-            applicationCache.addEventListener('noupdate', function (e) {
-                fb('cache nothing to update');
-                fluidbook.video.initCache();
-            }, false);
-            applicationCache.addEventListener('checking', function (e) {
-                fb('cache check');
-            }, false);
-            applicationCache.addEventListener('error', function (e) {
-                fb('cache error');
-            }, false);
-        }
-
         if (DATAS && DATAS.phonegap) {
             loadPhonegap();
         } else {
@@ -83,7 +62,7 @@ try {
             cordovaPath
             , cordovaLoaded);
         if (window.cordova) {
-            fb('cordova already loaded');
+            console.log('cordova already loaded');
             cordovaLoaded();
         }
         if (DEVICE_READY_BEFORE_JQUERY) {
@@ -123,7 +102,7 @@ try {
 
         DEVICE_READY = true;
 
-        fb('device ready !');
+        console.log('device ready !');
         document.addEventListener("offline", onDeviceOffline, false);
         var manifest;
         var fsprefix = window.localStorage.getItem('galfsprefix');
@@ -131,7 +110,11 @@ try {
         PLATFORM = DATAS.phonegap;
 
         if (PLATFORM == 'ios') {
-            window.ExternalFileUtil = cordova.require('com.techblue.cordova.plugin.externalfileutilios.ExternalFileUtilIos');
+            try {
+                window.ExternalFileUtil = cordova.require('com.techblue.cordova.plugin.externalfileutilios.ExternalFileUtilIos');
+            }catch (err){
+                console.error('Error while loading ExternalFileUtil plugin');
+            }
         } else if (PLATFORM == 'android') {
 
         }
@@ -140,7 +123,7 @@ try {
         try {
             collection = json_parse(window.localStorage.getItem('collection'));
         } catch (err) {
-            fb('error parsing collection');
+            console.log('error parsing collection');
         }
 
         if (collection.res != undefined && collection.res) {
@@ -152,13 +135,13 @@ try {
         }
 
         if (!OFFLINEAPP) {
-            fb('set manifest from manifest pub');
+            console.log('set manifest from manifest pub');
             manifest = collection.manifestPub[DATAS.id];
         }
 
 
         if (navigator.onLine && !OFFLINEAPP) {
-            fb('init online');
+            console.log('init online');
 
             var readyToLoad = false;
             var finishedLoading = false;
@@ -171,7 +154,7 @@ try {
             }, 1000);
 
             gal.onLoaded(function (info) {
-                fb('gal loaded');
+                console.log('gal loaded');
                 clearTimeout(timeout);
                 $(window).trigger('GALBundleLoaded', [info]);
             });
@@ -184,20 +167,20 @@ try {
 
             gal.check('extras', function (info) {
                 if (info.success) {
-                    fb('set offline flag');
+                    console.log('set offline flag');
                     FINISHLOADING = true;
                     window.localStorage.setItem('offline.' + DATAS.id, '1');
                 }
             });
 
             $(window).on('GALBundleLoaded', function (e, info) {
-                fb('Loaded :: ' + info.bundleName);
+                console.log('Loaded :: ' + info.bundleName);
 
                 if (info.bundleName == 'content_4') {
                     fluidbook.changeAddress();
                 }
                 if (info.bundleName == 'extras') {
-                    fb('set offline flag');
+                    console.log('set offline flag');
                     FINISHLOADING = true;
                     window.localStorage.setItem('offline.' + DATAS.id, '1');
                 }
@@ -409,7 +392,7 @@ try {
         }
     }
 } catch (err) {
-    fb(err);
+    console.log(err);
 }
 
 function checkScroll() {