]> _ Git - fluidbook-html5.git/commitdiff
wip #5188 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 13 Apr 2022 16:51:00 +0000 (18:51 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 13 Apr 2022 16:51:00 +0000 (18:51 +0200)
js/libs/fluidbook/fluidbook.links.js

index ba457397c08bf354fc5d0ccda6e77d97b85e4e7c..b15e19fbfa65597870b0470c504ca79fddb8900f 100644 (file)
@@ -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') {