]> _ Git - fluidbook-html5.git/commitdiff
fix #2942 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 19 Aug 2019 16:16:59 +0000 (18:16 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 19 Aug 2019 16:16:59 +0000 (18:16 +0200)
js/libs/fluidbook/fluidbook.js

index c3003cbe4be5647af774bff6e72bfe65d373e28c..bf13f81801666827a681135d9f7713c03ec54f4b 100644 (file)
@@ -574,7 +574,6 @@ Fluidbook.prototype = {
             delay = animationDuration;
         }
 
-
         var left = true, right = true;
         if (!this.displayOnePage) {
             if ((page <= 1 && this.l10n.dir === 'ltr') || (page >= this.contentlock.getMaxPage() && this.l10n.dir === 'rtl')) {
@@ -601,7 +600,6 @@ Fluidbook.prototype = {
             s_out.push(".right:not('.hidden')");
         }
 
-
         if (s_in.length > 0) {
             setTimeout(function () {
                 $(s).children(s_in.join(',')).removeClass('hidden');
@@ -610,27 +608,36 @@ Fluidbook.prototype = {
         if (s_out.length > 0) {
             $(s).children(s_out.join(',')).addClass('hidden');
         }
-
     }
     ,
     showAllButtons: function () {
         $("#next,#previous").addClass('help').show();
     },
     setPageNumbers: function () {
-        $("#pagesnumbers .left").html(this.getPageNumberOfSide('left'));
-        $("#pagesnumbers .right").html(this.getPageNumberOfSide('right'));
+        $("#pagesnumbers .left").html(this.getPageNumberOfSide('left', true));
+        $("#pagesnumbers .right").html(this.getPageNumberOfSide('right', true));
         $("#pagesnumbers").removeClass('hidden');
     },
-    getPhysicalPageNumberOfSide: function (side) { // Side should be 'left' or 'right'
+    getPhysicalPageNumberOfSide: function (side, strict) { // Side should be 'left' or 'right'
+        if (undefined === strict) {
+            strict = false;
+        }
+
         var pageSide = $("#currentDoublePage").find('.' + side);
-        if (pageSide.length == 0) {
+        if (pageSide.length === 0) {
+            if (strict) {
+                return false;
+            }
             pageSide = $("#currentDoublePage").find('.page').eq(0);
         }
-
         return $(pageSide).data('page');
     },
-    getPageNumberOfSide: function (side) {
-        var physical = this.getPhysicalPageNumberOfSide(side);
+    getPageNumberOfSide: function (side,strict) {
+        if (undefined === strict) {
+            strict = false;
+        }
+
+        var physical = this.getPhysicalPageNumberOfSide(side,strict);
         if (!physical || physical === 1) {
             return '';
         }