From adc80f55c80a157ecb23de03f75ad05dda54f8e4 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 31 Dec 2020 08:47:00 +0100 Subject: [PATCH] wait #4133 @0.5 --- js/libs/fluidbook/fluidbook.links.js | 48 +++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.links.js b/js/libs/fluidbook/fluidbook.links.js index f1132967..377af80c 100644 --- a/js/libs/fluidbook/fluidbook.links.js +++ b/js/libs/fluidbook/fluidbook.links.js @@ -147,15 +147,39 @@ FluidbookLinks.prototype = { } } - if (mode === 'exclusiveshow') { + var showid; + if (mode === 'shownext' || mode === 'shownextcycle') { + var ids = $(this).data('showid').split(','); + console.log(ids); + var current = $(this).data('current-showid'); + console.log(current); + if (current === undefined) { + showid = ids[0]; + } else { + var idx = ids.indexOf(current) + 1; + if (idx === ids.length) { + if (mode === 'shownext') { + return false; + } else { + idx = 0; + } + } + showid = ids[idx]; + } + console.log(showid); + $(this).data('current-showid', showid); + } else { + showid = $(this).data('showid'); + } + + if (mode === 'exclusiveshow' || mode === 'shownext' || mode === 'shownextcycle') { $('div.link[data-hidden="1"].show').each(function () { - $this.hidePlacedLink(this); + $this.hidePlacedLink(this, (mode === 'shownext' || mode === 'shownextcycle') ? 500 : 0); }); } - var close = $(this).data('showclose'); - $('div.link[data-id$="' + $(this).data('showid') + '"]').each(function () { + $('div.link[data-id$="' + showid + '"]').each(function () { var l = this; $(l).append(''); $(l).show(); @@ -272,13 +296,21 @@ FluidbookLinks.prototype = { return u.href; }, - hidePlacedLink: function (p) { + hidePlacedLink: function (p, timeout) { if ($(p).length === 0) { return; } - $(p).hide(); - $(p).removeClass('show'); - $(p).find('.linkshowclose').remove(); + if (timeout === undefined) { + timeout = 0; + } + setTimeout(function () { + + $(p).removeClass('show'); + $(p).find('.linkshowclose').remove(); + setTimeout(function () { + $(p).hide(); + }, 1000) + }, timeout); }, initLinks: function (pageNr) { -- 2.39.5