From 91bc71dba1491635c94c8950cb2b0f3e03843a65 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 13 Apr 2022 18:51:00 +0200 Subject: [PATCH] wip #5188 @0.5 --- js/libs/fluidbook/fluidbook.links.js | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.links.js b/js/libs/fluidbook/fluidbook.links.js index ba457397..b15e19fb 100644 --- a/js/libs/fluidbook/fluidbook.links.js +++ b/js/libs/fluidbook/fluidbook.links.js @@ -196,18 +196,28 @@ FluidbookLinks.prototype = { $(document).on(this.fluidbook.input.clickEvent, '[data-showid]:not([data-showmode="showonhover"])', function () { var mode = $(this).data('showmode'); + var ids = $(this).data('showid').toString().split(','); + + if (mode === 'hide') { + $.each(ids, function (k, id) { + $('div.link[data-id="' + id + '"]').hide(); + }); + return false; + } + if (mode === 'toggle') { - var l = $('div.link[data-id="' + $(this).data('showid') + '"].show'); - if (l.length > 0) { - l.removeClass('show'); - return false; - } + $.each(ids, function (k, id) { + var l = $('div.link[data-id="' + id + '"].show'); + if (l.length > 0) { + l.removeClass('show'); + } + }); + return false; } var showid = []; if (mode === 'pickrandom') { while (true) { - var ids = $(this).data('showid').toString().split(','); var idx = Math.floor(Math.random() * ids.length); showid = [ids[idx]]; if ($('div.link[data-hidden="1"][data-id$="' + showid + '"].show').length === 0 || ids.length === 0) { @@ -215,8 +225,6 @@ FluidbookLinks.prototype = { } } } else if (mode === 'shownext' || mode === 'shownextcycle' || mode === 'showprev' || mode === 'showprevcycle') { - var ids = $(this).data('showid').toString().split(','); - var a = 1; if (mode === 'showprev' || mode === 'showprevcycle') { a = -1; @@ -240,7 +248,7 @@ FluidbookLinks.prototype = { $(this).data('current-showid', showid[0]); }); } else { - showid = $(this).data('showid').toString().split(','); + showid = ids; } if (mode === 'exclusiveshow' || mode === 'shownext' || mode === 'shownextcycle' || mode === 'showprev' || mode === 'showprevcycle' || mode === 'pickrandom') { -- 2.39.5