From: Vincent Vanwaelscappel Date: Tue, 17 Sep 2013 13:00:55 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=759ca983db1c63e882409c82b57fc0a1a9d6eab3;p=fluidbook-html5.git --- diff --git a/js/libs/fluidbook/newjavascript.js b/js/libs/fluidbook/newjavascript.js deleted file mode 100644 index 9facedfa..00000000 --- a/js/libs/fluidbook/newjavascript.js +++ /dev/null @@ -1,7 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - - diff --git a/js/libs/gal/gal.filesystem.js b/js/libs/gal/gal.filesystem.js index 2685572c..fb3bab16 100644 --- a/js/libs/gal/gal.filesystem.js +++ b/js/libs/gal/gal.filesystem.js @@ -153,6 +153,7 @@ // requestFileSystem and storageInfo shims var requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem; + var storageInfo = window.storageInfo || window.webkitStorageInfo; var quota = opt_quota || DEFAULT_QUOTA; @@ -179,16 +180,13 @@ // Save grantedBytes in the adapter that.grantedBytes = grantedBytes; // Once quota is grantedBytes, initialize a filesystem + requestFileSystem(persistent, 0, onInitFs, onError); }; - if (storageInfo != undefined) { - // Get quota - storageInfo.requestQuota(window.PERSISTENT, quota, - quotaCallback, onError); - } else { - quotaCallback(0); - } + + quotaCallback(0); + }; diff --git a/js/main.js b/js/main.js index f5d96e84..617ad6bb 100644 --- a/js/main.js +++ b/js/main.js @@ -37,7 +37,6 @@ $(function() { } if (DATAS.phonegap) { - console.log('need to load cordova before launching app'); loadPhonegap(); } else { init(); @@ -45,19 +44,19 @@ $(function() { }); function loadPhonegap() { + var cordova = 'data/cordova.js'; - if (Modernizr.localStorage) { - var cordovaStorage = window.localStorage.getItem('cordova'); - if (cordovaStorage) { - cordova = window.localStorage.getItem('cordova'); - } + var cordovaStorage = window.localStorage.getItem('cordova'); + if (cordovaStorage) { + cordova = window.localStorage.getItem('cordova'); } + document.addEventListener('deviceready', onDeviceReady, false); + document.addEventListener("resume", onAppResume, false); + loadJSLibrary( cordova , function() { - document.addEventListener('deviceready', onDeviceReady, false); - document.addEventListener("resume", onAppResume, false); }); } @@ -71,8 +70,9 @@ function onAppResume() { 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(JSON.parse(manifest), fsprefix); gal.init(function() { startAfterLoading = true; init(); @@ -87,7 +87,6 @@ function onDeviceReady() { fluidbook.changeAddress(); } if (info.bundleName === 'extras') { - console.log('put offline flag'); window.localStorage.setItem('offline.' + DATAS.id, '1'); } fluidbook.loader.retryErrorImages(); @@ -98,14 +97,9 @@ function onDeviceReady() { } function loadJSLibrary(url, callback) { - if (!fluidbook.support.hasNetwork()) { - return; - } - if (jsLibraries.indexOf(url) > -1) { if (callback != undefined) { callback(); - } return; } @@ -140,6 +134,7 @@ function init() { if (INITED == true) { return; } + INITED = true; fluidbook = new Fluidbook(DATAS);