Fluidbook.prototype = {
init: function (settings) {
this.flags = {};
+ this.secureOKDone = false;
+ this.initEventsWhenSecureOK = false;
this.canNavigate = false;
this.shortLoading = false;
this.nointerface = false;
this.initTheme();
this.initLoading();
+
+ this.secureOKDone = true;
+ if (this.initEventsWhenSecureOK) {
+ initEvents();
+ }
},
initSettings: function (settings) {
},
hideMenuItems: function () {
- gsap.to($('#menuList > ul > li, #shareLinks,footer#mobile-credits'),{duration:0.1, autoAlpha: 0});
+ gsap.to($('#menuList > ul > li, #shareLinks,footer#mobile-credits'), {duration: 0.1, autoAlpha: 0});
},
showMenuItems: function () {
- gsap.to($('#menuList > ul > li, #shareLinks,footer#mobile-credits'),{duration:0.3,autoAlpha:1});
+ gsap.to($('#menuList > ul > li, #shareLinks,footer#mobile-credits'), {duration: 0.3, autoAlpha: 1});
},
print: function (button) {
},
checkSecure: function (callback) {
+ var $this=this;
+ // Hybrid protection
+ if (this.fluidbook.settings.secureURL !== 'http://' && this.fluidbook.settings.secureURL !== '' && this.fluidbook.settings.secureClientSidePassword !== '') {
+
+ return this.checkSecureByURL(function (res) {
+ if (res) {
+ callback();
+ } else {
+ $this.checkSecureByClientSidePassword(callback);
+ }
+ }, false);
+ }
+
if (this.fluidbook.settings.secureURL !== 'http://' && this.fluidbook.settings.secureURL !== '') {
- return this.checkSecureByURL(callback);
+ return this.checkSecureByURL(callback, true);
}
if (this.fluidbook.settings.secureClientSidePassword !== '') {
return this.checkSecureByClientSidePassword(callback);
callback();
},
- checkSecureByURL: function (callback) {
+ checkSecureByURL: function (callback, nokURL) {
+ if (nokURL === undefined) {
+ nokURL = true;
+ }
var $this = this;
$.ajax({
url: $this.fluidbook.settings.secureURL, crossDomain: true, method: 'GET', type: 'json', xhrFields: {
withCredentials: true
}, success: function (data) {
- var res = data.data[0]['logged-in'];
+ var res = data !== undefined && data.data !== undefined && data.data[0] !== undefined && data.data[0]['logged-in'];
if (res !== undefined && res !== null) {
- if (res === true) {
- callback();
- } else if (res === false) {
- $this.secureByURLNOK();
+ if (!nokURL) {
+ callback(res);
+ } else {
+ if (res === true) {
+ callback(true);
+ } else if (res === false) {
+ $this.secureByURLNOK();
+ }
}
}
}, error: function (e) {
console.log(e);
- callback();
+ callback(false);
}
});
},
},
checkSecureByClientSidePassword: function (callback) {
+
var u = window.sessionStorage.getItem('secureUsername');
var p = window.sessionStorage.getItem('securePassword');
var ok = false;
resizeSliderLink: function (ww, hh, single) {
var r = document.getElementById("fluidbook").getBoundingClientRect();
- var scale = r.width / this.fluidbook.settings.sliderImageDimensions[0];
- var h = this.fluidbook.settings.sliderImageDimensions[1] * scale;
+ var iw = this.fluidbook.settings.sliderImageDimensions[0];
+ var ih = this.fluidbook.settings.sliderImageDimensions[1];
+ var ah = hh - r.top - r.height;
+ var scale = Math.min(r.width / iw, ah / ih);
+ var h = ih * scale;
+ var w = iw * scale;
css = {
- left: r.left,
- top: (r.top + r.height) + ((hh - r.top - r.height - h) / 2),
+ left: r.left + ((r.width - w) / 2),
+ top: (r.top + r.height) + ((ah - h) / 2),
transform: "scale(" + scale + ")"
};
$("#sliderlinks").css(css);
window.fluidbook.ready();
}
- initEvents();
+ if(this.fluidbook.secureOKDone) {
+ initEvents();
+ }else{
+ this.fluidbook.initEventsWhenSecureOK=true;
+ }
}
function initEvents() {