From 46a8b151eb35bfe22a1ce7289a0f90458d0252a0 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 23 Jun 2014 16:07:45 +0000 Subject: [PATCH] --- js/libs/cube/util.js | 5 ++--- js/main.js | 21 ++++++++++++++++----- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/js/libs/cube/util.js b/js/libs/cube/util.js index da9692c4..9d813835 100644 --- a/js/libs/cube/util.js +++ b/js/libs/cube/util.js @@ -14,14 +14,13 @@ function arrayRemove(array, element) { } function json_parse(str, info) { - try { return JSON.parse(str); } catch (err) { if (info != undefined) { - + } - fb(err); + console.error('Error parsing json :: ' + err + ' :: ' + str); } } diff --git a/js/main.js b/js/main.js index e1370501..d5881760 100644 --- a/js/main.js +++ b/js/main.js @@ -109,7 +109,7 @@ try { return; } - console.log('device ready'); + console.log('device ready !'); DEVICE_READY = true; @@ -146,9 +146,16 @@ try { } if (DATAS.phonegap && !manifest && !OFFLINEAPP) { + console.log('set manifest from manifest pub'); + manifest = collection.manifestPub[DATAS.id]; + + } else { + console.log('manifest set in local storage'); } + console.log(manifest.bundles[0].name + ' :: ' + manifest.bundles[0].contents[0]); + if (navigator.onLine && manifest && !OFFLINEAPP) { console.log('init online'); @@ -156,10 +163,7 @@ try { var finishedLoading = false; gal = new GameAssetLoader(json_parse(manifest, 'manifest'), fsprefix); - gal.init(function() { - startAfterLoading = true; - init(); - }); + gal.init(galLoaded); gal.onLoaded(function(info) { $(window).trigger('GALBundleLoaded', [info]); @@ -180,6 +184,8 @@ try { }); $(window).on('GALBundleLoaded', function(e, info) { + console.log('Loaded :: ' + info.bundleName); + if (info.bundleName == 'content_4') { fluidbook.changeAddress(); } @@ -235,6 +241,11 @@ try { document.getElementsByTagName("head")[0].appendChild(script); } + function galLoaded() { + startAfterLoading = true; + init(); + } + function init() { if (INITED == true) { return; -- 2.39.5