From b5ebf60248b98d1e61d3a1d63c3cd7a2ddbcf990 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 4 Oct 2013 17:49:05 +0000 Subject: [PATCH] --- _index.html | 2 +- js/libs/fluidbook/fluidbook.js | 13 +++++++------ js/libs/fluidbook/fluidbook.l10n.js | 21 +++++++++++++++++---- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/_index.html b/_index.html index 64471236..2bd28589 100644 --- a/_index.html +++ b/_index.html @@ -12,7 +12,7 @@ - +
diff --git a/js/libs/fluidbook/fluidbook.js b/js/libs/fluidbook/fluidbook.js index db0ff92d..42ef1a0a 100644 --- a/js/libs/fluidbook/fluidbook.js +++ b/js/libs/fluidbook/fluidbook.js @@ -98,16 +98,17 @@ Fluidbook.prototype = { if ($("#splash").length == 0) { return; } + try { + console.log('hide splash'); + navigator.splashscreen.hide(); + } catch (err) { + console.warn('error trying hide splash'); + } + this.loader.canPreload(); var $this = this; setTimeout(function() { $this._hideSplash(); - try { - console.log('hide splash'); - navigator.splashscreen.hide(); - } catch (err) { - console.warn('error trying hide splash'); - } }, 3000); }, _hideSplash: function() { diff --git a/js/libs/fluidbook/fluidbook.l10n.js b/js/libs/fluidbook/fluidbook.l10n.js index d86b7d43..ed83475a 100644 --- a/js/libs/fluidbook/fluidbook.l10n.js +++ b/js/libs/fluidbook/fluidbook.l10n.js @@ -36,11 +36,16 @@ FluidbookL10N.prototype = { var forceLocales = window.sessionStorage.getItem('locales'); console.log('force Locales ' + forceLocales); var force = false; - if (forceLocales === null) { + if (forceLocales === undefined || forceLocales === null || forceLocales === 'undefined') { force = false; } else { force = true; - forceLocales = JSON.parse(forceLocales); + try { + forceLocales = JSON.parse(forceLocales); + } catch (err) { + force = false; + console.warn("error parsing forceLocales :: " + forceLocales); + } } if (this.fluidbook.datas.multilang == '') { @@ -66,14 +71,22 @@ FluidbookL10N.prototype = { var url = l[2]; if (force) { + var publications = forceLocales[l[0]]; + var pubid = publications[0]; + try { - url = '../' + forceLocales[l[0]] + '/index.html'; + url = window.location.toString(); + url.replace(/\/this.fluidbook.datas.id\//, "/" + pubid + "/"); + + if (this.fluidbook.datas.id == pubid) { + url = ''; + } } catch (err) { url = ''; } } - var o = {lang: l[0], flag: l[1], url: l[2], langName: l[3], countryName: l[4]}; + var o = {lang: l[0], flag: l[1], url: url, langName: l[3], countryName: l[4]}; $this.multilang[$this.multilang.length] = o; }); -- 2.39.5