]> _ Git - fluidbook-html5.git/commitdiff
(no commit message)
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 9 Sep 2013 15:16:08 +0000 (15:16 +0000)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 9 Sep 2013 15:16:08 +0000 (15:16 +0000)
js/main.js

index d37039fec9a8879968c5c00014c15f62cab09ef1..4e8e25812ab6b62471c84436a950bdcb4c1d6447 100644 (file)
@@ -37,13 +37,32 @@ $(function() {
        }
 
        if (DATAS.phonegap) {
-               document.addEventListener('deviceready', onDeviceReady, false);
-               document.addEventListener("resume", onAppResume, false);
+               loadPhonegap();
+
+
+
        } else {
                init();
        }
 });
 
+function loadPhonegap() {
+       var cordova = 'data/cordova.js';
+       if (Modernizr.localStorage) {
+               var cordovaStorage = window.localStorage.getItem('cordova');
+               if (cordovaStorage) {
+                       cordova = window.localStorage.getItem('cordova');
+               }
+       }
+
+       loadJSLibrary(
+                       cordova
+                       , function() {
+               document.addEventListener('deviceready', onDeviceReady, false);
+               document.addEventListener("resume", onAppResume, false);
+       });
+}
+
 function onAppResume() {
        if (!INITED) {
                return;
@@ -55,7 +74,7 @@ function onDeviceReady() {
        var manifest = window.sessionStorage.getItem('manifest.' + DATAS.id);
        var fsprefix = window.sessionStorage.getItem('galfsprefix');
        if (navigator.onLine && manifest) {
-               gal = new GameAssetLoader(fsprefix,JSON.parse(manifest));
+               gal = new GameAssetLoader(fsprefix, JSON.parse(manifest));
                gal.init(function() {
                        startAfterLoading = true;
                        init();