$(this.fluidbook).on('fluidbook.page.change.end', function () {
if ($this.lastTriggeredLinksPage == $this.fluidbook.currentPage) {
- return;
+ // return;
}
$this.lastTriggeredLinksPage = $this.fluidbook.currentPage;
var pages = $this.fluidbook.getDisplayedPages();
$.each(links, function (k, link) {
- console.log
setTimeout(function () {
+ $this.showLinkAnimating = false;
$this.triggerLinkById(link.link);
- }, link.delay * 1000);
+ }, k + (link.delay * 1000));
});
});
return false;
}
$this.showLinkAnimating = true;
+ var transition = $(this).data('showtransition') ? $(this).data('showtransition') : 'fadein';
+ var preventOtherTransitionTimeout = transition === 'fadeinout' ? 1000 : 500;
+
setTimeout(function () {
$this.showLinkAnimating = false;
- }, 1000);
+ }, preventOtherTransitionTimeout);
var mode = $(this).data('showmode');
- var transition = $(this).data('showtransition') ? $(this).data('showtransition') : 'fadein';
+
var ids = $(this).data('showid').toString().split(',');
if (mode === 'hide') {
}
var showid = [];
+ var hide = [];
+
if (mode === 'pickrandom') {
while (true) {
var idx = Math.floor(Math.random() * ids.length);
$('[data-showid="' + $(this).attr('data-showid') + '"]').each(function () {
$(this).data('current-showid', showid[0]);
});
+ } else if (mode === 'showhide') {
+ $.each(ids, function (k, v) {
+ let sign = v.substring(0, 1);
+ let offset = 0;
+ let show = true;
+ let id = v;
+ if (sign === '+') {
+ offset = 1;
+ } else if (sign === '-') {
+ offset = 1;
+ show = false;
+ }
+ if (offset > 0) {
+ id = id.substring(offset);
+ }
+ if (show) {
+ showid.push(id);
+ } else {
+ hide.push(id);
+ }
+ });
} else {
showid = ids;
}
let showTimeout = 10;
- if (mode === 'exclusiveshow' || mode === 'shownext' || mode === 'shownextcycle' || mode === 'showprev' || mode === 'showprevcycle' || mode === 'pickrandom') {
+ if (mode === 'exclusiveshow' || mode === 'shownext' || mode === 'shownextcycle' || mode === 'showprev' || mode === 'showprevcycle' || mode === 'pickrandom' || mode === 'showhide') {
var selector = 'div.link[data-hidden="1"].show';
- var hide = [];
+
// Only hide links that are in the list
- if ($(this).is('[data-showid]')) {
- hide = $(this).data('showid').split(',');
- var maxZindex = 0;
- $.each(hide, function (k, hideid) {
- var e = $('[data-id="' + hideid + '"]');
- var zIndex;
- if ($(e).is('[data-zindex]')) {
- zIndex = $(e).attr('data-zindex');
- } else {
- zIndex = $(e).css('z-index');
- $(e).attr('data-zindex', zIndex);
- }
+ if (mode !== 'showhide') {
+ if ($(this).is('[data-showid]')) {
+ hide = $(this).data('showid').split(',');
+ var maxZindex = 0;
+ $.each(hide, function (k, hideid) {
+ var e = $('[data-id="' + hideid + '"]');
+ var zIndex;
+ if ($(e).is('[data-zindex]')) {
+ zIndex = $(e).attr('data-zindex');
+ } else {
+ zIndex = $(e).css('z-index');
+ $(e).attr('data-zindex', zIndex);
+ }
- maxZindex = Math.max(parseInt(zIndex), maxZindex);
- });
- } else {
- hide = 'all';
- }
- if (mode === 'exclusiveshow') {
- hide = 'all';
+ maxZindex = Math.max(parseInt(zIndex), maxZindex);
+ });
+ } else {
+ hide = 'all';
+ }
+ if (mode === 'exclusiveshow') {
+ hide = 'all';
+ }
}
-
var transitionTime = 500;
var hideTimeout = 10;
if (transition === 'fadein') {
$.each(showid, function (k, id) {
+
$('div.link[data-id$="' + id + '"]').each(function () {
var l = this;
if (close !== 'none') {