From b937470e6f23f48547f41b8cc21d33d47950556e Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 7 Jun 2023 16:21:52 +0200 Subject: [PATCH] wait #6004 @0.5 --- js/libs/fluidbook/fluidbook.help.js | 6 +++--- js/libs/fluidbook/fluidbook.js | 6 +++++- js/libs/fluidbook/fluidbook.nav.js | 18 ++++++++++++++++-- js/libs/fluidbook/fluidbook.resize.js | 15 +++++---------- style/fluidbook.less | 7 ++++++- style/nav-horizontal.less | 8 +++++++- 6 files changed, 42 insertions(+), 18 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.help.js b/js/libs/fluidbook/fluidbook.help.js index 420f3e8b..2f1e7975 100644 --- a/js/libs/fluidbook/fluidbook.help.js +++ b/js/libs/fluidbook/fluidbook.help.js @@ -110,7 +110,7 @@ FluidbookHelp.prototype = { // When the menu position is inverted, the icon help lines need // to be drawn in the reverse order to avoid text/line overlaps - var tooltips = this.fluidbook._boolean(this.fluidbook.settings.invertMenuPosition) ? $(tooltipSelector).get().reverse() : $(tooltipSelector); + var tooltips = this.fluidbook.nav.isInverted() ? $(tooltipSelector).get().reverse() : $(tooltipSelector); var navScale = this.fluidbook.resize.navScale; var initialHeight = 20 * navScale; // Buffer in line height away from icons var hStep = 25 * navScale; // The step height - the difference in height between the icon label lines @@ -335,7 +335,7 @@ FluidbookHelp.prototype = { } if (this.fluidbook.bookmarks.enabled) { - var inverted = this.fluidbook._boolean(this.fluidbook.settings.invertMenuPosition); + var inverted = this.fluidbook.nav.isInverted() ; var side = ((this.fluidbook.l10n.dir === 'ltr' && inverted) || (this.fluidbook.l10n.dir === 'rtl' && !inverted)) ? 'left' : 'right'; if (this.fluidbook.mobilefirst.enabled) { side = 'right'; @@ -469,7 +469,7 @@ FluidbookHelp.prototype = { return true; } - if (!this.fluidbook._boolean(this.fluidbook.settings.invertMenuPosition) && !this.fluidbook.getButtonsVisibility().next && this.fluidbook.contentlock.getMaxPage() % 2 === 0) { + if (!this.fluidbook.nav.isInverted() && !this.fluidbook.getButtonsVisibility().next && this.fluidbook.contentlock.getMaxPage() % 2 === 0) { return false; } diff --git a/js/libs/fluidbook/fluidbook.js b/js/libs/fluidbook/fluidbook.js index 8905f410..f170c07c 100644 --- a/js/libs/fluidbook/fluidbook.js +++ b/js/libs/fluidbook/fluidbook.js @@ -226,12 +226,16 @@ Fluidbook.prototype = { $('html').addClass('sharp'); } - if (this._boolean(this.settings.invertMenuPosition)) { + if (this.nav.isInverted() ) { $('html').addClass('menu-inverted'); } else { $('html').addClass('menu-default'); } + if(this.nav.isLogoCentered()){ + $('#logo').addClass('center'); + } + $(document).on('fluidbook.init', function () { var logoImg = $("#splash .logo img"); if ($(logoImg).isLoaded()) { diff --git a/js/libs/fluidbook/fluidbook.nav.js b/js/libs/fluidbook/fluidbook.nav.js index b17d259e..5bc67bb7 100644 --- a/js/libs/fluidbook/fluidbook.nav.js +++ b/js/libs/fluidbook/fluidbook.nav.js @@ -9,7 +9,7 @@ function FluidbookNav(fluidbook) { this.horizontalNav = $("#horizontalNav"); this._inited = {}; this.setNav('horizontalNav'); - if($("#iconList").html()!=='') { + if ($("#iconList").html() !== '') { this.setNav('menu'); } if (Modernizr.msie) { @@ -23,9 +23,23 @@ function FluidbookNav(fluidbook) { } FluidbookNav.prototype = { + isLogoCentered: function () { + return this.fluidbook.settings.invertMenuPosition >= 2; + }, + + isInverted: function () { + let v = this.fluidbook.settings.invertMenuPosition; + if (v === false || v === 'false' || v == 0 || v == 2) { + return false; + } else if (v === true || v === 'true' || v == 1 || v == 3) { + return true; + } + return false; + }, + initMenu: function () { var $this = this, dir = this.fluidbook.l10n.dir, - inverted = this.fluidbook._boolean(this.fluidbook.settings.invertMenuPosition), + inverted = this.isInverted(), 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 c0685313..55bf9ffa 100644 --- a/js/libs/fluidbook/fluidbook.resize.js +++ b/js/libs/fluidbook/fluidbook.resize.js @@ -238,13 +238,8 @@ FluidbookResize.prototype = { transform: 'scale(' + (this.bookScale) + ')', top: this.fh, fontSize: 11.25 / this.bookScale }); - if (this.fluidbook._boolean(this.fluidbook.settings.logoHideWhenOverriden)) { - var availableWidthForLogo = (this.ww - this.fw) / 2; - if ($("#logo").outerWidth() > availableWidthForLogo) { - $("#logo").addClass('overridenByFluidbook'); - } else { - $("#logo").removeClass('overridenByFluidbook'); - } + if (this.fluidbook.nav.isLogoCentered()) { + $("#logo").css('left', (this.ww - this.fluidbook.settings.logoDimensions[0]) / 2); } if (this.fluidbook.interface.arrowsEnabled()) { @@ -423,7 +418,7 @@ FluidbookResize.prototype = { resizeAfterSearch: function () { var rect = $("#horizontalNav").get(0).getBoundingClientRect(); - var inverted = this.fluidbook._boolean(this.fluidbook.settings.invertMenuPosition) + var inverted = this.fluidbook.nav.isInverted() if ((this.fluidbook.l10n.ltr && !inverted) || (this.fluidbook.l10n.rtl && inverted)) { $("#afterSearch").css({left: rect.left + rect.width, right: 'auto'}); } else { @@ -432,12 +427,12 @@ FluidbookResize.prototype = { }, checkLogoVisibility: function () { - if (this.fluidbook.mobilefirst.enabled) { + if (this.fluidbook.mobilefirst.enabled || !this.fluidbook.settings.logoHideWhenOverriden) { return; } var logo = document.getElementById("logo").getBoundingClientRect(); var fluidbook = document.getElementById("fluidbook").getBoundingClientRect(); - var inverted = this.fluidbook._boolean(this.fluidbook.settings.invertMenuPosition); + var inverted = this.fluidbook.nav.isInverted(); var overlapY = logo.bottom > fluidbook.top; var overlapX; diff --git a/style/fluidbook.less b/style/fluidbook.less index 801d21d4..b3d4f974 100644 --- a/style/fluidbook.less +++ b/style/fluidbook.less @@ -1000,6 +1000,10 @@ input[type="search"]::-webkit-search-results-decoration { visibility: hidden; } + &.center { + right: auto !important; + } + // Positioning for left-to-right Fluidbooks + inverted menu on RTL .ltr &, .rtl.menu-inverted & { right: 0; @@ -1716,8 +1720,9 @@ html.ios body.portrait #interface { } } - &[data-menu="audio"]{ + &[data-menu="audio"] { overflow: visible; + a, div { &.button.back { top: -30px; diff --git a/style/nav-horizontal.less b/style/nav-horizontal.less index aeaa25e8..4e63696f 100644 --- a/style/nav-horizontal.less +++ b/style/nav-horizontal.less @@ -67,6 +67,12 @@ li { display: inline-block; vertical-align: middle; + + &:first-child { + a.icon-locales { + border: 0; + } + } } a { @@ -104,7 +110,7 @@ } } - span{ + span { transition: color @page-transition-duration; } -- 2.39.5