From: Vincent Vanwaelscappel Date: Fri, 26 Jun 2020 15:23:19 +0000 (+0200) Subject: fix #3744 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=ab549a6bc4799d62e06842203292d5acee388bc1;p=fluidbook-html5.git fix #3744 @0.5 --- diff --git a/js/libs/fluidbook/fluidbook.help.js b/js/libs/fluidbook/fluidbook.help.js index 33089659..478335ee 100644 --- a/js/libs/fluidbook/fluidbook.help.js +++ b/js/libs/fluidbook/fluidbook.help.js @@ -405,14 +405,31 @@ FluidbookHelp.prototype = { } this.fluidbook.hideUnnecessaryButtons(); } - } - , + }, + + showBookmark: function () { + if (!this.fluidbook.bookmarks.enabled) { + return false; + } + // cf. #3744 + // If we are in a doublepage, one the last page with a even pages number, we hide the bookmark help + if (this.fluidbook.displayOnePage) { + return true; + } + + if (!this.fluidbook.settings.invertMenuPosition && !this.fluidbook.getButtonsVisibility().next && this.fluidbook.contentlock.getMaxPage() % 2 === 0) { + return false; + } + + return true; + }, bookmarkLabel: function () { - if (!this.fluidbook.bookmarks.enabled) { + if (!this.showBookmark()) { return ''; } + // The bookmark help element is a bit complex because it must be placed in a section of the help overlay that is // not already used by the icon labels. Since the menu can be either on the left or right, this needs to be taken // into account. On the first and last pages of the Fluidbook we don't have a left or right page so it might not @@ -451,7 +468,7 @@ FluidbookHelp.prototype = { html += $('
' + this.fluidbook.l10n.__('add / remove bookmark') + '
')[0].outerHTML; var wrapper = $('
' + html + '
')[0].outerHTML - if(wrapper===undefined || wrapper==='undefined'){ + if (wrapper === undefined || wrapper === 'undefined') { return ''; } return wrapper; diff --git a/js/libs/fluidbook/fluidbook.js b/js/libs/fluidbook/fluidbook.js index b5f1119f..e83c2b30 100644 --- a/js/libs/fluidbook/fluidbook.js +++ b/js/libs/fluidbook/fluidbook.js @@ -509,6 +509,10 @@ Fluidbook.prototype = { } }, getButtonsVisibility: function (page) { + if (page === undefined) { + page = this.currentPage; + } + var max = this.contentlock.getMaxPage(); if (this.contentlock.getMaxPage() % 2 === 1 && this.settings.mobileNavigationType !== 'portrait' && @@ -541,8 +545,7 @@ Fluidbook.prototype = { } else { $("#previous").addClass('hidden'); } - } - , + }, updateShadows: function (page, animationDuration) { if (animationDuration === undefined) { animationDuration = 0; @@ -594,6 +597,7 @@ Fluidbook.prototype = { showAllButtons: function () { $("#next,#previous").addClass('help').show(); }, + setPageNumbers: function () { $("#pagesnumbers .left").html(this.getPageNumberOfSide('left', true)); $("#pagesnumbers .right").html(this.getPageNumberOfSide('right', true));