-function FluidbookCache(options) {
+function FluidbookCache(fluidbook) {
+ this.fluidbook=fluidbook;
this._cache = {};
- this.options = options;
+ this.options = fluidbook.settings;
this._prefix = 'fluidbook.' + this.options.id + '.';
this._support = false;
this._date = this.options.cacheDate;
FluidbookCache.prototype = {
init: function () {
+ var $this = this;
+ this.fluidbook.keyboard.keyShortcut('⌘+alt+c, ctrl+alt+c', function () {
+ $this.clear();
+ });
if (this._support) {
this.checkValidity();
}
this.displayOnePage = this.alwaysDisplayOnePage = this.settings.mobileNavigationType === 'portrait' || (this.pad && this.pad.enabled) || this.mobilefirst.enabled;
this.zoom = new FluidbookZoom(this);
this.zoom.resetZoom();
- this.cache = new FluidbookCache(this.settings);
+ this.cache = new FluidbookCache(this);
this.service = new FluidbookService(this, this.settings.id);
this.loader = new FluidbookLoader(this);
if (!this.mobilefirst.enabled) {
this.refw = 0;
this.refh = 0;
+ this.refh = 0;
this.searchString = '';
this.vectorTexts = !this.support.imagesVersion;
this.indexHTML = '';
} else {
$("body").addClass('desktop');
}
- if(this.settings.correctCenter){
+ if (this.settings.correctCenter) {
$('body').addClass('correct-center');
}
if (this.pad.enabled) {
}
$this.zoom.resetZoom();
$this.splash.hide();
+ $this.menu.closeViewCallbackEvent(true);
}, true);
} else if (args[1] === 'landing') {
$this.splash.hide();
FluidbookMenu.prototype = {
init: function () {
+ this.closeEventSent = false;
this.index = new FluidbookIndex(this.fluidbook);
var $this = this;
}
},
+ closeViewCallbackEvent: function (all) {
+ var $this = this;
+ if (this.closeEventSent) {
+ return;
+ }
+ this.closeEventSent = true;
+ $(this.fluidbook).trigger('fluidbook.view.close');
+ if (all) {
+ $(this.fluidbook).trigger('fluidbook.view.close.all');
+ }
+ setTimeout(function () {
+ $this.closeEventSent = false;
+ }, 1000);
+ },
+
closeView: function (callback, all, animate) {
+ var $this = this;
+ all = all || $("#view .mview").length <= 1;
+
+ var cb;
if (callback === undefined) {
- callback = function () {
+ cb = function () {
+ $this.closeViewCallbackEvent(all);
+ };
+ } else {
+ cb = function () {
+ callback();
+ $this.closeViewCallbackEvent(all);
};
}
- if (all || $("#view .mview").length <= 1) {
+ if (all) {
var currentHash = window.location.hash;
window.location.hash = '#/page/' + this.fluidbook.currentPage;
if (window.location.hash == currentHash) {
- this._closeView(callback, true, animate);
+ this._closeView(cb, true, animate);
+ } else {
+ setTimeout(cb, 1000);
}
} else {
- this._closeView(callback, all, animate);
+ this._closeView(cb, all, animate);
}
},
quickCloseView: function () {
$("#view .mview").remove();
+ $this.closeViewCallbackEvent(true);
},
resize: function (ww, hh) {