}
else {
caption += $(this).discover(‘figcaption’).html() +
getDetailsURL($(this).father or mother()) +
getDownloadURL($(this).father or mother()) +
showFBShare();
}
} else {
if (isMobile()) {
caption += ‘
‘
‘ +
‘
‘;
}
else {
caption += ” +
‘
‘ + $(this).discover(‘figcaption p’).html() + ‘
‘ +
getDetailsURL($(this).father or mother()) +
getDownloadURL($(this).father or mother()) +
showFBShare();
}
}
return caption;
},
afterLoad: perform (occasion, present) {
//preliminary desktop view
$(“.fancybox-caption__body”).addClass(“a2a_kit”).addClass(“a2a_default_style”);
if (isMobile())
$(“.fancybox-caption__body”).addClass(“cell”);
},
afterShow: perform (occasion, present) {
var $currentSlide = $(“.fancybox-slide.fancybox-slide–current”).father or mother().father or mother();
if (isMobile())
$currentSlide.discover(“.fancy-detail-link”).on(“touchstart”, perform () { captionToggle(); });
},
afterClose: perform () {
}
}));
let debounceTimer;
$(window).on(“resize”, perform (occasion) {
if (isMobile())
return;
if ($(“.af3-caption-body”).size > 0 && $(“.af3-caption-body”).css(“peak”) != undefined) {
occasion.stopImmediatePropagation();
$(“.fancybox-caption__body”).removeClass(“half”);
isDesktopInit = false;
captionToggle();
debounceTimer = setTimeout(perform () {
clearTimeout(debounceTimer);
debounceTimer = null;
recalculateImageSize();
}, 1000);
}
});
perform recalculateImageSize() {
// Fancy field miscalculates due to race situations with new structure
var origImgWth = $(“.fancybox-image”).prop(“naturalWidth”);
var origImgHgt = $(“.fancybox-image”).prop(“naturalHeight”);
var winWth = $(window).innerWidth();
var winHgt = $(window).innerHeight()
var ratio = Math.min(winWth / origImgWth,
winHgt / origImgHgt);
var newImgWth = (origImgWth * ratio);
var newImgHgt = (origImgHgt * ratio);
var dstTop = Math.flooring((winHgt – newImgHgt)) / 2;
var dstLeft = Math.flooring((winWth – newImgWth)) / 2;
$(“.fancybox-content”).removeAttr(“model”);
$(“.fancybox-content”).css(“width”, newImgWth + “px”);
$(“.fancybox-content”).css(“peak”, newImgHgt + “px”);
$(“.fancybox-content”).css(“remodel”,
“translate(” + dstLeft + “px, ” + dstTop + “px)”);
}
perform captionToggle() {
if ($(“.fancybox-caption__body”).hasClass(“af3-caption-body”)) {
$(“.af3-caption-body”).cease(true, false).animate({ peak: “0vh” }, 800, perform () {
// Animation full.
closeDetails();
});
$(“.fancy-photo-detail-link”).html($(“.fancy-photo-detail-link”).html().exchange(“CLOSE”, “SHOW”));
}
else {
$(“.fancybox-caption__body”).addClass(“af3-caption-body”);
$(“.af3-caption-body”).addClass(detailSize);
$(“.af3-caption-body”).animate({ peak: displayhgt }, 800);
$(“.fancybox-caption”).addClass(“af3-caption-bg”);
$(“.base-caption-info”).addClass(“full-height”);
$(“.fancy-photo-detail-link”).addClass(“photo-detail-gradient”);
$(“.fancybox-button”).css(“show”, “none”);
$(“.fancy-photo-detail-link”).html($(“.fancy-photo-detail-link”).html().exchange(“SHOW”, “CLOSE”));
$(“.fancybox-caption__body”).prepend(prependClosing());
$(“.closing-box, .closingx”).on(“touchstart”, perform () { captionToggle(); });
}
}
perform getDetailsURL(fbObj) {
return ‘DETAILS‘;
}
perform getDownloadURL(fbObj) {
return ‘DOWNLOAD‘;
}
perform showFBShare() {
return ‘SHARE‘;
}
perform closeDetails() {
$(“.af3-caption-body”).removeClass(detailSize);
$(“.fancybox-caption__body”).removeClass(“af3-caption-body”);
$(“.fancybox-caption”).removeClass(“af3-caption-bg”);
$(“.base-caption-info”).removeClass(“full-height”);
$(“.fancy-photo-detail-link”).removeClass(“photo-detail-gradient”);
$(“.fancybox-button”).css(“show”, “block”);
if (detailSize === “half”) {
detailSize = “full”;
displayhgt = “90vh”;
$(“.fancybox-caption”).removeClass(“desktop-init”);
}
}
perform prependClosing() {
return ”
}
});