From: Vincent Vanwaelscappel Date: Mon, 19 Aug 2019 16:16:59 +0000 (+0200) Subject: fix #2942 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=3ddbf68dc36e744fe1d7a2b2e061fc594ee27cfa;p=fluidbook-html5.git fix #2942 @0.5 --- diff --git a/js/libs/fluidbook/fluidbook.js b/js/libs/fluidbook/fluidbook.js index c3003cbe..bf13f818 100644 --- a/js/libs/fluidbook/fluidbook.js +++ b/js/libs/fluidbook/fluidbook.js @@ -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 ''; }