From: Vincent Vanwaelscappel Date: Tue, 14 Nov 2023 18:14:45 +0000 (+0100) Subject: wait #6421 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=48a1061d7b0b3812e741fc375e2d078d1357e501;p=fluidbook-html5.git wait #6421 @0.5 --- diff --git a/js/libs/fluidbook/fluidbook.links.js b/js/libs/fluidbook/fluidbook.links.js index 8eb58b20..c3a8d1dc 100644 --- a/js/libs/fluidbook/fluidbook.links.js +++ b/js/libs/fluidbook/fluidbook.links.js @@ -298,7 +298,8 @@ FluidbookLinks.prototype = { $('[data-showid="' + $(this).attr('data-showid') + '"]').each(function () { $(this).data('current-showid', showid[0]); }); - } else if (mode === 'showhide') { + } else if (mode === 'showhide' || mode === 'toggleshowhide') { + let invert = false; $.each(ids, function (k, v) { let sign = v.substring(0, 1); let offset = 0; @@ -313,22 +314,29 @@ FluidbookLinks.prototype = { if (offset > 0) { id = id.substring(offset); } - if (show) { + + if (k === 0 && mode === 'toggleshowhide') { + let l = $('div.link[data-id="' + id + '"]').hasClass('show'); + invert = (l && show) || (!l && !show); + } + + if ((show && !invert) || (!show && invert)) { showid.push(id); } else { hide.push(id); } }); + console.log('showhide', showid, hide); } else { showid = ids; } let showTimeout = 10; - if (mode === 'exclusiveshow' || mode === 'shownext' || mode === 'shownextcycle' || mode === 'showprev' || mode === 'showprevcycle' || mode === 'pickrandom' || mode === 'showhide') { + if (mode === 'exclusiveshow' || mode === 'shownext' || mode === 'shownextcycle' || mode === 'showprev' || mode === 'showprevcycle' || mode === 'pickrandom' || mode === 'showhide' || mode === 'toggleshowhide') { var selector = 'div.link[data-hidden="1"].show'; // Only hide links that are in the list - if (mode !== 'showhide') { + if (mode !== 'showhide' && mode !== 'toggleshowhide') { if ($(this).is('[data-showid]')) { hide = $(this).data('showid').split(','); var maxZindex = 0; @@ -364,6 +372,7 @@ FluidbookLinks.prototype = { $.each(showid, function (k, id) { selector += ':not([data-id$="' + id + '"])'; }); + console.log(selector); $(selector).each(function () { let timeout = hideTimeout; if ($(selector).is('[data-animation-hide]')) { @@ -374,6 +383,7 @@ FluidbookLinks.prototype = { if ($(this).is('[data-zindex]')) { $(this).css('z-index', $(this).data('zindex')); } + console.log('hide ',id); $this.hidePlacedLink(this, timeout); } });