});\r
},\r
hideSplash: function() {\r
- console.log('hide splash');\r
if ($("#splash").length == 0) {\r
return;\r
}\r
+ this.loader.canPreload();\r
var $this = this;\r
setTimeout(function() {\r
$this._hideSplash();\r
try {\r
+ console.log('hide splash');\r
navigator.splashscreen.hide();\r
} catch (err) {\r
-\r
+ console.warn('error trying hide splash');\r
}\r
}, 3000);\r
},\r
this.backgrounds = [];
this.links = [];
this.toPreload = [];
- this.numPreload = 6;
+ this.numPreload = 0;
this.imagesErrors = [];
- if (this.fluidbook.imagesVersion) {
- this.numPreload += 6;
- }
+
}
FluidbookLoader.prototype = {
+ canPreload: function() {
+ this.numPreload = 6;
+ if (this.fluidbook.imagesVersion) {
+ this.numPreload += 6;
+ }
+ if (this.fluidbook.datas.phonegap) {
+ this.numPreload = 6;
+ }
+ },
preloadPagesBeforeTransition: function(pages, callback) {
var $this = this;
var $pages = pages.slice(0);
});
},
preloadAround: function(page) {
+ if (this.numPreload == 0) {
+ this.cleanPreloaded();
+ return;
+ }
var min = Math.max(1, page - 1);
var max = Math.min(min + this.numPreload, this.fluidbook.datas.pages);
min = max - (this.numPreload);
if (window.gal != undefined) {
window.gal.downloadAndCall('content_' + page, function() {
$this.__loadBackground(page, callback);
- });
+ }, 250);
} else {
this.__loadBackground(page, callback);
}
}
},
__loadBackground: function(page, callback) {
- this.backgrounds[page] = this.loadImage(this.getBackgroundURL(page), null, null, null, callback);
+ var url = this.getBackgroundURL(page);
+ this.backgrounds[page] = this.loadImage(url, null, null, null, callback);
},
loadTexts: function(pageNr, callback) {
if (this.fluidbook.imagesVersion) {
var img = new Image();
var $this = this;
if (callback && typeof callback == 'function') {
- $(img).one('load', callback);
+ $(img).one('load', function() {
+ setTimeout(function() {
+ callback();
+ }, 100);
+ });
}
$(img).on('error', function() {
$this.imagesErrors.push(this);
+ setTimeout(function() {
+ callback();
+ }, 100);
});
img.src = src;
if (width != undefined && width != null) {
img.type = type;
}
if (callback && typeof callback == 'function' && (img.complete || img.readyState == 'complete' || img.readyState == 4)) {
- callback();
+ setTimeout(function() {
+ callback();
+ }, 100);
}
return $(img);
this.transitions3d = Modernizr.csstransforms3d && Modernizr.csstransformspreserve3d && this.transitions2d;
this.transitionendevent = null;
- if (Modernizr.mq('(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)')) {
- this.resolution = this.fluidbook.datas.retinaResolution;
- } else {
- this.resolution = 150;
- }
+
+ this.resolution = Modernizr.mq('(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)') ? this.fluidbook.datas.retinaResolution : 150;
this.isMobile = isMobile();
this.SVG = Modernizr.svg && this.fluidbook.datas.mobileIconVector;
* Downloads assets contained in the named bundle.
* @param {string} bundleName name of single bundle to download.
*/
- GAL.prototype.download = function(bundleName, callback) {
+ GAL.prototype.download = function(bundleName, callback, timeout) {
+ if (timeout == undefined) {
+ timeout = 0;
+ }
+
var bundle = this.bundles[bundleName];
if (callback == undefined) {
callback = function() {
bundleName: bundleName,
success: true
});
- callback();
+ setTimeout(function() {
+ callback();
+ }, timeout);
return;
}
addCallback_(this.error, opt_bundleName, callback);
};
- GAL.prototype.downloadAndCall = function(bundleName, callback) {
+ GAL.prototype.downloadAndCall = function(bundleName, callback, timeoutIfNotLoaded) {
var $this = this;
this.check(bundleName, function(info) {
if (info.success) {
callback();
} else {
- $this.download(bundleName, callback);
+ $this.download(bundleName, callback, timeoutIfNotLoaded);
}
});
};
display:none;\r
}\r
\r
+\r
/* Global settings */\r
a,input[type=text],input[type=password],input[type=file],textarea{outline:none;-webkit-appearance:none;}\r
a{text-decoration:none;color:inherit;}\r
position:absolute;\r
top:0px;\r
left:0px;\r
+ -webkit-transform: translateZ(0);\r
+ -moz-transform: translateZ(0);\r
+ -ms-transform: translateZ(0);\r
+ -o-transform: translateZ(0);\r
+ transform: translateZ(0);\r
}\r
\r
#shadow>div{\r