$('[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;
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;
$.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]')) {
if ($(this).is('[data-zindex]')) {
$(this).css('z-index', $(this).data('zindex'));
}
+ console.log('hide ',id);
$this.hidePlacedLink(this, timeout);
}
});