').find('#galleria');
}
var launch_galleria = function(source) {
Galleria.loadTheme('https://cdnjs.cloudflare.com/ajax/libs/galleria/1.5.7/themes/fullscreen/galleria.fullscreen.min.js');
if (window['console']) {
console.log('Galleria debug: ' + (!!(window['ASTERION_DEBUG_TOKENS'] && ASTERION_DEBUG_TOKENS.indexOf('galleria') !== false)));
}
var selectImage = $(links[index]);
for (var testIndex in source) {
if (selectImage.attr('id') == source[testIndex].id) {
index = testIndex;
break;
}
}
Galleria.run('#galleria', {
debug: !!(window['ASTERION_DEBUG_TOKENS'] && ASTERION_DEBUG_TOKENS.indexOf('galleria') !== false),
preload: 4,
show: index,
autoplay: false,
thumbnails: 'lazy',
showCounter: true,
transition: 'fade',
imageCrop: false,
transitionSpeed: 800,
dataSource: source,
extend: function(options) {
var self = this;
self.lazyLoadChunks(10);
var destroy = function() {
this.exitFullscreen();
this.destroy();
$('#galleria').remove();
$('html').attr('style', restore.html);
$('body').attr('style', restore.body);
};
this.attachKeyboard({
escape: destroy
});
this.addElement("close");
this.appendChild("image-nav", "close");
this.addIdleState(this.get('close'), {
opacity: 0
});
this.$('close')
.css({
opacity: 0.6
})
.mouseover(function() {
$(this).animate({
opacity: 1
}, 100);
})
.mouseout(function() {
$(this).animate({
opacity: 0.6
}, 100);
})
.click(this, function(e) {
destroy.apply(e.data);
});
var show_carousel = function(e) {
this.$('thumbnails-tab').click();
this.unbind(e);
};
this.bind('loadfinish', show_carousel);
if (!show_titles && !show_descriptions) {
this.bind('loadfinish', function() {
$(self.get('info')).hide();
});
}
if (show_download) {
this.addElement('download');
this.appendChild('thumbnails-container', 'download');
this.$('download').html('
Download');
this.bind('loadfinish', function(e) {
var src = $(e.imageTarget).attr('src').replace('/files/', '');
this.$('download').find('a').attr('href', '/download/' + src);
});
}
if (Galleria.TOUCH) {
var $container = window.$container = $('.galleria-thumbnails-list');
var $slider = window.$slider = $('.galleria-thumbnails', $container);
var start;
function min_left() {
return $container.width() - $slider.width();
}
// Touch Start
$('.galleria-thumbnails-list').on('touchstart', function(e) {
var touch = e.originalEvent.touches;
var slider = {
left: parseInt($slider.css('left')) || 0,
width: $slider.width()
};
start = {
pageX: touch[0].pageX,
pageY: touch[0].pageY,
time: +new Date(),
sliderOffset: {
left: slider.left,
right: slider.left + slider.width - $container.width()
}
};
self.$('thumb-nav-right').removeClass('disabled');
self.$('thumb-nav-left').removeClass('disabled');
// Touch Move
}).on('touchmove', function(e) {
var touch = e.originalEvent.touches;
// ensure swiping with one touch and not pinching
if (touch && touch.length > 1 || e.scale && e.scale !== 1 || $slider.width() 0) {
deltaX = deltaX + start.sliderOffset.left;
deltaX /= (Math.abs(deltaX) / $container.width() + 1.8);
deltaX = -start.sliderOffset.left + deltaX;
} else if (sliderX 0) {
self.$('thumb-nav-left').addClass('disabled');
$slider.animate({
left: 0
}, {
duration: 100,
easing: 'swing'
});
}
});
} else {
this.$("image-nav-left, image-nav-right").css("opacity", 0.6).unbind('mouseenter, mouseleave');
this.$("image-nav-left, image-nav-right").hover(
function() {
$(this).animate({
opacity: 1
}, 100);
},
function() {
$(this).animate({
opacity: 0.6
});
});
this.addIdleState(this.get('image-nav-right'), {
opacity: 0
});
this.addIdleState(this.get('image-nav-left'), {
opacity: 0
});
}
// MOD Nathan | 2017-10-16 | issue https://redmine.bravenet.com/issues/18054
// specifically asks for alt attributes in gallery, even though from an SEO
// perspective this serves no purpose. However, a solution is provided
// here: https://galleria.io/forums/topic/img-alt-tag/
this.bind('image', function(e) {
if (e['imageTarget'])
e.imageTarget.alt = e.galleriaData.description;
if (e['thumbTarget'])
e.thumbTarget.alt = e.galleriaData.description;
// MOD Nathan | 2019-01-07 | issue https://redmine.bravenet.com/issues/19800
// secondary loading of galleries seems to cause the thumbnail
// bar to size incorrectly. Performing a manual resize seems to
// resolve the issue
$(window).trigger('resize');
});
} // extend: function(options)
}); // Galleria.run('#galleria',
}; // var launch_galleria = function(source)
$.ajax({
url: "/resource/components/image_gallery/list_all/2156742",
type: 'GET',
data: {'max_id' : max_id },
dataType: 'json',
success: launch_galleria
});
e.preventDefault();
return false;
});
}($j));