From 385b7cfbcd853969a2054bf8d6ae249ca696292a Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 6 Feb 2019 17:29:07 +0100 Subject: [PATCH] #2277 @0:20 --- js/libs/fluidbook/fluidbook.contentlock.js | 19 ++++++++++++++++--- js/libs/fluidbook/fluidbook.js | 4 ++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.contentlock.js b/js/libs/fluidbook/fluidbook.contentlock.js index 3f9b8ae0..a11d2cf4 100644 --- a/js/libs/fluidbook/fluidbook.contentlock.js +++ b/js/libs/fluidbook/fluidbook.contentlock.js @@ -126,20 +126,33 @@ FluidbookContentLock.prototype = { return this.linksActions[linkId].indexOf(action) >= 0; }, - unlockNextPage: function () { + unlockCurrentPage: function () { + var $this = this; + var change = false; $.each(this.locks, function (k, v) { if (v.unlocked === 1) { return; } - if (v.conditions.length === 0) { + var currentPage = $this.fluidbook.currentPage; + if (currentPage % 2 === 1) { + currentPage--; + } + var lockPage = k; + if (lockPage % 2 === 1) { + lockPage--; + } + if (currentPage !== lockPage) { return; } $this.locks[k].unlocked = 1; + change = true; return true; }); - if (this.getNextLockPage() !== this.getMaxPage()) { + + if (change) { this.setMaxPage(this.getNextLockPage(), false); } + } } \ No newline at end of file diff --git a/js/libs/fluidbook/fluidbook.js b/js/libs/fluidbook/fluidbook.js index 0edb7d7e..e0591178 100644 --- a/js/libs/fluidbook/fluidbook.js +++ b/js/libs/fluidbook/fluidbook.js @@ -1036,8 +1036,8 @@ Fluidbook.prototype = { f(); }, - unlockNextPage: function () { - this.contentlock.unlockNextPage(); + unlockCurrentPage: function () { + this.contentlock.unlockCurrentPage(); }, flushNetworkQueue: function () { -- 2.39.5