]> _ Git - fluidbook-html5.git/commitdiff
fix #3744 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 26 Jun 2020 15:23:19 +0000 (17:23 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 26 Jun 2020 15:23:19 +0000 (17:23 +0200)
js/libs/fluidbook/fluidbook.help.js
js/libs/fluidbook/fluidbook.js

index 330896599963b3dc15119ab9a8abcffdb5b399e8..478335ee833b72879aadf2671d630bd66976c077 100644 (file)
@@ -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 += $('<div class="bookmark-help-label">' + this.fluidbook.l10n.__('add / remove bookmark') + '</div>')[0].outerHTML;
         var wrapper = $('<div class="bookmark-help">' + html + '</div>')[0].outerHTML
 
-        if(wrapper===undefined || wrapper==='undefined'){
+        if (wrapper === undefined || wrapper === 'undefined') {
             return '';
         }
         return wrapper;
index b5f1119fae63d4ab07fae28db419defb16acc39c..e83c2b30cf234a1c86a9b7636b826adc22271b43 100644 (file)
@@ -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));