" )
.addClass( "arrow" )
.addClass( feedback.vertical )
.addClass( feedback.horizontal )
.appendTo( this );
}
}
});
f_convertImages(fullImageSizeString, thumbImageSizeString, defaultColumnCount);
if ($(window).width() < 1025) {
$('.photolist').removeClass('nested-side');
$('.photolist').addClass('nested-top');
}
$('.fancybox3').fancybox({
fullScreen: {
autoStart: false
},
thumbs: {
autoStart: false,
hideOnClose: true
},
smallBtn: "auto",
afterLoad: function (instance, current) {
if (current.$image) {
current.$image.attr('alt', current.opts.$orig.find('meta[itemprop="name"]').attr('content'));
}
var pixelRatio = window.devicePixelRatio || 1;
if ( pixelRatio > 1.5 ) {
current.width = current.width / pixelRatio;
current.height = current.height / pixelRatio;
}
}
});
}
function f_convertImages(fullImageSizeString, thumbImageSizeString, defaultColumnCount) {
var galleryIndex = 0;
if ($('.nested-gst').length > 0 && $('.nested-gst:visible').length > 0)
galleryIndex = $('.nested-gst.selected').attr('data-index');
else
galleryIndex = $('.top-dropdown option:selected').attr('data-index');
$('#photoList' + galleryIndex + ' a.fancybox3').each(function(index, imageContainer) {
var imageSrc = $(imageContainer).attr('href');
var imageThumbSrc;
if ($('.top-dropdown option:selected').html() == instagramBtnName || $('.top-dropdown option:selected').html() == facebookBtnName) {
imageThumbSrc = $(imageContainer).find('.img_wrapper').data('thumbnail-url');
} else if ($(window).width() > 1025 && $('.nested-gst.selected').length > 0 && $('.nested-gst.selected').html() == instagramBtnName || $('.nested-gst.selected').html() == facebookBtnName) {
imageThumbSrc = $(imageContainer).find('.img_wrapper').data('thumbnail-url');
} else {
$(imageContainer).attr('href', imageSrc.replace(imageSize, fullImageSizeString));
imageThumbSrc = imageSrc.replace('dimg', 'dimg-crop').replace(fullImageSizeString, thumbImageSizeString).replace(imageSize, thumbImageSizeString);
var imageThumbAltText = $(imageContainer).find('.img_wrapper meta[itemprop="name"]').attr('content');
}
$(imageContainer).find('.img_wrapper').css('background-image', 'url(' + imageThumbSrc.replace(imageSize, $(window).width() + 'x' + $(window).height()) + ')');
$(imageContainer).addClass('fancybox3');
$(imageContainer).click(function(e, isFromPlayButton){
if (!isFromPlayButton){
var imageId = $(this).data('mediaid');
f_analyticsSendEvent('gallery', 'click-gallery-image', imageId.toString());
}
});
});
var minHeight = 0;
$('.photolist img:visible').each(function() {
if ($(this).height() > minHeight)
minHeight = $(this).height();
});
$('.gallerySquareContainer .img_wrapper img').css('min-height', minHeight);
var gallery_tab = $('#photoList' + galleryIndex);
f_createPaginationGallerySquares(gallery_tab, defaultColumnCount);
}
function f_convertMosaicImages(fullImageSizeString, thumbImageSizeString) {
var galleryIndex = 0;
if ($('.nested-gst').length > 0 && $('.nested-gst:visible').length > 0)
galleryIndex = $('.nested-gst.selected').attr('data-index');
else
galleryIndex = $('.top-dropdown option:selected').attr('data-index');
$('#grid' + galleryIndex + ' .mosaic-img').each(function() {
var url = $(this).find('meta[itemprop="contentUrl"]').attr('content');
$(this).css('background-image', 'url(' + url.replace(imageSize, $(window).width() + 'x' + $(window).height()) + ')');
});
$('#grid' + galleryIndex + ' a.fancybox3').each(function(index, imageContainer) {
var imageSrc = $(imageContainer).attr('href');
var imageThumbSrc;
if ($('.top-dropdown option:selected').html() == instagramBtnName || $('.top-dropdown option:selected').html() == facebookBtnName) {
imageThumbSrc = $(imageContainer).find('.img_wrapper').data('thumbnail-url');
} else if ($('.nested-gst.selected').length > 0 && $('.nested-gst.selected').html() == instagramBtnName || $('.nested-gst.selected').html() == facebookBtnName) {
imageThumbSrc = $(imageContainer).find('.img_wrapper').data('thumbnail-url');
} else {
$(imageContainer).attr('href', imageSrc.replace(imageSize, fullImageSizeString));
imageThumbSrc = imageSrc.replace('dimg', 'dimg-crop').replace(fullImageSizeString, thumbImageSizeString).replace(imageSize, thumbImageSizeString);
var imageThumbAltText = $(imageContainer).find('.img_wrapper meta[itemprop="name"]').attr('content');
}
$(imageContainer).find('.img_wrapper').html('

');
$(imageContainer).addClass('fancybox3');
$(imageContainer).click(function(e, isFromPlayButton){
if (!isFromPlayButton){
var imageId = $(this).data('mediaid');
f_analyticsSendEvent('gallery', 'click-gallery-image', imageId.toString());
}
});
});
var gallery_tab = $('#grid' + galleryIndex);
f_createPaginationGallerySquares(gallery_tab, 'mosaic');
}
function f_createPaginationGallerySquares(gallery_tab, defaultColumnCount) {
var gallery_tab_selector = '#' + gallery_tab.attr('id');
var galleryCount = 0;
$(gallery_tab_selector + ' .pagination-item').each(function () {
galleryCount++;
});
// If there is no need for the pagination don't create pagination
if (itemsPerPageGallery == 'false' || itemsPerPageGallery >= galleryCount) {
return;
}
// Create Pagination
else {
$(gallery_tab).attr('data-page', '');
$(gallery_tab_selector + ' .div-list-pagination-bot-gallery').remove();
var pageNum = (itemsPerPageGallery == '1' ? 0 : 1);
if (itemsPerPageGallery == '0')
return;
else {
$(gallery_tab_selector + ' .pagination-item').each(function (i, v) {
// Increment page number whenever in a new page
if (itemsPerPageGallery == '1' || (i + 1 > itemsPerPageGallery && (i + 1) % itemsPerPageGallery == 1))
pageNum++;
$(v).attr('data-page', pageNum);
});
if (pageNum > 1) {
var botPaginationHtml = '';
$(gallery_tab).append(botPaginationHtml);
f_loadPageGallerySquares('1', gallery_tab);
}
}
}
}
function f_loadPageGallerySquares(pageNum, elm) {
if ($(elm).hasClass('pagination-parent')) {
elmId = $(elm).attr('id');
}
else {
elmId = $(elm).parents('.pagination-parent').attr('id');
}
var gallery_tab_selector = '#' + elmId;
$(gallery_tab_selector + ' .pagination-item').hide();
$(gallery_tab_selector + ' .pagination-item[data-page="' + pageNum + '"]').show();
if ($(gallery_tab_selector).hasClass('grid')) {
var $grid = $(gallery_tab_selector).masonry({
initLayout: true,
itemSelector: '.grid-item',
columnWidth: '.grid-sizer',
percentPosition: true
});
// bind event
$grid.masonry( 'on', 'layoutComplete', function() {
console.log('layout is complete');
});
// trigger initial layout
$grid.masonry();
}
$(gallery_tab_selector + ' .list-pagination-gallery li').removeClass('active-page');
$(gallery_tab_selector + ' .list-pagination-gallery li[data-page="' + pageNum + '"]').addClass('active-page');
$(gallery_tab_selector + ' .list-pagination-gallery li').show();
$(gallery_tab_selector + ' .list-pagination-gallery li').each(function (i, v) {
if (parseInt($(v).attr('data-page')) > (parseInt(pageNum) + 3) || parseInt($(v).attr('data-page')) < (parseInt(pageNum) - 3))
$(v).hide();
});
if ($(gallery_tab_selector + ' .pagination-item[data-page="' + (parseInt(pageNum) + 1) + '"]').length == 0)
$(gallery_tab_selector + ' .list-pagination-gallery li:last-child').hide();
if ($(gallery_tab_selector + ' .pagination-item[data-page="' + (parseInt(pageNum) - 1) + '"]').length == 0)
$(gallery_tab_selector + ' .list-pagination-gallery li:first-child').hide();
}
function f_nextPageGallerySquares(elm) {
var gallery_tab_selector = '#' + $(elm).parents('.pagination-parent').attr('id');
var currentPage = $(gallery_tab_selector + ' .pagination-item:visible').first().attr('data-page');
if ($(gallery_tab_selector + ' .pagination-item[data-page="' + (parseInt(currentPage) + 1) + '"]').length > 0)
f_loadPageGallerySquares(parseInt(currentPage) + 1, gallery_tab_selector);
}
function f_previousPageGallerySquares(elm) {
var gallery_tab_selector = '#' + $(elm).parents('.pagination-parent').attr('id');
var currentPage = $(gallery_tab_selector + ' .pagination-item:visible').first().attr('data-page');
if ($(gallery_tab_selector + ' .pagination-item[data-page="' + (parseInt(currentPage) - 1) + '"]').length > 0)
f_loadPageGallerySquares(parseInt(currentPage) - 1, gallery_tab_selector);
}
function f_resize() {
$('.gallerySquareContainer .img_wrapper img').css('min-height', 0);
if (nestedGalleryLocation == 'side' && $(window).width() < 1025) {
$('.photolist').removeClass('nested-side');
$('.photolist').addClass('nested-top');
} else if(nestedGalleryLocation == 'side') {
$('.photolist').addClass('nested-side');
$('.photolist').removeClass('nested-top');
}
if ($(window).width() < 1025 && $('.top-dropdown option').length > 1)
$('.top-dropdown').removeClass('hide-dropdown');
if ($(window).width() > 1025 && nestedGalleryLocation != 'dropdown')
$('.top-dropdown').addClass('hide-dropdown');
if ($(window).width() < 768 && $('.headerButton.selected').attr('data-columns') == 'mosaic') {
if (p_lt_zonePagePlaceholder_pageplaceholder_p_lt_zoneWidget_WebPartLoader_ctl00_GalleryContainer.defaultView.toLowerCase() == '4')
$('.headerButton.column4').click();
else
$('.headerButton.column3').click();
}
var minHeight = 0;
$('.photolist img:visible').each(function() {
if ($(this).height() > minHeight)
minHeight = $(this).height();
});
$('.gallerySquareContainer .img_wrapper img').css('min-height', minHeight);
}