From: Vincent Vanwaelscappel Date: Thu, 22 Apr 2021 18:39:57 +0000 (+0200) Subject: done #4422 @2 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=68bdfb9d8d6132016d34feb92bc88a8152faf16c;p=fluidbook-html5.git done #4422 @2 --- diff --git a/js/libs/fluidbook/fluidbook.links.js b/js/libs/fluidbook/fluidbook.links.js index e608feb6..a7a37386 100644 --- a/js/libs/fluidbook/fluidbook.links.js +++ b/js/libs/fluidbook/fluidbook.links.js @@ -163,12 +163,12 @@ FluidbookLinks.prototype = { } } - var showid; + var showid = []; if (mode === 'pickrandom') { while (true) { var ids = $(this).data('showid').split(','); var idx = Math.floor(Math.random() * ids.length); - showid = ids[idx]; + showid = [ids[idx]]; if ($('div.link[data-hidden="1"][data-id$="' + showid + '"].show').length === 0 || ids.length === 0) { break; } @@ -177,7 +177,7 @@ FluidbookLinks.prototype = { var ids = $(this).data('showid').split(','); var current = $(this).data('current-showid'); if (current === undefined) { - showid = ids[0]; + showid = [ids[0]]; } else { var idx = ids.indexOf(current) + 1; if (idx === ids.length) { @@ -187,37 +187,43 @@ FluidbookLinks.prototype = { idx = 0; } } - showid = ids[idx]; + showid = [ids[idx]]; } - $(this).data('current-showid', showid); + $(this).data('current-showid', showid[0]); } else { - showid = $(this).data('showid'); + showid = $(this).data('showid').split(','); } if (mode === 'exclusiveshow' || mode === 'shownext' || mode === 'shownextcycle' || mode === 'pickrandom') { - $('div.link[data-hidden="1"].show:not([data-id$="' + showid + '"])').each(function () { + var selector = 'div.link[data-hidden="1"].show'; + $.each(showid, function (k,id) { + selector += ':not([data-id$="' + id + '"])'; + }); + $(selector).each(function () { $this.hidePlacedLink(this, (mode === 'shownext' || mode === 'shownextcycle') ? 500 : 0); }); } var close = $(this).data('showclose'); - $('div.link[data-id$="' + showid + '"]').each(function () { - var l = this; - if (close !== 'none') { - $(l).append(''); - } - $(l).show(); - $(l).trigger('fluidbook.link.show'); - if (close !== 'none') { - $(l).removeClass('notinteractive'); - $(l).find('img').css('pointer-events', 'none'); - } - setTimeout(function () { - $(l).addClass('show'); - }, 10); + console.log(showid); + $.each(showid, function (k,id) { + $('div.link[data-id$="' + id + '"]').each(function () { + var l = this; + if (close !== 'none') { + $(l).append(''); + } + $(l).show(); + $(l).trigger('fluidbook.link.show'); + if (close !== 'none') { + $(l).removeClass('notinteractive'); + $(l).find('img').css('pointer-events', 'none'); + } + setTimeout(function () { + $(l).addClass('show'); + }, 10); + }); }); - return false; });