(function(window, $, PhotoSwipe){
$(document).ready(function(){
var more_link
var options = {
jQueryMobile: true,
loop: var_loop,
captionAndToolbarAutoHideDelay: var_autohide,
imageScaleMethod: "fitNoUpscale",
getToolbar: function(){
return '
'+var_trad+'
';},
getImageMetaData:function(el){
return {
picture_url: $(el).attr('data-picture-url')
};}
};
var myPhotoSwipe = $(".thumbnails a").photoSwipe(options);
// onShow - store a reference to our "more_link" button
myPhotoSwipe.addEventHandler(PhotoSwipe.EventTypes.onShow, function(e){
more_link = window.document.querySelectorAll('#more_link')[0];
});
// onToolbarTap - listen out for when the toolbar is tapped
myPhotoSwipe.addEventHandler(PhotoSwipe.EventTypes.onToolbarTap, function(e){
if (e.toolbarAction === PhotoSwipe.Toolbar.ToolbarAction.none){
if (e.tapTarget === more_link || Util.DOM.isChildOf(e.tapTarget, more_link)){
var currentImage = myPhotoSwipe.getCurrentImage();
window.location=currentImage.metaData.picture_url;
}
}
});
$(window).bind('orientationchange', set_thumbnails_width);
set_thumbnails_width();
});
}(window, window.jQuery, window.Code.PhotoSwipe));
function set_thumbnails_width() {
var dpr = 1 //window.devicePixelRatio>1 ? window.devicePixelRatio : 1
, nb_thumbs = Math.max(2, Math.ceil($('.thumbnails').width() / (var_thumb_width/dpr+2*5)))
, width = Math.floor(1000000 / nb_thumbs) / 10000;
$('.thumbnails li').css('width', width+'%');
}