diff --git a/dist/jquery.fancybox.css b/dist/jquery.fancybox.css index 7fee589e..c5f28e13 100644 --- a/dist/jquery.fancybox.css +++ b/dist/jquery.fancybox.css @@ -1,6 +1,5 @@ body.compensate-for-scrollbar { - overflow: hidden; - -ms-overflow-style: none; } + overflow: hidden; } .fancybox-active { height: auto; } @@ -100,8 +99,8 @@ body.compensate-for-scrollbar { .fancybox-stage { direction: ltr; overflow: visible; - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); + -webkit-transform: translateZ(0); + transform: translateZ(0); z-index: 99994; } .fancybox-is-open .fancybox-stage { @@ -109,7 +108,7 @@ body.compensate-for-scrollbar { .fancybox-slide { -webkit-backface-visibility: hidden; - backface-visibility: hidden; + /* Using without prefix would break IE11 */ display: none; height: 100%; left: 0; @@ -145,11 +144,9 @@ body.compensate-for-scrollbar { z-index: 99995; } .fancybox-slide--image { + overflow: hidden; padding: 44px 0 0 0; } -.fancybox-slide--image { - overflow: visible; } - .fancybox-slide--image::before { display: none; } @@ -172,7 +169,6 @@ body.compensate-for-scrollbar { -webkit-animation-timing-function: cubic-bezier(0.5, 0, 0.14, 1); animation-timing-function: cubic-bezier(0.5, 0, 0.14, 1); -webkit-backface-visibility: hidden; - backface-visibility: hidden; background: transparent; background-repeat: no-repeat; background-size: 100% 100%; @@ -286,11 +282,13 @@ body.compensate-for-scrollbar { background: rgba(30, 30, 30, 0.6); border: 0; border-radius: 0; + box-shadow: none; cursor: pointer; display: inline-block; height: 44px; margin: 0; padding: 10px; + position: relative; transition: color .2s; vertical-align: top; visibility: inherit; @@ -337,6 +335,25 @@ body.compensate-for-scrollbar { .fancybox-button--fsexit svg:nth-child(1) { display: none; } +.fancybox-progress { + background: #ff5268; + height: 2px; + left: 0; + position: absolute; + right: 0; + top: 0; + -webkit-transform: scaleX(0); + -ms-transform: scaleX(0); + transform: scaleX(0); + -webkit-transform-origin: 0; + -ms-transform-origin: 0; + transform-origin: 0; + transition-property: -webkit-transform; + transition-property: transform; + transition-property: transform, -webkit-transform; + transition-timing-function: linear; + z-index: 99998; } + /* Close button on the top right corner of html content */ .fancybox-close-small { background: transparent; @@ -434,37 +451,31 @@ body.compensate-for-scrollbar { /* Loading indicator */ .fancybox-loading { - -webkit-animation: fancybox-rotate .8s infinite linear; - animation: fancybox-rotate .8s infinite linear; + -webkit-animation: fancybox-rotate 1s linear infinite; + animation: fancybox-rotate 1s linear infinite; background: transparent; - border: 6px solid rgba(100, 100, 100, 0.5); - border-radius: 100%; - border-top-color: #fff; - height: 60px; + border: 4px solid #888; + border-bottom-color: #fff; + border-radius: 50%; + height: 50px; left: 50%; - margin: -30px 0 0 -30px; - opacity: .6; + margin: -25px 0 0 -25px; + opacity: .7; padding: 0; position: absolute; top: 50%; - width: 60px; + width: 50px; z-index: 99999; } @-webkit-keyframes fancybox-rotate { - from { - -webkit-transform: rotate(0deg); - transform: rotate(0deg); } - to { - -webkit-transform: rotate(359deg); - transform: rotate(359deg); } } + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); } } @keyframes fancybox-rotate { - from { - -webkit-transform: rotate(0deg); - transform: rotate(0deg); } - to { - -webkit-transform: rotate(359deg); - transform: rotate(359deg); } } + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); } } /* Transition effects */ .fancybox-animated { @@ -664,7 +675,7 @@ body.compensate-for-scrollbar { /* Thumbs */ .fancybox-thumbs { - background: #fff; + background: #ddd; bottom: 0; display: none; margin: 0; @@ -737,7 +748,7 @@ body.compensate-for-scrollbar { width: 100px; } .fancybox-thumbs__list a::before { - border: 4px solid #4ea7f9; + border: 6px solid #ff5268; bottom: 0; content: ''; left: 0; diff --git a/dist/jquery.fancybox.js b/dist/jquery.fancybox.js index 914477a0..e456d124 100644 --- a/dist/jquery.fancybox.js +++ b/dist/jquery.fancybox.js @@ -1,5 +1,5 @@ // ================================================== -// fancyBox v3.4.1 +// fancyBox v3.4.2 // // Licensed GPLv3 for open source use // or fancyBox Commercial License for commercial use @@ -70,7 +70,7 @@ buttons: [ "zoom", //"share", - //"slideShow", + "slideShow", //"fullScreen", //"download", "thumbs", @@ -108,7 +108,7 @@ iframe: { // Iframe template tpl: - '', + '', // Preload iframe before displaying it // This allows to calculate iframe content width and height @@ -477,6 +477,51 @@ return rez; }; + // How much of an element is visible in viewport + // ============================================= + + var inViewport = function($el) { + var element = $el[0], + elementRect = element.getBoundingClientRect(), + parentRects = [], + visibleInAllParents, + windowHeight = $(window).height(), + pageScroll = $(document).scrollTop(), + elementTop = elementRect.top + pageScroll, + hiddenBefore = pageScroll - elementTop, + hiddenAfter = elementTop + elementRect.height - (pageScroll + windowHeight); + + // Check if the parent can hide its children + while (element.parentElement !== null) { + if ($(element.parentElement).css("overflow") === "hidden" || $(element.parentElement).css("overflow") === "auto") { + parentRects.push(element.parentElement.getBoundingClientRect()); + } + + element = element.parentElement; + } + + visibleInAllParents = parentRects.every(function(parentRect) { + var visiblePixelX = Math.min(elementRect.right, parentRect.right) - Math.max(elementRect.left, parentRect.left); + var visiblePixelY = Math.min(elementRect.bottom, parentRect.bottom) - Math.max(elementRect.top, parentRect.top); + + return visiblePixelX > 0 && visiblePixelY > 0; + }); + + if (!visibleInAllParents || pageScroll > elementTop + elementRect.height || elementTop > pageScroll + windowHeight) { + return 0; + } + + if (hiddenBefore > 0) { + return 100 - (hiddenBefore * 100) / elementRect.height; + } + + if (hiddenAfter > 0) { + return 100 - (hiddenAfter * 100) / elementRect.height; + } + + return 100; + }; + // Class definition // ================ @@ -527,8 +572,6 @@ var self = this, firstItem = self.group[self.currIndex], firstItemOpts = firstItem.opts, - scrollbarWidth = $.fancybox.scrollbarWidth, - $scrollDiv, $container, buttonStr; @@ -547,18 +590,10 @@ !$.fancybox.isMobile && document.body.scrollHeight > window.innerHeight ) { - if (scrollbarWidth === undefined) { - $scrollDiv = $('
').appendTo("body"); - - scrollbarWidth = $.fancybox.scrollbarWidth = $scrollDiv[0].offsetWidth - $scrollDiv[0].clientWidth; - - $scrollDiv.remove(); - } - $("head").append( - '" + '" ); $("body").addClass("compensate-for-scrollbar"); @@ -779,6 +814,7 @@ // Hide all buttons and disable interactivity for modal items if (obj.opts.modal) { obj.opts = $.extend(true, obj.opts, { + trapFocus: true, // Remove buttons infobar: 0, toolbar: 0, @@ -1012,34 +1048,31 @@ loop, current, previous, - canvasWidth, - transitionProps; + slidePos, + stagePos, + diff; if (self.isDragging || self.isClosing || (self.isAnimating && self.firstRun)) { return; } - pos = parseInt(pos, 10); - // Should loop? + pos = parseInt(pos, 10); loop = self.current ? self.current.opts.loop : self.opts.loop; if (!loop && (pos < 0 || pos >= groupLen)) { return false; } + // Check if opening for the first time; this helps to speed things up firstRun = self.firstRun = !Object.keys(self.slides).length; - if (groupLen < 2 && !firstRun && !!self.isDragging) { - return; - } - + // Create slides previous = self.current; self.prevIndex = self.currIndex; self.prevPos = self.currPos; - // Create slides current = self.createSlide(pos); if (groupLen > 1) { @@ -1060,8 +1093,6 @@ self.updateControls(); - isMoved = self.isMoved(current); - // Validate duration length current.forcedDuration = undefined; @@ -1073,72 +1104,102 @@ duration = parseInt(duration, 10); + // Check if user has swiped the slides or if still animating + isMoved = self.isMoved(previous); + + // Make sure current slide is visible + current.$slide.addClass("fancybox-slide--current"); + // Fresh start - reveal container, current slide and start loading content if (firstRun) { if (current.opts.animationEffect && duration) { self.$refs.container.css("transition-duration", duration + "ms"); } - self.$refs.container.addClass("fancybox-is-open"); - - // Make current slide visible - current.$slide.addClass("fancybox-slide--previous"); + self.$refs.container.addClass("fancybox-is-open").trigger("focus"); // Attempt to load content into slide - // At this point image would start loading, but inline/html content would load immediately + // This will later call `afterLoad` -> `revealContent` self.loadSlide(current); - current.$slide.removeClass("fancybox-slide--previous").addClass("fancybox-slide--current"); - self.preload("image"); - self.$refs.container.trigger("focus"); - return; } + // Get actual slide/stage positions (before cleaning up) + slidePos = $.fancybox.getTranslate(previous.$slide); + stagePos = $.fancybox.getTranslate(self.$refs.stage); + // Clean up all slides $.each(self.slides, function(index, slide) { - // Make sure that animation callback gets fired $.fancybox.stop(slide.$slide, true); - - slide.$slide.removeClass("fancybox-animated").removeClass(function(index, className) { - return (className.match(/(^|\s)fancybox-fx-\S+/g) || []).join(" "); - }); }); - // Make current slide visible even if content is still loading - current.$slide.removeClass("fancybox-slide--next fancybox-slide--previous").addClass("fancybox-slide--current"); + if (previous.pos !== current.pos) { + previous.isComplete = false; + + previous.$slide.removeClass("fancybox-slide--complete fancybox-slide--current"); + } - // If slides have been dragged, animate them to correct position + // If slides are out of place, then animate them to correct position if (isMoved) { - canvasWidth = Math.round(current.$slide.width()); + // Calculate horizontal swipe distance + diff = slidePos.left - (previous.pos * slidePos.width + previous.pos * previous.opts.gutter); $.each(self.slides, function(index, slide) { - var pos = slide.pos - current.pos; + // Make sure that each slide is in equal distance + // This is mostly needed for freshly added slides, because they are not yet positioned + var leftPos = slide.pos * slidePos.width + slide.pos * slide.opts.gutter; - $.fancybox.animate( - slide.$slide, - { - top: 0, - left: pos * canvasWidth + pos * slide.opts.gutter - }, - duration, - function() { - slide.$slide.removeAttr("style").removeClass("fancybox-slide--next fancybox-slide--previous"); + $.fancybox.setTranslate(slide.$slide, {top: 0, left: leftPos + diff - stagePos.left}); + + if (slide.pos !== current.pos) { + slide.$slide.addClass("fancybox-slide--" + (slide.pos > current.pos ? "next" : "previous")); + } + + // Redraw to make sure that transition will start + forceRedraw(slide.$slide); + + // Animate the slide + requestAFrame(function() { + $.fancybox.animate( + slide.$slide, + { + top: 0, + left: (slide.pos - current.pos) * slidePos.width + (slide.pos - current.pos) * slide.opts.gutter + }, + duration, + function() { + slide.$slide.removeAttr("style").removeClass("fancybox-slide--next fancybox-slide--previous"); - if (slide.pos === self.currPos) { - self.complete(); + if (slide.pos === self.currPos) { + self.complete(); + } } - } - ); + ); + }); }); } else { - self.$refs.stage.children().removeAttr("style"); - } + current.$slide + .parent() + .children() + .removeAttr("style"); - // Start transition that reveals current content - // or wait when it will be loaded + // Handle previously active slide + if (duration && current.opts.transitionEffect) { + $.fancybox.animate( + previous.$slide, + "fancybox-animated fancybox-slide--" + + (previous.pos > current.pos ? "next" : "previous") + + " fancybox-fx-" + + current.opts.transitionEffect, + duration, + null, + false + ); + } + } if (current.isLoaded) { self.revealContent(current); @@ -1147,31 +1208,6 @@ } self.preload("image"); - - if (previous.pos === current.pos) { - return; - } - - // Handle previously active slide - // ============================== - - transitionProps = "fancybox-slide--" + (previous.pos > current.pos ? "next" : "previous"); - - previous.$slide.removeClass("fancybox-slide--complete fancybox-slide--current fancybox-slide--next fancybox-slide--previous"); - - previous.isComplete = false; - - if (!duration || (!isMoved && !current.opts.transitionEffect)) { - return; - } - - if (isMoved) { - previous.$slide.addClass(transitionProps); - } else { - transitionProps = "fancybox-animated " + transitionProps + " fancybox-fx-" + current.opts.transitionEffect; - - $.fancybox.animate(previous.$slide, transitionProps, duration, null, false); - } }, // Create new "slide" element @@ -1366,9 +1402,17 @@ minRatio = Math.min(1, maxWidth / width, maxHeight / height); - // Use floor rounding to make sure it really fits - width = Math.floor(minRatio * width); - height = Math.floor(minRatio * height); + width = minRatio * width; + height = minRatio * height; + + // Adjust width/height to precisely fit into container + if (width > maxWidth - 0.5) { + width = maxWidth; + } + + if (height > maxHeight - 0.5) { + height = maxHeight; + } if (slide.type === "image") { rez.top = Math.floor((maxHeight - height) * 0.5) + parseFloat($slide.css("paddingTop")); @@ -1453,7 +1497,17 @@ opacity: 1 }, duration === undefined ? 0 : duration, - null, + function() { + // Clean up other slides + slide.$slide + .siblings() + .removeAttr("style") + .removeClass("fancybox-slide--previous fancybox-slide--next"); + + if (!slide.isComplete) { + self.complete(); + } + }, false ); } @@ -1464,9 +1518,20 @@ isMoved: function(slide) { var current = slide || this.current, - currentPos = $.fancybox.getTranslate(current.$slide); + slidePos, + stagePos; + + if (!current) { + return false; + } + + stagePos = $.fancybox.getTranslate(this.$refs.stage); + slidePos = $.fancybox.getTranslate(current.$slide); - return (currentPos.left !== 0 || currentPos.top !== 0) && !current.$slide.hasClass("fancybox-animated"); + return ( + (Math.abs(slidePos.top - stagePos.top) > 0 || Math.abs(slidePos.left - stagePos.left) > 0) && + !current.$slide.hasClass("fancybox-animated") + ); }, // Update cursor style depending if content can be zoomed @@ -1475,15 +1540,15 @@ updateCursor: function(nextWidth, nextHeight) { var self = this, current = self.current, - $container = self.$refs.container.removeClass( - "fancybox-is-zoomable fancybox-can-zoomIn fancybox-can-zoomOut fancybox-can-swipe fancybox-can-pan" - ), + $container = self.$refs.container, isZoomable; - if (!current || self.isClosing) { + if (!current || self.isClosing || !self.Guestures) { return; } + $container.removeClass("fancybox-is-zoomable fancybox-can-zoomIn fancybox-can-zoomOut fancybox-can-swipe fancybox-can-pan"); + isZoomable = self.isZoomable(); $container.toggleClass("fancybox-is-zoomable", isZoomable); @@ -1586,7 +1651,11 @@ slide.isLoading = true; - self.trigger("beforeLoad", slide); + if (self.trigger("beforeLoad", slide) === false) { + slide.isLoading = false; + + return false; + } type = slide.type; $slide = slide.$slide; @@ -1677,13 +1746,15 @@ windowWidth; // Check if need to show loading icon - slide.timouts = setTimeout(function() { - var $img = slide.$image; + requestAFrame(function() { + requestAFrame(function() { + var $img = slide.$image; - if (slide.isLoading && (!$img || !$img.length || !$img[0].complete) && !slide.hasError) { - self.showLoading(slide); - } - }, 350); + if (!self.isClosing && slide.isLoading && (!$img || !$img.length || !$img[0].complete) && !slide.hasError) { + self.showLoading(slide); + } + }); + }); // If we have "srcset", then we need to find first matching "src" value. // This is necessary, because when you set an src attribute, the browser will preload the image @@ -1797,12 +1868,6 @@ self.afterLoad(slide); } - // Clear timeout that checks if loading icon needs to be displayed - if (slide.timouts) { - clearTimeout(slide.timouts); - slide.timouts = null; - } - if (self.isClosing) { return; } @@ -1922,24 +1987,21 @@ $content.css({ width: "100%", - height: "" + "max-width": "100%", + height: "9999px" }); if (frameWidth === undefined) { frameWidth = Math.ceil(Math.max($body[0].clientWidth, $body.outerWidth(true))); } - if (frameWidth) { - $content.width(frameWidth); - } + $content.css("width", frameWidth ? frameWidth : "").css("max-width", ""); if (frameHeight === undefined) { frameHeight = Math.ceil(Math.max($body[0].clientHeight, $body.outerHeight(true))); } - if (frameHeight) { - $content.height(frameHeight); - } + $content.css("height", frameHeight ? frameHeight : ""); $slide.css("overflow", "auto"); } @@ -1968,6 +2030,7 @@ .empty(); slide.isLoaded = false; + slide.isRevealed = false; }); }, @@ -2114,7 +2177,10 @@ slide = slide || self.current; if (slide && !slide.$spinner) { - slide.$spinner = $(self.translate(self, self.opts.spinnerTpl)).appendTo(slide.$slide); + slide.$spinner = $(self.translate(self, self.opts.spinnerTpl)) + .appendTo(slide.$slide) + .hide() + .fadeIn(); } }, @@ -2127,7 +2193,7 @@ slide = slide || self.current; if (slide && slide.$spinner) { - slide.$spinner.remove(); + slide.$spinner.stop().remove(); delete slide.$spinner; } @@ -2195,10 +2261,6 @@ duration, opacity; - if (isMoved && isRevealed) { - return; - } - slide.isRevealed = true; effect = slide.opts[self.firstRun ? "animationEffect" : "transitionEffect"]; @@ -2209,7 +2271,7 @@ // Do not animate if revealing the same slide if (slide.pos === self.currPos) { if (slide.isComplete) { - effect = false; + //effect = false; } else { self.isAnimating = true; } @@ -2249,8 +2311,6 @@ // Draw image at start position $.fancybox.setTranslate(slide.$content.removeClass("fancybox-is-hidden"), start); - forceRedraw(slide.$content); - // Start animation $.fancybox.animate(slide.$content, end, duration, function() { self.isAnimating = false; @@ -2266,17 +2326,10 @@ // Simply show content if no effect // ================================ if (!effect) { - forceRedraw($slide); + slide.$content.removeClass("fancybox-is-hidden"); - if (!isRevealed) { - slide.$content - .removeClass("fancybox-is-hidden") - .hide() - .fadeIn("fast"); - } - - if (slide.pos === self.currPos) { - self.complete(); + if (!isRevealed && isMoved && slide.type === "image" && !slide.hasError) { + slide.$content.hide().fadeIn("fast"); } return; @@ -2288,15 +2341,12 @@ effectClassName = "fancybox-animated fancybox-slide--" + (slide.pos >= self.prevPos ? "next" : "previous") + " fancybox-fx-" + effect; - $slide - .removeAttr("style") - .removeClass("fancybox-slide--current fancybox-slide--next fancybox-slide--previous") - .addClass(effectClassName); + $slide.removeClass("fancybox-slide--current").addClass(effectClassName); slide.$content.removeClass("fancybox-is-hidden"); // Force reflow - forceRedraw($slide); + $slide.hide().show(0); $.fancybox.animate( $slide, @@ -2323,38 +2373,7 @@ thumbPos = $thumb && $thumb.length && $thumb[0].ownerDocument === document ? $thumb.offset() : 0, slidePos; - // Check if element is inside the viewport by at least 1 pixel - var isElementVisible = function($el) { - var element = $el[0], - elementRect = element.getBoundingClientRect(), - parentRects = [], - visibleInAllParents; - - while (element.parentElement !== null) { - if ($(element.parentElement).css("overflow") === "hidden" || $(element.parentElement).css("overflow") === "auto") { - parentRects.push(element.parentElement.getBoundingClientRect()); - } - - element = element.parentElement; - } - - visibleInAllParents = parentRects.every(function(parentRect) { - var visiblePixelX = Math.min(elementRect.right, parentRect.right) - Math.max(elementRect.left, parentRect.left); - var visiblePixelY = Math.min(elementRect.bottom, parentRect.bottom) - Math.max(elementRect.top, parentRect.top); - - return visiblePixelX > 0 && visiblePixelY > 0; - }); - - return ( - visibleInAllParents && - elementRect.bottom > 0 && - elementRect.right > 0 && - elementRect.left < $(window).width() && - elementRect.top < $(window).height() - ); - }; - - if (thumbPos && isElementVisible($thumb)) { + if (thumbPos && inViewport($thumb) >= 10) { slidePos = self.$refs.stage.offset(); rez = { @@ -2421,7 +2440,8 @@ current.$slide .find("video,audio") .filter(":visible:first") - .trigger("play"); + .trigger("play") + .on("ended", $.proxy(self.next, self)); } // Try to focus on the first focusable element @@ -2593,10 +2613,6 @@ // If there are multiple instances, they will be set again by "activate" method self.removeEvents(); - if (current.timouts) { - clearTimeout(current.timouts); - } - $content = current.$content; effect = current.opts.animationEffect; duration = $.isNumeric(d) ? d : effect ? current.opts.animationDuration : 0; @@ -2848,7 +2864,7 @@ }); $.fancybox = { - version: "3.4.1", + version: "3.4.2", defaults: defaults, // Get current instance and execute a command. @@ -2980,7 +2996,9 @@ } if (props.scaleX !== undefined && props.scaleY !== undefined) { - str = (str.length ? str + " " : "") + "scale(" + props.scaleX + ", " + props.scaleY + ")"; + str += " scale(" + props.scaleX + ", " + props.scaleY + ")"; + } else if (props.scaleX !== undefined) { + str += " scaleX(" + props.scaleX + ")"; } if (str.length) { @@ -3006,7 +3024,8 @@ // ============================= animate: function($el, to, duration, callback, leaveAnimationName) { - var final = false, + var self = this, + final = false, from; if ($.isFunction(duration)) { @@ -3018,7 +3037,7 @@ $el.removeAttr("style"); } - $.fancybox.stop($el); + self.stop($el); $el.on(transitionEnd, function(e) { // Skip events from child elements and z-index change @@ -3026,10 +3045,10 @@ return; } - $.fancybox.stop($el); + self.stop($el); if (final) { - $.fancybox.setTranslate($el, final); + self.setTranslate($el, final); } if ($.isNumeric(duration)) { @@ -3242,32 +3261,7 @@ (function($) { "use strict"; - // Formats matching url to final form - - var format = function(url, rez, params) { - if (!url) { - return; - } - - params = params || ""; - - if ($.type(params) === "object") { - params = $.param(params, true); - } - - $.each(rez, function(key, value) { - url = url.replace("$" + key, value || ""); - }); - - if (params.length) { - url += (url.indexOf("?") > 0 ? "&" : "?") + params; - } - - return url; - }; - // Object containing properties for each media type - var defaults = { youtube: { matcher: /(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*))(.*)/i, @@ -3295,8 +3289,7 @@ show_title: 1, show_byline: 1, show_portrait: 0, - fullscreen: 1, - api: 1 + fullscreen: 1 }, paramPlace: 3, type: "iframe", @@ -3342,6 +3335,29 @@ } }; + // Formats matching url to final form + var format = function(url, rez, params) { + if (!url) { + return; + } + + params = params || ""; + + if ($.type(params) === "object") { + params = $.param(params, true); + } + + $.each(rez, function(key, value) { + url = url.replace("$" + key, value || ""); + }); + + if (params.length) { + url += (url.indexOf("?") > 0 ? "&" : "?") + params; + } + + return url; + }; + $(document).on("objectNeedsType.fb", function(e, instance, item) { var url = item.src || "", type = false, @@ -3433,6 +3449,98 @@ item.type = item.opts.defaultType; } }); + + // Load YouTube/Video API on request to detect when video finished playing + var VideoAPILoader = { + youtube: { + src: "https://www.youtube.com/iframe_api", + class: "YT", + loading: false, + loaded: false + }, + + vimeo: { + src: "https://player.vimeo.com/api/player.js", + class: "Vimeo", + loading: false, + loaded: false + }, + + load: function(vendor) { + var _this = this, + script; + + if (this[vendor].loaded) { + setTimeout(function() { + _this.done(vendor); + }); + return; + } + + if (this[vendor].loading) { + return; + } + + this[vendor].loading = true; + + script = document.createElement("script"); + script.type = "text/javascript"; + script.src = this[vendor].src; + + if (vendor === "youtube") { + window.onYouTubeIframeAPIReady = function() { + _this[vendor].loaded = true; + _this.done(vendor); + }; + } else { + script.onload = function() { + _this[vendor].loaded = true; + _this.done(vendor); + }; + } + + document.body.appendChild(script); + }, + done: function(vendor) { + var instance, $el, player; + + if (vendor === "youtube") { + delete window.onYouTubeIframeAPIReady; + } + + instance = $.fancybox.getInstance(); + + if (instance) { + $el = instance.current.$content.find("iframe"); + + if (vendor === "youtube" && YT !== undefined && YT) { + player = new YT.Player($el.attr("id"), { + events: { + onStateChange: function(e) { + if (e.data == 0) { + instance.next(); + } + } + } + }); + } else if (vendor === "vimeo" && Vimeo !== undefined && Vimeo) { + player = new Vimeo.Player($el); + + player.on("ended", function() { + instance.next(); + }); + } + } + } + }; + + $(document).on({ + "afterShow.fb": function(e, instance, current) { + if (instance.group.length > 1 && (current.contentSource === "youtube" || current.contentSource === "vimeo")) { + VideoAPILoader.load(current.contentSource); + } + } + }); })(jQuery); // ========================================================================== @@ -3622,7 +3730,7 @@ self.startEvent = e; - self.canTap = true; + self.canTap = !current.$slide.hasClass("fancybox-animated"); self.$target = $target; self.$content = $content; self.opts = current.opts.touch; @@ -3682,8 +3790,6 @@ if (self.canPan) { $.fancybox.stop(self.$content); - self.$content.css("transition-duration", ""); - self.isPanning = true; } else { self.isSwiping = true; @@ -3702,8 +3808,6 @@ $.fancybox.stop(self.$content); - self.$content.css("transition-duration", ""); - self.centerPointStartX = (self.startPoints[0].x + self.startPoints[1].x) * 0.5 - $(window).scrollLeft(); self.centerPointStartY = (self.startPoints[0].y + self.startPoints[1].y) * 0.5 - $(window).scrollTop(); @@ -3765,6 +3869,7 @@ Guestures.prototype.onSwipe = function(e) { var self = this, + instance = self.instance, swiping = self.isSwiping, left = self.sliderStartPos.left || 0, angle; @@ -3775,9 +3880,9 @@ if (Math.abs(self.distance) > 10) { self.canTap = false; - if (self.instance.group.length < 2 && self.opts.vertical) { + if (instance.group.length < 2 && self.opts.vertical) { self.isSwiping = "y"; - } else if (self.instance.isDragging || self.opts.vertical === false || (self.opts.vertical === "auto" && $(window).width() > 800)) { + } else if (instance.isDragging || self.opts.vertical === false || (self.opts.vertical === "auto" && $(window).width() > 800)) { self.isSwiping = "x"; } else { angle = Math.abs((Math.atan2(self.distanceY, self.distanceX) * 180) / Math.PI); @@ -3785,34 +3890,45 @@ self.isSwiping = angle > 45 && angle < 135 ? "y" : "x"; } - self.canTap = false; - if (self.isSwiping === "y" && $.fancybox.isMobile && self.isScrollable) { self.isScrolling = true; return; } - self.instance.isDragging = self.isSwiping; + instance.isDragging = self.isSwiping; // Reset points to avoid jumping, because we dropped first swipes to calculate the angle self.startPoints = self.newPoints; - $.each(self.instance.slides, function(index, slide) { + $.each(instance.slides, function(index, slide) { + var slidePos, stagePos; + $.fancybox.stop(slide.$slide); - slide.$slide.css("transition-duration", ""); + slidePos = $.fancybox.getTranslate(slide.$slide); + stagePos = $.fancybox.getTranslate(instance.$refs.stage); - slide.inTransition = false; + slide.$slide + .removeAttr("style") + .removeClass("fancybox-animated") + .removeClass(function(index, className) { + return (className.match(/(^|\s)fancybox-fx-\S+/g) || []).join(" "); + }); - if (slide.pos === self.instance.current.pos) { - self.sliderStartPos.left = $.fancybox.getTranslate(slide.$slide).left - $.fancybox.getTranslate(self.instance.$refs.stage).left; + if (slide.pos === instance.current.pos) { + self.sliderStartPos.left = slidePos.left - stagePos.left; } + + $.fancybox.setTranslate(slide.$slide, { + top: slidePos.top - stagePos.top, + left: slidePos.left - stagePos.left + }); }); // Stop slideshow - if (self.instance.SlideShow && self.instance.SlideShow.isActive) { - self.instance.SlideShow.stop(); + if (instance.SlideShow && instance.SlideShow.isActive) { + instance.SlideShow.stop(); } } @@ -4040,7 +4156,6 @@ Guestures.prototype.ontouchend = function(e) { var self = this; - var dMs = Math.max(new Date().getTime() - self.startTime, 1); var swiping = self.isSwiping; var panning = self.isPanning; @@ -4048,6 +4163,7 @@ var scrolling = self.isScrolling; self.endPoints = getPointerXY(e); + self.dMs = Math.max(new Date().getTime() - self.startTime, 1); self.$container.removeClass("fancybox-is-grabbing"); @@ -4072,13 +4188,11 @@ return self.onTap(e); } - self.speed = 366; + self.speed = 100; // Speed in px/ms - self.velocityX = (self.distanceX / dMs) * 0.5; - self.velocityY = (self.distanceY / dMs) * 0.5; - - self.speedX = Math.max(self.speed * 0.5, Math.min(self.speed * 1.5, (1 / Math.abs(self.velocityX)) * self.speed)); + self.velocityX = (self.distanceX / self.dMs) * 0.5; + self.velocityY = (self.distanceY / self.dMs) * 0.5; if (panning) { self.endPanning(); @@ -4094,7 +4208,11 @@ Guestures.prototype.endSwiping = function(swiping, scrolling) { var self = this, ret = false, - len = self.instance.group.length; + len = self.instance.group.length, + velocityX = Math.abs(self.velocityX), + distanceX = Math.abs(self.distanceX), + canAdvance = swiping == "x" && len > 1 && ((self.dMs > 130 && distanceX > 10) || distanceX > 50), + speedX = Math.abs((velocityX * self.canvasWidth) / self.canvasWidth) > 0.8 ? 366 : 500; self.sliderLastPos = null; @@ -4111,18 +4229,14 @@ ); ret = self.instance.close(true, 200); - } else if (swiping == "x" && self.distanceX > 50 && len > 1) { - ret = self.instance.previous(self.speedX); - } else if (swiping == "x" && self.distanceX < -50 && len > 1) { - ret = self.instance.next(self.speedX); + } else if (canAdvance && self.distanceX > 0) { + ret = self.instance.previous(speedX); + } else if (canAdvance && self.distanceX < 0) { + ret = self.instance.next(speedX); } if (ret === false && (swiping == "x" || swiping == "y")) { - if (scrolling || len < 2) { - self.instance.centerSlide(self.instance.current, 150); - } else { - self.instance.jumpTo(self.instance.current.index); - } + self.instance.centerSlide(self.instance.current, 150); } self.$container.removeClass("fancybox-is-sliding"); @@ -4131,20 +4245,22 @@ // Limit panning from edges // ======================== Guestures.prototype.endPanning = function() { - var self = this; - var newOffsetX, newOffsetY, newPos; + var self = this, + newOffsetX, + newOffsetY, + newPos; if (!self.contentLastPos) { return; } - if (self.opts.momentum === false) { + if (self.opts.momentum === false || self.dMs > 350) { newOffsetX = self.contentLastPos.left; newOffsetY = self.contentLastPos.top; } else { // Continue movement - newOffsetX = self.contentLastPos.left + self.velocityX * self.speed; - newOffsetY = self.contentLastPos.top + self.velocityY * self.speed; + newOffsetX = self.contentLastPos.left + self.velocityX * 500; + newOffsetY = self.contentLastPos.top + self.velocityY * 500; } newPos = self.limitPosition(newOffsetX, newOffsetY, self.contentStartPos.width, self.contentStartPos.height); @@ -4352,7 +4468,8 @@ }, slideShow: { autoStart: false, - speed: 3000 + speed: 3000, + progress: true } }); @@ -4367,42 +4484,37 @@ $button: null, init: function() { - var self = this; + var self = this, + instance = self.instance, + opts = instance.group[instance.currIndex].opts.slideShow; - self.$button = self.instance.$refs.toolbar.find("[data-fancybox-play]").on("click", function() { + self.$button = instance.$refs.toolbar.find("[data-fancybox-play]").on("click", function() { self.toggle(); }); - if (self.instance.group.length < 2 || !self.instance.group[self.instance.currIndex].opts.slideShow) { + if (instance.group.length < 2 || !opts) { self.$button.hide(); + } else if (opts.progress) { + self.$progress = $('
').appendTo(instance.$refs.inner); } }, set: function(force) { var self = this, instance = self.instance, - current = instance.current, - advance = function() { - if (self.isActive) { - instance.jumpTo((instance.currIndex + 1) % instance.group.length); - } - }; + current = instance.current; // Check if reached last element if (current && (force === true || current.opts.loop || instance.currIndex < instance.group.length - 1)) { - self.timer = setTimeout(function() { - var $video; - - if (self.isActive) { - $video = current.$slide.find("video,audio").filter(":visible:first"); - - if ($video.length) { - $video.one("ended", advance); - } else { - advance(); - } + if (self.isActive && current.contentType !== "video") { + if (self.$progress) { + $.fancybox.animate(self.$progress.show(), {scaleX: 1}, current.opts.slideShow.speed); } - }, current.opts.slideShow.speed); + + self.timer = setTimeout(function() { + instance.jumpTo((instance.currIndex + 1) % instance.group.length); + }, current.opts.slideShow.speed); + } } else { self.stop(); instance.idleSecondsCounter = 0; @@ -4416,11 +4528,15 @@ clearTimeout(self.timer); self.timer = null; + + if (self.$progress) { + self.$progress.removeAttr("style").hide(); + } }, start: function() { - var self = this; - var current = self.instance.current; + var self = this, + current = self.instance.current; if (current) { self.$button @@ -4439,8 +4555,8 @@ }, stop: function() { - var self = this; - var current = self.instance.current; + var self = this, + current = self.instance.current; self.clear(); @@ -4452,6 +4568,10 @@ self.isActive = false; self.instance.trigger("onSlideShowChange", false); + + if (self.$progress) { + self.$progress.removeAttr("style").hide(); + } }, toggle: function() { @@ -4514,8 +4634,8 @@ // Page Visibility API to pause slideshow when window is not active $(document).on("visibilitychange", function() { - var instance = $.fancybox.getInstance(); - var SlideShow = instance && instance.SlideShow; + var instance = $.fancybox.getInstance(), + SlideShow = instance && instance.SlideShow; if (SlideShow && SlideShow.isActive) { if (document.hidden) { @@ -4813,8 +4933,8 @@ list.push( '' : "") + + '"' + + (src && src.length ? ' style="background-image:url(' + src + ')"' : "") + ">" ); }); diff --git a/dist/jquery.fancybox.min.css b/dist/jquery.fancybox.min.css index 7f2fb868..0637c0ef 100644 --- a/dist/jquery.fancybox.min.css +++ b/dist/jquery.fancybox.min.css @@ -1 +1 @@ -body.compensate-for-scrollbar{overflow:hidden;-ms-overflow-style:none}.fancybox-active{height:auto}.fancybox-is-hidden{left:-9999px;margin:0;position:absolute!important;top:-9999px;visibility:hidden}.fancybox-container{-webkit-backface-visibility:hidden;backface-visibility:hidden;height:100%;left:0;outline:none;position:fixed;-webkit-tap-highlight-color:transparent;top:0;-ms-touch-action:manipulation;touch-action:manipulation;-webkit-transform:translateZ(0);transform:translateZ(0);width:100%;z-index:99992}.fancybox-container *{box-sizing:border-box}.fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-stage{bottom:0;left:0;position:absolute;right:0;top:0}.fancybox-outer{-webkit-overflow-scrolling:touch;overflow-y:auto}.fancybox-bg{background:#1e1e1e;opacity:0;transition-duration:inherit;transition-property:opacity;transition-timing-function:cubic-bezier(.47,0,.74,.71)}.fancybox-is-open .fancybox-bg{opacity:.87;transition-timing-function:cubic-bezier(.22,.61,.36,1)}.fancybox-caption,.fancybox-infobar,.fancybox-navigation .fancybox-button,.fancybox-toolbar{direction:ltr;opacity:0;position:absolute;transition:opacity .25s ease,visibility 0s ease .25s;visibility:hidden;z-index:99997}.fancybox-show-caption .fancybox-caption,.fancybox-show-infobar .fancybox-infobar,.fancybox-show-nav .fancybox-navigation .fancybox-button,.fancybox-show-toolbar .fancybox-toolbar{opacity:1;transition:opacity .25s ease 0s,visibility 0s ease 0s;visibility:visible}.fancybox-infobar{color:#ccc;font-size:13px;-webkit-font-smoothing:subpixel-antialiased;height:44px;left:0;line-height:44px;min-width:44px;mix-blend-mode:difference;padding:0 10px;pointer-events:none;top:0;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.fancybox-toolbar{right:0;top:0}.fancybox-stage{direction:ltr;overflow:visible;-webkit-transform:translateZ(0);transform:translateZ(0);z-index:99994}.fancybox-is-open .fancybox-stage{overflow:hidden}.fancybox-slide{-webkit-backface-visibility:hidden;backface-visibility:hidden;display:none;height:100%;left:0;outline:none;overflow:auto;-webkit-overflow-scrolling:touch;padding:44px 44px 0;position:absolute;text-align:center;top:0;transition-property:opacity,-webkit-transform;transition-property:transform,opacity;transition-property:transform,opacity,-webkit-transform;white-space:normal;width:100%;z-index:99994}.fancybox-slide:before{content:"";display:inline-block;font-size:0;height:100%;vertical-align:middle;width:0}.fancybox-is-sliding .fancybox-slide,.fancybox-slide--current,.fancybox-slide--next,.fancybox-slide--previous{display:block}.fancybox-slide--next{z-index:99995}.fancybox-slide--image{padding:44px 0 0;overflow:visible}.fancybox-slide--image:before{display:none}.fancybox-slide--html{padding:6px 6px 0}.fancybox-content{background:#fff;display:inline-block;margin:0 0 44px;max-width:100%;overflow:auto;-webkit-overflow-scrolling:touch;padding:44px;position:relative;text-align:left;vertical-align:middle}.fancybox-slide--image .fancybox-content{-webkit-animation-timing-function:cubic-bezier(.5,0,.14,1);animation-timing-function:cubic-bezier(.5,0,.14,1);-webkit-backface-visibility:hidden;backface-visibility:hidden;background:transparent;background-repeat:no-repeat;background-size:100% 100%;left:0;max-width:none;overflow:visible;padding:0;position:absolute;top:0;-webkit-transform-origin:top left;transform-origin:top left;transition-property:opacity,-webkit-transform;transition-property:transform,opacity;transition-property:transform,opacity,-webkit-transform;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:99995}.fancybox-slide--html .fancybox-content{margin:0 0 6px}.fancybox-can-zoomOut .fancybox-content{cursor:zoom-out}.fancybox-can-zoomIn .fancybox-content{cursor:zoom-in}.fancybox-can-pan .fancybox-content,.fancybox-can-swipe .fancybox-content{cursor:-webkit-grab;cursor:grab}.fancybox-is-grabbing .fancybox-content{cursor:-webkit-grabbing;cursor:grabbing}.fancybox-container [data-selectable=true]{cursor:text}.fancybox-image,.fancybox-spaceball{background:transparent;border:0;height:100%;left:0;margin:0;max-height:none;max-width:none;padding:0;position:absolute;top:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%}.fancybox-spaceball{z-index:1}.fancybox-slide--iframe .fancybox-content,.fancybox-slide--map .fancybox-content,.fancybox-slide--video .fancybox-content{height:calc(100% - 44px);overflow:visible;padding:0;width:100%}.fancybox-slide--video .fancybox-content{background:#000}.fancybox-slide--map .fancybox-content{background:#e5e3df}.fancybox-slide--iframe .fancybox-content{background:#fff}.fancybox-iframe,.fancybox-video{background:transparent;border:0;display:block;height:100%;margin:0;overflow:hidden;padding:0;vertical-align:top;width:100%}.fancybox-error{background:#fff;cursor:default;max-width:400px;padding:40px;width:100%}.fancybox-error p{color:#444;font-size:16px;line-height:20px;margin:0;padding:0}.fancybox-button{background:rgba(30,30,30,.6);border:0;border-radius:0;cursor:pointer;display:inline-block;height:44px;margin:0;padding:10px;transition:color .2s;vertical-align:top;visibility:inherit;width:44px}.fancybox-button,.fancybox-button:link,.fancybox-button:visited{color:#ccc}.fancybox-button:hover{color:#fff}.fancybox-button:focus{outline:none}.fancybox-button.fancybox-focus{outline:1px dotted}.fancybox-button.disabled,.fancybox-button.disabled:hover,.fancybox-button[disabled],.fancybox-button[disabled]:hover{color:#888;cursor:default;outline:none}.fancybox-button svg{display:block;height:100%;overflow:visible;position:relative;width:100%}.fancybox-button svg path{fill:currentColor;stroke-width:0}.fancybox-button--fsenter svg:nth-child(2),.fancybox-button--fsexit svg:nth-child(1),.fancybox-button--pause svg:nth-child(1),.fancybox-button--play svg:nth-child(2){display:none}.fancybox-close-small{background:transparent;border:0;border-radius:0;color:#ccc;cursor:pointer;opacity:.8;padding:8px;position:absolute;right:-12px;top:-44px;z-index:401}.fancybox-close-small:hover{color:#fff;opacity:1}.fancybox-slide--html .fancybox-close-small{color:currentColor;padding:10px;right:0;top:0}.fancybox-is-scaling .fancybox-close-small,.fancybox-is-zoomable.fancybox-can-pan .fancybox-close-small{display:none}.fancybox-navigation .fancybox-button{background:transparent;height:100px;margin:0;opacity:0;position:absolute;top:calc(50% - 50px);width:70px}.fancybox-navigation .fancybox-button div{background:rgba(30,30,30,.6);height:100%;padding:7px}.fancybox-navigation .fancybox-button--arrow_left{left:0;padding:31px 26px 31px 6px}.fancybox-navigation .fancybox-button--arrow_right{padding:31px 6px 31px 26px;right:0}.fancybox-caption{bottom:0;color:#fff;font-size:14px;font-weight:400;left:0;line-height:1.5;padding:25px 44px;right:0}.fancybox-caption:before{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAEtCAQAAABjBcL7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHRJREFUKM+Vk8EOgDAIQ0vj/3+xBw8qIZZueFnIKC90MCAI8DlrkHGeqqGIU6lVigrBtpCWqeRWoHDNqs0F7VNVBVxmHRlvoVqjaYkdnDIaivH2HqZ5+oZj3JUzWB+cOz4G48Bg+tsJ/tqu4dLC/4Xb+0GcF5BwBC0AA53qAAAAAElFTkSuQmCC);background-repeat:repeat-x;background-size:contain;bottom:0;content:"";display:block;left:0;pointer-events:none;position:absolute;right:0;top:-25px;z-index:-1}.fancybox-caption:after{border-bottom:1px solid hsla(0,0%,100%,.3);content:"";display:block;left:44px;position:absolute;right:44px;top:0}.fancybox-caption a,.fancybox-caption a:link,.fancybox-caption a:visited{color:#ccc;text-decoration:none}.fancybox-caption a:hover{color:#fff;text-decoration:underline}.fancybox-loading{-webkit-animation:a .8s infinite linear;animation:a .8s infinite linear;background:transparent;border:6px solid hsla(0,0%,39%,.5);border-radius:100%;border-top-color:#fff;height:60px;left:50%;margin:-30px 0 0 -30px;opacity:.6;padding:0;position:absolute;top:50%;width:60px;z-index:99999}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fancybox-animated{transition-timing-function:cubic-bezier(0,0,.25,1)}.fancybox-fx-slide.fancybox-slide--previous{opacity:0;-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.fancybox-fx-slide.fancybox-slide--next{opacity:0;-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}.fancybox-fx-slide.fancybox-slide--current{opacity:1;-webkit-transform:translateZ(0);transform:translateZ(0)}.fancybox-fx-fade.fancybox-slide--next,.fancybox-fx-fade.fancybox-slide--previous{opacity:0;transition-timing-function:cubic-bezier(.19,1,.22,1)}.fancybox-fx-fade.fancybox-slide--current{opacity:1}.fancybox-fx-zoom-in-out.fancybox-slide--previous{opacity:0;-webkit-transform:scale3d(1.5,1.5,1.5);transform:scale3d(1.5,1.5,1.5)}.fancybox-fx-zoom-in-out.fancybox-slide--next{opacity:0;-webkit-transform:scale3d(.5,.5,.5);transform:scale3d(.5,.5,.5)}.fancybox-fx-zoom-in-out.fancybox-slide--current{opacity:1;-webkit-transform:scaleX(1);transform:scaleX(1)}.fancybox-fx-rotate.fancybox-slide--previous{opacity:0;-webkit-transform:rotate(-1turn);transform:rotate(-1turn)}.fancybox-fx-rotate.fancybox-slide--next{opacity:0;-webkit-transform:rotate(1turn);transform:rotate(1turn)}.fancybox-fx-rotate.fancybox-slide--current{opacity:1;-webkit-transform:rotate(0deg);transform:rotate(0deg)}.fancybox-fx-circular.fancybox-slide--previous{opacity:0;-webkit-transform:scale3d(0,0,0) translate3d(-100%,0,0);transform:scale3d(0,0,0) translate3d(-100%,0,0)}.fancybox-fx-circular.fancybox-slide--next{opacity:0;-webkit-transform:scale3d(0,0,0) translate3d(100%,0,0);transform:scale3d(0,0,0) translate3d(100%,0,0)}.fancybox-fx-circular.fancybox-slide--current{opacity:1;-webkit-transform:scaleX(1) translateZ(0);transform:scaleX(1) translateZ(0)}.fancybox-fx-tube.fancybox-slide--previous{-webkit-transform:translate3d(-100%,0,0) scale(.1) skew(-10deg);transform:translate3d(-100%,0,0) scale(.1) skew(-10deg)}.fancybox-fx-tube.fancybox-slide--next{-webkit-transform:translate3d(100%,0,0) scale(.1) skew(10deg);transform:translate3d(100%,0,0) scale(.1) skew(10deg)}.fancybox-fx-tube.fancybox-slide--current{-webkit-transform:translateZ(0) scale(1);transform:translateZ(0) scale(1)}@media (max-height:576px){.fancybox-slide{padding-left:6px;padding-right:6px}.fancybox-slide--image{padding:6px 0 0}.fancybox-slide--image .fancybox-content{margin-bottom:6px}.fancybox-slide--image .fancybox-close-small{background:#4e4e4e;color:#f2f4f6;height:36px;opacity:1;padding:6px;right:0;top:0;width:36px}}.fancybox-share{background:#f4f4f4;border-radius:3px;max-width:90%;padding:30px;text-align:center}.fancybox-share h1{color:#222;font-size:35px;font-weight:700;margin:0 0 20px}.fancybox-share p{margin:0;padding:0}.fancybox-share__button{border:0;border-radius:3px;display:inline-block;font-size:14px;font-weight:700;line-height:40px;margin:0 5px 10px;min-width:130px;padding:0 15px;text-decoration:none;transition:all .2s;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap}.fancybox-share__button:link,.fancybox-share__button:visited{color:#fff}.fancybox-share__button:hover{text-decoration:none}.fancybox-share__button--fb{background:#3b5998}.fancybox-share__button--fb:hover{background:#344e86}.fancybox-share__button--pt{background:#bd081d}.fancybox-share__button--pt:hover{background:#aa0719}.fancybox-share__button--tw{background:#1da1f2}.fancybox-share__button--tw:hover{background:#0d95e8}.fancybox-share__button svg{height:25px;margin-right:7px;position:relative;top:-1px;vertical-align:middle;width:25px}.fancybox-share__button svg path{fill:#fff}.fancybox-share__input{background:transparent;border:0;border-bottom:1px solid #d7d7d7;border-radius:0;color:#5d5b5b;font-size:14px;margin:10px 0 0;outline:none;padding:10px 15px;width:100%}.fancybox-thumbs{background:#fff;bottom:0;display:none;margin:0;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;padding:2px 2px 4px;position:absolute;right:0;-webkit-tap-highlight-color:transparent;top:0;width:212px;z-index:99995}.fancybox-thumbs-x{overflow-x:auto;overflow-y:hidden}.fancybox-show-thumbs .fancybox-thumbs{display:block}.fancybox-show-thumbs .fancybox-inner{right:212px}.fancybox-thumbs__list{font-size:0;height:100%;list-style:none;margin:0;overflow-x:hidden;overflow-y:auto;padding:0;position:absolute;position:relative;white-space:nowrap;width:100%}.fancybox-thumbs-x .fancybox-thumbs__list{overflow:hidden}.fancybox-thumbs-y .fancybox-thumbs__list::-webkit-scrollbar{width:7px}.fancybox-thumbs-y .fancybox-thumbs__list::-webkit-scrollbar-track{background:#fff;border-radius:10px;box-shadow:inset 0 0 6px rgba(0,0,0,.3)}.fancybox-thumbs-y .fancybox-thumbs__list::-webkit-scrollbar-thumb{background:#2a2a2a;border-radius:10px}.fancybox-thumbs__list a{-webkit-backface-visibility:hidden;backface-visibility:hidden;background-color:rgba(0,0,0,.1);background-position:50%;background-repeat:no-repeat;background-size:cover;cursor:pointer;float:left;height:75px;margin:2px;max-height:calc(100% - 8px);max-width:calc(50% - 4px);outline:none;overflow:hidden;padding:0;position:relative;-webkit-tap-highlight-color:transparent;width:100px}.fancybox-thumbs__list a:before{border:4px solid #4ea7f9;bottom:0;content:"";left:0;opacity:0;position:absolute;right:0;top:0;transition:all .2s cubic-bezier(.25,.46,.45,.94);z-index:99991}.fancybox-thumbs__list a:focus:before{opacity:.5}.fancybox-thumbs__list a.fancybox-thumbs-active:before{opacity:1}@media (max-width:768px){.fancybox-thumbs{width:110px}.fancybox-show-thumbs .fancybox-inner{right:110px}.fancybox-thumbs__list a{max-width:calc(100% - 10px)}} \ No newline at end of file +body.compensate-for-scrollbar{overflow:hidden}.fancybox-active{height:auto}.fancybox-is-hidden{left:-9999px;margin:0;position:absolute!important;top:-9999px;visibility:hidden}.fancybox-container{-webkit-backface-visibility:hidden;backface-visibility:hidden;height:100%;left:0;outline:none;position:fixed;-webkit-tap-highlight-color:transparent;top:0;-ms-touch-action:manipulation;touch-action:manipulation;-webkit-transform:translateZ(0);transform:translateZ(0);width:100%;z-index:99992}.fancybox-container *{box-sizing:border-box}.fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-stage{bottom:0;left:0;position:absolute;right:0;top:0}.fancybox-outer{-webkit-overflow-scrolling:touch;overflow-y:auto}.fancybox-bg{background:#1e1e1e;opacity:0;transition-duration:inherit;transition-property:opacity;transition-timing-function:cubic-bezier(.47,0,.74,.71)}.fancybox-is-open .fancybox-bg{opacity:.87;transition-timing-function:cubic-bezier(.22,.61,.36,1)}.fancybox-caption,.fancybox-infobar,.fancybox-navigation .fancybox-button,.fancybox-toolbar{direction:ltr;opacity:0;position:absolute;transition:opacity .25s ease,visibility 0s ease .25s;visibility:hidden;z-index:99997}.fancybox-show-caption .fancybox-caption,.fancybox-show-infobar .fancybox-infobar,.fancybox-show-nav .fancybox-navigation .fancybox-button,.fancybox-show-toolbar .fancybox-toolbar{opacity:1;transition:opacity .25s ease 0s,visibility 0s ease 0s;visibility:visible}.fancybox-infobar{color:#ccc;font-size:13px;-webkit-font-smoothing:subpixel-antialiased;height:44px;left:0;line-height:44px;min-width:44px;mix-blend-mode:difference;padding:0 10px;pointer-events:none;top:0;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.fancybox-toolbar{right:0;top:0}.fancybox-stage{direction:ltr;overflow:visible;-webkit-transform:translateZ(0);transform:translateZ(0);z-index:99994}.fancybox-is-open .fancybox-stage{overflow:hidden}.fancybox-slide{-webkit-backface-visibility:hidden;display:none;height:100%;left:0;outline:none;overflow:auto;-webkit-overflow-scrolling:touch;padding:44px 44px 0;position:absolute;text-align:center;top:0;transition-property:opacity,-webkit-transform;transition-property:transform,opacity;transition-property:transform,opacity,-webkit-transform;white-space:normal;width:100%;z-index:99994}.fancybox-slide:before{content:"";display:inline-block;font-size:0;height:100%;vertical-align:middle;width:0}.fancybox-is-sliding .fancybox-slide,.fancybox-slide--current,.fancybox-slide--next,.fancybox-slide--previous{display:block}.fancybox-slide--next{z-index:99995}.fancybox-slide--image{overflow:hidden;padding:44px 0 0}.fancybox-slide--image:before{display:none}.fancybox-slide--html{padding:6px 6px 0}.fancybox-content{background:#fff;display:inline-block;margin:0 0 44px;max-width:100%;overflow:auto;-webkit-overflow-scrolling:touch;padding:44px;position:relative;text-align:left;vertical-align:middle}.fancybox-slide--image .fancybox-content{-webkit-animation-timing-function:cubic-bezier(.5,0,.14,1);animation-timing-function:cubic-bezier(.5,0,.14,1);-webkit-backface-visibility:hidden;background:transparent;background-repeat:no-repeat;background-size:100% 100%;left:0;max-width:none;overflow:visible;padding:0;position:absolute;top:0;-webkit-transform-origin:top left;transform-origin:top left;transition-property:opacity,-webkit-transform;transition-property:transform,opacity;transition-property:transform,opacity,-webkit-transform;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:99995}.fancybox-slide--html .fancybox-content{margin:0 0 6px}.fancybox-can-zoomOut .fancybox-content{cursor:zoom-out}.fancybox-can-zoomIn .fancybox-content{cursor:zoom-in}.fancybox-can-pan .fancybox-content,.fancybox-can-swipe .fancybox-content{cursor:-webkit-grab;cursor:grab}.fancybox-is-grabbing .fancybox-content{cursor:-webkit-grabbing;cursor:grabbing}.fancybox-container [data-selectable=true]{cursor:text}.fancybox-image,.fancybox-spaceball{background:transparent;border:0;height:100%;left:0;margin:0;max-height:none;max-width:none;padding:0;position:absolute;top:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%}.fancybox-spaceball{z-index:1}.fancybox-slide--iframe .fancybox-content,.fancybox-slide--map .fancybox-content,.fancybox-slide--video .fancybox-content{height:calc(100% - 44px);overflow:visible;padding:0;width:100%}.fancybox-slide--video .fancybox-content{background:#000}.fancybox-slide--map .fancybox-content{background:#e5e3df}.fancybox-slide--iframe .fancybox-content{background:#fff}.fancybox-iframe,.fancybox-video{background:transparent;border:0;display:block;height:100%;margin:0;overflow:hidden;padding:0;vertical-align:top;width:100%}.fancybox-error{background:#fff;cursor:default;max-width:400px;padding:40px;width:100%}.fancybox-error p{color:#444;font-size:16px;line-height:20px;margin:0;padding:0}.fancybox-button{background:rgba(30,30,30,.6);border:0;border-radius:0;box-shadow:none;cursor:pointer;display:inline-block;height:44px;margin:0;padding:10px;position:relative;transition:color .2s;vertical-align:top;visibility:inherit;width:44px}.fancybox-button,.fancybox-button:link,.fancybox-button:visited{color:#ccc}.fancybox-button:hover{color:#fff}.fancybox-button:focus{outline:none}.fancybox-button.fancybox-focus{outline:1px dotted}.fancybox-button.disabled,.fancybox-button.disabled:hover,.fancybox-button[disabled],.fancybox-button[disabled]:hover{color:#888;cursor:default;outline:none}.fancybox-button svg{display:block;height:100%;overflow:visible;position:relative;width:100%}.fancybox-button svg path{fill:currentColor;stroke-width:0}.fancybox-button--fsenter svg:nth-child(2),.fancybox-button--fsexit svg:nth-child(1),.fancybox-button--pause svg:nth-child(1),.fancybox-button--play svg:nth-child(2){display:none}.fancybox-progress{background:#ff5268;height:2px;left:0;position:absolute;right:0;top:0;-webkit-transform:scaleX(0);transform:scaleX(0);-webkit-transform-origin:0;transform-origin:0;transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform;transition-timing-function:linear;z-index:99998}.fancybox-close-small{background:transparent;border:0;border-radius:0;color:#ccc;cursor:pointer;opacity:.8;padding:8px;position:absolute;right:-12px;top:-44px;z-index:401}.fancybox-close-small:hover{color:#fff;opacity:1}.fancybox-slide--html .fancybox-close-small{color:currentColor;padding:10px;right:0;top:0}.fancybox-is-scaling .fancybox-close-small,.fancybox-is-zoomable.fancybox-can-pan .fancybox-close-small{display:none}.fancybox-navigation .fancybox-button{background:transparent;height:100px;margin:0;opacity:0;position:absolute;top:calc(50% - 50px);width:70px}.fancybox-navigation .fancybox-button div{background:rgba(30,30,30,.6);height:100%;padding:7px}.fancybox-navigation .fancybox-button--arrow_left{left:0;padding:31px 26px 31px 6px}.fancybox-navigation .fancybox-button--arrow_right{padding:31px 6px 31px 26px;right:0}.fancybox-caption{bottom:0;color:#fff;font-size:14px;font-weight:400;left:0;line-height:1.5;padding:25px 44px;right:0}.fancybox-caption:before{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAEtCAQAAABjBcL7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHRJREFUKM+Vk8EOgDAIQ0vj/3+xBw8qIZZueFnIKC90MCAI8DlrkHGeqqGIU6lVigrBtpCWqeRWoHDNqs0F7VNVBVxmHRlvoVqjaYkdnDIaivH2HqZ5+oZj3JUzWB+cOz4G48Bg+tsJ/tqu4dLC/4Xb+0GcF5BwBC0AA53qAAAAAElFTkSuQmCC);background-repeat:repeat-x;background-size:contain;bottom:0;content:"";display:block;left:0;pointer-events:none;position:absolute;right:0;top:-25px;z-index:-1}.fancybox-caption:after{border-bottom:1px solid hsla(0,0%,100%,.3);content:"";display:block;left:44px;position:absolute;right:44px;top:0}.fancybox-caption a,.fancybox-caption a:link,.fancybox-caption a:visited{color:#ccc;text-decoration:none}.fancybox-caption a:hover{color:#fff;text-decoration:underline}.fancybox-loading{-webkit-animation:a 1s linear infinite;animation:a 1s linear infinite;background:transparent;border:4px solid #888;border-bottom-color:#fff;border-radius:50%;height:50px;left:50%;margin:-25px 0 0 -25px;opacity:.7;padding:0;position:absolute;top:50%;width:50px;z-index:99999}@-webkit-keyframes a{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.fancybox-animated{transition-timing-function:cubic-bezier(0,0,.25,1)}.fancybox-fx-slide.fancybox-slide--previous{opacity:0;-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.fancybox-fx-slide.fancybox-slide--next{opacity:0;-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}.fancybox-fx-slide.fancybox-slide--current{opacity:1;-webkit-transform:translateZ(0);transform:translateZ(0)}.fancybox-fx-fade.fancybox-slide--next,.fancybox-fx-fade.fancybox-slide--previous{opacity:0;transition-timing-function:cubic-bezier(.19,1,.22,1)}.fancybox-fx-fade.fancybox-slide--current{opacity:1}.fancybox-fx-zoom-in-out.fancybox-slide--previous{opacity:0;-webkit-transform:scale3d(1.5,1.5,1.5);transform:scale3d(1.5,1.5,1.5)}.fancybox-fx-zoom-in-out.fancybox-slide--next{opacity:0;-webkit-transform:scale3d(.5,.5,.5);transform:scale3d(.5,.5,.5)}.fancybox-fx-zoom-in-out.fancybox-slide--current{opacity:1;-webkit-transform:scaleX(1);transform:scaleX(1)}.fancybox-fx-rotate.fancybox-slide--previous{opacity:0;-webkit-transform:rotate(-1turn);transform:rotate(-1turn)}.fancybox-fx-rotate.fancybox-slide--next{opacity:0;-webkit-transform:rotate(1turn);transform:rotate(1turn)}.fancybox-fx-rotate.fancybox-slide--current{opacity:1;-webkit-transform:rotate(0deg);transform:rotate(0deg)}.fancybox-fx-circular.fancybox-slide--previous{opacity:0;-webkit-transform:scale3d(0,0,0) translate3d(-100%,0,0);transform:scale3d(0,0,0) translate3d(-100%,0,0)}.fancybox-fx-circular.fancybox-slide--next{opacity:0;-webkit-transform:scale3d(0,0,0) translate3d(100%,0,0);transform:scale3d(0,0,0) translate3d(100%,0,0)}.fancybox-fx-circular.fancybox-slide--current{opacity:1;-webkit-transform:scaleX(1) translateZ(0);transform:scaleX(1) translateZ(0)}.fancybox-fx-tube.fancybox-slide--previous{-webkit-transform:translate3d(-100%,0,0) scale(.1) skew(-10deg);transform:translate3d(-100%,0,0) scale(.1) skew(-10deg)}.fancybox-fx-tube.fancybox-slide--next{-webkit-transform:translate3d(100%,0,0) scale(.1) skew(10deg);transform:translate3d(100%,0,0) scale(.1) skew(10deg)}.fancybox-fx-tube.fancybox-slide--current{-webkit-transform:translateZ(0) scale(1);transform:translateZ(0) scale(1)}@media (max-height:576px){.fancybox-slide{padding-left:6px;padding-right:6px}.fancybox-slide--image{padding:6px 0 0}.fancybox-slide--image .fancybox-content{margin-bottom:6px}.fancybox-slide--image .fancybox-close-small{background:#4e4e4e;color:#f2f4f6;height:36px;opacity:1;padding:6px;right:0;top:0;width:36px}}.fancybox-share{background:#f4f4f4;border-radius:3px;max-width:90%;padding:30px;text-align:center}.fancybox-share h1{color:#222;font-size:35px;font-weight:700;margin:0 0 20px}.fancybox-share p{margin:0;padding:0}.fancybox-share__button{border:0;border-radius:3px;display:inline-block;font-size:14px;font-weight:700;line-height:40px;margin:0 5px 10px;min-width:130px;padding:0 15px;text-decoration:none;transition:all .2s;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap}.fancybox-share__button:link,.fancybox-share__button:visited{color:#fff}.fancybox-share__button:hover{text-decoration:none}.fancybox-share__button--fb{background:#3b5998}.fancybox-share__button--fb:hover{background:#344e86}.fancybox-share__button--pt{background:#bd081d}.fancybox-share__button--pt:hover{background:#aa0719}.fancybox-share__button--tw{background:#1da1f2}.fancybox-share__button--tw:hover{background:#0d95e8}.fancybox-share__button svg{height:25px;margin-right:7px;position:relative;top:-1px;vertical-align:middle;width:25px}.fancybox-share__button svg path{fill:#fff}.fancybox-share__input{background:transparent;border:0;border-bottom:1px solid #d7d7d7;border-radius:0;color:#5d5b5b;font-size:14px;margin:10px 0 0;outline:none;padding:10px 15px;width:100%}.fancybox-thumbs{background:#ddd;bottom:0;display:none;margin:0;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;padding:2px 2px 4px;position:absolute;right:0;-webkit-tap-highlight-color:transparent;top:0;width:212px;z-index:99995}.fancybox-thumbs-x{overflow-x:auto;overflow-y:hidden}.fancybox-show-thumbs .fancybox-thumbs{display:block}.fancybox-show-thumbs .fancybox-inner{right:212px}.fancybox-thumbs__list{font-size:0;height:100%;list-style:none;margin:0;overflow-x:hidden;overflow-y:auto;padding:0;position:absolute;position:relative;white-space:nowrap;width:100%}.fancybox-thumbs-x .fancybox-thumbs__list{overflow:hidden}.fancybox-thumbs-y .fancybox-thumbs__list::-webkit-scrollbar{width:7px}.fancybox-thumbs-y .fancybox-thumbs__list::-webkit-scrollbar-track{background:#fff;border-radius:10px;box-shadow:inset 0 0 6px rgba(0,0,0,.3)}.fancybox-thumbs-y .fancybox-thumbs__list::-webkit-scrollbar-thumb{background:#2a2a2a;border-radius:10px}.fancybox-thumbs__list a{-webkit-backface-visibility:hidden;backface-visibility:hidden;background-color:rgba(0,0,0,.1);background-position:50%;background-repeat:no-repeat;background-size:cover;cursor:pointer;float:left;height:75px;margin:2px;max-height:calc(100% - 8px);max-width:calc(50% - 4px);outline:none;overflow:hidden;padding:0;position:relative;-webkit-tap-highlight-color:transparent;width:100px}.fancybox-thumbs__list a:before{border:6px solid #ff5268;bottom:0;content:"";left:0;opacity:0;position:absolute;right:0;top:0;transition:all .2s cubic-bezier(.25,.46,.45,.94);z-index:99991}.fancybox-thumbs__list a:focus:before{opacity:.5}.fancybox-thumbs__list a.fancybox-thumbs-active:before{opacity:1}@media (max-width:768px){.fancybox-thumbs{width:110px}.fancybox-show-thumbs .fancybox-inner{right:110px}.fancybox-thumbs__list a{max-width:calc(100% - 10px)}} \ No newline at end of file diff --git a/dist/jquery.fancybox.min.js b/dist/jquery.fancybox.min.js index ad9ca947..c02c00a5 100644 --- a/dist/jquery.fancybox.min.js +++ b/dist/jquery.fancybox.min.js @@ -1,5 +1,5 @@ // ================================================== -// fancyBox v3.4.1 +// fancyBox v3.4.2 // // Licensed GPLv3 for open source use // or fancyBox Commercial License for commercial use @@ -8,6 +8,6 @@ // Copyright 2018 fancyApps // // ================================================== -!function(t,e,n,o){"use strict";function i(t,e){var o,i,a,s=[],r=0;t&&t.isDefaultPrevented()||(t.preventDefault(),e=e||{},t&&t.data&&(e=p(t.data.options,e)),o=e.$target||n(t.currentTarget).trigger("blur"),a=n.fancybox.getInstance(),a&&a.$trigger&&a.$trigger.is(o)||(e.selector?s=n(e.selector):(i=o.attr("data-fancybox")||"",i?(s=t.data?t.data.items:[],s=s.length?s.filter('[data-fancybox="'+i+'"]'):n('[data-fancybox="'+i+'"]')):s=[o]),r=n(s).index(o),r<0&&(r=0),a=n.fancybox.open(s,e,r),a.$trigger=o))}if(t.console=t.console||{info:function(t){}},n){if(n.fn.fancybox)return void console.info("fancyBox already initialized");var a={closeExisting:!1,loop:!1,gutter:50,keyboard:!0,arrows:!0,infobar:!0,smallBtn:"auto",toolbar:"auto",buttons:["zoom","thumbs","close"],idleTime:3,protect:!1,modal:!1,image:{preload:!1},ajax:{settings:{data:{fancybox:!0}}},iframe:{tpl:'',preload:!0,css:{},attr:{scrolling:"auto"}},video:{tpl:'',format:"",autoStart:!0},defaultType:"image",animationEffect:"zoom",animationDuration:366,zoomOpacity:"auto",transitionEffect:"fade",transitionDuration:366,slideClass:"",baseClass:"",baseTpl:'',spinnerTpl:'
',errorTpl:'

{{ERROR}}

',btnTpl:{download:'',zoom:'',close:'',arrowLeft:'',arrowRight:'',smallBtn:''},parentEl:"body",hideScrollbar:!0,autoFocus:!0,backFocus:!0,trapFocus:!0,fullScreen:{autoStart:!1},touch:{vertical:!0,momentum:!0},hash:null,media:{},slideShow:{autoStart:!1,speed:3e3},thumbs:{autoStart:!1,hideOnClose:!0,parentEl:".fancybox-container",axis:"y"},wheel:"auto",onInit:n.noop,beforeLoad:n.noop,afterLoad:n.noop,beforeShow:n.noop,afterShow:n.noop,beforeClose:n.noop,afterClose:n.noop,onActivate:n.noop,onDeactivate:n.noop,clickContent:function(t,e){return"image"===t.type&&"zoom"},clickSlide:"close",clickOutside:"close",dblclickContent:!1,dblclickSlide:!1,dblclickOutside:!1,mobile:{idleTime:!1,clickContent:function(t,e){return"image"===t.type&&"toggleControls"},clickSlide:function(t,e){return"image"===t.type?"toggleControls":"close"},dblclickContent:function(t,e){return"image"===t.type&&"zoom"},dblclickSlide:function(t,e){return"image"===t.type&&"zoom"}},lang:"en",i18n:{en:{CLOSE:"Close",NEXT:"Next",PREV:"Previous",ERROR:"The requested content cannot be loaded.
Please try again later.",PLAY_START:"Start slideshow",PLAY_STOP:"Pause slideshow",FULL_SCREEN:"Full screen",THUMBS:"Thumbnails",DOWNLOAD:"Download",SHARE:"Share",ZOOM:"Zoom"},de:{CLOSE:"Schliessen",NEXT:"Weiter",PREV:"Zurück",ERROR:"Die angeforderten Daten konnten nicht geladen werden.
Bitte versuchen Sie es später nochmal.",PLAY_START:"Diaschau starten",PLAY_STOP:"Diaschau beenden",FULL_SCREEN:"Vollbild",THUMBS:"Vorschaubilder",DOWNLOAD:"Herunterladen",SHARE:"Teilen",ZOOM:"Maßstab"}}},s=n(t),r=n(e),c=0,l=function(t){return t&&t.hasOwnProperty&&t instanceof n},d=function(){return t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||function(e){return t.setTimeout(e,1e3/60)}}(),u=function(){var t,n=e.createElement("fakeelement"),i={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(t in i)if(n.style[t]!==o)return i[t];return"transitionend"}(),f=function(t){return t&&t.length&&t[0].offsetHeight},p=function(t,e){var o=n.extend(!0,{},t,e);return n.each(e,function(t,e){n.isArray(e)&&(o[t]=e)}),o},h=function(t,e,o){var i=this;i.opts=p({index:o},n.fancybox.defaults),n.isPlainObject(e)&&(i.opts=p(i.opts,e)),n.fancybox.isMobile&&(i.opts=p(i.opts,i.opts.mobile)),i.id=i.opts.id||++c,i.currIndex=parseInt(i.opts.index,10)||0,i.prevIndex=null,i.prevPos=null,i.currPos=0,i.firstRun=!0,i.group=[],i.slides={},i.addContent(t),i.group.length&&i.init()};n.extend(h.prototype,{init:function(){var i,a,s,r=this,c=r.group[r.currIndex],l=c.opts,d=n.fancybox.scrollbarWidth;l.closeExisting&&n.fancybox.close(!0),n("body").addClass("fancybox-active"),!n.fancybox.getInstance()&&l.hideScrollbar!==!1&&!n.fancybox.isMobile&&e.body.scrollHeight>t.innerHeight&&(d===o&&(i=n('
').appendTo("body"),d=n.fancybox.scrollbarWidth=i[0].offsetWidth-i[0].clientWidth,i.remove()),n("head").append('"),n("body").addClass("compensate-for-scrollbar")),s="",n.each(l.buttons,function(t,e){s+=l.btnTpl[e]||""}),a=n(r.translate(r,l.baseTpl.replace("{{buttons}}",s).replace("{{arrows}}",l.btnTpl.arrowLeft+l.btnTpl.arrowRight))).attr("id","fancybox-container-"+r.id).addClass(l.baseClass).data("FancyBox",r).appendTo(l.parentEl),r.$refs={container:a},["bg","inner","infobar","toolbar","stage","caption","navigation"].forEach(function(t){r.$refs[t]=a.find(".fancybox-"+t)}),r.trigger("onInit"),r.activate(),r.jumpTo(r.currIndex)},translate:function(t,e){var n=t.opts.i18n[t.opts.lang];return e.replace(/\{\{(\w+)\}\}/g,function(t,e){var i=n[e];return i===o?t:i})},addContent:function(t){var e,i=this,a=n.makeArray(t);n.each(a,function(t,e){var a,s,r,c,l,d={},u={};n.isPlainObject(e)?(d=e,u=e.opts||e):"object"===n.type(e)&&n(e).length?(a=n(e),u=a.data()||{},u=n.extend(!0,{},u,u.options),u.$orig=a,d.src=i.opts.src||u.src||a.attr("href"),d.type||d.src||(d.type="inline",d.src=e)):d={type:"html",src:e+""},d.opts=n.extend(!0,{},i.opts,u),n.isArray(u.buttons)&&(d.opts.buttons=u.buttons),n.fancybox.isMobile&&d.opts.mobile&&(d.opts=p(d.opts,d.opts.mobile)),s=d.type||d.opts.type,c=d.src||"",!s&&c&&((r=c.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(s="video",d.opts.video.format||(d.opts.video.format="video/"+("ogv"===r[1]?"ogg":r[1]))):c.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?s="image":c.match(/\.(pdf)((\?|#).*)?$/i)?s="iframe":"#"===c.charAt(0)&&(s="inline")),s?d.type=s:i.trigger("objectNeedsType",d),d.contentType||(d.contentType=n.inArray(d.type,["html","inline","ajax"])>-1?"html":d.type),d.index=i.group.length,"auto"==d.opts.smallBtn&&(d.opts.smallBtn=n.inArray(d.type,["html","inline","ajax"])>-1),"auto"===d.opts.toolbar&&(d.opts.toolbar=!d.opts.smallBtn),d.opts.$trigger&&d.index===i.opts.index&&(d.opts.$thumb=d.opts.$trigger.find("img:first"),d.opts.$thumb.length&&(d.opts.$orig=d.opts.$trigger)),d.opts.$thumb&&d.opts.$thumb.length||!d.opts.$orig||(d.opts.$thumb=d.opts.$orig.find("img:first")),"function"===n.type(d.opts.caption)&&(d.opts.caption=d.opts.caption.apply(e,[i,d])),"function"===n.type(i.opts.caption)&&(d.opts.caption=i.opts.caption.apply(e,[i,d])),d.opts.caption instanceof n||(d.opts.caption=d.opts.caption===o?"":d.opts.caption+""),"ajax"===d.type&&(l=c.split(/\s+/,2),l.length>1&&(d.src=l.shift(),d.opts.filter=l.shift())),d.opts.modal&&(d.opts=n.extend(!0,d.opts,{infobar:0,toolbar:0,smallBtn:0,keyboard:0,slideShow:0,fullScreen:0,thumbs:0,touch:0,clickContent:!1,clickSlide:!1,clickOutside:!1,dblclickContent:!1,dblclickSlide:!1,dblclickOutside:!1})),i.group.push(d)}),Object.keys(i.slides).length&&(i.updateControls(),e=i.Thumbs,e&&e.isActive&&(e.create(),e.focus()))},addEvents:function(){var e=this;e.removeEvents(),e.$refs.container.on("click.fb-close","[data-fancybox-close]",function(t){t.stopPropagation(),t.preventDefault(),e.close(t)}).on("touchstart.fb-prev click.fb-prev","[data-fancybox-prev]",function(t){t.stopPropagation(),t.preventDefault(),e.previous()}).on("touchstart.fb-next click.fb-next","[data-fancybox-next]",function(t){t.stopPropagation(),t.preventDefault(),e.next()}).on("click.fb","[data-fancybox-zoom]",function(t){e[e.isScaledDown()?"scaleToActual":"scaleToFit"]()}),s.on("orientationchange.fb resize.fb",function(t){t&&t.originalEvent&&"resize"===t.originalEvent.type?d(function(){e.update()}):(e.current&&"iframe"===e.current.type&&e.$refs.stage.hide(),setTimeout(function(){e.$refs.stage.show(),e.update()},n.fancybox.isMobile?600:250))}),r.on("keydown.fb",function(t){var o=n.fancybox?n.fancybox.getInstance():null,i=o.current,a=t.keyCode||t.which;if(9==a)return void(i.opts.trapFocus&&e.focus(t));if(!(!i.opts.keyboard||t.ctrlKey||t.altKey||t.shiftKey||n(t.target).is("input")||n(t.target).is("textarea")))return 8===a||27===a?(t.preventDefault(),void e.close(t)):37===a||38===a?(t.preventDefault(),void e.previous()):39===a||40===a?(t.preventDefault(),void e.next()):void e.trigger("afterKeydown",t,a)}),e.group[e.currIndex].opts.idleTime&&(e.idleSecondsCounter=0,r.on("mousemove.fb-idle mouseleave.fb-idle mousedown.fb-idle touchstart.fb-idle touchmove.fb-idle scroll.fb-idle keydown.fb-idle",function(t){e.idleSecondsCounter=0,e.isIdle&&e.showControls(),e.isIdle=!1}),e.idleInterval=t.setInterval(function(){e.idleSecondsCounter++,e.idleSecondsCounter>=e.group[e.currIndex].opts.idleTime&&!e.isDragging&&(e.isIdle=!0,e.idleSecondsCounter=0,e.hideControls())},1e3))},removeEvents:function(){var e=this;s.off("orientationchange.fb resize.fb"),r.off("keydown.fb .fb-idle"),this.$refs.container.off(".fb-close .fb-prev .fb-next"),e.idleInterval&&(t.clearInterval(e.idleInterval),e.idleInterval=null)},previous:function(t){return this.jumpTo(this.currPos-1,t)},next:function(t){return this.jumpTo(this.currPos+1,t)},jumpTo:function(t,e){var i,a,s,r,c,l,d,u=this,f=u.group.length;if(!(u.isDragging||u.isClosing||u.isAnimating&&u.firstRun)){if(t=parseInt(t,10),s=u.current?u.current.opts.loop:u.opts.loop,!s&&(t<0||t>=f))return!1;if(i=u.firstRun=!Object.keys(u.slides).length,!(f<2&&!i&&u.isDragging)){if(c=u.current,u.prevIndex=u.currIndex,u.prevPos=u.currPos,r=u.createSlide(t),f>1&&((s||r.index0)&&u.createSlide(t-1)),u.current=r,u.currIndex=r.index,u.currPos=r.pos,u.trigger("beforeShow",i),u.updateControls(),a=u.isMoved(r),r.forcedDuration=o,n.isNumeric(e)?r.forcedDuration=e:e=r.opts[i?"animationDuration":"transitionDuration"],e=parseInt(e,10),i)return r.opts.animationEffect&&e&&u.$refs.container.css("transition-duration",e+"ms"),u.$refs.container.addClass("fancybox-is-open"),r.$slide.addClass("fancybox-slide--previous"),u.loadSlide(r),r.$slide.removeClass("fancybox-slide--previous").addClass("fancybox-slide--current"),u.preload("image"),void u.$refs.container.trigger("focus");n.each(u.slides,function(t,e){n.fancybox.stop(e.$slide,!0),e.$slide.removeClass("fancybox-animated").removeClass(function(t,e){return(e.match(/(^|\s)fancybox-fx-\S+/g)||[]).join(" ")})}),r.$slide.removeClass("fancybox-slide--next fancybox-slide--previous").addClass("fancybox-slide--current"),a?(l=Math.round(r.$slide.width()),n.each(u.slides,function(t,o){var i=o.pos-r.pos;n.fancybox.animate(o.$slide,{top:0,left:i*l+i*o.opts.gutter},e,function(){o.$slide.removeAttr("style").removeClass("fancybox-slide--next fancybox-slide--previous"),o.pos===u.currPos&&u.complete()})})):u.$refs.stage.children().removeAttr("style"),r.isLoaded?u.revealContent(r):u.loadSlide(r),u.preload("image"),c.pos!==r.pos&&(d="fancybox-slide--"+(c.pos>r.pos?"next":"previous"),c.$slide.removeClass("fancybox-slide--complete fancybox-slide--current fancybox-slide--next fancybox-slide--previous"),c.isComplete=!1,e&&(a||r.opts.transitionEffect)&&(a?c.$slide.addClass(d):(d="fancybox-animated "+d+" fancybox-fx-"+r.opts.transitionEffect,n.fancybox.animate(c.$slide,d,e,null,!1))))}}},createSlide:function(t){var e,o,i=this;return o=t%i.group.length,o=o<0?i.group.length+o:o,!i.slides[t]&&i.group[o]&&(e=n('
').appendTo(i.$refs.stage),i.slides[t]=n.extend(!0,{},i.group[o],{pos:t,$slide:e,isLoaded:!1}),i.updateSlide(i.slides[t])),i.slides[t]},scaleToActual:function(t,e,i){var a,s,r,c,l,d=this,u=d.current,f=u.$content,p=n.fancybox.getTranslate(u.$slide).width,h=n.fancybox.getTranslate(u.$slide).height,g=u.width,b=u.height;!d.isAnimating&&f&&"image"==u.type&&u.isLoaded&&!u.hasError&&(n.fancybox.stop(f),d.isAnimating=!0,t=t===o?.5*p:t,e=e===o?.5*h:e,a=n.fancybox.getTranslate(f),a.top-=n.fancybox.getTranslate(u.$slide).top,a.left-=n.fancybox.getTranslate(u.$slide).left,c=g/a.width,l=b/a.height,s=.5*p-.5*g,r=.5*h-.5*b,g>p&&(s=a.left*c-(t*c-t),s>0&&(s=0),sh&&(r=a.top*l-(e*l-e),r>0&&(r=0),rl/a?d=l/a:l>d*a&&(l=d*a)),u.width=l,u.height=d,u)},update:function(){var t=this;n.each(t.slides,function(e,n){t.updateSlide(n)})},updateSlide:function(t){var e=this,o=t&&t.$content,i=t.width||t.opts.width,a=t.height||t.opts.height,s=t.$slide;o&&(i||a||"video"===t.contentType)&&!t.hasError&&(n.fancybox.stop(o),n.fancybox.setTranslate(o,e.getFitPos(t)),t.pos===e.currPos&&(e.isAnimating=!1,e.updateCursor())),s.length&&(s.trigger("refresh"),e.$refs.toolbar.toggleClass("compensate-for-scrollbar",s.get(0).scrollHeight>s.get(0).clientHeight)),e.trigger("onUpdate",t)},centerSlide:function(t,e){var i,a,s=this;s.current&&(i=Math.round(t.$slide.width()),a=t.pos-s.current.pos,n.fancybox.animate(t.$slide,{top:0,left:a*i+a*t.opts.gutter,opacity:1},e===o?0:e,null,!1))},isMoved:function(t){var e=t||this.current,o=n.fancybox.getTranslate(e.$slide);return(0!==o.left||0!==o.top)&&!e.$slide.hasClass("fancybox-animated")},updateCursor:function(t,e){var o,i=this,a=i.current,s=i.$refs.container.removeClass("fancybox-is-zoomable fancybox-can-zoomIn fancybox-can-zoomOut fancybox-can-swipe fancybox-can-pan");a&&!i.isClosing&&(o=i.isZoomable(),s.toggleClass("fancybox-is-zoomable",o),n("[data-fancybox-zoom]").prop("disabled",!o),i.canPan(t,e)?s.addClass("fancybox-can-pan"):o&&("zoom"===a.opts.clickContent||n.isFunction(a.opts.clickContent)&&"zoom"==a.opts.clickContent(a))?s.addClass("fancybox-can-zoomIn"):a.opts.touch&&(a.opts.touch.vertical||i.group.length>1)&&"video"!==a.contentType&&s.addClass("fancybox-can-swipe"))},isZoomable:function(){var t,e=this,n=e.current;if(n&&!e.isClosing&&"image"===n.type&&!n.hasError){if(!n.isLoaded)return!0;if(t=e.getFitPos(n),n.width>t.width||n.height>t.height)return!0}return!1},isScaledDown:function(t,e){var i=this,a=!1,s=i.current,r=s.$content;return t!==o&&e!==o?a=t1.5||Math.abs(a.height-r.height)>1.5),r},loadSlide:function(t){var e,o,i,a=this;if(!t.isLoading&&!t.isLoaded){switch(t.isLoading=!0,a.trigger("beforeLoad",t),e=t.type,o=t.$slide,o.off("refresh").trigger("onReset").addClass(t.opts.slideClass),e){case"image":a.setImage(t);break;case"iframe":a.setIframe(t);break;case"html":a.setContent(t,t.src||t.content);break;case"video":a.setContent(t,t.opts.video.tpl.replace("{{src}}",t.src).replace("{{format}}",t.opts.videoFormat||t.opts.video.format));break;case"inline":n(t.src).length?a.setContent(t,n(t.src)):a.setError(t);break;case"ajax":a.showLoading(t),i=n.ajax(n.extend({},t.opts.ajax.settings,{url:t.src,success:function(e,n){"success"===n&&a.setContent(t,e)},error:function(e,n){e&&"abort"!==n&&a.setError(t)}})),o.one("onReset",function(){i.abort()});break;default:a.setError(t)}return!0}},setImage:function(e){var o,i,a,s,r,c=this,l=e.opts.srcset||e.opts.image.srcset;if(e.timouts=setTimeout(function(){var t=e.$image;!e.isLoading||t&&t.length&&t[0].complete||e.hasError||c.showLoading(e)},350),l){s=t.devicePixelRatio||1,r=t.innerWidth*s,a=l.split(",").map(function(t){var e={};return t.trim().split(/\s+/).forEach(function(t,n){var o=parseInt(t.substring(0,t.length-1),10);return 0===n?e.url=t:void(o&&(e.value=o,e.postfix=t[t.length-1]))}),e}),a.sort(function(t,e){return t.value-e.value});for(var d=0;d=r||"x"===u.postfix&&u.value>=s){i=u;break}}!i&&a.length&&(i=a[a.length-1]),i&&(e.src=i.url,e.width&&e.height&&"w"==i.postfix&&(e.height=e.width/e.height*i.value,e.width=i.value),e.opts.srcset=l)}e.$content=n('
').addClass("fancybox-is-hidden").appendTo(e.$slide.addClass("fancybox-slide--image")),o=e.opts.thumb||!(!e.opts.$thumb||!e.opts.$thumb.length)&&e.opts.$thumb.attr("src"),e.opts.preload!==!1&&e.opts.width&&e.opts.height&&o&&(e.width=e.opts.width,e.height=e.opts.height,e.$ghost=n("").one("error",function(){n(this).remove(),e.$ghost=null}).one("load",function(){c.afterLoad(e)}).addClass("fancybox-image").appendTo(e.$content).attr("src",o)),c.setBigImage(e)},setBigImage:function(t){var e=this,o=n("");t.$image=o.one("error",function(){e.setError(t)}).one("load",function(){var n;t.$ghost||(e.resolveImageSlideSize(t,this.naturalWidth,this.naturalHeight),e.afterLoad(t)),t.timouts&&(clearTimeout(t.timouts),t.timouts=null),e.isClosing||(t.opts.srcset&&(n=t.opts.sizes,n&&"auto"!==n||(n=(t.width/t.height>1&&s.width()/s.height()>1?"100":Math.round(t.width/t.height*100))+"vw"),o.attr("sizes",n).attr("srcset",t.opts.srcset)),t.$ghost&&setTimeout(function(){t.$ghost&&!e.isClosing&&t.$ghost.hide()},Math.min(300,Math.max(1e3,t.height/1600))),e.hideLoading(t))}).addClass("fancybox-image").attr("src",t.src).appendTo(t.$content),(o[0].complete||"complete"==o[0].readyState)&&o[0].naturalWidth&&o[0].naturalHeight?o.trigger("load"):o[0].error&&o.trigger("error")},resolveImageSlideSize:function(t,e,n){var o=parseInt(t.opts.width,10),i=parseInt(t.opts.height,10);t.width=e,t.height=n,o>0&&(t.width=o,t.height=Math.floor(o*n/e)),i>0&&(t.width=Math.floor(i*e/n),t.height=i)},setIframe:function(t){var e,i=this,a=t.opts.iframe,s=t.$slide;t.$content=n('
').css(a.css).appendTo(s),s.addClass("fancybox-slide--"+t.contentType),t.$iframe=e=n(a.tpl.replace(/\{rnd\}/g,(new Date).getTime())).attr(a.attr).appendTo(t.$content),a.preload?(i.showLoading(t),e.on("load.fb error.fb",function(e){this.isReady=1,t.$slide.trigger("refresh"),i.afterLoad(t)}),s.on("refresh.fb",function(){var n,i,r=t.$content,c=a.css.width,l=a.css.height;if(1===e[0].isReady){try{n=e.contents(),i=n.find("body")}catch(t){}i&&i.length&&i.children().length&&(s.css("overflow","visible"),r.css({width:"100%",height:""}),c===o&&(c=Math.ceil(Math.max(i[0].clientWidth,i.outerWidth(!0)))),c&&r.width(c),l===o&&(l=Math.ceil(Math.max(i[0].clientHeight,i.outerHeight(!0)))),l&&r.height(l),s.css("overflow","auto")),r.removeClass("fancybox-is-hidden")}})):this.afterLoad(t),e.attr("src",t.src),s.one("onReset",function(){try{n(this).find("iframe").hide().unbind().attr("src","//about:blank")}catch(t){}n(this).off("refresh.fb").empty(),t.isLoaded=!1})},setContent:function(t,e){var o=this;o.isClosing||(o.hideLoading(t),t.$content&&n.fancybox.stop(t.$content),t.$slide.empty(),l(e)&&e.parent().length?(e.hasClass("fancybox-content")&&e.parent(".fancybox-slide--html").trigger("onReset"),t.$placeholder=n("
").hide().insertAfter(e),e.css("display","inline-block")):t.hasError||("string"===n.type(e)&&(e=n("
").append(n.trim(e)).contents()),t.opts.filter&&(e=n("
").html(e).find(t.opts.filter))),t.$slide.one("onReset",function(){n(this).find("video,audio").trigger("pause"),t.$placeholder&&(t.$placeholder.after(e.removeClass("fancybox-content").hide()).remove(),t.$placeholder=null),t.$smallBtn&&(t.$smallBtn.remove(),t.$smallBtn=null),t.hasError||(n(this).empty(),t.isLoaded=!1,t.isRevealed=!1)}),n(e).appendTo(t.$slide),n(e).is("video,audio")&&(n(e).addClass("fancybox-video"),n(e).wrap("
"),t.contentType="video",t.opts.width=t.opts.width||n(e).attr("width"),t.opts.height=t.opts.height||n(e).attr("height")),t.$content=t.$slide.children().filter("div,form,main,video,audio,article,.fancybox-content").first(),t.$content.siblings().hide(),t.$content.length||(t.$content=t.$slide.wrapInner("
").children().first()),t.$content.addClass("fancybox-content"),t.$slide.addClass("fancybox-slide--"+t.contentType),this.afterLoad(t))},setError:function(t){t.hasError=!0,t.$slide.trigger("onReset").removeClass("fancybox-slide--"+t.contentType).addClass("fancybox-slide--error"),t.contentType="html",this.setContent(t,this.translate(t,t.opts.errorTpl)),t.pos===this.currPos&&(this.isAnimating=!1)},showLoading:function(t){var e=this;t=t||e.current,t&&!t.$spinner&&(t.$spinner=n(e.translate(e,e.opts.spinnerTpl)).appendTo(t.$slide))},hideLoading:function(t){var e=this;t=t||e.current,t&&t.$spinner&&(t.$spinner.remove(),delete t.$spinner)},afterLoad:function(t){var e=this;e.isClosing||(t.isLoading=!1,t.isLoaded=!0,e.trigger("afterLoad",t),e.hideLoading(t),t.pos===e.currPos&&e.updateCursor(),!t.opts.smallBtn||t.$smallBtn&&t.$smallBtn.length||(t.$smallBtn=n(e.translate(t,t.opts.btnTpl.smallBtn)).appendTo(t.$content)),t.opts.protect&&t.$content&&!t.hasError&&(t.$content.on("contextmenu.fb",function(t){return 2==t.button&&t.preventDefault(),!0}),"image"===t.type&&n('
').appendTo(t.$content)),e.revealContent(t))},revealContent:function(t){var e,i,a,s,r=this,c=t.$slide,l=!1,d=!1,u=r.isMoved(t),p=t.isRevealed;if(!u||!p){if(t.isRevealed=!0,e=t.opts[r.firstRun?"animationEffect":"transitionEffect"],a=t.opts[r.firstRun?"animationDuration":"transitionDuration"],a=parseInt(t.forcedDuration===o?a:t.forcedDuration,10),t.pos===r.currPos&&(t.isComplete?e=!1:r.isAnimating=!0),!u&&t.pos===r.currPos&&a||(e=!1),"zoom"===e&&(t.pos===r.currPos&&a&&"image"===t.type&&!t.hasError&&(d=r.getThumbPos(t))?l=r.getFitPos(t):e="fade"),"zoom"===e)return l.scaleX=l.width/d.width,l.scaleY=l.height/d.height,s=t.opts.zoomOpacity,"auto"==s&&(s=Math.abs(t.width/t.height-d.width/d.height)>.1),s&&(d.opacity=.1,l.opacity=1),n.fancybox.setTranslate(t.$content.removeClass("fancybox-is-hidden"),d),f(t.$content),void n.fancybox.animate(t.$content,l,a,function(){r.isAnimating=!1,r.complete()});if(r.updateSlide(t),!e)return f(c),p||t.$content.removeClass("fancybox-is-hidden").hide().fadeIn("fast"),void(t.pos===r.currPos&&r.complete());n.fancybox.stop(c),i="fancybox-animated fancybox-slide--"+(t.pos>=r.prevPos?"next":"previous")+" fancybox-fx-"+e,c.removeAttr("style").removeClass("fancybox-slide--current fancybox-slide--next fancybox-slide--previous").addClass(i),t.$content.removeClass("fancybox-is-hidden"),f(c),n.fancybox.animate(c,"fancybox-slide--current",a,function(){c.removeClass(i).removeAttr("style"),t.pos===r.currPos&&r.complete()},!0)}},getThumbPos:function(o){var i,a=this,s=!1,r=o.opts.$thumb,c=r&&r.length&&r[0].ownerDocument===e?r.offset():0,l=function(e){for(var o,i=e[0],a=i.getBoundingClientRect(),s=[];null!==i.parentElement;)"hidden"!==n(i.parentElement).css("overflow")&&"auto"!==n(i.parentElement).css("overflow")||s.push(i.parentElement.getBoundingClientRect()),i=i.parentElement;return o=s.every(function(t){var e=Math.min(a.right,t.right)-Math.max(a.left,t.left),n=Math.min(a.bottom,t.bottom)-Math.max(a.top,t.top);return e>0&&n>0}),o&&a.bottom>0&&a.right>0&&a.left=e.currPos-1&&o.pos<=e.currPos+1?i[o.pos]=o:o&&(n.fancybox.stop(o.$slide),o.$slide.off().remove())}),e.slides=i),e.isAnimating=!1,e.updateCursor(),e.trigger("afterShow"),o.opts.video.autoStart&&o.$slide.find("video,audio").filter(":visible:first").trigger("play"),o.opts.autoFocus&&"html"===o.contentType&&(t=o.$content.find("input[autofocus]:enabled:visible:first"),t.length?t.trigger("focus"):e.focus(null,!0)),o.$slide.scrollTop(0).scrollLeft(0))},preload:function(t){var e=this,n=e.slides[e.currPos+1],o=e.slides[e.currPos-1];o&&o.type===t&&e.loadSlide(o),n&&n.type===t&&e.loadSlide(n)},focus:function(t,o){var i,a,s=this,r=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex^="-"])'].join(",");s.isClosing||(i=!t&&s.current&&s.current.isComplete?s.current.$slide.find("*:visible"+(o?":not(.fancybox-close-small)":"")):s.$refs.container.find("*:visible"),i=i.filter(r).filter(function(){return"hidden"!==n(this).css("visibility")&&!n(this).hasClass("disabled")}),i.length?(a=i.index(e.activeElement),t&&t.shiftKey?(a<0||0==a)&&(t.preventDefault(),i.eq(i.length-1).trigger("focus")):(a<0||a==i.length-1)&&(t&&t.preventDefault(),i.eq(0).trigger("focus"))):s.$refs.container.trigger("focus"))},activate:function(){var t=this;n(".fancybox-container").each(function(){var e=n(this).data("FancyBox");e&&e.id!==t.id&&!e.isClosing&&(e.trigger("onDeactivate"),e.removeEvents(),e.isVisible=!1)}),t.isVisible=!0,(t.current||t.isIdle)&&(t.update(),t.updateControls()),t.trigger("onActivate"),t.addEvents()},close:function(t,e){var o,i,a,s,r,c,l,p=this,h=p.current,g=function(){p.cleanUp(t)};return!p.isClosing&&(p.isClosing=!0,p.trigger("beforeClose",t)===!1?(p.isClosing=!1,d(function(){p.update()}),!1):(p.removeEvents(),h.timouts&&clearTimeout(h.timouts),a=h.$content,o=h.opts.animationEffect,i=n.isNumeric(e)?e:o?h.opts.animationDuration:0,h.$slide.off(u).removeClass("fancybox-slide--complete fancybox-slide--next fancybox-slide--previous fancybox-animated"),h.$slide.siblings().trigger("onReset").remove(),i&&p.$refs.container.removeClass("fancybox-is-open").addClass("fancybox-is-closing"),p.hideLoading(h),p.hideControls(),p.updateCursor(),"zoom"!==o||t!==!0&&a&&i&&"image"===h.type&&!h.hasError&&(l=p.getThumbPos(h))||(o="fade"),"zoom"===o?(n.fancybox.stop(a),s=n.fancybox.getTranslate(a),c={top:s.top,left:s.left,scaleX:s.width/l.width,scaleY:s.height/l.height,width:l.width,height:l.height},r=h.opts.zoomOpacity,"auto"==r&&(r=Math.abs(h.width/h.height-l.width/l.height)>.1),r&&(l.opacity=0),n.fancybox.setTranslate(a,c),f(a),n.fancybox.animate(a,l,i,g),!0):(o&&i?t===!0?setTimeout(g,i):n.fancybox.animate(h.$slide.removeClass("fancybox-slide--current"),"fancybox-animated fancybox-slide--previous fancybox-fx-"+o,i,g):g(),!0)))},cleanUp:function(e){var o,i,a,s=this,r=s.current.opts.$orig;s.current.$slide.trigger("onReset"),s.$refs.container.empty().remove(),s.trigger("afterClose",e),s.current.opts.backFocus&&(r&&r.length&&r.is(":visible")||(r=s.$trigger),r&&r.length&&(i=t.scrollX,a=t.scrollY,r.trigger("focus"),n("html, body").scrollTop(a).scrollLeft(i))),s.current=null,o=n.fancybox.getInstance(),o?o.activate():(n("body").removeClass("fancybox-active compensate-for-scrollbar"),n("#fancybox-style-noscroll").remove())},trigger:function(t,e){var o,i=Array.prototype.slice.call(arguments,1),a=this,s=e&&e.opts?e:a.current;return s?i.unshift(s):s=a,i.unshift(a),n.isFunction(s.opts[t])&&(o=s.opts[t].apply(s,i)),o===!1?o:void("afterClose"!==t&&a.$refs?a.$refs.container.trigger(t+".fb",i):r.trigger(t+".fb",i))},updateControls:function(){var t=this,o=t.current,i=o.index,a=o.opts.caption,s=t.$refs.container,r=t.$refs.caption;o.$slide.trigger("refresh"),t.$caption=a&&a.length?r.html(a):null,t.isHiddenControls||t.isIdle||t.showControls(),s.find("[data-fancybox-count]").html(t.group.length),s.find("[data-fancybox-index]").html(i+1),s.find("[data-fancybox-prev]").prop("disabled",!o.opts.loop&&i<=0),s.find("[data-fancybox-next]").prop("disabled",!o.opts.loop&&i>=t.group.length-1),"image"===o.type?s.find("[data-fancybox-zoom]").show().end().find("[data-fancybox-download]").attr("href",o.opts.image.src||o.src).show():o.opts.toolbar&&s.find("[data-fancybox-download],[data-fancybox-zoom]").hide(),n(e.activeElement).is(":hidden,[disabled]")&&t.$refs.container.trigger("focus")},hideControls:function(){this.isHiddenControls=!0,this.$refs.container.removeClass("fancybox-show-infobar fancybox-show-toolbar fancybox-show-caption fancybox-show-nav")},showControls:function(){var t=this,e=t.current?t.current.opts:t.opts,n=t.$refs.container;t.isHiddenControls=!1, -t.idleSecondsCounter=0,n.toggleClass("fancybox-show-toolbar",!(!e.toolbar||!e.buttons)).toggleClass("fancybox-show-infobar",!!(e.infobar&&t.group.length>1)).toggleClass("fancybox-show-caption",!!t.$caption).toggleClass("fancybox-show-nav",!!(e.arrows&&t.group.length>1)).toggleClass("fancybox-is-modal",!!e.modal)},toggleControls:function(){this.isHiddenControls?this.showControls():this.hideControls()}}),n.fancybox={version:"3.4.1",defaults:a,getInstance:function(t){var e=n('.fancybox-container:not(".fancybox-is-closing"):last').data("FancyBox"),o=Array.prototype.slice.call(arguments,1);return e instanceof h&&("string"===n.type(t)?e[t].apply(e,o):"function"===n.type(t)&&t.apply(e,o),e)},open:function(t,e,n){return new h(t,e,n)},close:function(t){var e=this.getInstance();e&&(e.close(),t===!0&&this.close(t))},destroy:function(){this.close(!0),r.add("body").off("click.fb-start","**")},isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),use3d:function(){var n=e.createElement("div");return t.getComputedStyle&&t.getComputedStyle(n)&&t.getComputedStyle(n).getPropertyValue("transform")&&!(e.documentMode&&e.documentMode<11)}(),getTranslate:function(t){var e;return!(!t||!t.length)&&(e=t[0].getBoundingClientRect(),{top:e.top||0,left:e.left||0,width:e.width,height:e.height,opacity:parseFloat(t.css("opacity"))})},setTranslate:function(t,e){var n="",i={};if(t&&e)return e.left===o&&e.top===o||(n=(e.left===o?t.position().left:e.left)+"px, "+(e.top===o?t.position().top:e.top)+"px",n=this.use3d?"translate3d("+n+", 0px)":"translate("+n+")"),e.scaleX!==o&&e.scaleY!==o&&(n=(n.length?n+" ":"")+"scale("+e.scaleX+", "+e.scaleY+")"),n.length&&(i.transform=n),e.opacity!==o&&(i.opacity=e.opacity),e.width!==o&&(i.width=e.width),e.height!==o&&(i.height=e.height),t.css(i)},animate:function(t,e,i,a,s){var r,c=!1;n.isFunction(i)&&(a=i,i=null),n.isPlainObject(e)||t.removeAttr("style"),n.fancybox.stop(t),t.on(u,function(o){(!o||!o.originalEvent||t.is(o.originalEvent.target)&&"z-index"!=o.originalEvent.propertyName)&&(n.fancybox.stop(t),c&&n.fancybox.setTranslate(t,c),n.isNumeric(i)&&t.css("transition-duration",""),n.isPlainObject(e)?s===!1&&t.removeAttr("style"):s!==!0&&t.removeClass(e),n.isFunction(a)&&a(o))}),n.isNumeric(i)&&t.css("transition-duration",i+"ms"),n.isPlainObject(e)?(e.scaleX!==o&&e.scaleY!==o&&(r=n.fancybox.getTranslate(t),c=n.extend({},e,{width:r.width*e.scaleX,height:r.height*e.scaleY,scaleX:1,scaleY:1}),delete e.width,delete e.height,t.parent().hasClass("fancybox-slide--image")&&t.parent().addClass("fancybox-is-scaling")),n.fancybox.setTranslate(t,e)):t.addClass(e),t.data("timer",setTimeout(function(){t.trigger("transitionend")},i+16))},stop:function(t,e){t&&t.length&&(clearTimeout(t.data("timer")),e&&t.trigger(u),t.off(u).css("transition-duration",""),t.parent().removeClass("fancybox-is-scaling"))}},n.fn.fancybox=function(t){var e;return t=t||{},e=t.selector||!1,e?n("body").off("click.fb-start",e).on("click.fb-start",e,{options:t},i):this.off("click.fb-start").on("click.fb-start",{items:this,options:t},i),this},r.on("click.fb-start","[data-fancybox]",i),r.on("click.fb-start","[data-fancybox-trigger]",function(t){n('[data-fancybox="'+n(this).attr("data-fancybox-trigger")+'"]').eq(n(this).attr("data-fancybox-index")||0).trigger("click.fb-start",{$trigger:n(this)})}),function(){var t=".fancybox-button",e="fancybox-focus",o=null;r.on("mousedown mouseup focus blur",t,function(i){switch(i.type){case"mousedown":o=n(this);break;case"mouseup":o=null;break;case"focusin":n(t).removeClass(e),n(this).is(o)||n(this).is("[disabled]")||n(this).addClass(e);break;case"focusout":n(t).removeClass(e)}})}()}}(window,document,jQuery),function(t){"use strict";var e=function(e,n,o){if(e)return o=o||"","object"===t.type(o)&&(o=t.param(o,!0)),t.each(n,function(t,n){e=e.replace("$"+t,n||"")}),o.length&&(e+=(e.indexOf("?")>0?"&":"?")+o),e},n={youtube:{matcher:/(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*))(.*)/i,params:{autoplay:1,autohide:1,fs:1,rel:0,hd:1,wmode:"transparent",enablejsapi:1,html5:1},paramPlace:8,type:"iframe",url:"//www.youtube-nocookie.com/embed/$4",thumb:"//img.youtube.com/vi/$4/hqdefault.jpg"},vimeo:{matcher:/^.+vimeo.com\/(.*\/)?([\d]+)(.*)?/,params:{autoplay:1,hd:1,show_title:1,show_byline:1,show_portrait:0,fullscreen:1,api:1},paramPlace:3,type:"iframe",url:"//player.vimeo.com/video/$2"},instagram:{matcher:/(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,type:"image",url:"//$1/p/$2/media/?size=l"},gmap_place:{matcher:/(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(((maps\/(place\/(.*)\/)?\@(.*),(\d+.?\d+?)z))|(\?ll=))(.*)?/i,type:"iframe",url:function(t){return"//maps.google."+t[2]+"/?ll="+(t[9]?t[9]+"&z="+Math.floor(t[10])+(t[12]?t[12].replace(/^\//,"&"):""):t[12]+"").replace(/\?/,"&")+"&output="+(t[12]&&t[12].indexOf("layer=c")>0?"svembed":"embed")}},gmap_search:{matcher:/(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(maps\/search\/)(.*)/i,type:"iframe",url:function(t){return"//maps.google."+t[2]+"/maps?q="+t[5].replace("query=","q=").replace("api=1","")+"&output=embed"}}};t(document).on("objectNeedsType.fb",function(o,i,a){var s,r,c,l,d,u,f,p=a.src||"",h=!1;s=t.extend(!0,{},n,a.opts.media),t.each(s,function(n,o){if(c=p.match(o.matcher)){if(h=o.type,f=n,u={},o.paramPlace&&c[o.paramPlace]){d=c[o.paramPlace],"?"==d[0]&&(d=d.substring(1)),d=d.split("&");for(var i=0;ie.clientHeight,a=("scroll"===o||"auto"===o)&&e.scrollWidth>e.clientWidth;return i||a},l=function(t){for(var e=!1;;){if(e=c(t.get(0)))break;if(t=t.parent(),!t.length||t.hasClass("fancybox-stage")||t.is("body"))break}return e},d=function(t){var e=this;e.instance=t,e.$bg=t.$refs.bg,e.$stage=t.$refs.stage,e.$container=t.$refs.container,e.destroy(),e.$container.on("touchstart.fb.touch mousedown.fb.touch",n.proxy(e,"ontouchstart"))};d.prototype.destroy=function(){this.$container.off(".fb.touch")},d.prototype.ontouchstart=function(o){var i=this,c=n(o.target),d=i.instance,u=d.current,f=u.$slide,p=u.$content,h="touchstart"==o.type;if(h&&i.$container.off("mousedown.fb.touch"),(!o.originalEvent||2!=o.originalEvent.button)&&f.length&&c.length&&!r(c)&&!r(c.parent())&&(c.is("img")||!(o.originalEvent.clientX>c[0].clientWidth+c.offset().left))){if(!u||d.isAnimating||d.isClosing)return o.stopPropagation(),void o.preventDefault();if(i.realPoints=i.startPoints=a(o),i.startPoints.length){if(u.touch&&o.stopPropagation(),i.startEvent=o,i.canTap=!0,i.$target=c,i.$content=p,i.opts=u.opts.touch,i.isPanning=!1,i.isSwiping=!1,i.isZooming=!1,i.isScrolling=!1,i.canPan=d.canPan(),i.startTime=(new Date).getTime(),i.distanceX=i.distanceY=i.distance=0,i.canvasWidth=Math.round(f[0].clientWidth),i.canvasHeight=Math.round(f[0].clientHeight),i.contentLastPos=null,i.contentStartPos=n.fancybox.getTranslate(i.$content)||{top:0,left:0},i.sliderStartPos=i.sliderLastPos||n.fancybox.getTranslate(f),i.stagePos=n.fancybox.getTranslate(d.$refs.stage),i.sliderStartPos.top-=i.stagePos.top,i.sliderStartPos.left-=i.stagePos.left,i.contentStartPos.top-=i.stagePos.top,i.contentStartPos.left-=i.stagePos.left,n(e).off(".fb.touch").on(h?"touchend.fb.touch touchcancel.fb.touch":"mouseup.fb.touch mouseleave.fb.touch",n.proxy(i,"ontouchend")).on(h?"touchmove.fb.touch":"mousemove.fb.touch",n.proxy(i,"ontouchmove")),n.fancybox.isMobile&&e.addEventListener("scroll",i.onscroll,!0),!i.opts&&!i.canPan||!c.is(i.$stage)&&!i.$stage.find(c).length)return void(c.is(".fancybox-image")&&o.preventDefault());i.isScrollable=l(c)||l(c.parent()),n.fancybox.isMobile&&i.isScrollable||o.preventDefault(),(1===i.startPoints.length||u.hasError)&&(i.canPan?(n.fancybox.stop(i.$content),i.$content.css("transition-duration",""),i.isPanning=!0):i.isSwiping=!0,i.$container.addClass("fancybox-is-grabbing")),2===i.startPoints.length&&"image"===u.type&&(u.isLoaded||u.$ghost)&&(i.canTap=!1,i.isSwiping=!1,i.isPanning=!1,i.isZooming=!0,n.fancybox.stop(i.$content),i.$content.css("transition-duration",""),i.centerPointStartX=.5*(i.startPoints[0].x+i.startPoints[1].x)-n(t).scrollLeft(),i.centerPointStartY=.5*(i.startPoints[0].y+i.startPoints[1].y)-n(t).scrollTop(),i.percentageOfImageAtPinchPointX=(i.centerPointStartX-i.contentStartPos.left)/i.contentStartPos.width,i.percentageOfImageAtPinchPointY=(i.centerPointStartY-i.contentStartPos.top)/i.contentStartPos.height,i.startDistanceBetweenFingers=s(i.startPoints[0],i.startPoints[1]))}}},d.prototype.onscroll=function(t){var n=this;n.isScrolling=!0,e.removeEventListener("scroll",n.onscroll,!0)},d.prototype.ontouchmove=function(t){var e=this;return void 0!==t.originalEvent.buttons&&0===t.originalEvent.buttons?void e.ontouchend(t):e.isScrolling?void(e.canTap=!1):(e.newPoints=a(t),void((e.opts||e.canPan)&&e.newPoints.length&&e.newPoints.length&&(e.isSwiping&&e.isSwiping===!0||t.preventDefault(),e.distanceX=s(e.newPoints[0],e.startPoints[0],"x"),e.distanceY=s(e.newPoints[0],e.startPoints[0],"y"),e.distance=s(e.newPoints[0],e.startPoints[0]),e.distance>0&&(e.isSwiping?e.onSwipe(t):e.isPanning?e.onPan():e.isZooming&&e.onZoom()))))},d.prototype.onSwipe=function(e){var a,s=this,r=s.isSwiping,c=s.sliderStartPos.left||0;if(r!==!0)"x"==r&&(s.distanceX>0&&(s.instance.group.length<2||0===s.instance.current.index&&!s.instance.current.opts.loop)?c+=Math.pow(s.distanceX,.8):s.distanceX<0&&(s.instance.group.length<2||s.instance.current.index===s.instance.group.length-1&&!s.instance.current.opts.loop)?c-=Math.pow(-s.distanceX,.8):c+=s.distanceX),s.sliderLastPos={top:"x"==r?0:s.sliderStartPos.top+s.distanceY,left:c},s.requestId&&(i(s.requestId),s.requestId=null),s.requestId=o(function(){s.sliderLastPos&&(n.each(s.instance.slides,function(t,e){var o=e.pos-s.instance.currPos;n.fancybox.setTranslate(e.$slide,{top:s.sliderLastPos.top,left:s.sliderLastPos.left+o*s.canvasWidth+o*e.opts.gutter})}),s.$container.addClass("fancybox-is-sliding"))});else if(Math.abs(s.distance)>10){if(s.canTap=!1,s.instance.group.length<2&&s.opts.vertical?s.isSwiping="y":s.instance.isDragging||s.opts.vertical===!1||"auto"===s.opts.vertical&&n(t).width()>800?s.isSwiping="x":(a=Math.abs(180*Math.atan2(s.distanceY,s.distanceX)/Math.PI),s.isSwiping=a>45&&a<135?"y":"x"),s.canTap=!1,"y"===s.isSwiping&&n.fancybox.isMobile&&s.isScrollable)return void(s.isScrolling=!0);s.instance.isDragging=s.isSwiping,s.startPoints=s.newPoints,n.each(s.instance.slides,function(t,e){n.fancybox.stop(e.$slide),e.$slide.css("transition-duration",""),e.inTransition=!1,e.pos===s.instance.current.pos&&(s.sliderStartPos.left=n.fancybox.getTranslate(e.$slide).left-n.fancybox.getTranslate(s.instance.$refs.stage).left)}),s.instance.SlideShow&&s.instance.SlideShow.isActive&&s.instance.SlideShow.stop()}},d.prototype.onPan=function(){var t=this;return s(t.newPoints[0],t.realPoints[0])<(n.fancybox.isMobile?10:5)?void(t.startPoints=t.newPoints):(t.canTap=!1,t.contentLastPos=t.limitMovement(),t.requestId&&(i(t.requestId),t.requestId=null),void(t.requestId=o(function(){n.fancybox.setTranslate(t.$content,t.contentLastPos)})))},d.prototype.limitMovement=function(){var t,e,n,o,i,a,s=this,r=s.canvasWidth,c=s.canvasHeight,l=s.distanceX,d=s.distanceY,u=s.contentStartPos,f=u.left,p=u.top,h=u.width,g=u.height;return i=h>r?f+l:f,a=p+d,t=Math.max(0,.5*r-.5*h),e=Math.max(0,.5*c-.5*g),n=Math.min(r-h,.5*r-.5*h),o=Math.min(c-g,.5*c-.5*g),l>0&&i>t&&(i=t-1+Math.pow(-t+f+l,.8)||0),l<0&&i0&&a>e&&(a=e-1+Math.pow(-e+p+d,.8)||0),d<0&&aa?(t=t>0?0:t,t=ts?(e=e>0?0:e,e=e50?(n.fancybox.animate(o.instance.current.$slide,{top:o.sliderStartPos.top+o.distanceY+150*o.velocityY,opacity:0},200),i=o.instance.close(!0,200)):"x"==t&&o.distanceX>50&&a>1?i=o.instance.previous(o.speedX):"x"==t&&o.distanceX<-50&&a>1&&(i=o.instance.next(o.speedX)),i!==!1||"x"!=t&&"y"!=t||(e||a<2?o.instance.centerSlide(o.instance.current,150):o.instance.jumpTo(o.instance.current.index)),o.$container.removeClass("fancybox-is-sliding")},d.prototype.endPanning=function(){var t,e,o,i=this;i.contentLastPos&&(i.opts.momentum===!1?(t=i.contentLastPos.left,e=i.contentLastPos.top):(t=i.contentLastPos.left+i.velocityX*i.speed,e=i.contentLastPos.top+i.velocityY*i.speed),o=i.limitPosition(t,e,i.contentStartPos.width,i.contentStartPos.height),o.width=i.contentStartPos.width,o.height=i.contentStartPos.height,n.fancybox.animate(i.$content,o,330))},d.prototype.endZooming=function(){var t,e,o,i,a=this,s=a.instance.current,r=a.newWidth,c=a.newHeight;a.contentLastPos&&(t=a.contentLastPos.left,e=a.contentLastPos.top,i={top:e,left:t,width:r,height:c,scaleX:1,scaleY:1},n.fancybox.setTranslate(a.$content,i),rs.width||c>s.height?a.instance.scaleToActual(a.centerPointStartX,a.centerPointStartY,150):(o=a.limitPosition(t,e,r,c),n.fancybox.setTranslate(a.$content,n.fancybox.getTranslate(a.$content)),n.fancybox.animate(a.$content,o,150)))},d.prototype.onTap=function(e){var o,i=this,s=n(e.target),r=i.instance,c=r.current,l=e&&a(e)||i.startPoints,d=l[0]?l[0].x-n(t).scrollLeft()-i.stagePos.left:0,u=l[0]?l[0].y-n(t).scrollTop()-i.stagePos.top:0,f=function(t){var o=c.opts[t];if(n.isFunction(o)&&(o=o.apply(r,[c,e])),o)switch(o){case"close":r.close(i.startEvent);break;case"toggleControls":r.toggleControls(!0);break;case"next":r.next();break;case"nextOrClose":r.group.length>1?r.next():r.close(i.startEvent);break;case"zoom":"image"==c.type&&(c.isLoaded||c.$ghost)&&(r.canPan()?r.scaleToFit():r.isScaledDown()?r.scaleToActual(d,u):r.group.length<2&&r.close(i.startEvent))}};if((!e.originalEvent||2!=e.originalEvent.button)&&(s.is("img")||!(d>s[0].clientWidth+s.offset().left))){if(s.is(".fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-container"))o="Outside";else if(s.is(".fancybox-slide"))o="Slide";else{if(!r.current.$content||!r.current.$content.find(s).addBack().filter(s).length)return;o="Content"}if(i.tapped){if(clearTimeout(i.tapped),i.tapped=null,Math.abs(d-i.tapX)>50||Math.abs(u-i.tapY)>50)return this;f("dblclick"+o)}else i.tapX=d,i.tapY=u,c.opts["dblclick"+o]&&c.opts["dblclick"+o]!==c.opts["click"+o]?i.tapped=setTimeout(function(){i.tapped=null,f("click"+o)},500):f("click"+o);return this}},n(e).on("onActivate.fb",function(t,e){e&&!e.Guestures&&(e.Guestures=new d(e))})}(window,document,jQuery),function(t,e){"use strict";e.extend(!0,e.fancybox.defaults,{btnTpl:{slideShow:''},slideShow:{autoStart:!1,speed:3e3}});var n=function(t){this.instance=t,this.init()};e.extend(n.prototype,{timer:null,isActive:!1,$button:null,init:function(){var t=this;t.$button=t.instance.$refs.toolbar.find("[data-fancybox-play]").on("click",function(){t.toggle()}),(t.instance.group.length<2||!t.instance.group[t.instance.currIndex].opts.slideShow)&&t.$button.hide()},set:function(t){var e=this,n=e.instance,o=n.current,i=function(){e.isActive&&n.jumpTo((n.currIndex+1)%n.group.length)};o&&(t===!0||o.opts.loop||n.currIndex'},fullScreen:{autoStart:!1}}),e(t).on(n.fullscreenchange,function(){var t=o.isFullscreen(),n=e.fancybox.getInstance();n&&(n.current&&"image"===n.current.type&&n.isAnimating&&(n.current.$content.css("transition","none"),n.isAnimating=!1,n.update(!0,!0,0)),n.trigger("onFullscreenChange",t),n.$refs.container.toggleClass("fancybox-is-fullscreen",t),n.$refs.toolbar.find("[data-fancybox-fullscreen]").toggleClass("fancybox-button--fsenter",!t).toggleClass("fancybox-button--fsexit",t))})}e(t).on({"onInit.fb":function(t,e){var i;return n?void(e&&e.group[e.currIndex].opts.fullScreen?(i=e.$refs.container,i.on("click.fb-fullscreen","[data-fancybox-fullscreen]",function(t){t.stopPropagation(),t.preventDefault(),o.toggle()}),e.opts.fullScreen&&e.opts.fullScreen.autoStart===!0&&o.request(),e.FullScreen=o):e&&e.$refs.toolbar.find("[data-fancybox-fullscreen]").hide()):void e.$refs.toolbar.find("[data-fancybox-fullscreen]").remove()},"afterKeydown.fb":function(t,e,n,o,i){e&&e.FullScreen&&70===i&&(o.preventDefault(),e.FullScreen.toggle())},"beforeClose.fb":function(t,e){e&&e.FullScreen&&e.$refs.container.hasClass("fancybox-is-fullscreen")&&o.exit()}})}(document,jQuery),function(t,e){"use strict";var n="fancybox-thumbs",o=n+"-active";e.fancybox.defaults=e.extend(!0,{btnTpl:{thumbs:''},thumbs:{autoStart:!1,hideOnClose:!0,parentEl:".fancybox-container",axis:"y"}},e.fancybox.defaults);var i=function(t){this.init(t)};e.extend(i.prototype,{$button:null,$grid:null,$list:null,isVisible:!1,isActive:!1,init:function(t){var e,n,o=this;o.instance=t,t.Thumbs=o,o.opts=t.group[t.currIndex].opts.thumbs,e=t.group[0],e=e.opts.thumb||!(!e.opts.$thumb||!e.opts.$thumb.length)&&e.opts.$thumb.attr("src"),t.group.length>1&&(n=t.group[1],n=n.opts.thumb||!(!n.opts.$thumb||!n.opts.$thumb.length)&&n.opts.$thumb.attr("src")),o.$button=t.$refs.toolbar.find("[data-fancybox-thumbs]"),o.opts&&e&&n?(o.$button.show().on("click",function(){o.toggle()}),o.isActive=!0):o.$button.hide()},create:function(){var t,o=this,i=o.instance,a=o.opts.parentEl,s=[];o.$grid||(o.$grid=e('
').appendTo(i.$refs.container.find(a).addBack().filter(a)),o.$grid.on("click","a",function(){i.jumpTo(e(this).attr("data-index"))})),o.$list||(o.$list=e('
').appendTo(o.$grid)),e.each(i.group,function(e,n){t=n.opts.thumb||(n.opts.$thumb?n.opts.$thumb.attr("src"):null),t||"image"!==n.type||(t=n.src),s.push('':"")+">")}),o.$list[0].innerHTML=s.join(""),"x"===o.opts.axis&&o.$list.width(parseInt(o.$grid.css("padding-right"),10)+i.group.length*o.$list.children().eq(0).outerWidth(!0))},focus:function(t){var e,n,i=this,a=i.$list,s=i.$grid;i.instance.current&&(e=a.children().removeClass(o).filter('[data-index="'+i.instance.current.index+'"]').addClass(o),n=e.position(),"y"===i.opts.axis&&(n.top<0||n.top>a.height()-e.outerHeight())?a.stop().animate({scrollTop:a.scrollTop()+n.top},t):"x"===i.opts.axis&&(n.lefts.scrollLeft()+(s.width()-e.outerWidth()))&&a.parent().stop().animate({scrollLeft:n.left},t))},update:function(){var t=this;t.instance.$refs.container.toggleClass("fancybox-show-thumbs",this.isVisible),t.isVisible?(t.$grid||t.create(),t.instance.trigger("onThumbsShow"),t.focus(0)):t.$grid&&t.instance.trigger("onThumbsHide"),t.instance.update()},hide:function(){this.isVisible=!1,this.update()},show:function(){this.isVisible=!0,this.update()},toggle:function(){this.isVisible=!this.isVisible,this.update()}}),e(t).on({"onInit.fb":function(t,e){var n;e&&!e.Thumbs&&(n=new i(e),n.isActive&&n.opts.autoStart===!0&&n.show())},"beforeShow.fb":function(t,e,n,o){var i=e&&e.Thumbs;i&&i.isVisible&&i.focus(o?0:250)},"afterKeydown.fb":function(t,e,n,o,i){var a=e&&e.Thumbs;a&&a.isActive&&71===i&&(o.preventDefault(),a.toggle())},"beforeClose.fb":function(t,e){var n=e&&e.Thumbs;n&&n.isVisible&&n.opts.hideOnClose!==!1&&n.$grid.hide()}})}(document,jQuery),function(t,e){"use strict";function n(t){var e={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};return String(t).replace(/[&<>"'`=\/]/g,function(t){return e[t]})}e.extend(!0,e.fancybox.defaults,{btnTpl:{share:''},share:{url:function(t,e){return!t.currentHash&&"inline"!==e.type&&"html"!==e.type&&(e.origSrc||e.src)||window.location},tpl:''}}),e(t).on("click","[data-fancybox-share]",function(){var t,o,i=e.fancybox.getInstance(),a=i.current||null;a&&("function"===e.type(a.opts.share.url)&&(t=a.opts.share.url.apply(a,[i,a])),o=a.opts.share.tpl.replace(/\{\{media\}\}/g,"image"===a.type?encodeURIComponent(a.src):"").replace(/\{\{url\}\}/g,encodeURIComponent(t)).replace(/\{\{url_raw\}\}/g,n(t)).replace(/\{\{descr\}\}/g,i.$caption?encodeURIComponent(i.$caption.text()):""),e.fancybox.open({src:i.translate(i,o),type:"html",opts:{touch:!1,animationEffect:!1,afterLoad:function(t,e){i.$refs.container.one("beforeClose.fb",function(){t.close(null,0)}),e.$content.find(".fancybox-share__button").click(function(){return window.open(this.href,"Share","width=550, height=450"),!1})},mobile:{autoFocus:!1}}}))})}(document,jQuery),function(t,e,n){"use strict";function o(){var e=t.location.hash.substr(1),n=e.split("-"),o=n.length>1&&/^\+?\d+$/.test(n[n.length-1])?parseInt(n.pop(-1),10)||1:1,i=n.join("-");return{hash:e,index:o<1?1:o,gallery:i}}function i(t){""!==t.gallery&&n("[data-fancybox='"+n.escapeSelector(t.gallery)+"']").eq(t.index-1).focus().trigger("click.fb-start")}function a(t){var e,n;return!!t&&(e=t.current?t.current.opts:t.opts,n=e.hash||(e.$orig?e.$orig.data("fancybox")||e.$orig.data("fancybox-trigger"):""),""!==n&&n)}n.escapeSelector||(n.escapeSelector=function(t){var e=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,n=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t};return(t+"").replace(e,n)}),n(function(){n.fancybox.defaults.hash!==!1&&(n(e).on({"onInit.fb":function(t,e){var n,i;e.group[e.currIndex].opts.hash!==!1&&(n=o(),i=a(e),i&&n.gallery&&i==n.gallery&&(e.currIndex=n.index-1))},"beforeShow.fb":function(n,o,i,s){var r;i&&i.opts.hash!==!1&&(r=a(o),r&&(o.currentHash=r+(o.group.length>1?"-"+(i.index+1):""),t.location.hash!=="#"+o.currentHash&&(s&&!o.origHash&&(o.origHash=t.location.hash),o.hashTimer&&clearTimeout(o.hashTimer),o.hashTimer=setTimeout(function(){"replaceState"in t.history?(t.history[s?"pushState":"replaceState"]({},e.title,t.location.pathname+t.location.search+"#"+o.currentHash),s&&(o.hasCreatedHistory=!0)):t.location.hash=o.currentHash,o.hashTimer=null},300))))},"beforeClose.fb":function(n,o,i){i.opts.hash!==!1&&(clearTimeout(o.hashTimer),o.currentHash&&o.hasCreatedHistory?t.history.back():o.currentHash&&("replaceState"in t.history?t.history.replaceState({},e.title,t.location.pathname+t.location.search+(o.origHash||"")):t.location.hash=o.origHash),o.currentHash=null)}}),n(t).on("hashchange.fb",function(){var t=o(),e=null;n.each(n(".fancybox-container").get().reverse(),function(t,o){var i=n(o).data("FancyBox");if(i&&i.currentHash)return e=i,!1}),e?e.currentHash===t.gallery+"-"+t.index||1===t.index&&e.currentHash==t.gallery||(e.currentHash=null,e.close()):""!==t.gallery&&i(t)}),setTimeout(function(){n.fancybox.getInstance()||i(o())},50))})}(window,document,jQuery),function(t,e){"use strict";var n=(new Date).getTime();e(t).on({"onInit.fb":function(t,e,o){e.$refs.stage.on("mousewheel DOMMouseScroll wheel MozMousePixelScroll",function(t){ -var o=e.current,i=(new Date).getTime();e.group.length<2||o.opts.wheel===!1||"auto"===o.opts.wheel&&"image"!==o.type||(t.preventDefault(),t.stopPropagation(),o.$slide.hasClass("fancybox-animated")||(t=t.originalEvent||t,i-n<250||(n=i,e[(-t.deltaY||-t.deltaX||t.wheelDelta||-t.detail)<0?"next":"previous"]())))})}})}(document,jQuery); \ No newline at end of file +!function(t,e,n,o){"use strict";function a(t,e){var o,a,i,s=[],r=0;t&&t.isDefaultPrevented()||(t.preventDefault(),e=e||{},t&&t.data&&(e=p(t.data.options,e)),o=e.$target||n(t.currentTarget).trigger("blur"),i=n.fancybox.getInstance(),i&&i.$trigger&&i.$trigger.is(o)||(e.selector?s=n(e.selector):(a=o.attr("data-fancybox")||"",a?(s=t.data?t.data.items:[],s=s.length?s.filter('[data-fancybox="'+a+'"]'):n('[data-fancybox="'+a+'"]')):s=[o]),r=n(s).index(o),r<0&&(r=0),i=n.fancybox.open(s,e,r),i.$trigger=o))}if(t.console=t.console||{info:function(t){}},n){if(n.fn.fancybox)return void console.info("fancyBox already initialized");var i={closeExisting:!1,loop:!1,gutter:50,keyboard:!0,arrows:!0,infobar:!0,smallBtn:"auto",toolbar:"auto",buttons:["zoom","slideShow","thumbs","close"],idleTime:3,protect:!1,modal:!1,image:{preload:!1},ajax:{settings:{data:{fancybox:!0}}},iframe:{tpl:'',preload:!0,css:{},attr:{scrolling:"auto"}},video:{tpl:'',format:"",autoStart:!0},defaultType:"image",animationEffect:"zoom",animationDuration:366,zoomOpacity:"auto",transitionEffect:"fade",transitionDuration:366,slideClass:"",baseClass:"",baseTpl:'',spinnerTpl:'
',errorTpl:'

{{ERROR}}

',btnTpl:{download:'',zoom:'',close:'',arrowLeft:'',arrowRight:'',smallBtn:''},parentEl:"body",hideScrollbar:!0,autoFocus:!0,backFocus:!0,trapFocus:!0,fullScreen:{autoStart:!1},touch:{vertical:!0,momentum:!0},hash:null,media:{},slideShow:{autoStart:!1,speed:3e3},thumbs:{autoStart:!1,hideOnClose:!0,parentEl:".fancybox-container",axis:"y"},wheel:"auto",onInit:n.noop,beforeLoad:n.noop,afterLoad:n.noop,beforeShow:n.noop,afterShow:n.noop,beforeClose:n.noop,afterClose:n.noop,onActivate:n.noop,onDeactivate:n.noop,clickContent:function(t,e){return"image"===t.type&&"zoom"},clickSlide:"close",clickOutside:"close",dblclickContent:!1,dblclickSlide:!1,dblclickOutside:!1,mobile:{idleTime:!1,clickContent:function(t,e){return"image"===t.type&&"toggleControls"},clickSlide:function(t,e){return"image"===t.type?"toggleControls":"close"},dblclickContent:function(t,e){return"image"===t.type&&"zoom"},dblclickSlide:function(t,e){return"image"===t.type&&"zoom"}},lang:"en",i18n:{en:{CLOSE:"Close",NEXT:"Next",PREV:"Previous",ERROR:"The requested content cannot be loaded.
Please try again later.",PLAY_START:"Start slideshow",PLAY_STOP:"Pause slideshow",FULL_SCREEN:"Full screen",THUMBS:"Thumbnails",DOWNLOAD:"Download",SHARE:"Share",ZOOM:"Zoom"},de:{CLOSE:"Schliessen",NEXT:"Weiter",PREV:"Zurück",ERROR:"Die angeforderten Daten konnten nicht geladen werden.
Bitte versuchen Sie es später nochmal.",PLAY_START:"Diaschau starten",PLAY_STOP:"Diaschau beenden",FULL_SCREEN:"Vollbild",THUMBS:"Vorschaubilder",DOWNLOAD:"Herunterladen",SHARE:"Teilen",ZOOM:"Maßstab"}}},s=n(t),r=n(e),c=0,l=function(t){return t&&t.hasOwnProperty&&t instanceof n},d=function(){return t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||function(e){return t.setTimeout(e,1e3/60)}}(),u=function(){var t,n=e.createElement("fakeelement"),a={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(t in a)if(n.style[t]!==o)return a[t];return"transitionend"}(),f=function(t){return t&&t.length&&t[0].offsetHeight},p=function(t,e){var o=n.extend(!0,{},t,e);return n.each(e,function(t,e){n.isArray(e)&&(o[t]=e)}),o},h=function(o){for(var a,i=o[0],s=i.getBoundingClientRect(),r=[],c=n(t).height(),l=n(e).scrollTop(),d=s.top+l,u=l-d,f=d+s.height-(l+c);null!==i.parentElement;)"hidden"!==n(i.parentElement).css("overflow")&&"auto"!==n(i.parentElement).css("overflow")||r.push(i.parentElement.getBoundingClientRect()),i=i.parentElement;return a=r.every(function(t){var e=Math.min(s.right,t.right)-Math.max(s.left,t.left),n=Math.min(s.bottom,t.bottom)-Math.max(s.top,t.top);return e>0&&n>0}),!a||l>d+s.height||d>l+c?0:u>0?100-100*u/s.height:f>0?100-100*f/s.height:100},g=function(t,e,o){var a=this;a.opts=p({index:o},n.fancybox.defaults),n.isPlainObject(e)&&(a.opts=p(a.opts,e)),n.fancybox.isMobile&&(a.opts=p(a.opts,a.opts.mobile)),a.id=a.opts.id||++c,a.currIndex=parseInt(a.opts.index,10)||0,a.prevIndex=null,a.prevPos=null,a.currPos=0,a.firstRun=!0,a.group=[],a.slides={},a.addContent(t),a.group.length&&a.init()};n.extend(g.prototype,{init:function(){var o,a,i=this,s=i.group[i.currIndex],r=s.opts;r.closeExisting&&n.fancybox.close(!0),n("body").addClass("fancybox-active"),!n.fancybox.getInstance()&&r.hideScrollbar!==!1&&!n.fancybox.isMobile&&e.body.scrollHeight>t.innerHeight&&(n("head").append('"),n("body").addClass("compensate-for-scrollbar")),a="",n.each(r.buttons,function(t,e){a+=r.btnTpl[e]||""}),o=n(i.translate(i,r.baseTpl.replace("{{buttons}}",a).replace("{{arrows}}",r.btnTpl.arrowLeft+r.btnTpl.arrowRight))).attr("id","fancybox-container-"+i.id).addClass(r.baseClass).data("FancyBox",i).appendTo(r.parentEl),i.$refs={container:o},["bg","inner","infobar","toolbar","stage","caption","navigation"].forEach(function(t){i.$refs[t]=o.find(".fancybox-"+t)}),i.trigger("onInit"),i.activate(),i.jumpTo(i.currIndex)},translate:function(t,e){var n=t.opts.i18n[t.opts.lang];return e.replace(/\{\{(\w+)\}\}/g,function(t,e){var a=n[e];return a===o?t:a})},addContent:function(t){var e,a=this,i=n.makeArray(t);n.each(i,function(t,e){var i,s,r,c,l,d={},u={};n.isPlainObject(e)?(d=e,u=e.opts||e):"object"===n.type(e)&&n(e).length?(i=n(e),u=i.data()||{},u=n.extend(!0,{},u,u.options),u.$orig=i,d.src=a.opts.src||u.src||i.attr("href"),d.type||d.src||(d.type="inline",d.src=e)):d={type:"html",src:e+""},d.opts=n.extend(!0,{},a.opts,u),n.isArray(u.buttons)&&(d.opts.buttons=u.buttons),n.fancybox.isMobile&&d.opts.mobile&&(d.opts=p(d.opts,d.opts.mobile)),s=d.type||d.opts.type,c=d.src||"",!s&&c&&((r=c.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(s="video",d.opts.video.format||(d.opts.video.format="video/"+("ogv"===r[1]?"ogg":r[1]))):c.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?s="image":c.match(/\.(pdf)((\?|#).*)?$/i)?s="iframe":"#"===c.charAt(0)&&(s="inline")),s?d.type=s:a.trigger("objectNeedsType",d),d.contentType||(d.contentType=n.inArray(d.type,["html","inline","ajax"])>-1?"html":d.type),d.index=a.group.length,"auto"==d.opts.smallBtn&&(d.opts.smallBtn=n.inArray(d.type,["html","inline","ajax"])>-1),"auto"===d.opts.toolbar&&(d.opts.toolbar=!d.opts.smallBtn),d.opts.$trigger&&d.index===a.opts.index&&(d.opts.$thumb=d.opts.$trigger.find("img:first"),d.opts.$thumb.length&&(d.opts.$orig=d.opts.$trigger)),d.opts.$thumb&&d.opts.$thumb.length||!d.opts.$orig||(d.opts.$thumb=d.opts.$orig.find("img:first")),"function"===n.type(d.opts.caption)&&(d.opts.caption=d.opts.caption.apply(e,[a,d])),"function"===n.type(a.opts.caption)&&(d.opts.caption=a.opts.caption.apply(e,[a,d])),d.opts.caption instanceof n||(d.opts.caption=d.opts.caption===o?"":d.opts.caption+""),"ajax"===d.type&&(l=c.split(/\s+/,2),l.length>1&&(d.src=l.shift(),d.opts.filter=l.shift())),d.opts.modal&&(d.opts=n.extend(!0,d.opts,{trapFocus:!0,infobar:0,toolbar:0,smallBtn:0,keyboard:0,slideShow:0,fullScreen:0,thumbs:0,touch:0,clickContent:!1,clickSlide:!1,clickOutside:!1,dblclickContent:!1,dblclickSlide:!1,dblclickOutside:!1})),a.group.push(d)}),Object.keys(a.slides).length&&(a.updateControls(),e=a.Thumbs,e&&e.isActive&&(e.create(),e.focus()))},addEvents:function(){var e=this;e.removeEvents(),e.$refs.container.on("click.fb-close","[data-fancybox-close]",function(t){t.stopPropagation(),t.preventDefault(),e.close(t)}).on("touchstart.fb-prev click.fb-prev","[data-fancybox-prev]",function(t){t.stopPropagation(),t.preventDefault(),e.previous()}).on("touchstart.fb-next click.fb-next","[data-fancybox-next]",function(t){t.stopPropagation(),t.preventDefault(),e.next()}).on("click.fb","[data-fancybox-zoom]",function(t){e[e.isScaledDown()?"scaleToActual":"scaleToFit"]()}),s.on("orientationchange.fb resize.fb",function(t){t&&t.originalEvent&&"resize"===t.originalEvent.type?d(function(){e.update()}):(e.current&&"iframe"===e.current.type&&e.$refs.stage.hide(),setTimeout(function(){e.$refs.stage.show(),e.update()},n.fancybox.isMobile?600:250))}),r.on("keydown.fb",function(t){var o=n.fancybox?n.fancybox.getInstance():null,a=o.current,i=t.keyCode||t.which;if(9==i)return void(a.opts.trapFocus&&e.focus(t));if(!(!a.opts.keyboard||t.ctrlKey||t.altKey||t.shiftKey||n(t.target).is("input")||n(t.target).is("textarea")))return 8===i||27===i?(t.preventDefault(),void e.close(t)):37===i||38===i?(t.preventDefault(),void e.previous()):39===i||40===i?(t.preventDefault(),void e.next()):void e.trigger("afterKeydown",t,i)}),e.group[e.currIndex].opts.idleTime&&(e.idleSecondsCounter=0,r.on("mousemove.fb-idle mouseleave.fb-idle mousedown.fb-idle touchstart.fb-idle touchmove.fb-idle scroll.fb-idle keydown.fb-idle",function(t){e.idleSecondsCounter=0,e.isIdle&&e.showControls(),e.isIdle=!1}),e.idleInterval=t.setInterval(function(){e.idleSecondsCounter++,e.idleSecondsCounter>=e.group[e.currIndex].opts.idleTime&&!e.isDragging&&(e.isIdle=!0,e.idleSecondsCounter=0,e.hideControls())},1e3))},removeEvents:function(){var e=this;s.off("orientationchange.fb resize.fb"),r.off("keydown.fb .fb-idle"),this.$refs.container.off(".fb-close .fb-prev .fb-next"),e.idleInterval&&(t.clearInterval(e.idleInterval),e.idleInterval=null)},previous:function(t){return this.jumpTo(this.currPos-1,t)},next:function(t){return this.jumpTo(this.currPos+1,t)},jumpTo:function(t,e){var a,i,s,r,c,l,u,p,h=this,g=h.group.length;if(!(h.isDragging||h.isClosing||h.isAnimating&&h.firstRun)){if(t=parseInt(t,10),s=h.current?h.current.opts.loop:h.opts.loop,!s&&(t<0||t>=g))return!1;if(a=h.firstRun=!Object.keys(h.slides).length,c=h.current,h.prevIndex=h.currIndex,h.prevPos=h.currPos,r=h.createSlide(t),g>1&&((s||r.index0)&&h.createSlide(t-1)),h.current=r,h.currIndex=r.index,h.currPos=r.pos,h.trigger("beforeShow",a),h.updateControls(),r.forcedDuration=o,n.isNumeric(e)?r.forcedDuration=e:e=r.opts[a?"animationDuration":"transitionDuration"],e=parseInt(e,10),i=h.isMoved(c),r.$slide.addClass("fancybox-slide--current"),a)return r.opts.animationEffect&&e&&h.$refs.container.css("transition-duration",e+"ms"),h.$refs.container.addClass("fancybox-is-open").trigger("focus"),h.loadSlide(r),void h.preload("image");l=n.fancybox.getTranslate(c.$slide),u=n.fancybox.getTranslate(h.$refs.stage),n.each(h.slides,function(t,e){n.fancybox.stop(e.$slide,!0)}),c.pos!==r.pos&&(c.isComplete=!1,c.$slide.removeClass("fancybox-slide--complete fancybox-slide--current")),i?(p=l.left-(c.pos*l.width+c.pos*c.opts.gutter),n.each(h.slides,function(t,o){var a=o.pos*l.width+o.pos*o.opts.gutter;n.fancybox.setTranslate(o.$slide,{top:0,left:a+p-u.left}),o.pos!==r.pos&&o.$slide.addClass("fancybox-slide--"+(o.pos>r.pos?"next":"previous")),f(o.$slide),d(function(){n.fancybox.animate(o.$slide,{top:0,left:(o.pos-r.pos)*l.width+(o.pos-r.pos)*o.opts.gutter},e,function(){o.$slide.removeAttr("style").removeClass("fancybox-slide--next fancybox-slide--previous"),o.pos===h.currPos&&h.complete()})})})):(r.$slide.parent().children().removeAttr("style"),e&&r.opts.transitionEffect&&n.fancybox.animate(c.$slide,"fancybox-animated fancybox-slide--"+(c.pos>r.pos?"next":"previous")+" fancybox-fx-"+r.opts.transitionEffect,e,null,!1)),r.isLoaded?h.revealContent(r):h.loadSlide(r),h.preload("image")}},createSlide:function(t){var e,o,a=this;return o=t%a.group.length,o=o<0?a.group.length+o:o,!a.slides[t]&&a.group[o]&&(e=n('
').appendTo(a.$refs.stage),a.slides[t]=n.extend(!0,{},a.group[o],{pos:t,$slide:e,isLoaded:!1}),a.updateSlide(a.slides[t])),a.slides[t]},scaleToActual:function(t,e,a){var i,s,r,c,l,d=this,u=d.current,f=u.$content,p=n.fancybox.getTranslate(u.$slide).width,h=n.fancybox.getTranslate(u.$slide).height,g=u.width,b=u.height;!d.isAnimating&&f&&"image"==u.type&&u.isLoaded&&!u.hasError&&(n.fancybox.stop(f),d.isAnimating=!0,t=t===o?.5*p:t,e=e===o?.5*h:e,i=n.fancybox.getTranslate(f),i.top-=n.fancybox.getTranslate(u.$slide).top,i.left-=n.fancybox.getTranslate(u.$slide).left,c=g/i.width,l=b/i.height,s=.5*p-.5*g,r=.5*h-.5*b,g>p&&(s=i.left*c-(t*c-t),s>0&&(s=0),sh&&(r=i.top*l-(e*l-e),r>0&&(r=0),re-.5&&(l=e),d>o-.5&&(d=o),"image"===t.type?(u.top=Math.floor(.5*(o-d))+parseFloat(c.css("paddingTop")),u.left=Math.floor(.5*(e-l))+parseFloat(c.css("paddingLeft"))):"video"===t.contentType&&(i=t.opts.width&&t.opts.height?l/d:t.opts.ratio||16/9,d>l/i?d=l/i:l>d*i&&(l=d*i)),u.width=l,u.height=d,u)},update:function(){var t=this;n.each(t.slides,function(e,n){t.updateSlide(n)})},updateSlide:function(t){var e=this,o=t&&t.$content,a=t.width||t.opts.width,i=t.height||t.opts.height,s=t.$slide;o&&(a||i||"video"===t.contentType)&&!t.hasError&&(n.fancybox.stop(o),n.fancybox.setTranslate(o,e.getFitPos(t)),t.pos===e.currPos&&(e.isAnimating=!1,e.updateCursor())),s.length&&(s.trigger("refresh"),e.$refs.toolbar.toggleClass("compensate-for-scrollbar",s.get(0).scrollHeight>s.get(0).clientHeight)),e.trigger("onUpdate",t)},centerSlide:function(t,e){var a,i,s=this;s.current&&(a=Math.round(t.$slide.width()),i=t.pos-s.current.pos,n.fancybox.animate(t.$slide,{top:0,left:i*a+i*t.opts.gutter,opacity:1},e===o?0:e,function(){t.$slide.siblings().removeAttr("style").removeClass("fancybox-slide--previous fancybox-slide--next"),t.isComplete||s.complete()},!1))},isMoved:function(t){var e,o,a=t||this.current;return!!a&&(o=n.fancybox.getTranslate(this.$refs.stage),e=n.fancybox.getTranslate(a.$slide),(Math.abs(e.top-o.top)>0||Math.abs(e.left-o.left)>0)&&!a.$slide.hasClass("fancybox-animated"))},updateCursor:function(t,e){var o,a=this,i=a.current,s=a.$refs.container;i&&!a.isClosing&&a.Guestures&&(s.removeClass("fancybox-is-zoomable fancybox-can-zoomIn fancybox-can-zoomOut fancybox-can-swipe fancybox-can-pan"),o=a.isZoomable(),s.toggleClass("fancybox-is-zoomable",o),n("[data-fancybox-zoom]").prop("disabled",!o),a.canPan(t,e)?s.addClass("fancybox-can-pan"):o&&("zoom"===i.opts.clickContent||n.isFunction(i.opts.clickContent)&&"zoom"==i.opts.clickContent(i))?s.addClass("fancybox-can-zoomIn"):i.opts.touch&&(i.opts.touch.vertical||a.group.length>1)&&"video"!==i.contentType&&s.addClass("fancybox-can-swipe"))},isZoomable:function(){var t,e=this,n=e.current;if(n&&!e.isClosing&&"image"===n.type&&!n.hasError){if(!n.isLoaded)return!0;if(t=e.getFitPos(n),n.width>t.width||n.height>t.height)return!0}return!1},isScaledDown:function(t,e){var a=this,i=!1,s=a.current,r=s.$content;return t!==o&&e!==o?i=t1.5||Math.abs(i.height-r.height)>1.5),r},loadSlide:function(t){var e,o,a,i=this;if(!t.isLoading&&!t.isLoaded){if(t.isLoading=!0,i.trigger("beforeLoad",t)===!1)return t.isLoading=!1,!1;switch(e=t.type,o=t.$slide,o.off("refresh").trigger("onReset").addClass(t.opts.slideClass),e){case"image":i.setImage(t);break;case"iframe":i.setIframe(t);break;case"html":i.setContent(t,t.src||t.content);break;case"video":i.setContent(t,t.opts.video.tpl.replace("{{src}}",t.src).replace("{{format}}",t.opts.videoFormat||t.opts.video.format));break;case"inline":n(t.src).length?i.setContent(t,n(t.src)):i.setError(t);break;case"ajax":i.showLoading(t),a=n.ajax(n.extend({},t.opts.ajax.settings,{url:t.src,success:function(e,n){"success"===n&&i.setContent(t,e)},error:function(e,n){e&&"abort"!==n&&i.setError(t)}})),o.one("onReset",function(){a.abort()});break;default:i.setError(t)}return!0}},setImage:function(e){var o,a,i,s,r,c=this,l=e.opts.srcset||e.opts.image.srcset;if(d(function(){d(function(){var t=e.$image;c.isClosing||!e.isLoading||t&&t.length&&t[0].complete||e.hasError||c.showLoading(e)})}),l){s=t.devicePixelRatio||1,r=t.innerWidth*s,i=l.split(",").map(function(t){var e={};return t.trim().split(/\s+/).forEach(function(t,n){var o=parseInt(t.substring(0,t.length-1),10);return 0===n?e.url=t:void(o&&(e.value=o,e.postfix=t[t.length-1]))}),e}),i.sort(function(t,e){return t.value-e.value});for(var u=0;u=r||"x"===f.postfix&&f.value>=s){a=f;break}}!a&&i.length&&(a=i[i.length-1]),a&&(e.src=a.url,e.width&&e.height&&"w"==a.postfix&&(e.height=e.width/e.height*a.value,e.width=a.value),e.opts.srcset=l)}e.$content=n('
').addClass("fancybox-is-hidden").appendTo(e.$slide.addClass("fancybox-slide--image")),o=e.opts.thumb||!(!e.opts.$thumb||!e.opts.$thumb.length)&&e.opts.$thumb.attr("src"),e.opts.preload!==!1&&e.opts.width&&e.opts.height&&o&&(e.width=e.opts.width,e.height=e.opts.height,e.$ghost=n("").one("error",function(){n(this).remove(),e.$ghost=null}).one("load",function(){c.afterLoad(e)}).addClass("fancybox-image").appendTo(e.$content).attr("src",o)),c.setBigImage(e)},setBigImage:function(t){var e=this,o=n("");t.$image=o.one("error",function(){e.setError(t)}).one("load",function(){var n;t.$ghost||(e.resolveImageSlideSize(t,this.naturalWidth,this.naturalHeight),e.afterLoad(t)),e.isClosing||(t.opts.srcset&&(n=t.opts.sizes,n&&"auto"!==n||(n=(t.width/t.height>1&&s.width()/s.height()>1?"100":Math.round(t.width/t.height*100))+"vw"),o.attr("sizes",n).attr("srcset",t.opts.srcset)),t.$ghost&&setTimeout(function(){t.$ghost&&!e.isClosing&&t.$ghost.hide()},Math.min(300,Math.max(1e3,t.height/1600))),e.hideLoading(t))}).addClass("fancybox-image").attr("src",t.src).appendTo(t.$content),(o[0].complete||"complete"==o[0].readyState)&&o[0].naturalWidth&&o[0].naturalHeight?o.trigger("load"):o[0].error&&o.trigger("error")},resolveImageSlideSize:function(t,e,n){var o=parseInt(t.opts.width,10),a=parseInt(t.opts.height,10);t.width=e,t.height=n,o>0&&(t.width=o,t.height=Math.floor(o*n/e)),a>0&&(t.width=Math.floor(a*e/n),t.height=a)},setIframe:function(t){var e,a=this,i=t.opts.iframe,s=t.$slide;t.$content=n('
').css(i.css).appendTo(s),s.addClass("fancybox-slide--"+t.contentType),t.$iframe=e=n(i.tpl.replace(/\{rnd\}/g,(new Date).getTime())).attr(i.attr).appendTo(t.$content),i.preload?(a.showLoading(t),e.on("load.fb error.fb",function(e){this.isReady=1,t.$slide.trigger("refresh"),a.afterLoad(t)}),s.on("refresh.fb",function(){var n,a,r=t.$content,c=i.css.width,l=i.css.height;if(1===e[0].isReady){try{n=e.contents(),a=n.find("body")}catch(t){}a&&a.length&&a.children().length&&(s.css("overflow","visible"),r.css({width:"100%","max-width":"100%",height:"9999px"}),c===o&&(c=Math.ceil(Math.max(a[0].clientWidth,a.outerWidth(!0)))),r.css("width",c?c:"").css("max-width",""),l===o&&(l=Math.ceil(Math.max(a[0].clientHeight,a.outerHeight(!0)))),r.css("height",l?l:""),s.css("overflow","auto")),r.removeClass("fancybox-is-hidden")}})):this.afterLoad(t),e.attr("src",t.src),s.one("onReset",function(){try{n(this).find("iframe").hide().unbind().attr("src","//about:blank")}catch(t){}n(this).off("refresh.fb").empty(),t.isLoaded=!1,t.isRevealed=!1})},setContent:function(t,e){var o=this;o.isClosing||(o.hideLoading(t),t.$content&&n.fancybox.stop(t.$content),t.$slide.empty(),l(e)&&e.parent().length?(e.hasClass("fancybox-content")&&e.parent(".fancybox-slide--html").trigger("onReset"),t.$placeholder=n("
").hide().insertAfter(e),e.css("display","inline-block")):t.hasError||("string"===n.type(e)&&(e=n("
").append(n.trim(e)).contents()),t.opts.filter&&(e=n("
").html(e).find(t.opts.filter))),t.$slide.one("onReset",function(){n(this).find("video,audio").trigger("pause"),t.$placeholder&&(t.$placeholder.after(e.removeClass("fancybox-content").hide()).remove(),t.$placeholder=null),t.$smallBtn&&(t.$smallBtn.remove(),t.$smallBtn=null),t.hasError||(n(this).empty(),t.isLoaded=!1,t.isRevealed=!1)}),n(e).appendTo(t.$slide),n(e).is("video,audio")&&(n(e).addClass("fancybox-video"),n(e).wrap("
"),t.contentType="video",t.opts.width=t.opts.width||n(e).attr("width"),t.opts.height=t.opts.height||n(e).attr("height")),t.$content=t.$slide.children().filter("div,form,main,video,audio,article,.fancybox-content").first(),t.$content.siblings().hide(),t.$content.length||(t.$content=t.$slide.wrapInner("
").children().first()),t.$content.addClass("fancybox-content"),t.$slide.addClass("fancybox-slide--"+t.contentType),this.afterLoad(t))},setError:function(t){t.hasError=!0,t.$slide.trigger("onReset").removeClass("fancybox-slide--"+t.contentType).addClass("fancybox-slide--error"),t.contentType="html",this.setContent(t,this.translate(t,t.opts.errorTpl)),t.pos===this.currPos&&(this.isAnimating=!1)},showLoading:function(t){var e=this;t=t||e.current,t&&!t.$spinner&&(t.$spinner=n(e.translate(e,e.opts.spinnerTpl)).appendTo(t.$slide).hide().fadeIn())},hideLoading:function(t){var e=this;t=t||e.current,t&&t.$spinner&&(t.$spinner.stop().remove(),delete t.$spinner)},afterLoad:function(t){var e=this;e.isClosing||(t.isLoading=!1,t.isLoaded=!0,e.trigger("afterLoad",t),e.hideLoading(t),t.pos===e.currPos&&e.updateCursor(),!t.opts.smallBtn||t.$smallBtn&&t.$smallBtn.length||(t.$smallBtn=n(e.translate(t,t.opts.btnTpl.smallBtn)).appendTo(t.$content)),t.opts.protect&&t.$content&&!t.hasError&&(t.$content.on("contextmenu.fb",function(t){return 2==t.button&&t.preventDefault(),!0}),"image"===t.type&&n('
').appendTo(t.$content)),e.revealContent(t))},revealContent:function(t){var e,a,i,s,r=this,c=t.$slide,l=!1,d=!1,u=r.isMoved(t),f=t.isRevealed;return t.isRevealed=!0,e=t.opts[r.firstRun?"animationEffect":"transitionEffect"],i=t.opts[r.firstRun?"animationDuration":"transitionDuration"],i=parseInt(t.forcedDuration===o?i:t.forcedDuration,10),t.pos===r.currPos&&(t.isComplete||(r.isAnimating=!0)),!u&&t.pos===r.currPos&&i||(e=!1),"zoom"===e&&(t.pos===r.currPos&&i&&"image"===t.type&&!t.hasError&&(d=r.getThumbPos(t))?l=r.getFitPos(t):e="fade"),"zoom"===e?(l.scaleX=l.width/d.width,l.scaleY=l.height/d.height,s=t.opts.zoomOpacity,"auto"==s&&(s=Math.abs(t.width/t.height-d.width/d.height)>.1),s&&(d.opacity=.1,l.opacity=1),n.fancybox.setTranslate(t.$content.removeClass("fancybox-is-hidden"),d),void n.fancybox.animate(t.$content,l,i,function(){r.isAnimating=!1,r.complete()})):(r.updateSlide(t),e?(n.fancybox.stop(c),a="fancybox-animated fancybox-slide--"+(t.pos>=r.prevPos?"next":"previous")+" fancybox-fx-"+e,c.removeClass("fancybox-slide--current").addClass(a),t.$content.removeClass("fancybox-is-hidden"),c.hide().show(0),void n.fancybox.animate(c,"fancybox-slide--current",i,function(){c.removeClass(a).removeAttr("style"),t.pos===r.currPos&&r.complete()},!0)):(t.$content.removeClass("fancybox-is-hidden"),void(f||!u||"image"!==t.type||t.hasError||t.$content.hide().fadeIn("fast"))))},getThumbPos:function(t){var n,o=this,a=!1,i=t.opts.$thumb,s=i&&i.length&&i[0].ownerDocument===e?i.offset():0;return s&&h(i)>=10&&(n=o.$refs.stage.offset(),a={top:s.top-n.top+parseFloat(i.css("border-top-width")||0),left:s.left-n.left+parseFloat(i.css("border-left-width")||0),width:i.width(),height:i.height(),scaleX:1,scaleY:1}),a},complete:function(){var t,e=this,o=e.current,a={};!e.isMoved()&&o.isLoaded&&(o.isComplete||(o.isComplete=!0,o.$slide.siblings().trigger("onReset"),e.preload("inline"),f(o.$slide),o.$slide.addClass("fancybox-slide--complete"),n.each(e.slides,function(t,o){o.pos>=e.currPos-1&&o.pos<=e.currPos+1?a[o.pos]=o:o&&(n.fancybox.stop(o.$slide),o.$slide.off().remove())}),e.slides=a),e.isAnimating=!1,e.updateCursor(),e.trigger("afterShow"),o.opts.video.autoStart&&o.$slide.find("video,audio").filter(":visible:first").trigger("play").on("ended",n.proxy(e.next,e)),o.opts.autoFocus&&"html"===o.contentType&&(t=o.$content.find("input[autofocus]:enabled:visible:first"),t.length?t.trigger("focus"):e.focus(null,!0)),o.$slide.scrollTop(0).scrollLeft(0))},preload:function(t){var e=this,n=e.slides[e.currPos+1],o=e.slides[e.currPos-1];o&&o.type===t&&e.loadSlide(o),n&&n.type===t&&e.loadSlide(n)},focus:function(t,o){var a,i,s=this,r=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex^="-"])'].join(",");s.isClosing||(a=!t&&s.current&&s.current.isComplete?s.current.$slide.find("*:visible"+(o?":not(.fancybox-close-small)":"")):s.$refs.container.find("*:visible"),a=a.filter(r).filter(function(){return"hidden"!==n(this).css("visibility")&&!n(this).hasClass("disabled")}),a.length?(i=a.index(e.activeElement),t&&t.shiftKey?(i<0||0==i)&&(t.preventDefault(),a.eq(a.length-1).trigger("focus")):(i<0||i==a.length-1)&&(t&&t.preventDefault(),a.eq(0).trigger("focus"))):s.$refs.container.trigger("focus"))},activate:function(){var t=this;n(".fancybox-container").each(function(){var e=n(this).data("FancyBox");e&&e.id!==t.id&&!e.isClosing&&(e.trigger("onDeactivate"),e.removeEvents(),e.isVisible=!1)}),t.isVisible=!0,(t.current||t.isIdle)&&(t.update(),t.updateControls()),t.trigger("onActivate"),t.addEvents()},close:function(t,e){var o,a,i,s,r,c,l,p=this,h=p.current,g=function(){p.cleanUp(t)};return!p.isClosing&&(p.isClosing=!0,p.trigger("beforeClose",t)===!1?(p.isClosing=!1,d(function(){p.update()}),!1):(p.removeEvents(),i=h.$content,o=h.opts.animationEffect,a=n.isNumeric(e)?e:o?h.opts.animationDuration:0,h.$slide.off(u).removeClass("fancybox-slide--complete fancybox-slide--next fancybox-slide--previous fancybox-animated"),h.$slide.siblings().trigger("onReset").remove(),a&&p.$refs.container.removeClass("fancybox-is-open").addClass("fancybox-is-closing"),p.hideLoading(h),p.hideControls(),p.updateCursor(),"zoom"!==o||t!==!0&&i&&a&&"image"===h.type&&!h.hasError&&(l=p.getThumbPos(h))||(o="fade"),"zoom"===o?(n.fancybox.stop(i),s=n.fancybox.getTranslate(i),c={top:s.top,left:s.left,scaleX:s.width/l.width,scaleY:s.height/l.height,width:l.width,height:l.height},r=h.opts.zoomOpacity,"auto"==r&&(r=Math.abs(h.width/h.height-l.width/l.height)>.1),r&&(l.opacity=0),n.fancybox.setTranslate(i,c),f(i),n.fancybox.animate(i,l,a,g),!0):(o&&a?t===!0?setTimeout(g,a):n.fancybox.animate(h.$slide.removeClass("fancybox-slide--current"),"fancybox-animated fancybox-slide--previous fancybox-fx-"+o,a,g):g(),!0)))},cleanUp:function(e){var o,a,i,s=this,r=s.current.opts.$orig;s.current.$slide.trigger("onReset"),s.$refs.container.empty().remove(),s.trigger("afterClose",e),s.current.opts.backFocus&&(r&&r.length&&r.is(":visible")||(r=s.$trigger),r&&r.length&&(a=t.scrollX,i=t.scrollY,r.trigger("focus"),n("html, body").scrollTop(i).scrollLeft(a))),s.current=null,o=n.fancybox.getInstance(),o?o.activate():(n("body").removeClass("fancybox-active compensate-for-scrollbar"),n("#fancybox-style-noscroll").remove())},trigger:function(t,e){var o,a=Array.prototype.slice.call(arguments,1),i=this,s=e&&e.opts?e:i.current;return s?a.unshift(s):s=i,a.unshift(i),n.isFunction(s.opts[t])&&(o=s.opts[t].apply(s,a)),o===!1?o:void("afterClose"!==t&&i.$refs?i.$refs.container.trigger(t+".fb",a):r.trigger(t+".fb",a))},updateControls:function(){var t=this,o=t.current,a=o.index,i=o.opts.caption,s=t.$refs.container,r=t.$refs.caption;o.$slide.trigger("refresh"),t.$caption=i&&i.length?r.html(i):null,t.isHiddenControls||t.isIdle||t.showControls(),s.find("[data-fancybox-count]").html(t.group.length),s.find("[data-fancybox-index]").html(a+1),s.find("[data-fancybox-prev]").prop("disabled",!o.opts.loop&&a<=0),s.find("[data-fancybox-next]").prop("disabled",!o.opts.loop&&a>=t.group.length-1),"image"===o.type?s.find("[data-fancybox-zoom]").show().end().find("[data-fancybox-download]").attr("href",o.opts.image.src||o.src).show():o.opts.toolbar&&s.find("[data-fancybox-download],[data-fancybox-zoom]").hide(),n(e.activeElement).is(":hidden,[disabled]")&&t.$refs.container.trigger("focus")},hideControls:function(){this.isHiddenControls=!0,this.$refs.container.removeClass("fancybox-show-infobar fancybox-show-toolbar fancybox-show-caption fancybox-show-nav")},showControls:function(){var t=this,e=t.current?t.current.opts:t.opts,n=t.$refs.container;t.isHiddenControls=!1, +t.idleSecondsCounter=0,n.toggleClass("fancybox-show-toolbar",!(!e.toolbar||!e.buttons)).toggleClass("fancybox-show-infobar",!!(e.infobar&&t.group.length>1)).toggleClass("fancybox-show-caption",!!t.$caption).toggleClass("fancybox-show-nav",!!(e.arrows&&t.group.length>1)).toggleClass("fancybox-is-modal",!!e.modal)},toggleControls:function(){this.isHiddenControls?this.showControls():this.hideControls()}}),n.fancybox={version:"3.4.2",defaults:i,getInstance:function(t){var e=n('.fancybox-container:not(".fancybox-is-closing"):last').data("FancyBox"),o=Array.prototype.slice.call(arguments,1);return e instanceof g&&("string"===n.type(t)?e[t].apply(e,o):"function"===n.type(t)&&t.apply(e,o),e)},open:function(t,e,n){return new g(t,e,n)},close:function(t){var e=this.getInstance();e&&(e.close(),t===!0&&this.close(t))},destroy:function(){this.close(!0),r.add("body").off("click.fb-start","**")},isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),use3d:function(){var n=e.createElement("div");return t.getComputedStyle&&t.getComputedStyle(n)&&t.getComputedStyle(n).getPropertyValue("transform")&&!(e.documentMode&&e.documentMode<11)}(),getTranslate:function(t){var e;return!(!t||!t.length)&&(e=t[0].getBoundingClientRect(),{top:e.top||0,left:e.left||0,width:e.width,height:e.height,opacity:parseFloat(t.css("opacity"))})},setTranslate:function(t,e){var n="",a={};if(t&&e)return e.left===o&&e.top===o||(n=(e.left===o?t.position().left:e.left)+"px, "+(e.top===o?t.position().top:e.top)+"px",n=this.use3d?"translate3d("+n+", 0px)":"translate("+n+")"),e.scaleX!==o&&e.scaleY!==o?n+=" scale("+e.scaleX+", "+e.scaleY+")":e.scaleX!==o&&(n+=" scaleX("+e.scaleX+")"),n.length&&(a.transform=n),e.opacity!==o&&(a.opacity=e.opacity),e.width!==o&&(a.width=e.width),e.height!==o&&(a.height=e.height),t.css(a)},animate:function(t,e,a,i,s){var r,c=this,l=!1;n.isFunction(a)&&(i=a,a=null),n.isPlainObject(e)||t.removeAttr("style"),c.stop(t),t.on(u,function(o){(!o||!o.originalEvent||t.is(o.originalEvent.target)&&"z-index"!=o.originalEvent.propertyName)&&(c.stop(t),l&&c.setTranslate(t,l),n.isNumeric(a)&&t.css("transition-duration",""),n.isPlainObject(e)?s===!1&&t.removeAttr("style"):s!==!0&&t.removeClass(e),n.isFunction(i)&&i(o))}),n.isNumeric(a)&&t.css("transition-duration",a+"ms"),n.isPlainObject(e)?(e.scaleX!==o&&e.scaleY!==o&&(r=n.fancybox.getTranslate(t),l=n.extend({},e,{width:r.width*e.scaleX,height:r.height*e.scaleY,scaleX:1,scaleY:1}),delete e.width,delete e.height,t.parent().hasClass("fancybox-slide--image")&&t.parent().addClass("fancybox-is-scaling")),n.fancybox.setTranslate(t,e)):t.addClass(e),t.data("timer",setTimeout(function(){t.trigger("transitionend")},a+16))},stop:function(t,e){t&&t.length&&(clearTimeout(t.data("timer")),e&&t.trigger(u),t.off(u).css("transition-duration",""),t.parent().removeClass("fancybox-is-scaling"))}},n.fn.fancybox=function(t){var e;return t=t||{},e=t.selector||!1,e?n("body").off("click.fb-start",e).on("click.fb-start",e,{options:t},a):this.off("click.fb-start").on("click.fb-start",{items:this,options:t},a),this},r.on("click.fb-start","[data-fancybox]",a),r.on("click.fb-start","[data-fancybox-trigger]",function(t){n('[data-fancybox="'+n(this).attr("data-fancybox-trigger")+'"]').eq(n(this).attr("data-fancybox-index")||0).trigger("click.fb-start",{$trigger:n(this)})}),function(){var t=".fancybox-button",e="fancybox-focus",o=null;r.on("mousedown mouseup focus blur",t,function(a){switch(a.type){case"mousedown":o=n(this);break;case"mouseup":o=null;break;case"focusin":n(t).removeClass(e),n(this).is(o)||n(this).is("[disabled]")||n(this).addClass(e);break;case"focusout":n(t).removeClass(e)}})}()}}(window,document,jQuery),function(t){"use strict";var e={youtube:{matcher:/(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*))(.*)/i,params:{autoplay:1,autohide:1,fs:1,rel:0,hd:1,wmode:"transparent",enablejsapi:1,html5:1},paramPlace:8,type:"iframe",url:"//www.youtube-nocookie.com/embed/$4",thumb:"//img.youtube.com/vi/$4/hqdefault.jpg"},vimeo:{matcher:/^.+vimeo.com\/(.*\/)?([\d]+)(.*)?/,params:{autoplay:1,hd:1,show_title:1,show_byline:1,show_portrait:0,fullscreen:1},paramPlace:3,type:"iframe",url:"//player.vimeo.com/video/$2"},instagram:{matcher:/(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,type:"image",url:"//$1/p/$2/media/?size=l"},gmap_place:{matcher:/(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(((maps\/(place\/(.*)\/)?\@(.*),(\d+.?\d+?)z))|(\?ll=))(.*)?/i,type:"iframe",url:function(t){return"//maps.google."+t[2]+"/?ll="+(t[9]?t[9]+"&z="+Math.floor(t[10])+(t[12]?t[12].replace(/^\//,"&"):""):t[12]+"").replace(/\?/,"&")+"&output="+(t[12]&&t[12].indexOf("layer=c")>0?"svembed":"embed")}},gmap_search:{matcher:/(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(maps\/search\/)(.*)/i,type:"iframe",url:function(t){return"//maps.google."+t[2]+"/maps?q="+t[5].replace("query=","q=").replace("api=1","")+"&output=embed"}}},n=function(e,n,o){if(e)return o=o||"","object"===t.type(o)&&(o=t.param(o,!0)),t.each(n,function(t,n){e=e.replace("$"+t,n||"")}),o.length&&(e+=(e.indexOf("?")>0?"&":"?")+o),e};t(document).on("objectNeedsType.fb",function(o,a,i){var s,r,c,l,d,u,f,p=i.src||"",h=!1;s=t.extend(!0,{},e,i.opts.media),t.each(s,function(e,o){if(c=p.match(o.matcher)){if(h=o.type,f=e,u={},o.paramPlace&&c[o.paramPlace]){d=c[o.paramPlace],"?"==d[0]&&(d=d.substring(1)),d=d.split("&");for(var a=0;a1&&("youtube"===n.contentSource||"vimeo"===n.contentSource)&&o.load(n.contentSource)}})}(jQuery),function(t,e,n){"use strict";var o=function(){return t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||function(e){return t.setTimeout(e,1e3/60)}}(),a=function(){return t.cancelAnimationFrame||t.webkitCancelAnimationFrame||t.mozCancelAnimationFrame||t.oCancelAnimationFrame||function(e){t.clearTimeout(e)}}(),i=function(e){var n=[];e=e.originalEvent||e||t.e,e=e.touches&&e.touches.length?e.touches:e.changedTouches&&e.changedTouches.length?e.changedTouches:[e];for(var o in e)e[o].pageX?n.push({x:e[o].pageX,y:e[o].pageY}):e[o].clientX&&n.push({x:e[o].clientX,y:e[o].clientY});return n},s=function(t,e,n){return e&&t?"x"===n?t.x-e.x:"y"===n?t.y-e.y:Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)):0},r=function(t){if(t.is('a,area,button,[role="button"],input,label,select,summary,textarea,video,audio')||n.isFunction(t.get(0).onclick)||t.data("selectable"))return!0;for(var e=0,o=t[0].attributes,a=o.length;ee.clientHeight,i=("scroll"===o||"auto"===o)&&e.scrollWidth>e.clientWidth;return a||i},l=function(t){for(var e=!1;;){if(e=c(t.get(0)))break;if(t=t.parent(),!t.length||t.hasClass("fancybox-stage")||t.is("body"))break}return e},d=function(t){var e=this;e.instance=t,e.$bg=t.$refs.bg,e.$stage=t.$refs.stage,e.$container=t.$refs.container,e.destroy(),e.$container.on("touchstart.fb.touch mousedown.fb.touch",n.proxy(e,"ontouchstart"))};d.prototype.destroy=function(){this.$container.off(".fb.touch")},d.prototype.ontouchstart=function(o){var a=this,c=n(o.target),d=a.instance,u=d.current,f=u.$slide,p=u.$content,h="touchstart"==o.type;if(h&&a.$container.off("mousedown.fb.touch"),(!o.originalEvent||2!=o.originalEvent.button)&&f.length&&c.length&&!r(c)&&!r(c.parent())&&(c.is("img")||!(o.originalEvent.clientX>c[0].clientWidth+c.offset().left))){if(!u||d.isAnimating||d.isClosing)return o.stopPropagation(),void o.preventDefault();if(a.realPoints=a.startPoints=i(o),a.startPoints.length){if(u.touch&&o.stopPropagation(),a.startEvent=o,a.canTap=!u.$slide.hasClass("fancybox-animated"),a.$target=c,a.$content=p,a.opts=u.opts.touch,a.isPanning=!1,a.isSwiping=!1,a.isZooming=!1,a.isScrolling=!1,a.canPan=d.canPan(),a.startTime=(new Date).getTime(),a.distanceX=a.distanceY=a.distance=0,a.canvasWidth=Math.round(f[0].clientWidth),a.canvasHeight=Math.round(f[0].clientHeight),a.contentLastPos=null,a.contentStartPos=n.fancybox.getTranslate(a.$content)||{top:0,left:0},a.sliderStartPos=a.sliderLastPos||n.fancybox.getTranslate(f),a.stagePos=n.fancybox.getTranslate(d.$refs.stage),a.sliderStartPos.top-=a.stagePos.top,a.sliderStartPos.left-=a.stagePos.left,a.contentStartPos.top-=a.stagePos.top,a.contentStartPos.left-=a.stagePos.left,n(e).off(".fb.touch").on(h?"touchend.fb.touch touchcancel.fb.touch":"mouseup.fb.touch mouseleave.fb.touch",n.proxy(a,"ontouchend")).on(h?"touchmove.fb.touch":"mousemove.fb.touch",n.proxy(a,"ontouchmove")),n.fancybox.isMobile&&e.addEventListener("scroll",a.onscroll,!0),!a.opts&&!a.canPan||!c.is(a.$stage)&&!a.$stage.find(c).length)return void(c.is(".fancybox-image")&&o.preventDefault());a.isScrollable=l(c)||l(c.parent()),n.fancybox.isMobile&&a.isScrollable||o.preventDefault(),(1===a.startPoints.length||u.hasError)&&(a.canPan?(n.fancybox.stop(a.$content),a.isPanning=!0):a.isSwiping=!0,a.$container.addClass("fancybox-is-grabbing")),2===a.startPoints.length&&"image"===u.type&&(u.isLoaded||u.$ghost)&&(a.canTap=!1,a.isSwiping=!1,a.isPanning=!1,a.isZooming=!0,n.fancybox.stop(a.$content),a.centerPointStartX=.5*(a.startPoints[0].x+a.startPoints[1].x)-n(t).scrollLeft(),a.centerPointStartY=.5*(a.startPoints[0].y+a.startPoints[1].y)-n(t).scrollTop(),a.percentageOfImageAtPinchPointX=(a.centerPointStartX-a.contentStartPos.left)/a.contentStartPos.width,a.percentageOfImageAtPinchPointY=(a.centerPointStartY-a.contentStartPos.top)/a.contentStartPos.height,a.startDistanceBetweenFingers=s(a.startPoints[0],a.startPoints[1]))}}},d.prototype.onscroll=function(t){var n=this;n.isScrolling=!0,e.removeEventListener("scroll",n.onscroll,!0)},d.prototype.ontouchmove=function(t){var e=this;return void 0!==t.originalEvent.buttons&&0===t.originalEvent.buttons?void e.ontouchend(t):e.isScrolling?void(e.canTap=!1):(e.newPoints=i(t),void((e.opts||e.canPan)&&e.newPoints.length&&e.newPoints.length&&(e.isSwiping&&e.isSwiping===!0||t.preventDefault(),e.distanceX=s(e.newPoints[0],e.startPoints[0],"x"),e.distanceY=s(e.newPoints[0],e.startPoints[0],"y"),e.distance=s(e.newPoints[0],e.startPoints[0]),e.distance>0&&(e.isSwiping?e.onSwipe(t):e.isPanning?e.onPan():e.isZooming&&e.onZoom()))))},d.prototype.onSwipe=function(e){var i,s=this,r=s.instance,c=s.isSwiping,l=s.sliderStartPos.left||0;if(c!==!0)"x"==c&&(s.distanceX>0&&(s.instance.group.length<2||0===s.instance.current.index&&!s.instance.current.opts.loop)?l+=Math.pow(s.distanceX,.8):s.distanceX<0&&(s.instance.group.length<2||s.instance.current.index===s.instance.group.length-1&&!s.instance.current.opts.loop)?l-=Math.pow(-s.distanceX,.8):l+=s.distanceX),s.sliderLastPos={top:"x"==c?0:s.sliderStartPos.top+s.distanceY,left:l},s.requestId&&(a(s.requestId),s.requestId=null),s.requestId=o(function(){s.sliderLastPos&&(n.each(s.instance.slides,function(t,e){var o=e.pos-s.instance.currPos;n.fancybox.setTranslate(e.$slide,{top:s.sliderLastPos.top,left:s.sliderLastPos.left+o*s.canvasWidth+o*e.opts.gutter})}),s.$container.addClass("fancybox-is-sliding"))});else if(Math.abs(s.distance)>10){if(s.canTap=!1,r.group.length<2&&s.opts.vertical?s.isSwiping="y":r.isDragging||s.opts.vertical===!1||"auto"===s.opts.vertical&&n(t).width()>800?s.isSwiping="x":(i=Math.abs(180*Math.atan2(s.distanceY,s.distanceX)/Math.PI),s.isSwiping=i>45&&i<135?"y":"x"),"y"===s.isSwiping&&n.fancybox.isMobile&&s.isScrollable)return void(s.isScrolling=!0);r.isDragging=s.isSwiping,s.startPoints=s.newPoints,n.each(r.slides,function(t,e){var o,a;n.fancybox.stop(e.$slide),o=n.fancybox.getTranslate(e.$slide),a=n.fancybox.getTranslate(r.$refs.stage),e.$slide.removeAttr("style").removeClass("fancybox-animated").removeClass(function(t,e){return(e.match(/(^|\s)fancybox-fx-\S+/g)||[]).join(" ")}),e.pos===r.current.pos&&(s.sliderStartPos.left=o.left-a.left),n.fancybox.setTranslate(e.$slide,{top:o.top-a.top,left:o.left-a.left})}),r.SlideShow&&r.SlideShow.isActive&&r.SlideShow.stop()}},d.prototype.onPan=function(){var t=this;return s(t.newPoints[0],t.realPoints[0])<(n.fancybox.isMobile?10:5)?void(t.startPoints=t.newPoints):(t.canTap=!1,t.contentLastPos=t.limitMovement(),t.requestId&&(a(t.requestId),t.requestId=null),void(t.requestId=o(function(){n.fancybox.setTranslate(t.$content,t.contentLastPos)})))},d.prototype.limitMovement=function(){var t,e,n,o,a,i,s=this,r=s.canvasWidth,c=s.canvasHeight,l=s.distanceX,d=s.distanceY,u=s.contentStartPos,f=u.left,p=u.top,h=u.width,g=u.height;return a=h>r?f+l:f,i=p+d,t=Math.max(0,.5*r-.5*h),e=Math.max(0,.5*c-.5*g),n=Math.min(r-h,.5*r-.5*h),o=Math.min(c-g,.5*c-.5*g),l>0&&a>t&&(a=t-1+Math.pow(-t+f+l,.8)||0),l<0&&a0&&i>e&&(i=e-1+Math.pow(-e+p+d,.8)||0),d<0&&ii?(t=t>0?0:t,t=ts?(e=e>0?0:e,e=e1&&(o.dMs>130&&r>10||r>50),l=Math.abs(s*o.canvasWidth/o.canvasWidth)>.8?366:500;o.sliderLastPos=null,"y"==t&&!e&&Math.abs(o.distanceY)>50?(n.fancybox.animate(o.instance.current.$slide,{top:o.sliderStartPos.top+o.distanceY+150*o.velocityY,opacity:0},200),a=o.instance.close(!0,200)):c&&o.distanceX>0?a=o.instance.previous(l):c&&o.distanceX<0&&(a=o.instance.next(l)),a!==!1||"x"!=t&&"y"!=t||o.instance.centerSlide(o.instance.current,150),o.$container.removeClass("fancybox-is-sliding")},d.prototype.endPanning=function(){var t,e,o,a=this;a.contentLastPos&&(a.opts.momentum===!1||a.dMs>350?(t=a.contentLastPos.left,e=a.contentLastPos.top):(t=a.contentLastPos.left+500*a.velocityX,e=a.contentLastPos.top+500*a.velocityY),o=a.limitPosition(t,e,a.contentStartPos.width,a.contentStartPos.height),o.width=a.contentStartPos.width,o.height=a.contentStartPos.height,n.fancybox.animate(a.$content,o,330))},d.prototype.endZooming=function(){var t,e,o,a,i=this,s=i.instance.current,r=i.newWidth,c=i.newHeight;i.contentLastPos&&(t=i.contentLastPos.left,e=i.contentLastPos.top,a={top:e,left:t,width:r,height:c,scaleX:1,scaleY:1},n.fancybox.setTranslate(i.$content,a),rs.width||c>s.height?i.instance.scaleToActual(i.centerPointStartX,i.centerPointStartY,150):(o=i.limitPosition(t,e,r,c),n.fancybox.setTranslate(i.$content,n.fancybox.getTranslate(i.$content)),n.fancybox.animate(i.$content,o,150)))},d.prototype.onTap=function(e){var o,a=this,s=n(e.target),r=a.instance,c=r.current,l=e&&i(e)||a.startPoints,d=l[0]?l[0].x-n(t).scrollLeft()-a.stagePos.left:0,u=l[0]?l[0].y-n(t).scrollTop()-a.stagePos.top:0,f=function(t){var o=c.opts[t];if(n.isFunction(o)&&(o=o.apply(r,[c,e])),o)switch(o){case"close":r.close(a.startEvent);break;case"toggleControls":r.toggleControls(!0);break;case"next":r.next();break;case"nextOrClose":r.group.length>1?r.next():r.close(a.startEvent);break;case"zoom":"image"==c.type&&(c.isLoaded||c.$ghost)&&(r.canPan()?r.scaleToFit():r.isScaledDown()?r.scaleToActual(d,u):r.group.length<2&&r.close(a.startEvent))}};if((!e.originalEvent||2!=e.originalEvent.button)&&(s.is("img")||!(d>s[0].clientWidth+s.offset().left))){if(s.is(".fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-container"))o="Outside";else if(s.is(".fancybox-slide"))o="Slide";else{if(!r.current.$content||!r.current.$content.find(s).addBack().filter(s).length)return;o="Content"}if(a.tapped){if(clearTimeout(a.tapped),a.tapped=null,Math.abs(d-a.tapX)>50||Math.abs(u-a.tapY)>50)return this;f("dblclick"+o)}else a.tapX=d,a.tapY=u,c.opts["dblclick"+o]&&c.opts["dblclick"+o]!==c.opts["click"+o]?a.tapped=setTimeout(function(){a.tapped=null,f("click"+o)},500):f("click"+o);return this}},n(e).on("onActivate.fb",function(t,e){e&&!e.Guestures&&(e.Guestures=new d(e))})}(window,document,jQuery),function(t,e){"use strict";e.extend(!0,e.fancybox.defaults,{btnTpl:{slideShow:''},slideShow:{autoStart:!1,speed:3e3,progress:!0}});var n=function(t){this.instance=t,this.init()};e.extend(n.prototype,{timer:null,isActive:!1,$button:null,init:function(){var t=this,n=t.instance,o=n.group[n.currIndex].opts.slideShow;t.$button=n.$refs.toolbar.find("[data-fancybox-play]").on("click",function(){t.toggle()}),n.group.length<2||!o?t.$button.hide():o.progress&&(t.$progress=e('
').appendTo(n.$refs.inner))},set:function(t){var n=this,o=n.instance,a=o.current;a&&(t===!0||a.opts.loop||o.currIndex'},fullScreen:{autoStart:!1}}),e(t).on(n.fullscreenchange,function(){var t=o.isFullscreen(),n=e.fancybox.getInstance();n&&(n.current&&"image"===n.current.type&&n.isAnimating&&(n.current.$content.css("transition","none"),n.isAnimating=!1,n.update(!0,!0,0)),n.trigger("onFullscreenChange",t),n.$refs.container.toggleClass("fancybox-is-fullscreen",t),n.$refs.toolbar.find("[data-fancybox-fullscreen]").toggleClass("fancybox-button--fsenter",!t).toggleClass("fancybox-button--fsexit",t))})}e(t).on({"onInit.fb":function(t,e){var a;return n?void(e&&e.group[e.currIndex].opts.fullScreen?(a=e.$refs.container,a.on("click.fb-fullscreen","[data-fancybox-fullscreen]",function(t){t.stopPropagation(),t.preventDefault(),o.toggle()}),e.opts.fullScreen&&e.opts.fullScreen.autoStart===!0&&o.request(),e.FullScreen=o):e&&e.$refs.toolbar.find("[data-fancybox-fullscreen]").hide()):void e.$refs.toolbar.find("[data-fancybox-fullscreen]").remove()},"afterKeydown.fb":function(t,e,n,o,a){e&&e.FullScreen&&70===a&&(o.preventDefault(),e.FullScreen.toggle())},"beforeClose.fb":function(t,e){e&&e.FullScreen&&e.$refs.container.hasClass("fancybox-is-fullscreen")&&o.exit()}})}(document,jQuery),function(t,e){"use strict";var n="fancybox-thumbs",o=n+"-active";e.fancybox.defaults=e.extend(!0,{btnTpl:{thumbs:''},thumbs:{autoStart:!1,hideOnClose:!0,parentEl:".fancybox-container",axis:"y"}},e.fancybox.defaults);var a=function(t){this.init(t)};e.extend(a.prototype,{$button:null,$grid:null,$list:null,isVisible:!1,isActive:!1,init:function(t){var e,n,o=this;o.instance=t,t.Thumbs=o,o.opts=t.group[t.currIndex].opts.thumbs,e=t.group[0],e=e.opts.thumb||!(!e.opts.$thumb||!e.opts.$thumb.length)&&e.opts.$thumb.attr("src"),t.group.length>1&&(n=t.group[1],n=n.opts.thumb||!(!n.opts.$thumb||!n.opts.$thumb.length)&&n.opts.$thumb.attr("src")),o.$button=t.$refs.toolbar.find("[data-fancybox-thumbs]"),o.opts&&e&&n?(o.$button.show().on("click",function(){o.toggle()}),o.isActive=!0):o.$button.hide()},create:function(){var t,o=this,a=o.instance,i=o.opts.parentEl,s=[];o.$grid||(o.$grid=e('
').appendTo(a.$refs.container.find(i).addBack().filter(i)),o.$grid.on("click","a",function(){a.jumpTo(e(this).attr("data-index"))})),o.$list||(o.$list=e('
').appendTo(o.$grid)),e.each(a.group,function(e,n){t=n.opts.thumb||(n.opts.$thumb?n.opts.$thumb.attr("src"):null),t||"image"!==n.type||(t=n.src),s.push('")}),o.$list[0].innerHTML=s.join(""),"x"===o.opts.axis&&o.$list.width(parseInt(o.$grid.css("padding-right"),10)+a.group.length*o.$list.children().eq(0).outerWidth(!0))},focus:function(t){var e,n,a=this,i=a.$list,s=a.$grid;a.instance.current&&(e=i.children().removeClass(o).filter('[data-index="'+a.instance.current.index+'"]').addClass(o),n=e.position(),"y"===a.opts.axis&&(n.top<0||n.top>i.height()-e.outerHeight())?i.stop().animate({scrollTop:i.scrollTop()+n.top},t):"x"===a.opts.axis&&(n.lefts.scrollLeft()+(s.width()-e.outerWidth()))&&i.parent().stop().animate({scrollLeft:n.left},t))},update:function(){var t=this;t.instance.$refs.container.toggleClass("fancybox-show-thumbs",this.isVisible),t.isVisible?(t.$grid||t.create(),t.instance.trigger("onThumbsShow"),t.focus(0)):t.$grid&&t.instance.trigger("onThumbsHide"),t.instance.update()},hide:function(){this.isVisible=!1,this.update()},show:function(){this.isVisible=!0,this.update()},toggle:function(){this.isVisible=!this.isVisible,this.update()}}),e(t).on({"onInit.fb":function(t,e){var n;e&&!e.Thumbs&&(n=new a(e),n.isActive&&n.opts.autoStart===!0&&n.show())},"beforeShow.fb":function(t,e,n,o){var a=e&&e.Thumbs;a&&a.isVisible&&a.focus(o?0:250)},"afterKeydown.fb":function(t,e,n,o,a){var i=e&&e.Thumbs;i&&i.isActive&&71===a&&(o.preventDefault(),i.toggle())},"beforeClose.fb":function(t,e){var n=e&&e.Thumbs;n&&n.isVisible&&n.opts.hideOnClose!==!1&&n.$grid.hide()}})}(document,jQuery),function(t,e){"use strict";function n(t){var e={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};return String(t).replace(/[&<>"'`=\/]/g,function(t){return e[t]})}e.extend(!0,e.fancybox.defaults,{btnTpl:{share:''},share:{url:function(t,e){return!t.currentHash&&"inline"!==e.type&&"html"!==e.type&&(e.origSrc||e.src)||window.location},tpl:''}}),e(t).on("click","[data-fancybox-share]",function(){var t,o,a=e.fancybox.getInstance(),i=a.current||null;i&&("function"===e.type(i.opts.share.url)&&(t=i.opts.share.url.apply(i,[a,i])),o=i.opts.share.tpl.replace(/\{\{media\}\}/g,"image"===i.type?encodeURIComponent(i.src):"").replace(/\{\{url\}\}/g,encodeURIComponent(t)).replace(/\{\{url_raw\}\}/g,n(t)).replace(/\{\{descr\}\}/g,a.$caption?encodeURIComponent(a.$caption.text()):""),e.fancybox.open({src:a.translate(a,o),type:"html",opts:{touch:!1,animationEffect:!1,afterLoad:function(t,e){a.$refs.container.one("beforeClose.fb",function(){t.close(null,0)}),e.$content.find(".fancybox-share__button").click(function(){return window.open(this.href,"Share","width=550, height=450"),!1})},mobile:{autoFocus:!1}}}))})}(document,jQuery),function(t,e,n){"use strict";function o(){var e=t.location.hash.substr(1),n=e.split("-"),o=n.length>1&&/^\+?\d+$/.test(n[n.length-1])?parseInt(n.pop(-1),10)||1:1,a=n.join("-");return{hash:e,index:o<1?1:o,gallery:a}}function a(t){""!==t.gallery&&n("[data-fancybox='"+n.escapeSelector(t.gallery)+"']").eq(t.index-1).focus().trigger("click.fb-start")}function i(t){var e,n;return!!t&&(e=t.current?t.current.opts:t.opts,n=e.hash||(e.$orig?e.$orig.data("fancybox")||e.$orig.data("fancybox-trigger"):""),""!==n&&n)}n.escapeSelector||(n.escapeSelector=function(t){var e=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,n=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t};return(t+"").replace(e,n)}),n(function(){n.fancybox.defaults.hash!==!1&&(n(e).on({"onInit.fb":function(t,e){var n,a;e.group[e.currIndex].opts.hash!==!1&&(n=o(),a=i(e),a&&n.gallery&&a==n.gallery&&(e.currIndex=n.index-1))},"beforeShow.fb":function(n,o,a,s){var r;a&&a.opts.hash!==!1&&(r=i(o),r&&(o.currentHash=r+(o.group.length>1?"-"+(a.index+1):""), +t.location.hash!=="#"+o.currentHash&&(s&&!o.origHash&&(o.origHash=t.location.hash),o.hashTimer&&clearTimeout(o.hashTimer),o.hashTimer=setTimeout(function(){"replaceState"in t.history?(t.history[s?"pushState":"replaceState"]({},e.title,t.location.pathname+t.location.search+"#"+o.currentHash),s&&(o.hasCreatedHistory=!0)):t.location.hash=o.currentHash,o.hashTimer=null},300))))},"beforeClose.fb":function(n,o,a){a.opts.hash!==!1&&(clearTimeout(o.hashTimer),o.currentHash&&o.hasCreatedHistory?t.history.back():o.currentHash&&("replaceState"in t.history?t.history.replaceState({},e.title,t.location.pathname+t.location.search+(o.origHash||"")):t.location.hash=o.origHash),o.currentHash=null)}}),n(t).on("hashchange.fb",function(){var t=o(),e=null;n.each(n(".fancybox-container").get().reverse(),function(t,o){var a=n(o).data("FancyBox");if(a&&a.currentHash)return e=a,!1}),e?e.currentHash===t.gallery+"-"+t.index||1===t.index&&e.currentHash==t.gallery||(e.currentHash=null,e.close()):""!==t.gallery&&a(t)}),setTimeout(function(){n.fancybox.getInstance()||a(o())},50))})}(window,document,jQuery),function(t,e){"use strict";var n=(new Date).getTime();e(t).on({"onInit.fb":function(t,e,o){e.$refs.stage.on("mousewheel DOMMouseScroll wheel MozMousePixelScroll",function(t){var o=e.current,a=(new Date).getTime();e.group.length<2||o.opts.wheel===!1||"auto"===o.opts.wheel&&"image"!==o.type||(t.preventDefault(),t.stopPropagation(),o.$slide.hasClass("fancybox-animated")||(t=t.originalEvent||t,a-n<250||(n=a,e[(-t.deltaY||-t.deltaX||t.wheelDelta||-t.detail)<0?"next":"previous"]())))})}})}(document,jQuery); \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 64260d17..855dd2be 100644 --- a/docs/index.html +++ b/docs/index.html @@ -266,8 +266,8 @@

Compatibility

- fancybox includes support for touch gestures and even supports pinch gestures for zooming. It is perfectly suited for both - mobile and desktop browsers. + fancybox includes support for touch gestures and even supports pinch gestures for zooming. + It is perfectly suited for both mobile and desktop browsers.

@@ -292,8 +292,8 @@

Setup

You can install fancybox by linking .css and - .js files to your html file. Make sure you also load the jQuery library. Below is a basic HTML template - to use as an example: + .js files to your html file. Make sure you also load the jQuery library. Below is a basic HTML + template to use as an example:

<!DOCTYPE html>
@@ -346,7 +346,8 @@ 

  • If you already have jQuery on your page, you shouldn't include it second time
  • Do not include both fancybox.js and fancybox.min.js files
  • - Some functionality (ajax, iframes, etc) will not work when you're opening local file directly on your browser, the code must + Some functionality (ajax, iframes, etc) will not work when you're opening local file directly on your + browser, the code must be running on a web server
  • @@ -360,7 +361,8 @@

    Initialize with data attributes

    The most basic way to use fancybox is by adding the - data-fancybox attribute to your element. This will automatically bind click event that will start + data-fancybox attribute to your element. This will automatically bind click event that will + start fancybox. Use href or data-src attribute to specify source of your content. Example: @@ -376,7 +378,8 @@

    Initialize with data attributes

    If you have a group of items, you can use the same attribute - data-fancybox value for each of them to create a gallery. Each group should have a unique value. + data-fancybox value for each of them to create a gallery. Each group should have a unique + value. Example:

    @@ -399,8 +402,8 @@

    Initialize with data attributes

    - Sometimes you have multiple links pointing to the same source and that creates duplicates in the gallery. To avoid that, - simply use + Sometimes you have multiple links pointing to the same source and that creates duplicates in the gallery. + To avoid that, simply use data-fancybox-trigger attribute with the same value used for data-fancybox attribute for your other links. Optionally, use data-fancybox-index attribute to specify index of starting element: @@ -414,7 +417,7 @@

    Initialize with data attributes

    View demo on CodePen

    -

    Initialize with JavaScript

    +

    Initialize with JavaScript

    Select your elements with a jQuery selector (you can use any valid selector) and call the @@ -432,8 +435,8 @@

    Initialize with JavaScript

    Sometimes you might need to bind fancybox to dynamically added elements. Use - selector option to attach click event listener for elements that exist now or in the future. All - selected items will be automatically grouped in the gallery. Example: + selector option to attach click event listener for elements that exist now or in the future. + All selected items will be automatically grouped in the gallery. Example:

    $().fancybox({
    @@ -481,8 +484,8 @@ 

    - fancybox attempts to automatically detect the type of content based on the given url. If it cannot be detected, the type - can also be set manually using + fancybox attempts to automatically detect the type of content based on the given url. If it cannot be + detected, the type can also be set manually using data-type attribute (or type option). Example:

    @@ -497,8 +500,8 @@

    Media types

    - fancybox is designed to display images, video, iframes and any HTML content. For your convenience, there is a built in support - for inline content and ajax. + fancybox is designed to display images, video, iframes and any HTML content. For your convenience, there is + a built in support for inline content and ajax.

    Images

    @@ -516,8 +519,9 @@

    Images

    - By default, fancybox fully preloads an image before displaying it. You can choose to display the image right away. It will - render and show the full size image while the data is being received. To do so, some attributes are necessary: + By default, fancybox fully preloads an image before displaying it. You can choose to display the image + right away. It will render and show the full size image while the data is being received. To do so, some + attributes are necessary:

      @@ -537,8 +541,8 @@

      Images

      You can also use these width and - height properties to control size of the image. This can be used to make images look sharper on - retina displays. Example: + height properties to control size of the image. This can be used to make images look sharper + on retina displays. Example:

      $('[data-fancybox="images"]').fancybox({
      @@ -557,8 +561,8 @@ 

      Images

      - fancybox supports "srcset" so it can display different images based on viewport width. You can use this to improve download - times for mobile users and over time save bandwidth. Example: + fancybox supports "srcset" so it can display different images based on viewport width. You can use this to + improve download times for mobile users and over time save bandwidth. Example:

      <a href="medium.jpg" data-fancybox="images" data-srcset="large.jpg 1600w, medium.jpg 1200w, small.jpg 640w">
      @@ -569,9 +573,9 @@ 

      Images

      - It is also possible to protect images from downloading by right-click. While this does not protect from truly determined - users, it should discourage the vast majority from ripping off your files. Optionally, put the watermark over - image. + It is also possible to protect images from downloading by right-click. While this does not protect from + truly determined users, it should discourage the vast majority from ripping off your files. + Optionally, put the watermark over image.

      $('[data-fancybox]').fancybox({
      @@ -585,9 +589,8 @@ 

      Images

      Video

      - YouTube and Vimeo videos can be used with fancybox by just providing the page URL. Link to MP4 video directly or use trigger - element to display hidden - <video> element. + YouTube and Vimeo videos can be used with fancybox by just providing the page URL. Link to MP4 video + directly or use trigger element to display hidden <video> element.

      @@ -660,9 +663,9 @@

      Video

      Iframe

      - If you need to display content from another page, add data-fancybox and data-type="iframe" attributes - to your link. This would create <iframe> element that allows to embed an entire web - document inside the modal. + If you need to display content from another page, add data-fancybox and data-type="iframe" + attributes to your link. This would create <iframe> element that allows to + embed an entire web document inside the modal.

      <a data-fancybox data-type="iframe" data-src="http://codepen.io/fancyapps/full/jyEGGG/" href="javascript:;">
      @@ -679,14 +682,15 @@ 

      Iframe

      If you have not disabled iframe preloading (using - preload option), the script will atempt to calculate content dimensions and will adjust width/height - of <iframe> to fit with content in it. Keep in mind, that due to - same origin policy, there are - some limitations. + preload option), the script will atempt to calculate content dimensions and will adjust + width/height of <iframe> to fit with content in it. Keep in mind, that due to + same origin policy, there + are some limitations.

      - This example will disable iframe preloading and will display small close button next to iframe instead of the toolbar: + This example will disable iframe preloading and will display small close button next to iframe instead of + the toolbar:

      $('[data-fancybox]').fancybox({
      @@ -740,7 +744,8 @@ 

      Iframe

      Inline

      - fancybox can be used to display any HTML element on the page. First, create a hidden element with unique ID: + fancybox can be used to display any HTML element on the page. + First, create a hidden element with unique ID:

      <div style="display: none;" id="hidden-content">
      @@ -750,9 +755,8 @@ 

      Inline

      Then simply create a link having - data-src attribute that matches ID of the element you want to open (preceded by a hash mark (#); - in this example - - #hidden-content): + data-src attribute that matches ID of the element you want to open (preceded by a hash mark + (#); in this example - #hidden-content):

      <a data-fancybox data-src="#hidden-content" href="javascript:;">
      @@ -764,13 +768,13 @@ 

      Inline

      The script will append small close button (if you have not disabled by - smallBtn:false) and will not apply any styles except for centering. Therefore you can easily set - custom dimensions using CSS. + smallBtn:false) and will not apply any styles except for centering. Therefore you can easily + set custom dimensions using CSS.

      - Info If necessary, you can make your element (and similarly any other html - content) scrollable by adding additional wrapping element and some CSS - + Info If necessary, you can make your element (and similarly any other + html content) scrollable by adding additional wrapping element and some CSS - view demo on CodePen.

      @@ -792,8 +796,8 @@

      Ajax

      Additionally it is possible to define a selector with the - data-filter attribute to show only a part of the response. The selector can be any string, that - is a valid jQuery selector: + data-filter attribute to show only a part of the response. The selector can be any string, + that is a valid jQuery selector:

      <a data-fancybox data-type="ajax" data-src="my_page.com/path/to/ajax/" data-filter="#two" href="javascript:;">
      @@ -850,7 +854,7 @@ 

      Options

      buttons: [ "zoom", //"share", - //"slideShow", + "slideShow", //"fullScreen", //"download", "thumbs", @@ -888,7 +892,7 @@

      Options

      iframe: { // Iframe template tpl: - '<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen allowtransparency="true" src=""></iframe>', + '<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" allowfullscreen allow="fullscreen autoplay" src=""></iframe>', // Preload iframe before displaying it // This allows to calculate iframe content width and height @@ -901,7 +905,7 @@

      Options

      // Iframe tag attributes attr: { - scrolling: "auto" + scrolling: "auto" } }, @@ -962,9 +966,7 @@

      Options

      '<div class="fancybox-container" role="dialog" tabindex="-1">' + '<div class="fancybox-bg"></div>' + '<div class="fancybox-inner">' + - '<div class="fancybox-infobar">' + - "<span data-fancybox-index></span>&nbsp;/&nbsp;<span data-fancybox-count></span>" + - "</div>" + + '<div class="fancybox-infobar"><span data-fancybox-index></span>&nbsp;/&nbsp;<span data-fancybox-count></span></div>' + '<div class="fancybox-toolbar">{{buttons}}</div>' + '<div class="fancybox-navigation">{{arrows}}</div>' + '<div class="fancybox-stage"></div>' + @@ -980,39 +982,37 @@

      Options

      btnTpl: { download: - '<a download data-fancybox-download class="fancybox-button fancybox-button--download" title="{{DOWNLOAD}}" href="javascript:;">' + - '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.62 17.09V19H5.38v-1.91zm-2.97-6.96L17 11.45l-5 4.87-5-4.87 1.36-1.32 2.68 2.64V5h1.92v7.77z"/></svg>' + - "</a>", + '<a download data-fancybox-download class="fancybox-button fancybox-button--download" title="{{DOWNLOAD}}" href="javascript:;">' + + '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.62 17.09V19H5.38v-1.91zm-2.97-6.96L17 11.45l-5 4.87-5-4.87 1.36-1.32 2.68 2.64V5h1.92v7.77z"/></svg>' + + "</a>", zoom: - '<button data-fancybox-zoom class="fancybox-button fancybox-button--zoom" title="{{ZOOM}}">' + - '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.7 17.3l-3-3a5.9 5.9 0 0 0-.6-7.6 5.9 5.9 0 0 0-8.4 0 5.9 5.9 0 0 0 0 8.4 5.9 5.9 0 0 0 7.7.7l3 3a1 1 0 0 0 1.3 0c.4-.5.4-1 0-1.5zM8.1 13.8a4 4 0 0 1 0-5.7 4 4 0 0 1 5.7 0 4 4 0 0 1 0 5.7 4 4 0 0 1-5.7 0z"/></svg>' + - "</button>", + '<button data-fancybox-zoom class="fancybox-button fancybox-button--zoom" title="{{ZOOM}}">' + + '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.7 17.3l-3-3a5.9 5.9 0 0 0-.6-7.6 5.9 5.9 0 0 0-8.4 0 5.9 5.9 0 0 0 0 8.4 5.9 5.9 0 0 0 7.7.7l3 3a1 1 0 0 0 1.3 0c.4-.5.4-1 0-1.5zM8.1 13.8a4 4 0 0 1 0-5.7 4 4 0 0 1 5.7 0 4 4 0 0 1 0 5.7 4 4 0 0 1-5.7 0z"/></svg>' + + "</button>", close: - '<button data-fancybox-close class="fancybox-button fancybox-button--close" title="{{CLOSE}}">' + - '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 10.6L6.6 5.2 5.2 6.6l5.4 5.4-5.4 5.4 1.4 1.4 5.4-5.4 5.4 5.4 1.4-1.4-5.4-5.4 5.4-5.4-1.4-1.4-5.4 5.4z"/></svg>' + - "</button>", + '<button data-fancybox-close class="fancybox-button fancybox-button--close" title="{{CLOSE}}">' + + '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 10.6L6.6 5.2 5.2 6.6l5.4 5.4-5.4 5.4 1.4 1.4 5.4-5.4 5.4 5.4 1.4-1.4-5.4-5.4 5.4-5.4-1.4-1.4-5.4 5.4z"/></svg>' + + "</button>", // Arrows arrowLeft: - '<a data-fancybox-prev class="fancybox-button fancybox-button--arrow_left" title="{{PREV}}" href="javascript:;">' + - '<svg viewBox="0 0 40 40">' + - '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.28 15.7l-1.34 1.37L5 12l4.94-5.07 1.34 1.38-2.68 2.72H19v1.94H8.6z"/></svg>' + - "</svg>" + - "</a>", + '<button data-fancybox-prev class="fancybox-button fancybox-button--arrow_left" title="{{PREV}}">' + + '<div><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.28 15.7l-1.34 1.37L5 12l4.94-5.07 1.34 1.38-2.68 2.72H19v1.94H8.6z"/></svg></div>' + + "</button>", arrowRight: - '<a data-fancybox-next class="fancybox-button fancybox-button--arrow_right" title="{{NEXT}}" href="javascript:;">' + - '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.4 12.97l-2.68 2.72 1.34 1.38L19 12l-4.94-5.07-1.34 1.38 2.68 2.72H5v1.94z"/></svg>' + - "</a>", + '<button data-fancybox-next class="fancybox-button fancybox-button--arrow_right" title="{{NEXT}}">' + + '<div><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.4 12.97l-2.68 2.72 1.34 1.38L19 12l-4.94-5.07-1.34 1.38 2.68 2.72H5v1.94z"/></svg></div>' + + "</button>", // This small close button will be appended to your html/inline/ajax content by default, // if "smallBtn" option is not set to false smallBtn: - '<button type="button" data-fancybox-close class="fancybox-button fancybox-close-small" title="{{CLOSE}}">' + - '<svg xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 24 24"><path d="M13 12l5-5-1-1-5 5-5-5-1 1 5 5-5 5 1 1 5-5 5 5 1-1z"/></svg>' + - "</button>" + '<button type="button" data-fancybox-close class="fancybox-button fancybox-close-small" title="{{CLOSE}}">' + + '<svg xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 24 24"><path d="M13 12l5-5-1-1-5 5-5-5-1 1 5 5-5 5 1 1 5-5 5 5 1-1z"/></svg>' + + "</button>" }, // Container is injected into this element @@ -1054,12 +1054,12 @@

      Options

      // Example: /* media : { - youtube : { - params : { - autoplay : 0 - } + youtube : { + params : { + autoplay : 0 } } + } */ media: {}, @@ -1086,8 +1086,8 @@

      Options

      // Example: /* afterShow: function( instance, current ) { - console.info( 'Clicked element:' ); - console.info( current.opts.$orig ); + console.info( 'Clicked element:' ); + console.info( current.opts.$orig ); } */ @@ -1192,8 +1192,7 @@

      Options

      - Set instance options by passing a valid object to - fancybox() method: + Set instance options by passing a valid object to fancybox() method:

      $("[data-fancybox]").fancybox({
      @@ -1213,14 +1212,13 @@ 

      Options

      Custom options for each element individually can be set by adding a - data-options attribute to the element. This attribute should contain the properly formatted JSON - object. + data-options attribute to the element. + This attribute should contain the properly formatted JSON object.

      It is also possible to quickly set any option using parameterized name of the selected option, for example, - animationEffect would be - data-animation-effect: + animationEffect would be data-animation-effect:

      <a data-fancybox data-options='{"caption" : "My caption", "src" : "https://codepen.io/about/", "type" : "iframe"}' href="javascript:;" class="btn btn-primary">
      @@ -1241,8 +1239,8 @@ 

      Options

      API

      - The fancybox API offers a couple of methods to control fancybox. This gives you the ability to extend the plugin and to integrate - it with other web application components. + The fancybox API offers a couple of methods to control fancybox. This gives you the ability to extend the + plugin and to integrate it with other web application components.

      Core methods

      @@ -1268,7 +1266,6 @@

      Core methods

      Starting fancybox

      -

      When creating group objects manually, each item should follow this pattern:

      @@ -1280,7 +1277,6 @@

      Starting fancybox

      }
      -

      Example of opening image gallery programmatically:

      @@ -1326,8 +1322,8 @@

      Starting fancybox

      - If you wish to quickly display some html content (for example, a message), then you can use a simpler syntax. Do not forget - to use a wrapping element around your content. + If you wish to quickly display some html content (for example, a message), then you can use a simpler + syntax. Do not forget to use a wrapping element around your content.

      $.fancybox.open('<div class="message"><h2>Hello!</h2><p>You are awesome!</p></div>');
      @@ -1336,7 +1332,8 @@

      Starting fancybox

      - Group items can be collection of jQuery objects, too. This can be used, for example, to display group of inline elements: + Group items can be collection of jQuery objects, too. + This can be used, for example, to display group of inline elements:

      $('#test').on('click', function() {
      @@ -1352,7 +1349,8 @@ 

      Starting fancybox

      Instance methods

      - In order to use these methods, you need an instance of the plugin's object. There are 3 common ways to get the reference. + In order to use these methods, you need an instance of the plugin's object. + There are 3 common ways to get the reference.

      @@ -1368,7 +1366,6 @@

      Instance methods

      // Your content and options );
      -

      3) From within the callback - first argument is always a reference to current instance:

      @@ -1382,7 +1379,6 @@

      Instance methods

      Once you have a reference to fancybox instance the following methods are available:

      -
      // Go to next gallery item
       instance.next( duration );
       
      @@ -1432,7 +1428,6 @@ 

      Instance methods

      instance.close();
      -

      You can also do something like this:

      @@ -1465,7 +1460,8 @@

      Events

      onDeactivate : When other instance has been activated

      - Event callbacks can be set as function properties of the options object passed to fancybox initialization function: + Event callbacks can be set as function properties of the options object passed to fancybox initialization + function:

      <script type="text/javascript">
      @@ -1496,10 +1492,9 @@ 

      Events

      - It is also possible to attach event handler for all instances. To prevent interfering with other scripts, these events have - been namespaced to - .fb. These handlers receive 3 parameters - event, current fancybox instance and current gallery - object. + It is also possible to attach event handler for all instances. To prevent interfering with other scripts, + these events have been namespaced to .fb. + These handlers receive 3 parameters - event, current fancybox instance and current gallery object.

      Here is an example of binding to the @@ -1529,10 +1524,9 @@

      Events

      Modules

      - fancybox code is split into several files (modules) that extend core functionality. You can build your own fancybox version - by excluding unnecessary modules, if needed. Each one has their own - js and/or - css files. + fancybox code is split into several files (modules) that extend core functionality. You can build your own + fancybox version by excluding unnecessary modules, if needed. + Each one has their own js and/or css files.

      @@ -1641,9 +1635,9 @@

      Modules

      - If you would inspect fancybox instance object, you would find that same keys ar captialized - these are references for each - module object. Also, you would notice that fancybox uses common naming convention to prefix jQuery objects with - $. + If you would inspect fancybox instance object, you would find that same keys ar captialized - these are + references for each module object. + Also, you would notice that fancybox uses common naming convention to prefix jQuery objects with $.

      @@ -1695,9 +1689,8 @@

      #1 Opening/closing causes fixed element to jump

      - Simply add - compensate-for-scrollbar CSS class to your fixed positioned elements. Example of using Bootstrap - navbar component: + Simply add compensate-for-scrollbar CSS class to your fixed positioned elements. + Example of using Bootstrap navbar component:

      <nav class="navbar navbar-inverse navbar-fixed-top compensate-for-scrollbar">
      @@ -1731,8 +1724,8 @@ 

      You can use - caption option that accepts a function and is called for each group element. Example of appending - image download link: + caption option that accepts a function and is called for each group element. + Example of appending image download link:

      $( '[data-fancybox="images"]' ).fancybox({
      @@ -1750,7 +1743,6 @@ 

      View demo on CodePen

      -

      Add current image index and image count (the total number of images in the gallery) right in the caption:

      @@ -1817,9 +1809,9 @@

      - There is currenty no JS option to change thumbnail grid position. But fancybox is designed so that you can use CSS to change - position or dimension for each block (e.g., content area, caption or thumbnail grid). This gives you freedom - to completely change the look and feel of the modal window, if needed. + There is currenty no JS option to change thumbnail grid position. But fancybox is designed so that you can + use CSS to change position or dimension for each block (e.g., content area, caption or thumbnail grid). + This gives you freedom to completely change the look and feel of the modal window, if needed. View demo on CodePen

      @@ -1852,10 +1844,12 @@

      - If you are combining fancybox with slider/carousel script and that script clones items to enable infinite navigation, then - duplicated items will appear in the gallery. To avoid that - 1) initialise fancybox on all items except cloned; - 2) add custom click event on cloned items and trigger click event on corresponding "real" item. Here is an example - using Slick slider: + If you are combining fancybox with slider/carousel script and that script clones items to enable infinite + navigation, then duplicated items will appear in the gallery. + To avoid that - + 1) initialise fancybox on all items except cloned; + 2) add custom click event on cloned items and trigger click event on corresponding "real" item. Here is an + example using Slick slider:

      // Init fancybox
       // =============
      diff --git a/package.json b/package.json
      index 17f6c1ce..10278d20 100644
      --- a/package.json
      +++ b/package.json
      @@ -1,7 +1,7 @@
       {
         "name": "@fancyapps/fancybox",
         "description": "Touch enabled, responsive and fully customizable jQuery lightbox script",
      -  "version": "3.4.1",
      +  "version": "3.4.2",
         "homepage": "https://fancyapps.com/fancybox/3/",
         "main": "dist/jquery.fancybox.js",
         "style": "dist/jquery.fancybox.css",
      diff --git a/src/css/core.css b/src/css/core.css
      index f3dd1cfc..b6a4057c 100644
      --- a/src/css/core.css
      +++ b/src/css/core.css
      @@ -1,6 +1,5 @@
       body.compensate-for-scrollbar {
           overflow: hidden;
      -    -ms-overflow-style: none;
       }
       
       .fancybox-active {
      @@ -107,7 +106,7 @@ body.compensate-for-scrollbar {
       .fancybox-stage {
           direction: ltr;
           overflow: visible;
      -    transform: translate3d(0, 0, 0);
      +    transform: translateZ(0);
           z-index: 99994;
       }
       
      @@ -116,7 +115,7 @@ body.compensate-for-scrollbar {
       }
       
       .fancybox-slide {
      -    backface-visibility: hidden;
      +    -webkit-backface-visibility: hidden; /* Using without prefix would break IE11 */
           display: none;
           height: 100%;
           left: 0;
      @@ -154,13 +153,10 @@ body.compensate-for-scrollbar {
       }
       
       .fancybox-slide--image {
      +    overflow: hidden;
           padding: 44px 0 0 0;
       }
       
      -.fancybox-slide--image {
      -    overflow: visible;
      -}
      -
       .fancybox-slide--image::before {
           display: none;
       }
      @@ -184,7 +180,7 @@ body.compensate-for-scrollbar {
       
       .fancybox-slide--image .fancybox-content {
           animation-timing-function: cubic-bezier(.5, 0, .14, 1);
      -    backface-visibility: hidden;
      +    -webkit-backface-visibility: hidden;
           background: transparent;
           background-repeat: no-repeat;
           background-size: 100% 100%;
      @@ -301,11 +297,13 @@ body.compensate-for-scrollbar {
           background: rgba(30, 30, 30, .6);
           border: 0;
           border-radius: 0;
      +    box-shadow: none;
           cursor: pointer;
           display: inline-block;
           height: 44px;
           margin: 0;
           padding: 10px;
      +    position: relative;
           transition: color .2s;
           vertical-align: top;
           visibility: inherit;
      @@ -362,6 +360,19 @@ body.compensate-for-scrollbar {
           display: none;
       }
       
      +.fancybox-progress {
      +    background: #ff5268;
      +    height: 2px;
      +    left: 0;
      +    position: absolute;
      +    right: 0;
      +    top: 0;
      +    transform: scaleX(0);
      +    transform-origin: 0;
      +    transition-property: transform;
      +    transition-timing-function: linear;
      +    z-index: 99998;
      +}
       /* Close button on the top right corner of html content */
       
       .fancybox-close-small {
      @@ -476,28 +487,25 @@ body.compensate-for-scrollbar {
       /* Loading indicator */
       
       .fancybox-loading {
      -    animation: fancybox-rotate .8s infinite linear;
      +    animation: fancybox-rotate 1s linear infinite;
           background: transparent;
      -    border: 6px solid rgba(100, 100, 100, .5);
      -    border-radius: 100%;
      -    border-top-color: #fff;
      -    height: 60px;
      +    border: 4px solid #888;
      +    border-bottom-color: #fff;
      +    border-radius: 50%;
      +    height: 50px;
           left: 50%;
      -    margin: -30px 0 0 -30px;
      -    opacity: .6;
      +    margin: -25px 0 0 -25px;
      +    opacity: .7;
           padding: 0;
           position: absolute;
           top: 50%;
      -    width: 60px;
      +    width: 50px;
           z-index: 99999;
       }
       
       @keyframes fancybox-rotate {
      -    from {
      -        transform: rotate(0deg);
      -    }
      -    to {
      -        transform: rotate(359deg);
      +    100% {
      +        transform: rotate(360deg);
           }
       }
       
      diff --git a/src/css/thumbs.css b/src/css/thumbs.css
      index 14a1b510..f07ea650 100644
      --- a/src/css/thumbs.css
      +++ b/src/css/thumbs.css
      @@ -1,7 +1,7 @@
       /* Thumbs */
       
       .fancybox-thumbs {
      -    background: #fff;
      +    background: #ddd;
           bottom: 0;
           display: none;
           margin: 0;
      @@ -83,7 +83,7 @@
       }
       
       .fancybox-thumbs__list a::before {
      -    border: 4px solid #4ea7f9;
      +    border: 6px solid #ff5268;
           bottom: 0;
           content: '';
           left: 0;
      diff --git a/src/js/core.js b/src/js/core.js
      index ad90aa46..da469452 100644
      --- a/src/js/core.js
      +++ b/src/js/core.js
      @@ -60,7 +60,7 @@
           buttons: [
             "zoom",
             //"share",
      -      //"slideShow",
      +      "slideShow",
             //"fullScreen",
             //"download",
             "thumbs",
      @@ -98,7 +98,7 @@
           iframe: {
             // Iframe template
             tpl:
      -        '',
      +        '',
       
             // Preload iframe before displaying it
             // This allows to calculate iframe content width and height
      @@ -467,6 +467,51 @@
           return rez;
         };
       
      +  // How much of an element is visible in viewport
      +  // =============================================
      +
      +  var inViewport = function($el) {
      +    var element = $el[0],
      +      elementRect = element.getBoundingClientRect(),
      +      parentRects = [],
      +      visibleInAllParents,
      +      windowHeight = $(window).height(),
      +      pageScroll = $(document).scrollTop(),
      +      elementTop = elementRect.top + pageScroll,
      +      hiddenBefore = pageScroll - elementTop,
      +      hiddenAfter = elementTop + elementRect.height - (pageScroll + windowHeight);
      +
      +    // Check if the parent can hide its children
      +    while (element.parentElement !== null) {
      +      if ($(element.parentElement).css("overflow") === "hidden" || $(element.parentElement).css("overflow") === "auto") {
      +        parentRects.push(element.parentElement.getBoundingClientRect());
      +      }
      +
      +      element = element.parentElement;
      +    }
      +
      +    visibleInAllParents = parentRects.every(function(parentRect) {
      +      var visiblePixelX = Math.min(elementRect.right, parentRect.right) - Math.max(elementRect.left, parentRect.left);
      +      var visiblePixelY = Math.min(elementRect.bottom, parentRect.bottom) - Math.max(elementRect.top, parentRect.top);
      +
      +      return visiblePixelX > 0 && visiblePixelY > 0;
      +    });
      +
      +    if (!visibleInAllParents || pageScroll > elementTop + elementRect.height || elementTop > pageScroll + windowHeight) {
      +      return 0;
      +    }
      +
      +    if (hiddenBefore > 0) {
      +      return 100 - (hiddenBefore * 100) / elementRect.height;
      +    }
      +
      +    if (hiddenAfter > 0) {
      +      return 100 - (hiddenAfter * 100) / elementRect.height;
      +    }
      +
      +    return 100;
      +  };
      +
         // Class definition
         // ================
       
      @@ -517,8 +562,6 @@
             var self = this,
               firstItem = self.group[self.currIndex],
               firstItemOpts = firstItem.opts,
      -        scrollbarWidth = $.fancybox.scrollbarWidth,
      -        $scrollDiv,
               $container,
               buttonStr;
       
      @@ -537,18 +580,10 @@
               !$.fancybox.isMobile &&
               document.body.scrollHeight > window.innerHeight
             ) {
      -        if (scrollbarWidth === undefined) {
      -          $scrollDiv = $('
      ').appendTo("body"); - - scrollbarWidth = $.fancybox.scrollbarWidth = $scrollDiv[0].offsetWidth - $scrollDiv[0].clientWidth; - - $scrollDiv.remove(); - } - $("head").append( - '" + '" ); $("body").addClass("compensate-for-scrollbar"); @@ -769,6 +804,7 @@ // Hide all buttons and disable interactivity for modal items if (obj.opts.modal) { obj.opts = $.extend(true, obj.opts, { + trapFocus: true, // Remove buttons infobar: 0, toolbar: 0, @@ -1002,34 +1038,31 @@ loop, current, previous, - canvasWidth, - transitionProps; + slidePos, + stagePos, + diff; if (self.isDragging || self.isClosing || (self.isAnimating && self.firstRun)) { return; } - pos = parseInt(pos, 10); - // Should loop? + pos = parseInt(pos, 10); loop = self.current ? self.current.opts.loop : self.opts.loop; if (!loop && (pos < 0 || pos >= groupLen)) { return false; } + // Check if opening for the first time; this helps to speed things up firstRun = self.firstRun = !Object.keys(self.slides).length; - if (groupLen < 2 && !firstRun && !!self.isDragging) { - return; - } - + // Create slides previous = self.current; self.prevIndex = self.currIndex; self.prevPos = self.currPos; - // Create slides current = self.createSlide(pos); if (groupLen > 1) { @@ -1050,8 +1083,6 @@ self.updateControls(); - isMoved = self.isMoved(current); - // Validate duration length current.forcedDuration = undefined; @@ -1063,72 +1094,102 @@ duration = parseInt(duration, 10); + // Check if user has swiped the slides or if still animating + isMoved = self.isMoved(previous); + + // Make sure current slide is visible + current.$slide.addClass("fancybox-slide--current"); + // Fresh start - reveal container, current slide and start loading content if (firstRun) { if (current.opts.animationEffect && duration) { self.$refs.container.css("transition-duration", duration + "ms"); } - self.$refs.container.addClass("fancybox-is-open"); - - // Make current slide visible - current.$slide.addClass("fancybox-slide--previous"); + self.$refs.container.addClass("fancybox-is-open").trigger("focus"); // Attempt to load content into slide - // At this point image would start loading, but inline/html content would load immediately + // This will later call `afterLoad` -> `revealContent` self.loadSlide(current); - current.$slide.removeClass("fancybox-slide--previous").addClass("fancybox-slide--current"); - self.preload("image"); - self.$refs.container.trigger("focus"); - return; } + // Get actual slide/stage positions (before cleaning up) + slidePos = $.fancybox.getTranslate(previous.$slide); + stagePos = $.fancybox.getTranslate(self.$refs.stage); + // Clean up all slides $.each(self.slides, function(index, slide) { - // Make sure that animation callback gets fired $.fancybox.stop(slide.$slide, true); - - slide.$slide.removeClass("fancybox-animated").removeClass(function(index, className) { - return (className.match(/(^|\s)fancybox-fx-\S+/g) || []).join(" "); - }); }); - // Make current slide visible even if content is still loading - current.$slide.removeClass("fancybox-slide--next fancybox-slide--previous").addClass("fancybox-slide--current"); + if (previous.pos !== current.pos) { + previous.isComplete = false; + + previous.$slide.removeClass("fancybox-slide--complete fancybox-slide--current"); + } - // If slides have been dragged, animate them to correct position + // If slides are out of place, then animate them to correct position if (isMoved) { - canvasWidth = Math.round(current.$slide.width()); + // Calculate horizontal swipe distance + diff = slidePos.left - (previous.pos * slidePos.width + previous.pos * previous.opts.gutter); $.each(self.slides, function(index, slide) { - var pos = slide.pos - current.pos; + // Make sure that each slide is in equal distance + // This is mostly needed for freshly added slides, because they are not yet positioned + var leftPos = slide.pos * slidePos.width + slide.pos * slide.opts.gutter; - $.fancybox.animate( - slide.$slide, - { - top: 0, - left: pos * canvasWidth + pos * slide.opts.gutter - }, - duration, - function() { - slide.$slide.removeAttr("style").removeClass("fancybox-slide--next fancybox-slide--previous"); + $.fancybox.setTranslate(slide.$slide, {top: 0, left: leftPos + diff - stagePos.left}); + + if (slide.pos !== current.pos) { + slide.$slide.addClass("fancybox-slide--" + (slide.pos > current.pos ? "next" : "previous")); + } + + // Redraw to make sure that transition will start + forceRedraw(slide.$slide); + + // Animate the slide + requestAFrame(function() { + $.fancybox.animate( + slide.$slide, + { + top: 0, + left: (slide.pos - current.pos) * slidePos.width + (slide.pos - current.pos) * slide.opts.gutter + }, + duration, + function() { + slide.$slide.removeAttr("style").removeClass("fancybox-slide--next fancybox-slide--previous"); - if (slide.pos === self.currPos) { - self.complete(); + if (slide.pos === self.currPos) { + self.complete(); + } } - } - ); + ); + }); }); } else { - self.$refs.stage.children().removeAttr("style"); - } + current.$slide + .parent() + .children() + .removeAttr("style"); - // Start transition that reveals current content - // or wait when it will be loaded + // Handle previously active slide + if (duration && current.opts.transitionEffect) { + $.fancybox.animate( + previous.$slide, + "fancybox-animated fancybox-slide--" + + (previous.pos > current.pos ? "next" : "previous") + + " fancybox-fx-" + + current.opts.transitionEffect, + duration, + null, + false + ); + } + } if (current.isLoaded) { self.revealContent(current); @@ -1137,31 +1198,6 @@ } self.preload("image"); - - if (previous.pos === current.pos) { - return; - } - - // Handle previously active slide - // ============================== - - transitionProps = "fancybox-slide--" + (previous.pos > current.pos ? "next" : "previous"); - - previous.$slide.removeClass("fancybox-slide--complete fancybox-slide--current fancybox-slide--next fancybox-slide--previous"); - - previous.isComplete = false; - - if (!duration || (!isMoved && !current.opts.transitionEffect)) { - return; - } - - if (isMoved) { - previous.$slide.addClass(transitionProps); - } else { - transitionProps = "fancybox-animated " + transitionProps + " fancybox-fx-" + current.opts.transitionEffect; - - $.fancybox.animate(previous.$slide, transitionProps, duration, null, false); - } }, // Create new "slide" element @@ -1356,9 +1392,17 @@ minRatio = Math.min(1, maxWidth / width, maxHeight / height); - // Use floor rounding to make sure it really fits - width = Math.floor(minRatio * width); - height = Math.floor(minRatio * height); + width = minRatio * width; + height = minRatio * height; + + // Adjust width/height to precisely fit into container + if (width > maxWidth - 0.5) { + width = maxWidth; + } + + if (height > maxHeight - 0.5) { + height = maxHeight; + } if (slide.type === "image") { rez.top = Math.floor((maxHeight - height) * 0.5) + parseFloat($slide.css("paddingTop")); @@ -1443,7 +1487,17 @@ opacity: 1 }, duration === undefined ? 0 : duration, - null, + function() { + // Clean up other slides + slide.$slide + .siblings() + .removeAttr("style") + .removeClass("fancybox-slide--previous fancybox-slide--next"); + + if (!slide.isComplete) { + self.complete(); + } + }, false ); } @@ -1454,9 +1508,20 @@ isMoved: function(slide) { var current = slide || this.current, - currentPos = $.fancybox.getTranslate(current.$slide); + slidePos, + stagePos; + + if (!current) { + return false; + } + + stagePos = $.fancybox.getTranslate(this.$refs.stage); + slidePos = $.fancybox.getTranslate(current.$slide); - return (currentPos.left !== 0 || currentPos.top !== 0) && !current.$slide.hasClass("fancybox-animated"); + return ( + (Math.abs(slidePos.top - stagePos.top) > 0 || Math.abs(slidePos.left - stagePos.left) > 0) && + !current.$slide.hasClass("fancybox-animated") + ); }, // Update cursor style depending if content can be zoomed @@ -1465,15 +1530,15 @@ updateCursor: function(nextWidth, nextHeight) { var self = this, current = self.current, - $container = self.$refs.container.removeClass( - "fancybox-is-zoomable fancybox-can-zoomIn fancybox-can-zoomOut fancybox-can-swipe fancybox-can-pan" - ), + $container = self.$refs.container, isZoomable; - if (!current || self.isClosing) { + if (!current || self.isClosing || !self.Guestures) { return; } + $container.removeClass("fancybox-is-zoomable fancybox-can-zoomIn fancybox-can-zoomOut fancybox-can-swipe fancybox-can-pan"); + isZoomable = self.isZoomable(); $container.toggleClass("fancybox-is-zoomable", isZoomable); @@ -1576,7 +1641,11 @@ slide.isLoading = true; - self.trigger("beforeLoad", slide); + if (self.trigger("beforeLoad", slide) === false) { + slide.isLoading = false; + + return false; + } type = slide.type; $slide = slide.$slide; @@ -1667,13 +1736,15 @@ windowWidth; // Check if need to show loading icon - slide.timouts = setTimeout(function() { - var $img = slide.$image; + requestAFrame(function() { + requestAFrame(function() { + var $img = slide.$image; - if (slide.isLoading && (!$img || !$img.length || !$img[0].complete) && !slide.hasError) { - self.showLoading(slide); - } - }, 350); + if (!self.isClosing && slide.isLoading && (!$img || !$img.length || !$img[0].complete) && !slide.hasError) { + self.showLoading(slide); + } + }); + }); // If we have "srcset", then we need to find first matching "src" value. // This is necessary, because when you set an src attribute, the browser will preload the image @@ -1787,12 +1858,6 @@ self.afterLoad(slide); } - // Clear timeout that checks if loading icon needs to be displayed - if (slide.timouts) { - clearTimeout(slide.timouts); - slide.timouts = null; - } - if (self.isClosing) { return; } @@ -1912,24 +1977,21 @@ $content.css({ width: "100%", - height: "" + "max-width": "100%", + height: "9999px" }); if (frameWidth === undefined) { frameWidth = Math.ceil(Math.max($body[0].clientWidth, $body.outerWidth(true))); } - if (frameWidth) { - $content.width(frameWidth); - } + $content.css("width", frameWidth ? frameWidth : "").css("max-width", ""); if (frameHeight === undefined) { frameHeight = Math.ceil(Math.max($body[0].clientHeight, $body.outerHeight(true))); } - if (frameHeight) { - $content.height(frameHeight); - } + $content.css("height", frameHeight ? frameHeight : ""); $slide.css("overflow", "auto"); } @@ -1958,6 +2020,7 @@ .empty(); slide.isLoaded = false; + slide.isRevealed = false; }); }, @@ -2104,7 +2167,10 @@ slide = slide || self.current; if (slide && !slide.$spinner) { - slide.$spinner = $(self.translate(self, self.opts.spinnerTpl)).appendTo(slide.$slide); + slide.$spinner = $(self.translate(self, self.opts.spinnerTpl)) + .appendTo(slide.$slide) + .hide() + .fadeIn(); } }, @@ -2117,7 +2183,7 @@ slide = slide || self.current; if (slide && slide.$spinner) { - slide.$spinner.remove(); + slide.$spinner.stop().remove(); delete slide.$spinner; } @@ -2185,10 +2251,6 @@ duration, opacity; - if (isMoved && isRevealed) { - return; - } - slide.isRevealed = true; effect = slide.opts[self.firstRun ? "animationEffect" : "transitionEffect"]; @@ -2199,7 +2261,7 @@ // Do not animate if revealing the same slide if (slide.pos === self.currPos) { if (slide.isComplete) { - effect = false; + //effect = false; } else { self.isAnimating = true; } @@ -2239,8 +2301,6 @@ // Draw image at start position $.fancybox.setTranslate(slide.$content.removeClass("fancybox-is-hidden"), start); - forceRedraw(slide.$content); - // Start animation $.fancybox.animate(slide.$content, end, duration, function() { self.isAnimating = false; @@ -2256,17 +2316,10 @@ // Simply show content if no effect // ================================ if (!effect) { - forceRedraw($slide); + slide.$content.removeClass("fancybox-is-hidden"); - if (!isRevealed) { - slide.$content - .removeClass("fancybox-is-hidden") - .hide() - .fadeIn("fast"); - } - - if (slide.pos === self.currPos) { - self.complete(); + if (!isRevealed && isMoved && slide.type === "image" && !slide.hasError) { + slide.$content.hide().fadeIn("fast"); } return; @@ -2278,15 +2331,12 @@ effectClassName = "fancybox-animated fancybox-slide--" + (slide.pos >= self.prevPos ? "next" : "previous") + " fancybox-fx-" + effect; - $slide - .removeAttr("style") - .removeClass("fancybox-slide--current fancybox-slide--next fancybox-slide--previous") - .addClass(effectClassName); + $slide.removeClass("fancybox-slide--current").addClass(effectClassName); slide.$content.removeClass("fancybox-is-hidden"); // Force reflow - forceRedraw($slide); + $slide.hide().show(0); $.fancybox.animate( $slide, @@ -2313,38 +2363,7 @@ thumbPos = $thumb && $thumb.length && $thumb[0].ownerDocument === document ? $thumb.offset() : 0, slidePos; - // Check if element is inside the viewport by at least 1 pixel - var isElementVisible = function($el) { - var element = $el[0], - elementRect = element.getBoundingClientRect(), - parentRects = [], - visibleInAllParents; - - while (element.parentElement !== null) { - if ($(element.parentElement).css("overflow") === "hidden" || $(element.parentElement).css("overflow") === "auto") { - parentRects.push(element.parentElement.getBoundingClientRect()); - } - - element = element.parentElement; - } - - visibleInAllParents = parentRects.every(function(parentRect) { - var visiblePixelX = Math.min(elementRect.right, parentRect.right) - Math.max(elementRect.left, parentRect.left); - var visiblePixelY = Math.min(elementRect.bottom, parentRect.bottom) - Math.max(elementRect.top, parentRect.top); - - return visiblePixelX > 0 && visiblePixelY > 0; - }); - - return ( - visibleInAllParents && - elementRect.bottom > 0 && - elementRect.right > 0 && - elementRect.left < $(window).width() && - elementRect.top < $(window).height() - ); - }; - - if (thumbPos && isElementVisible($thumb)) { + if (thumbPos && inViewport($thumb) >= 10) { slidePos = self.$refs.stage.offset(); rez = { @@ -2411,7 +2430,8 @@ current.$slide .find("video,audio") .filter(":visible:first") - .trigger("play"); + .trigger("play") + .on("ended", $.proxy(self.next, self)); } // Try to focus on the first focusable element @@ -2583,10 +2603,6 @@ // If there are multiple instances, they will be set again by "activate" method self.removeEvents(); - if (current.timouts) { - clearTimeout(current.timouts); - } - $content = current.$content; effect = current.opts.animationEffect; duration = $.isNumeric(d) ? d : effect ? current.opts.animationDuration : 0; @@ -2970,7 +2986,9 @@ } if (props.scaleX !== undefined && props.scaleY !== undefined) { - str = (str.length ? str + " " : "") + "scale(" + props.scaleX + ", " + props.scaleY + ")"; + str += " scale(" + props.scaleX + ", " + props.scaleY + ")"; + } else if (props.scaleX !== undefined) { + str += " scaleX(" + props.scaleX + ")"; } if (str.length) { @@ -2996,7 +3014,8 @@ // ============================= animate: function($el, to, duration, callback, leaveAnimationName) { - var final = false, + var self = this, + final = false, from; if ($.isFunction(duration)) { @@ -3008,7 +3027,7 @@ $el.removeAttr("style"); } - $.fancybox.stop($el); + self.stop($el); $el.on(transitionEnd, function(e) { // Skip events from child elements and z-index change @@ -3016,10 +3035,10 @@ return; } - $.fancybox.stop($el); + self.stop($el); if (final) { - $.fancybox.setTranslate($el, final); + self.setTranslate($el, final); } if ($.isNumeric(duration)) { diff --git a/src/js/guestures.js b/src/js/guestures.js index 58e0b55b..5a729299 100644 --- a/src/js/guestures.js +++ b/src/js/guestures.js @@ -185,7 +185,7 @@ self.startEvent = e; - self.canTap = true; + self.canTap = !current.$slide.hasClass("fancybox-animated"); self.$target = $target; self.$content = $content; self.opts = current.opts.touch; @@ -245,8 +245,6 @@ if (self.canPan) { $.fancybox.stop(self.$content); - self.$content.css("transition-duration", ""); - self.isPanning = true; } else { self.isSwiping = true; @@ -265,8 +263,6 @@ $.fancybox.stop(self.$content); - self.$content.css("transition-duration", ""); - self.centerPointStartX = (self.startPoints[0].x + self.startPoints[1].x) * 0.5 - $(window).scrollLeft(); self.centerPointStartY = (self.startPoints[0].y + self.startPoints[1].y) * 0.5 - $(window).scrollTop(); @@ -328,6 +324,7 @@ Guestures.prototype.onSwipe = function(e) { var self = this, + instance = self.instance, swiping = self.isSwiping, left = self.sliderStartPos.left || 0, angle; @@ -338,9 +335,9 @@ if (Math.abs(self.distance) > 10) { self.canTap = false; - if (self.instance.group.length < 2 && self.opts.vertical) { + if (instance.group.length < 2 && self.opts.vertical) { self.isSwiping = "y"; - } else if (self.instance.isDragging || self.opts.vertical === false || (self.opts.vertical === "auto" && $(window).width() > 800)) { + } else if (instance.isDragging || self.opts.vertical === false || (self.opts.vertical === "auto" && $(window).width() > 800)) { self.isSwiping = "x"; } else { angle = Math.abs((Math.atan2(self.distanceY, self.distanceX) * 180) / Math.PI); @@ -348,34 +345,45 @@ self.isSwiping = angle > 45 && angle < 135 ? "y" : "x"; } - self.canTap = false; - if (self.isSwiping === "y" && $.fancybox.isMobile && self.isScrollable) { self.isScrolling = true; return; } - self.instance.isDragging = self.isSwiping; + instance.isDragging = self.isSwiping; // Reset points to avoid jumping, because we dropped first swipes to calculate the angle self.startPoints = self.newPoints; - $.each(self.instance.slides, function(index, slide) { + $.each(instance.slides, function(index, slide) { + var slidePos, stagePos; + $.fancybox.stop(slide.$slide); - slide.$slide.css("transition-duration", ""); + slidePos = $.fancybox.getTranslate(slide.$slide); + stagePos = $.fancybox.getTranslate(instance.$refs.stage); - slide.inTransition = false; + slide.$slide + .removeAttr("style") + .removeClass("fancybox-animated") + .removeClass(function(index, className) { + return (className.match(/(^|\s)fancybox-fx-\S+/g) || []).join(" "); + }); - if (slide.pos === self.instance.current.pos) { - self.sliderStartPos.left = $.fancybox.getTranslate(slide.$slide).left - $.fancybox.getTranslate(self.instance.$refs.stage).left; + if (slide.pos === instance.current.pos) { + self.sliderStartPos.left = slidePos.left - stagePos.left; } + + $.fancybox.setTranslate(slide.$slide, { + top: slidePos.top - stagePos.top, + left: slidePos.left - stagePos.left + }); }); // Stop slideshow - if (self.instance.SlideShow && self.instance.SlideShow.isActive) { - self.instance.SlideShow.stop(); + if (instance.SlideShow && instance.SlideShow.isActive) { + instance.SlideShow.stop(); } } @@ -603,7 +611,6 @@ Guestures.prototype.ontouchend = function(e) { var self = this; - var dMs = Math.max(new Date().getTime() - self.startTime, 1); var swiping = self.isSwiping; var panning = self.isPanning; @@ -611,6 +618,7 @@ var scrolling = self.isScrolling; self.endPoints = getPointerXY(e); + self.dMs = Math.max(new Date().getTime() - self.startTime, 1); self.$container.removeClass("fancybox-is-grabbing"); @@ -635,13 +643,11 @@ return self.onTap(e); } - self.speed = 366; + self.speed = 100; // Speed in px/ms - self.velocityX = (self.distanceX / dMs) * 0.5; - self.velocityY = (self.distanceY / dMs) * 0.5; - - self.speedX = Math.max(self.speed * 0.5, Math.min(self.speed * 1.5, (1 / Math.abs(self.velocityX)) * self.speed)); + self.velocityX = (self.distanceX / self.dMs) * 0.5; + self.velocityY = (self.distanceY / self.dMs) * 0.5; if (panning) { self.endPanning(); @@ -657,7 +663,11 @@ Guestures.prototype.endSwiping = function(swiping, scrolling) { var self = this, ret = false, - len = self.instance.group.length; + len = self.instance.group.length, + velocityX = Math.abs(self.velocityX), + distanceX = Math.abs(self.distanceX), + canAdvance = swiping == "x" && len > 1 && ((self.dMs > 130 && distanceX > 10) || distanceX > 50), + speedX = Math.abs((velocityX * self.canvasWidth) / self.canvasWidth) > 0.8 ? 366 : 500; self.sliderLastPos = null; @@ -674,18 +684,14 @@ ); ret = self.instance.close(true, 200); - } else if (swiping == "x" && self.distanceX > 50 && len > 1) { - ret = self.instance.previous(self.speedX); - } else if (swiping == "x" && self.distanceX < -50 && len > 1) { - ret = self.instance.next(self.speedX); + } else if (canAdvance && self.distanceX > 0) { + ret = self.instance.previous(speedX); + } else if (canAdvance && self.distanceX < 0) { + ret = self.instance.next(speedX); } if (ret === false && (swiping == "x" || swiping == "y")) { - if (scrolling || len < 2) { - self.instance.centerSlide(self.instance.current, 150); - } else { - self.instance.jumpTo(self.instance.current.index); - } + self.instance.centerSlide(self.instance.current, 150); } self.$container.removeClass("fancybox-is-sliding"); @@ -694,20 +700,22 @@ // Limit panning from edges // ======================== Guestures.prototype.endPanning = function() { - var self = this; - var newOffsetX, newOffsetY, newPos; + var self = this, + newOffsetX, + newOffsetY, + newPos; if (!self.contentLastPos) { return; } - if (self.opts.momentum === false) { + if (self.opts.momentum === false || self.dMs > 350) { newOffsetX = self.contentLastPos.left; newOffsetY = self.contentLastPos.top; } else { // Continue movement - newOffsetX = self.contentLastPos.left + self.velocityX * self.speed; - newOffsetY = self.contentLastPos.top + self.velocityY * self.speed; + newOffsetX = self.contentLastPos.left + self.velocityX * 500; + newOffsetY = self.contentLastPos.top + self.velocityY * 500; } newPos = self.limitPosition(newOffsetX, newOffsetY, self.contentStartPos.width, self.contentStartPos.height); diff --git a/src/js/media.js b/src/js/media.js index d0c0d17c..f0600b2c 100644 --- a/src/js/media.js +++ b/src/js/media.js @@ -7,32 +7,7 @@ (function($) { "use strict"; - // Formats matching url to final form - - var format = function(url, rez, params) { - if (!url) { - return; - } - - params = params || ""; - - if ($.type(params) === "object") { - params = $.param(params, true); - } - - $.each(rez, function(key, value) { - url = url.replace("$" + key, value || ""); - }); - - if (params.length) { - url += (url.indexOf("?") > 0 ? "&" : "?") + params; - } - - return url; - }; - // Object containing properties for each media type - var defaults = { youtube: { matcher: /(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*))(.*)/i, @@ -60,8 +35,7 @@ show_title: 1, show_byline: 1, show_portrait: 0, - fullscreen: 1, - api: 1 + fullscreen: 1 }, paramPlace: 3, type: "iframe", @@ -107,6 +81,29 @@ } }; + // Formats matching url to final form + var format = function(url, rez, params) { + if (!url) { + return; + } + + params = params || ""; + + if ($.type(params) === "object") { + params = $.param(params, true); + } + + $.each(rez, function(key, value) { + url = url.replace("$" + key, value || ""); + }); + + if (params.length) { + url += (url.indexOf("?") > 0 ? "&" : "?") + params; + } + + return url; + }; + $(document).on("objectNeedsType.fb", function(e, instance, item) { var url = item.src || "", type = false, @@ -198,4 +195,96 @@ item.type = item.opts.defaultType; } }); + + // Load YouTube/Video API on request to detect when video finished playing + var VideoAPILoader = { + youtube: { + src: "https://www.youtube.com/iframe_api", + class: "YT", + loading: false, + loaded: false + }, + + vimeo: { + src: "https://player.vimeo.com/api/player.js", + class: "Vimeo", + loading: false, + loaded: false + }, + + load: function(vendor) { + var _this = this, + script; + + if (this[vendor].loaded) { + setTimeout(function() { + _this.done(vendor); + }); + return; + } + + if (this[vendor].loading) { + return; + } + + this[vendor].loading = true; + + script = document.createElement("script"); + script.type = "text/javascript"; + script.src = this[vendor].src; + + if (vendor === "youtube") { + window.onYouTubeIframeAPIReady = function() { + _this[vendor].loaded = true; + _this.done(vendor); + }; + } else { + script.onload = function() { + _this[vendor].loaded = true; + _this.done(vendor); + }; + } + + document.body.appendChild(script); + }, + done: function(vendor) { + var instance, $el, player; + + if (vendor === "youtube") { + delete window.onYouTubeIframeAPIReady; + } + + instance = $.fancybox.getInstance(); + + if (instance) { + $el = instance.current.$content.find("iframe"); + + if (vendor === "youtube" && YT !== undefined && YT) { + player = new YT.Player($el.attr("id"), { + events: { + onStateChange: function(e) { + if (e.data == 0) { + instance.next(); + } + } + } + }); + } else if (vendor === "vimeo" && Vimeo !== undefined && Vimeo) { + player = new Vimeo.Player($el); + + player.on("ended", function() { + instance.next(); + }); + } + } + } + }; + + $(document).on({ + "afterShow.fb": function(e, instance, current) { + if (instance.group.length > 1 && (current.contentSource === "youtube" || current.contentSource === "vimeo")) { + VideoAPILoader.load(current.contentSource); + } + } + }); })(jQuery); diff --git a/src/js/slideshow.js b/src/js/slideshow.js index 25282506..4dce352b 100644 --- a/src/js/slideshow.js +++ b/src/js/slideshow.js @@ -20,7 +20,8 @@ }, slideShow: { autoStart: false, - speed: 3000 + speed: 3000, + progress: true } }); @@ -35,42 +36,37 @@ $button: null, init: function() { - var self = this; + var self = this, + instance = self.instance, + opts = instance.group[instance.currIndex].opts.slideShow; - self.$button = self.instance.$refs.toolbar.find("[data-fancybox-play]").on("click", function() { + self.$button = instance.$refs.toolbar.find("[data-fancybox-play]").on("click", function() { self.toggle(); }); - if (self.instance.group.length < 2 || !self.instance.group[self.instance.currIndex].opts.slideShow) { + if (instance.group.length < 2 || !opts) { self.$button.hide(); + } else if (opts.progress) { + self.$progress = $('
      ').appendTo(instance.$refs.inner); } }, set: function(force) { var self = this, instance = self.instance, - current = instance.current, - advance = function() { - if (self.isActive) { - instance.jumpTo((instance.currIndex + 1) % instance.group.length); - } - }; + current = instance.current; // Check if reached last element if (current && (force === true || current.opts.loop || instance.currIndex < instance.group.length - 1)) { - self.timer = setTimeout(function() { - var $video; - - if (self.isActive) { - $video = current.$slide.find("video,audio").filter(":visible:first"); - - if ($video.length) { - $video.one("ended", advance); - } else { - advance(); - } + if (self.isActive && current.contentType !== "video") { + if (self.$progress) { + $.fancybox.animate(self.$progress.show(), {scaleX: 1}, current.opts.slideShow.speed); } - }, current.opts.slideShow.speed); + + self.timer = setTimeout(function() { + instance.jumpTo((instance.currIndex + 1) % instance.group.length); + }, current.opts.slideShow.speed); + } } else { self.stop(); instance.idleSecondsCounter = 0; @@ -84,11 +80,15 @@ clearTimeout(self.timer); self.timer = null; + + if (self.$progress) { + self.$progress.removeAttr("style").hide(); + } }, start: function() { - var self = this; - var current = self.instance.current; + var self = this, + current = self.instance.current; if (current) { self.$button @@ -107,8 +107,8 @@ }, stop: function() { - var self = this; - var current = self.instance.current; + var self = this, + current = self.instance.current; self.clear(); @@ -120,6 +120,10 @@ self.isActive = false; self.instance.trigger("onSlideShowChange", false); + + if (self.$progress) { + self.$progress.removeAttr("style").hide(); + } }, toggle: function() { @@ -182,8 +186,8 @@ // Page Visibility API to pause slideshow when window is not active $(document).on("visibilitychange", function() { - var instance = $.fancybox.getInstance(); - var SlideShow = instance && instance.SlideShow; + var instance = $.fancybox.getInstance(), + SlideShow = instance && instance.SlideShow; if (SlideShow && SlideShow.isActive) { if (document.hidden) { diff --git a/src/js/thumbs.js b/src/js/thumbs.js index 44c6a6f7..f11b07b1 100644 --- a/src/js/thumbs.js +++ b/src/js/thumbs.js @@ -111,8 +111,8 @@ list.push( '' : "") + + '"' + + (src && src.length ? ' style="background-image:url(' + src + ')"' : "") + ">" ); });