]> _ Git - fluidbook-html5.git/commitdiff
wait #4133 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 31 Dec 2020 07:47:00 +0000 (08:47 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 31 Dec 2020 07:48:42 +0000 (08:48 +0100)
js/libs/fluidbook/fluidbook.links.js

index f1132967003aa74d400ab88d4706b36607663e83..377af80ca0720b8046d264e690279db116056ab1 100644 (file)
@@ -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('<a href="#" class="linkshowclose ' + close + '"></a>');
                 $(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) {