]> _ Git - fluidbook-html5.git/commitdiff
(no commit message)
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 13 Nov 2013 13:52:02 +0000 (13:52 +0000)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 13 Nov 2013 13:52:02 +0000 (13:52 +0000)
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.loader.js
js/main.js

index 7c730cbc0186058ee84be930e705d525c1886f41..623b31fc24715f3ec2a15377d49cdea444b08b09 100644 (file)
@@ -764,7 +764,7 @@ Fluidbook.prototype = {
                        bookmark: 'thumbnails',\r
                        video: 'extras'};\r
 \r
-               if (this.gal != null && preload[view] != undefined) {\r
+               if (!OFFLINEAPP && this.gal != null && preload[view] != undefined) {\r
                        var w = this.addWaiter(true);\r
                        this.gal.downloadAndCall(preload[view], function() {\r
                                if ($this.waiterActive(w)) {\r
@@ -1249,7 +1249,7 @@ Fluidbook.prototype = {
                }\r
                var e = pdf.split('/');\r
                pdfName = e.pop();\r
-               if (this.gal) {\r
+               if (this.gal && !OFFLINEAPP) {\r
                        this.displayLoader();\r
                        this.gal.downloadAndCall('extras', function() {\r
                                $this._openFile(pdf, $("#print"), 'pdf', pdfName);\r
index 0d15f9c9da5eec930942dd3241ba6b83194de41d..a758d0fe214e4b3ecca6ebe2d709259f0f62fc50 100644 (file)
@@ -210,7 +210,7 @@ FluidbookLoader.prototype = {
                        callback();
                } else {
                        var $this = this;
-                       if (window.gal != undefined) {
+                       if (window.gal != undefined && !OFLINEAPP) {
                                window.gal.downloadAndCall('content_' + page, function() {
                                        $this.__loadBackground(page, callback);
                                }, 250);
index 29c14a101831c7e49a00bbedd4f6914721ed95d5..3fdefc89c822eda83b301aa08bdf47dea78e6ea7 100644 (file)
@@ -10,6 +10,7 @@ var startAfterLoading = false;
 var gal = null;
 var home = window.location.toString();
 var resolution = 'auto';
+var OFFLINEAPP = false;
 
 try {
        $(function() {
@@ -52,6 +53,8 @@ try {
        function loadPhonegap() {
                var cordova = 'data/cordova.js';
                var cordovaStorage = window.localStorage.getItem('cordova');
+               OFFLINEAPP = window.localStorage.getItem('offlineapp') == '1';
+
                if (cordovaStorage) {
                        cordova = window.localStorage.getItem('cordova');
                }
@@ -62,7 +65,7 @@ try {
                loadJSLibrary(
                                cordova
                                , function() {
-               });
+                               });
        }
 
        function onAppResume() {
@@ -91,11 +94,11 @@ try {
                        resolution = collection.res;
                }
 
-               if (DATAS.phonegap && !manifest) {
+               if (DATAS.phonegap && !manifest && !OFFLINEAPP) {
                        manifest = collection.manifestPub[DATAS.id];
                }
 
-               if (navigator.onLine && manifest) {
+               if (navigator.onLine && manifest && !OFFLINEAPP) {
                        var readyToLoad = false;
                        var finishedLoading = false;
                        gal = new GameAssetLoader(JSON.parse(manifest), fsprefix);
@@ -259,18 +262,25 @@ try {
                                var id = $(this).data('id');
                                window.localStorage.setItem('locale', locale);
 
-                               var topmanifest = window.sessionStorage.getItem('topmanifest');
-                               window.gallocale = new GameAssetLoader(JSON.parse(topmanifest), window.sessionStorage.getItem('galfsprefix'));
-                               window.gallocale.init(function() {
-                                       window.gallocale.downloadAndCall('p_' + id, function() {
-                                               var url = window.home;
-                                               var replace = "/" + fluidbook.datas.id + "/";
-                                               var replaceby = "/" + id + "/";
-                                               url = url.replace(replace, replaceby);
-                                               var c = window.localStorage.getItem('collection');
-                                               window.location = url;
+                               if (OFFLINEAPP) {
+                                       /**
+                                        * 
+                                        * @todo
+                                        */
+                               } else {
+                                       var topmanifest = window.sessionStorage.getItem('topmanifest');
+                                       window.gallocale = new GameAssetLoader(JSON.parse(topmanifest), window.sessionStorage.getItem('galfsprefix'));
+                                       window.gallocale.init(function() {
+                                               window.gallocale.downloadAndCall('p_' + id, function() {
+                                                       var url = window.home;
+                                                       var replace = "/" + fluidbook.datas.id + "/";
+                                                       var replaceby = "/" + id + "/";
+                                                       url = url.replace(replace, replaceby);
+                                                       var c = window.localStorage.getItem('collection');
+                                                       window.location = url;
+                                               });
                                        });
-                               });
+                               }
                        } catch (err) {
 
                        }