var _cb;
var $this = this;
var timeScale = 1;
+ $('body').addClass('perftest');
- if (this.performancesMode !== 'performancesTest') {
- console.log('no perf test');
- _cb = callback;
- timeScale = 0.1;
- } else {
+ if (this.fluidbook.shortLoading) {
+ console.log('No perf test', (Date.now() - $this.fluidbook.splash.initDate) / 1000)
+ callback();
+ timeScale = 0.01;
_cb = function () {
- $this.performancesEndTime = new Date();
- $this.adjustPerformancesSettings(callback);
+ console.log('After first fake turn', (Date.now() - $this.fluidbook.splash.initDate) / 1000)
+ };
+ } else {
+ if (this.performancesMode !== 'performancesTest') {
+ console.log('no perf test');
+ _cb = function () {
+ callback();
+ }
+ timeScale = 0.01;
+ } else {
+ _cb = function () {
+ $this.performancesEndTime = new Date();
+ $this.adjustPerformancesSettings(callback);
+ }
}
}
this.prepareTurn({flip: [1, 2]}, function () {
$this.playTurn(1, function () {
_cb();
+ $('body').removeClass('perftest');
}, timeScale);
});
},
gsap.fromTo(this, {progressAnimation: 0,}, {
duration: this.animationTime * timeScale,
- progressAnimation: 1, ease: 'power0.in', delay: delay, onStart: function () {
+ progressAnimation: 1,
+ ease: 'power0.in',
+ delay: delay,
+ onStart: function () {
if ($this.performancesTestRunning) {
$this.performancesStartTime = new Date();
}
- }, onComplete: function () {
+ },
+ onComplete: function () {
this.tlname = '';
callback();
setTimeout(function () {
$this.turnRunning = false;
- }, 5);
+ }, 4);
//$this._callbackAfterNextRender = callback;
}
});
this.secureOKDone = false;
this.initEventsWhenSecureOK = false;
this.canNavigate = false;
- this.shortLoading = false;
+ this.shortLoading = settings.shortLoading;
this.nointerface = false;
this.hideBook = false;
var pdfName;
if (this.settings.pages != this.contentlock.getMaxPage()) {
- pdf = this.service.getBaseURL(true) + 'e/'+this.settings.id+'-' + this.settings.cid + '/1-' + this.contentlock.getMaxPage();
+ pdf = this.service.getBaseURL(true) + 'e/' + this.settings.id + '-' + this.settings.cid + '/1-' + this.contentlock.getMaxPage();
} else if (this.settings.pdfName.substr(0, 4) === 'http') {
pdf = this.settings.pdfName;
} else {
function FluidbookSplash(fluidbook) {
this.fluidbook = fluidbook;
- this.hideSplashTimeout = 0.5;
+ this.hideSplashTimeout = fluidbook.shortLoading ? 0 : 0.5;
this.isHidding = false;
+ this.initDate = Date.now();
this.init();
}
FluidbookSplash.prototype = {
init: function () {
+ var $this = this;
+ this.initTime = Date.now();
+
this.waitForTimer = true;
this.waitForReady = true;
this.hideIfPossible();
}
- var $this = this;
- this.initTime = Date.now();
- setTimeout(function () {
- $this.waitForTimer = false;
- $this.hideIfPossible();
- }, min * 1000);
+
+ if (min > 0) {
+ setTimeout(function () {
+ $this.waitForTimer = false;
+ $this.hideIfPossible();
+ }, min * 1000);
+ }
},
hide: function () {
if ($("#splash").length == 0) {
return;
}
+ console.log('Hide', (Date.now() - this.initDate) / 1000);
this.waitForReady = false;
try {
navigator.splashscreen.hide();
resize();
this.fluidbook.networkControl.pause(4000);
setTimeout(function () {
- this.fluidbook.pagetransitions.flip3d.performancesTest(function () {
+ $this.fluidbook.pagetransitions.flip3d.performancesTest(function () {
$this.fluidbook.networkControl.resume();
var timeout = $this.hideSplashTimeout;
+ console.log('After performance test', timeout, (Date.now() - $this.initDate) / 1000)
setTimeout(function () {
$this.hideIfPossible();
}, timeout * 1000);
})
- }, 500);
+ }, $this.fluidbook.shortLoading ? 4 : 500);
} else {
this.hideIfPossible();
}
hideIfPossible: function () {
if (!this.waitForReady && !this.waitForTimer) {
+ console.log('Hide if possible', (Date.now() - this.initDate) / 1000);
this._hide();
}
},
$("#main,#viewOverlay,#view").css('visibility', 'visible');
this.fluidbook.resize.resize(false);
this.fluidbook.hideLoader(0, true);
- this.fluidbook.networkControl.pause(1500);
+ if (!this.fluidbook.shortLoading) {
+ this.fluidbook.networkControl.pause(1500);
+ }
- if (this.fluidbook.shortLoading) {
- $('#splash').remove();
- } else if (this.fluidbook.support.transitions2d && !this.fluidbook.support.iOS) {
+ if (this.fluidbook.support.transitions2d && !this.fluidbook.support.iOS) {
$("#splash").css('opacity', 0).one('transitionend', function () {
$(this).remove();
});
setTimeout(function () {
$("#splash").remove();
+ $('body').removeClass('perftest');
}, 1500);
this.fluidbook.allowChangePage();
$(this.fluidbook).trigger('fluidbook.splash.hide');
this.isHidding = false;
+ console.log('Hide splash', (Date.now() - this.initDate) / 1000);
},
}
\ No newline at end of file