From: Vincent Vanwaelscappel Date: Tue, 20 Jul 2021 09:39:07 +0000 (+0200) Subject: wait #4600 @2 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=0aac9968859ea88bc8c2ee0292dabdf6e8fa2a30;p=fluidbook-html5.git wait #4600 @2 --- diff --git a/js/libs/fluidbook/fluidbook.help.js b/js/libs/fluidbook/fluidbook.help.js index 2e01fa9d..9f069881 100644 --- a/js/libs/fluidbook/fluidbook.help.js +++ b/js/libs/fluidbook/fluidbook.help.js @@ -332,7 +332,7 @@ FluidbookHelp.prototype = { } if (this.fluidbook.bookmarks.enabled) { - var inverted = this.fluidbook.settings.invertMenuPosition; + var inverted = this.fluidbook._boolean(this.fluidbook.settings.invertMenuPosition); var side = ((this.fluidbook.l10n.dir === 'ltr' && inverted) || (this.fluidbook.l10n.dir === 'rtl' && !inverted)) ? 'left' : 'right'; if (this.fluidbook.mobilefirst.enabled) { side = 'right'; @@ -448,7 +448,7 @@ FluidbookHelp.prototype = { return true; } - if (!this.fluidbook.settings.invertMenuPosition && !this.fluidbook.getButtonsVisibility().next && this.fluidbook.contentlock.getMaxPage() % 2 === 0) { + if (!this.fluidbook._boolean(this.fluidbook.settings.invertMenuPosition) && !this.fluidbook.getButtonsVisibility().next && this.fluidbook.contentlock.getMaxPage() % 2 === 0) { return false; } @@ -467,7 +467,7 @@ FluidbookHelp.prototype = { // be possible to always display the bookmark icon in this case... var dir = this.fluidbook.l10n.dir; - var inverted = this.fluidbook.settings.invertMenuPosition; + var inverted = this.fluidbook._boolean(this.fluidbook.settings.invertMenuPosition); var side = ((dir === 'ltr' && inverted) || (dir === 'rtl' && !inverted)) ? 'left' : 'right'; if (this.fluidbook.mobilefirst.enabled) { side = 'right'; diff --git a/js/libs/fluidbook/fluidbook.js b/js/libs/fluidbook/fluidbook.js index 49fcf083..c222bbec 100644 --- a/js/libs/fluidbook/fluidbook.js +++ b/js/libs/fluidbook/fluidbook.js @@ -23,7 +23,7 @@ Fluidbook.prototype = { this.canNavigate = false; this.shortLoading = false; this.nointerface = false; - this.hideBook=false; + this.hideBook = false; if ($_GET['nointerface'] !== undefined) { $('body').addClass('nointerface'); @@ -44,6 +44,13 @@ Fluidbook.prototype = { }); }, + _boolean: function (v) { + if (v === undefined || v === null || v === '0' || v === 0 || v === 'false' || !v) { + return false; + } + return true; + }, + secureOK: function () { this.singleMode = (this.settings.mobileNavigationType === 'portrait' || this.settings.mobileNavigationType === 'mobilefirst'); @@ -178,7 +185,7 @@ Fluidbook.prototype = { $('html').addClass('sharp'); } - if (this.settings.invertMenuPosition) { + if (this._boolean(this.settings.invertMenuPosition)) { $('html').addClass('menu-inverted'); } else { $('html').addClass('menu-default'); diff --git a/js/libs/fluidbook/fluidbook.nav.js b/js/libs/fluidbook/fluidbook.nav.js index bd0ece2b..48ce3dbf 100644 --- a/js/libs/fluidbook/fluidbook.nav.js +++ b/js/libs/fluidbook/fluidbook.nav.js @@ -24,7 +24,7 @@ FluidbookNav.prototype = { initMenu: function () { var $this = this, dir = this.fluidbook.l10n.dir, - inverted = this.fluidbook.settings.invertMenuPosition, + inverted = this.fluidbook._boolean(this.fluidbook.settings.invertMenuPosition), side = ((dir === 'ltr' && inverted) || (dir === 'rtl' && !inverted)) ? 'right' : 'left'; var extensions = ['pagedim-black', 'position-front']; diff --git a/js/libs/fluidbook/fluidbook.resize.js b/js/libs/fluidbook/fluidbook.resize.js index 43bfe22c..90cb6a94 100644 --- a/js/libs/fluidbook/fluidbook.resize.js +++ b/js/libs/fluidbook/fluidbook.resize.js @@ -222,7 +222,7 @@ FluidbookResize.prototype = { var pageNumberScale = Math.min(1, 1 / (this.bookScale / 0.5)); $("#pagesnumbers").css('font-size', $("#pagesnumbers").data('size') * pageNumberScale); - if (this.fluidbook.settings.logoHideWhenOverriden) { + if (this.fluidbook._boolean(this.fluidbook.settings.logoHideWhenOverriden)) { var availableWidthForLogo = (this.ww - fw) / 2; if ($("#logo").outerWidth() > availableWidthForLogo) { $("#logo").addClass('overridenByFluidbook'); @@ -359,7 +359,8 @@ FluidbookResize.prototype = { resizeAfterSearch: function () { var rect = $("#horizontalNav").get(0).getBoundingClientRect(); - if ((this.fluidbook.l10n.ltr && !this.fluidbook.settings.invertMenuPosition) || (this.fluidbook.l10n.rtl && this.fluidbook.settings.invertMenuPosition)) { + var inverted=this.fluidbook._boolean(this.fluidbook.settings.invertMenuPosition) + if ((this.fluidbook.l10n.ltr && !inverted) || (this.fluidbook.l10n.rtl && inverted)) { $("#afterSearch").css({left: rect.left + rect.width, right: 'auto'}); } else { $("#afterSearch").css({right: this.ww - rect.right + rect.width, left: 'auto'}); @@ -372,10 +373,11 @@ FluidbookResize.prototype = { } var logo = document.getElementById("logo").getBoundingClientRect(); var fluidbook = document.getElementById("fluidbook").getBoundingClientRect(); + var inverted=this.fluidbook._boolean(this.fluidbook.settings.invertMenuPosition); var overlapY = logo.bottom > fluidbook.top; var overlapX; - if ((this.fluidbook.l10n.rtl && !this.fluidbook.settings.invertMenuPosition) || (this.fluidbook.l10n.ltr && this.fluidbook.settings.invertMenuPosition)) { + if ((this.fluidbook.l10n.rtl && !inverted) || (this.fluidbook.l10n.ltr && inverted)) { overlapX = (logo.right > (fluidbook.left - $("#center-fluidbook").data('left'))); } else { overlapX = (logo.left < (fluidbook.right - $("#center-fluidbook").data('left')));