-function Fluidbook(datas) {
- this.init(datas);
+function Fluidbook(settings) {
+ this.init(settings);
}
// Constantes
Fluidbook.BOTTOM = 9;
Fluidbook.prototype = {
- init: function (datas) {
-
+ init: function (settings) {
this.flags = {};
this.canNavigate = false;
- this.initSettings(datas);
- this.singleMode = (this.datas.mobileNavigationType === 'portrait' || this.datas.mobileNavigationType === 'mobilefirst');
+ this.initSettings(settings);
+ this.secure = new FluidbookSecure(this);
- this.junk = datas.cacheDate;
+ var $this = this;
+ this.secure.checkSecure(function () {
+ $this.secureOK();
+ });
+ },
+
+ secureOK: function () {
+ this.singleMode = (this.settings.mobileNavigationType === 'portrait' || this.settings.mobileNavigationType === 'mobilefirst');
+
+ this.junk = this.settings.cacheDate;
this.networkControl = new FluidbookNetworkControl(this);
this.input = new FluidbookInput(this);
- if (this.datas.landingPage != undefined && this.datas.landingPage != '') {
+ if (this.settings.landingPage != undefined && this.settings.landingPage != '') {
this.landingpage = new FluidbookLandingPage(this);
}
- this.secure = new FluidbookSecure(this);
+
this.contentlock = new FluidbookContentLock(this);
this.menu = new FluidbookMenu(this);
this.support = new FluidbookSupport(this);
this.mobilefirst = new FluidbookMobileFirst(this);
this.zoom = new FluidbookZoom(this);
this.zoom.resetZoom();
- this.cache = new FluidbookCache(datas);
- this.service = new FluidbookService(this, datas.id);
+ this.cache = new FluidbookCache(this.settings);
+ this.service = new FluidbookService(this, this.settings.id);
this.loader = new FluidbookLoader(this);
this.pad = new FluidbookPad(this);
this.scorm = new FluidbookScorm(this);
this.slideshow = new FluidbookSlideshow(this);
this.printing = new FluidbookPrint(this);
- if (this.datas.basket) {
+ if (this.settings.basket) {
this.cart = new FluidbookCart(this);
}
- if (this.datas.form == 'bulle') {
+ if (this.settings.form == 'bulle') {
this.form = new FluidbookBulleForm(this);
- } else if (this.datas.form == 'bourbon') {
+ } else if (this.settings.form == 'bourbon') {
this.form = new FluidbookBourbonForm(this);
- } else if (this.datas.form == 'avery') {
+ } else if (this.settings.form == 'avery') {
this.form = new FluidbookAveryForm(this);
} else {
this.form == false;
if (this.pad.enabled) {
$("body").addClass('pad');
}
- $('html').addClass(this.datas.mobileLVersion);
+ $('html').addClass(this.settings.mobileLVersion);
this.currentPage = -1;
this.currentPageURL = -1;
this.initLoading();
},
- initSettings: function (datas) {
- this.datas = datas;
+ initSettings: function (settings) {
+ this.settings = settings;
if ($_GET['transition'] != null) {
var map = {1: 'none', 2: 'slide', 3: 'flip', 4: 'flip3d'};
- this.datas.mobileTransitions = map[$_GET['transition']];
+ this.settings.mobileTransitions = map[$_GET['transition']];
}
},
initTheme: function () {
var $this = this;
- if (this.datas.arrowsTheme) {
+ if (this.settings.arrowsTheme) {
$('html').addClass('sharp');
}
- if (this.datas.invertMenuPosition) {
+ if (this.settings.invertMenuPosition) {
$('html').addClass('menu-inverted');
} else {
$('html').addClass('menu-default');
}
$(this).trigger('fluidbook.splash.beforehide');
var $this = this;
- if (this.support.transitions3dacc && this.datas.mobileTransitions === 'flip3d' && !this.mobilefirst.enabled) {
+ if (this.support.transitions3dacc && this.settings.mobileTransitions === 'flip3d' && !this.mobilefirst.enabled) {
$("#main,#viewOverlay,#view").css('visibility', 'visible');
resize();
this.networkControl.pause(4000);
},
loadPlugins: function () {
- $.each(this.datas.plugins, function (k, plugin) {
+ $.each(this.settings.plugins, function (k, plugin) {
try {
var functionName = plugin.replace(/\./g, '_');
eval(functionName + '();');
} catch (err) {
}
});
- $.each(this.datas.htmlmultimedia, function (k, code) {
+ $.each(this.settings.htmlmultimedia, function (k, code) {
try {
eval(code);
} catch (err) {
if (args[1] === 'closeview') {
return this.setCurrentPage(this.currentPage);
} else if (args[1] === 'page') {
- if (fluidbook.datas.pageLabels[args[2]] !== undefined) {
- page = fluidbook.datas.pageLabels[args[2]];
+ if (fluidbook.settings.pageLabels[args[2]] !== undefined) {
+ page = fluidbook.settings.pageLabels[args[2]];
} else {
page = parseInt(args[2]);
}
if (this.currentPage === -1) {
if (view === 'multimedia' || view === 'video' || view === 'iframe') {
var searchURL = args.join('/');
- $.each(this.datas.links, function (pageNr, links) {
+ $.each(this.settings.links, function (pageNr, links) {
var hl = $('<root>' + links + '</root>');
if ($(hl).find('[href="' + searchURL + '"]').length > 0) {
$this.currentPage = pageNr;
getButtonsVisibility: function (page) {
var max = this.contentlock.getMaxPage();
if (this.contentlock.getMaxPage() % 2 === 1 &&
- this.datas.mobileNavigationType !== 'portrait' &&
- this.datas.mobileNavigationType !== 'mobilefirst' &&
+ this.settings.mobileNavigationType !== 'portrait' &&
+ this.settings.mobileNavigationType !== 'mobilefirst' &&
this.resize.orientation !== 'portrait') {
max--;
}
return this.physicalToVirtual(physical);
},
clickLogo: function () {
- if (this.datas.url_link == '' || this.datas.url_link == 'http://') {
+ if (this.settings.url_link == '' || this.settings.url_link == 'http://') {
return;
}
- if (this.datas.url_link.indexOf('#') === 0) {
- window.location.hash = this.datas.url_link;
+ if (this.settings.url_link.indexOf('#') === 0) {
+ window.location.hash = this.settings.url_link;
} else {
- this.wopen(this.datas.url_link, '_blank');
+ this.wopen(this.settings.url_link, '_blank');
}
},
this.waiters = [];
},
physicalToVirtual: function (page) {
- return this.datas.numerotation[page - 1];
+ return this.settings.numerotation[page - 1];
},
virtualToPhysical: function (page) {
if (page === undefined) {
return false;
}
- var i = this.datas.numerotation.indexOf(page.toString());
+ var i = this.settings.numerotation.indexOf(page.toString());
if (i == -1) {
return false;
}
var pdf;
var pdfName;
- if (this.datas.pages != this.contentlock.getMaxPage()) {
- pdf = 'https://workshop.fluidbook.com/s/e/' + this.datas.cid + '/1-' + this.contentlock.getMaxPage();
- } else if (this.datas.pdfName.substr(0, 4) === 'http') {
- pdf = this.datas.pdfName;
+ if (this.settings.pages != this.contentlock.getMaxPage()) {
+ pdf = 'https://workshop.fluidbook.com/s/e/' + this.settings.cid + '/1-' + this.contentlock.getMaxPage();
+ } else if (this.settings.pdfName.substr(0, 4) === 'http') {
+ pdf = this.settings.pdfName;
} else {
- pdf = this.relativeToAbsolute('data/' + this.datas.pdfName);
+ pdf = this.relativeToAbsolute('data/' + this.settings.pdfName);
}
var e = pdf.split('/');
pdfName = e.pop();
}
var $this = this;
- if (this.datas.phonegap != false) {
+ if (this.settings.phonegap != false) {
if (type == undefined) {
var e = url.split('.');
type = e.pop();
var $this = this;
var types_ios = {pdf: 'com.adobe.pdf'};
var types_android = {pdf: 'application/pdf'};
- if (this.datas.phonegap === 'ios') {
+ if (this.settings.phonegap === 'ios') {
console.log('open download on ios ' + type + ' -> ' + types_ios[type]);
this.displayLoader();
if (types_ios[type] !== undefined) {
}
}
- if (this.datas.phonegap === 'android') {
+ if (this.settings.phonegap === 'android') {
if (types_android[type] !== undefined) {
var errorCallback = function (e) {
var locationdefault = 'yes';
var mtarget = target;
var replace = true;
- if (this.datas.phonegap) {
+ if (this.settings.phonegap) {
if (target == '_unique' || target == '_new') {
mtarget = '_blank';
}
} else {
if (target == '_new') {
- mtarget = 'fb_' + this.datas.id + '_' + Math.round(Math.random() * 10000000);
+ mtarget = 'fb_' + this.settings.id + '_' + Math.round(Math.random() * 10000000);
options += ',scrollbars=yes'
} else if (target == '_unique') {
- mtarget = 'fb_' + this.datas.id;
+ mtarget = 'fb_' + this.settings.id;
options += ',scrollbars=yes'
} else {
}
}
- if (this.datas.phonegap) {
+ if (this.settings.phonegap) {
locationdefault = 'yes';
}
options += ',location=' + locationdefault;
}
- if (this.datas.phonegap && mtarget == '_blank') {
+ if (this.settings.phonegap && mtarget == '_blank') {
options += ',zoom=yes,enableViewportScale=yes'
}
- if (!this.datas.phonegap && mtarget == '_blank') {
+ if (!this.settings.phonegap && mtarget == '_blank') {
options = undefined;
replace = undefined;
}