")
.html(content)
.find(slide.opts.filter);
}}
slide.$slide.one("onReset", function(){
$(this)
.find("video,audio")
.trigger("pause");
if(slide.$placeholder){
slide.$placeholder.after(content.hide()).remove();
slide.$placeholder=null;
}
if(slide.$smallBtn){
slide.$smallBtn.remove();
slide.$smallBtn=null;
}
if(!slide.hasError){
$(this).empty();
slide.isLoaded=false;
}});
$(content).appendTo(slide.$slide);
if($(content).is("video,audio")){
$(content).addClass("fancybox-video");
$(content).wrap("
");
slide.contentType="video";
slide.opts.width=slide.opts.width||$(content).attr("width");
slide.opts.height=slide.opts.height||$(content).attr("height");
}
slide.$content=slide.$slide
.children()
.filter("div,form,main,video,audio")
.first()
.addClass("fancybox-content");
slide.$slide.addClass("fancybox-slide--" + slide.contentType);
this.afterLoad(slide);
},
setError: function(slide){
slide.hasError=true;
slide.$slide
.trigger("onReset")
.removeClass("fancybox-slide--" + slide.contentType)
.addClass("fancybox-slide--error");
slide.contentType="html";
this.setContent(slide, this.translate(slide, slide.opts.errorTpl));
if(slide.pos===this.currPos){
this.isAnimating=false;
}},
showLoading: function(slide){
var self=this;
slide=slide||self.current;
if(slide&&!slide.$spinner){
slide.$spinner=$(self.translate(self, self.opts.spinnerTpl)).appendTo(slide.$slide);
}},
hideLoading: function(slide){
var self=this;
slide=slide||self.current;
if(slide&&slide.$spinner){
slide.$spinner.remove();
delete slide.$spinner;
}},
afterLoad: function(slide){
var self=this;
if(self.isClosing){
return;
}
slide.isLoading=false;
slide.isLoaded=true;
self.trigger("afterLoad", slide);
self.hideLoading(slide);
if(slide.pos===self.currPos){
self.updateCursor();
}
if(slide.opts.smallBtn&&(!slide.$smallBtn||!slide.$smallBtn.length)){
slide.$smallBtn=$(self.translate(slide, slide.opts.btnTpl.smallBtn)).prependTo(slide.$content);
}
if(slide.opts.protect&&slide.$content&&!slide.hasError){
slide.$content.on("contextmenu.fb", function(e){
if(e.button==2){
e.preventDefault();
}
return true;
});
if(slide.type==="image"){
$('
').appendTo(slide.$content);
}}
self.revealContent(slide);
},
revealContent: function(slide){
var self=this,
$slide=slide.$slide,
end=false,
start=false,
effect,
effectClassName,
duration,
opacity;
effect=slide.opts[self.firstRun ? "animationEffect":"transitionEffect"];
duration=slide.opts[self.firstRun ? "animationDuration":"transitionDuration"];
duration=parseInt(slide.forcedDuration===undefined ? duration:slide.forcedDuration, 10);
if(slide.pos===self.currPos){
if(slide.isComplete){
effect=false;
}else{
self.isAnimating=true;
}}
if(slide.isMoved||slide.pos!==self.currPos||!duration){
effect=false;
}
if(effect==="zoom"){
if(slide.pos===self.currPos&&duration&&slide.type==="image"&&!slide.hasError&&(start=self.getThumbPos(slide))){
end=self.getFitPos(slide);
}else{
effect="fade";
}}
if(effect==="zoom"){
end.scaleX=end.width / start.width;
end.scaleY=end.height / start.height;
opacity=slide.opts.zoomOpacity;
if(opacity=="auto"){
opacity=Math.abs(slide.width / slide.height - start.width / start.height) > 0.1;
}
if(opacity){
start.opacity=0.1;
end.opacity=1;
}
$.fancybox.setTranslate(slide.$content.removeClass("fancybox-is-hidden"), start);
forceRedraw(slide.$content);
$.fancybox.animate(slide.$content, end, duration, function(){
self.isAnimating=false;
self.complete();
});
return;
}
self.updateSlide(slide);
if(!effect){
forceRedraw($slide);
slide.$content.removeClass("fancybox-is-hidden");
if(slide.pos===self.currPos){
self.complete();
}
return;
}
$.fancybox.stop($slide);
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.$content.removeClass("fancybox-is-hidden");
forceRedraw($slide);
$.fancybox.animate($slide,
"fancybox-slide--current",
duration,
function(e){
$slide.removeClass(effectClassName).removeAttr("style");
if(slide.pos===self.currPos){
self.complete();
}},
true
);
},
getThumbPos: function(slide){
var self=this,
rez=false,
$thumb=slide.opts.$thumb,
thumbPos=$thumb&&$thumb.length&&$thumb[0].ownerDocument===document ? $thumb.offset():0,
slidePos;
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)){
slidePos=self.$refs.stage.offset();
rez={
top: thumbPos.top - slidePos.top + parseFloat($thumb.css("border-top-width")||0),
left: thumbPos.left - slidePos.left + parseFloat($thumb.css("border-left-width")||0),
width: $thumb.width(),
height: $thumb.height(),
scaleX: 1,
scaleY: 1
};}
return rez;
},
complete: function(){
var self=this,
current=self.current,
slides={};
if(current.isMoved||!current.isLoaded){
return;
}
if(!current.isComplete){
current.isComplete=true;
current.$slide.siblings().trigger("onReset");
self.preload("inline");
forceRedraw(current.$slide);
current.$slide.addClass("fancybox-slide--complete");
$.each(self.slides, function(key, slide){
if(slide.pos >=self.currPos - 1&&slide.pos <=self.currPos + 1){
slides[slide.pos]=slide;
}else if(slide){
$.fancybox.stop(slide.$slide);
slide.$slide.off().remove();
}});
self.slides=slides;
}
self.isAnimating=false;
self.updateCursor();
self.trigger("afterShow");
current.$slide
.find("video,audio")
.filter(":visible:first")
.trigger("play");
if($(document.activeElement).is("[disabled]") ||
(current.opts.autoFocus&&!(current.type=="image"||current.type==="iframe"))
){
self.focus();
}},
preload: function(type){
var self=this,
next=self.slides[self.currPos + 1],
prev=self.slides[self.currPos - 1];
if(next&&next.type===type){
self.loadSlide(next);
}
if(prev&&prev.type===type){
self.loadSlide(prev);
}},
focus: function(){
var current=this.current,
$el;
if(this.isClosing){
return;
}
if(current&¤t.isComplete&¤t.$content){
$el=current.$content.find("input[autofocus]:enabled:visible:first");
if(!$el.length){
$el=current.$content.find("button,:input,[tabindex],a").filter(":enabled:visible:first");
}
$el=$el&&$el.length ? $el:current.$content;
$el.trigger("focus");
}},
activate: function(){
var self=this;
$(".fancybox-container").each(function(){
var instance=$(this).data("FancyBox");
if(instance&&instance.id!==self.id&&!instance.isClosing){
instance.trigger("onDeactivate");
instance.removeEvents();
instance.isVisible=false;
}});
self.isVisible=true;
if(self.current||self.isIdle){
self.update();
self.updateControls();
}
self.trigger("onActivate");
self.addEvents();
},
close: function(e, d){
var self=this,
current=self.current,
effect,
duration,
$content,
domRect,
opacity,
start,
end;
var done=function(){
self.cleanUp(e);
};
if(self.isClosing){
return false;
}
self.isClosing=true;
if(self.trigger("beforeClose", e)===false){
self.isClosing=false;
requestAFrame(function(){
self.update();
});
return false;
}
self.removeEvents();
if(current.timouts){
clearTimeout(current.timouts);
}
$content=current.$content;
effect=current.opts.animationEffect;
duration=$.isNumeric(d) ? d:effect ? current.opts.animationDuration:0;
current.$slide
.off(transitionEnd)
.removeClass("fancybox-slide--complete fancybox-slide--next fancybox-slide--previous fancybox-animated");
current.$slide
.siblings()
.trigger("onReset")
.remove();
if(duration){
self.$refs.container.removeClass("fancybox-is-open").addClass("fancybox-is-closing");
}
self.hideLoading(current);
self.hideControls();
self.updateCursor();
if(effect==="zoom" &&
!(e!==true&&$content&&duration&¤t.type==="image"&&!current.hasError&&(end=self.getThumbPos(current)))
){
effect="fade";
}
if(effect==="zoom"){
$.fancybox.stop($content);
domRect=$.fancybox.getTranslate($content);
start={
top: domRect.top,
left: domRect.left,
scaleX: domRect.width / end.width,
scaleY: domRect.height / end.height,
width: end.width,
height: end.height
};
opacity=current.opts.zoomOpacity;
if(opacity=="auto"){
opacity=Math.abs(current.width / current.height - end.width / end.height) > 0.1;
}
if(opacity){
end.opacity=0;
}
$.fancybox.setTranslate($content, start);
forceRedraw($content);
$.fancybox.animate($content, end, duration, done);
return true;
}
if(effect&&duration){
if(e===true){
setTimeout(done, duration);
}else{
$.fancybox.animate(current.$slide.removeClass("fancybox-slide--current"),
"fancybox-animated fancybox-slide--previous fancybox-fx-" + effect,
duration,
done
);
}}else{
done();
}
return true;
},
cleanUp: function(e){
var self=this,
$body=$("body"),
instance,
scrollTop;
self.current.$slide.trigger("onReset");
self.$refs.container.empty().remove();
self.trigger("afterClose", e);
if(self.$lastFocus&&!!self.current.opts.backFocus){
self.$lastFocus.trigger("focus");
}
self.current=null;
instance=$.fancybox.getInstance();
if(instance){
instance.activate();
}else{
$body.removeClass("fancybox-active compensate-for-scrollbar");
$("#fancybox-style-noscroll").remove();
}},
trigger: function(name, slide){
var args=Array.prototype.slice.call(arguments, 1),
self=this,
obj=slide&&slide.opts ? slide:self.current,
rez;
if(obj){
args.unshift(obj);
}else{
obj=self;
}
args.unshift(self);
if($.isFunction(obj.opts[name])){
rez=obj.opts[name].apply(obj, args);
}
if(rez===false){
return rez;
}
if(name==="afterClose"||!self.$refs){
$D.trigger(name + ".fb", args);
}else{
self.$refs.container.trigger(name + ".fb", args);
}},
updateControls: function(force){
var self=this,
current=self.current,
index=current.index,
caption=current.opts.caption,
$container=self.$refs.container,
$caption=self.$refs.caption;
current.$slide.trigger("refresh");
self.$caption=caption&&caption.length ? $caption.html(caption):null;
if(!self.isHiddenControls&&!self.isIdle){
self.showControls();
}
$container.find("[data-fancybox-count]").html(self.group.length);
$container.find("[data-fancybox-index]").html(index + 1);
$container.find("[data-fancybox-prev]").toggleClass("disabled", !current.opts.loop&&index <=0);
$container.find("[data-fancybox-next]").toggleClass("disabled", !current.opts.loop&&index >=self.group.length - 1);
if(current.type==="image"){
$container
.find("[data-fancybox-zoom]")
.show()
.end()
.find("[data-fancybox-download]")
.attr("href", current.opts.image.src||current.src)
.show();
}else if(current.opts.toolbar){
$container.find("[data-fancybox-download],[data-fancybox-zoom]").hide();
}},
hideControls: function(){
this.isHiddenControls=true;
this.$refs.container.removeClass("fancybox-show-infobar fancybox-show-toolbar fancybox-show-caption fancybox-show-nav");
},
showControls: function(){
var self=this,
opts=self.current ? self.current.opts:self.opts,
$container=self.$refs.container;
self.isHiddenControls=false;
self.idleSecondsCounter=0;
$container
.toggleClass("fancybox-show-toolbar", !!(opts.toolbar&&opts.buttons))
.toggleClass("fancybox-show-infobar", !!(opts.infobar&&self.group.length > 1))
.toggleClass("fancybox-show-nav", !!(opts.arrows&&self.group.length > 1))
.toggleClass("fancybox-is-modal", !!opts.modal);
if(self.$caption){
$container.addClass("fancybox-show-caption ");
}else{
$container.removeClass("fancybox-show-caption");
}},
toggleControls: function(){
if(this.isHiddenControls){
this.showControls();
}else{
this.hideControls();
}}
});
$.fancybox={
version: "3.3.5",
defaults: defaults,
getInstance: function(command){
var instance=$('.fancybox-container:not(".fancybox-is-closing"):last').data("FancyBox"),
args=Array.prototype.slice.call(arguments, 1);
if(instance instanceof FancyBox){
if($.type(command)==="string"){
instance[command].apply(instance, args);
}else if($.type(command)==="function"){
command.apply(instance, args);
}
return instance;
}
return false;
},
open: function(items, opts, index){
return new FancyBox(items, opts, index);
},
close: function(all){
var instance=this.getInstance();
if(instance){
instance.close();
if(all===true){
this.close();
}}
},
destroy: function(){
this.close(true);
$D.add("body").off("click.fb-start", "**");
},
isMobile:
document.createTouch!==undefined&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
use3d: (function(){
var div=document.createElement("div");
return (
window.getComputedStyle &&
window.getComputedStyle(div) &&
window.getComputedStyle(div).getPropertyValue("transform") &&
!(document.documentMode&&document.documentMode < 11)
);
})(),
getTranslate: function($el){
var domRect;
if(!$el||!$el.length){
return false;
}
domRect=$el[0].getBoundingClientRect();
return {
top: domRect.top||0,
left: domRect.left||0,
width: domRect.width,
height: domRect.height,
opacity: parseFloat($el.css("opacity"))
};},
setTranslate: function($el, props){
var str="",
css={};
if(!$el||!props){
return;
}
if(props.left!==undefined||props.top!==undefined){
str =
(props.left===undefined ? $el.position().left:props.left) +
"px, " +
(props.top===undefined ? $el.position().top:props.top) +
"px";
if(this.use3d){
str="translate3d(" + str + ", 0px)";
}else{
str="translate(" + str + ")";
}}
if(props.scaleX!==undefined&&props.scaleY!==undefined){
str=(str.length ? str + " ":"") + "scale(" + props.scaleX + ", " + props.scaleY + ")";
}
if(str.length){
css.transform=str;
}
if(props.opacity!==undefined){
css.opacity=props.opacity;
}
if(props.width!==undefined){
css.width=props.width;
}
if(props.height!==undefined){
css.height=props.height;
}
return $el.css(css);
},
animate: function($el, to, duration, callback, leaveAnimationName){
var final=false;
if($.isFunction(duration)){
callback=duration;
duration=null;
}
if(!$.isPlainObject(to)){
$el.removeAttr("style");
}
$.fancybox.stop($el);
$el.on(transitionEnd, function(e){
if(e&&e.originalEvent&&(!$el.is(e.originalEvent.target)||e.originalEvent.propertyName=="z-index")){
return;
}
$.fancybox.stop($el);
if(final){
$.fancybox.setTranslate($el, final);
}
if($.isPlainObject(to)){
if(leaveAnimationName===false){
$el.removeAttr("style");
}}else if(leaveAnimationName!==true){
$el.removeClass(to);
}
if($.isFunction(callback)){
callback(e);
}});
if($.isNumeric(duration)){
$el.css("transition-duration", duration + "ms");
}
if($.isPlainObject(to)){
if(to.scaleX!==undefined&&to.scaleY!==undefined){
final=$.extend({}, to, {
width: $el.width() * to.scaleX,
height: $el.height() * to.scaleY,
scaleX: 1,
scaleY: 1
});
delete to.width;
delete to.height;
if($el.parent().hasClass("fancybox-slide--image")){
$el.parent().addClass("fancybox-is-scaling");
}}
$.fancybox.setTranslate($el, to);
}else{
$el.addClass(to);
}
$el.data("timer",
setTimeout(function(){
$el.trigger("transitionend");
}, duration + 16)
);
},
stop: function($el){
if($el&&$el.length){
clearTimeout($el.data("timer"));
$el.off("transitionend").css("transition-duration", "");
$el.parent().removeClass("fancybox-is-scaling");
}}
};
function _run(e, opts){
var items=[],
index=0,
$target,
value;
if(e&&e.isDefaultPrevented()){
return;
}
e.preventDefault();
opts=e&&e.data ? e.data.options:opts||{};
$target=opts.$target||$(e.currentTarget);
value=$target.attr("data-fancybox")||"";
if(value){
items=opts.selector ? $(opts.selector):e.data ? e.data.items:[];
items=items.length ? items.filter('[data-fancybox="' + value + '"]'):$('[data-fancybox="' + value + '"]');
index=items.index($target);
if(index < 0){
index=0;
}}else{
items=[$target];
}
$.fancybox.open(items, opts, index);
}
$.fn.fancybox=function(options){
var selector;
options=options||{};
selector=options.selector||false;
if(selector){
$("body")
.off("click.fb-start", selector)
.on("click.fb-start", selector, {options: options}, _run);
}else{
this.off("click.fb-start").on("click.fb-start",
{
items: this,
options: options
},
_run
);
}
return this;
};
$D.on("click.fb-start", "[data-fancybox]", _run);
$D.on("click.fb-start", "[data-trigger]", function(e){
_run(e, {
$target: $('[data-fancybox="' + $(e.currentTarget).attr("data-trigger") + '"]').eq($(e.currentTarget).attr("data-index")||0),
$trigger: $(this)
});
});
})(window, document, window.jQuery||jQuery);
(function($){
"use strict";
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;
};
var defaults={
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.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(rez){
return (
"//maps.google." +
rez[2] +
"/?ll=" +
(rez[9] ? rez[9] + "&z=" + Math.floor(rez[10]) + (rez[12] ? rez[12].replace(/^\//, "&"):""):rez[12] + "").replace(/\?/, "&") +
"&output=" +
(rez[12]&&rez[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(rez){
return "//maps.google." + rez[2] + "/maps?q=" + rez[5].replace("query=", "q=").replace("api=1", "") + "&output=embed";
}}
};
$(document).on("objectNeedsType.fb", function(e, instance, item){
var url=item.src||"",
type=false,
media,
thumb,
rez,
params,
urlParams,
paramObj,
provider;
media=$.extend(true, {}, defaults, item.opts.media);
$.each(media, function(providerName, providerOpts){
rez=url.match(providerOpts.matcher);
if(!rez){
return;
}
type=providerOpts.type;
provider=providerName;
paramObj={};
if(providerOpts.paramPlace&&rez[providerOpts.paramPlace]){
urlParams=rez[providerOpts.paramPlace];
if(urlParams[0]=="?"){
urlParams=urlParams.substring(1);
}
urlParams=urlParams.split("&");
for (var m=0; m < urlParams.length; ++m){
var p=urlParams[m].split("=", 2);
if(p.length==2){
paramObj[p[0]]=decodeURIComponent(p[1].replace(/\+/g, " "));
}}
}
params=$.extend(true, {}, providerOpts.params, item.opts[providerName], paramObj);
url =
$.type(providerOpts.url)==="function" ? providerOpts.url.call(this, rez, params, item):format(providerOpts.url, rez, params);
thumb =
$.type(providerOpts.thumb)==="function" ? providerOpts.thumb.call(this, rez, params, item):format(providerOpts.thumb, rez);
if(providerName==="youtube"){
url=url.replace(/&t=((\d+)m)?(\d+)s/, function(match, p1, m, s){
return "&start=" + ((m ? parseInt(m, 10) * 60:0) + parseInt(s, 10));
});
}else if(providerName==="vimeo"){
url=url.replace("&%23", "#");
}
return false;
});
if(type){
if(!item.opts.thumb&&!(item.opts.$thumb&&item.opts.$thumb.length)){
item.opts.thumb=thumb;
}
if(type==="iframe"){
item.opts=$.extend(true, item.opts, {
iframe: {
preload: false,
attr: {
scrolling: "no"
}}
});
}
$.extend(item, {
type: type,
src: url,
origSrc: item.src,
contentSource: provider,
contentType: type==="image" ? "image":provider=="gmap_place"||provider=="gmap_search" ? "map":"video"
});
}else if(url){
item.type=item.opts.defaultType;
}});
})(window.jQuery||jQuery);
(function(window, document, $){
"use strict";
var requestAFrame=(function(){
return (
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
function(callback){
return window.setTimeout(callback, 1000 / 60);
}
);
})();
var cancelAFrame=(function(){
return (
window.cancelAnimationFrame ||
window.webkitCancelAnimationFrame ||
window.mozCancelAnimationFrame ||
window.oCancelAnimationFrame ||
function(id){
window.clearTimeout(id);
}
);
})();
var getPointerXY=function(e){
var result=[];
e=e.originalEvent||e || window.e;
e=e.touches&&e.touches.length ? e.touches:e.changedTouches&&e.changedTouches.length ? e.changedTouches:[e];
for (var key in e){
if(e[key].pageX){
result.push({
x: e[key].pageX,
y: e[key].pageY
});
}else if(e[key].clientX){
result.push({
x: e[key].clientX,
y: e[key].clientY
});
}}
return result;
};
var distance=function(point2, point1, what){
if(!point1||!point2){
return 0;
}
if(what==="x"){
return point2.x - point1.x;
}else if(what==="y"){
return point2.y - point1.y;
}
return Math.sqrt(Math.pow(point2.x - point1.x, 2) + Math.pow(point2.y - point1.y, 2));
};
var isClickable=function($el){
if($el.is('a,area,button,[role="button"],input,label,select,summary,textarea,video,audio') ||
$.isFunction($el.get(0).onclick) ||
$el.data("selectable")
){
return true;
}
for (var i=0, atts=$el[0].attributes, n=atts.length; i < n; i++){
if(atts[i].nodeName.substr(0, 14)==="data-fancybox-"){
return true;
}}
return false;
};
var hasScrollbars=function(el){
var overflowY=window.getComputedStyle(el)["overflow-y"],
overflowX=window.getComputedStyle(el)["overflow-x"],
vertical=(overflowY==="scroll"||overflowY==="auto")&&el.scrollHeight > el.clientHeight,
horizontal=(overflowX==="scroll"||overflowX==="auto")&&el.scrollWidth > el.clientWidth;
return vertical||horizontal;
};
var isScrollable=function($el){
var rez=false;
while (true){
rez=hasScrollbars($el.get(0));
if(rez){
break;
}
$el=$el.parent();
if(!$el.length||$el.hasClass("fancybox-stage")||$el.is("body")){
break;
}}
return rez;
};
var Guestures=function(instance){
var self=this;
self.instance=instance;
self.$bg=instance.$refs.bg;
self.$stage=instance.$refs.stage;
self.$container=instance.$refs.container;
self.destroy();
self.$container.on("touchstart.fb.touch mousedown.fb.touch", $.proxy(self, "ontouchstart"));
};
Guestures.prototype.destroy=function(){
this.$container.off(".fb.touch");
};
Guestures.prototype.ontouchstart=function(e){
var self=this,
$target=$(e.target),
instance=self.instance,
current=instance.current,
$content=current.$content,
isTouchDevice=e.type=="touchstart";
if(isTouchDevice){
self.$container.off("mousedown.fb.touch");
}
if(e.originalEvent&&e.originalEvent.button==2){
return;
}
if(!$target.length||isClickable($target)||isClickable($target.parent())){
return;
}
if(!$target.is("img")&&e.originalEvent.clientX > $target[0].clientWidth + $target.offset().left){
return;
}
if(!current||instance.isAnimating||instance.isClosing){
e.stopPropagation();
e.preventDefault();
return;
}
self.realPoints=self.startPoints=getPointerXY(e);
if(!self.startPoints.length){
return;
}
e.stopPropagation();
self.startEvent=e;
self.canTap=true;
self.$target=$target;
self.$content=$content;
self.opts=current.opts.touch;
self.isPanning=false;
self.isSwiping=false;
self.isZooming=false;
self.isScrolling=false;
self.startTime=new Date().getTime();
self.distanceX=self.distanceY=self.distance=0;
self.canvasWidth=Math.round(current.$slide[0].clientWidth);
self.canvasHeight=Math.round(current.$slide[0].clientHeight);
self.contentLastPos=null;
self.contentStartPos=$.fancybox.getTranslate(self.$content)||{top: 0, left: 0};
self.sliderStartPos=self.sliderLastPos||$.fancybox.getTranslate(current.$slide);
self.stagePos=$.fancybox.getTranslate(instance.$refs.stage);
self.sliderStartPos.top -=self.stagePos.top;
self.sliderStartPos.left -=self.stagePos.left;
self.contentStartPos.top -=self.stagePos.top;
self.contentStartPos.left -=self.stagePos.left;
$(document)
.off(".fb.touch")
.on(isTouchDevice ? "touchend.fb.touch touchcancel.fb.touch":"mouseup.fb.touch mouseleave.fb.touch", $.proxy(self, "ontouchend"))
.on(isTouchDevice ? "touchmove.fb.touch":"mousemove.fb.touch", $.proxy(self, "ontouchmove"));
if($.fancybox.isMobile){
document.addEventListener("scroll", self.onscroll, true);
}
if(!(self.opts||instance.canPan())||!($target.is(self.$stage)||self.$stage.find($target).length)){
if($target.is(".fancybox-image")){
e.preventDefault();
}
return;
}
if(!($.fancybox.isMobile&&(isScrollable($target)||isScrollable($target.parent())))){
e.preventDefault();
}
if(self.startPoints.length===1||current.hasError){
if(self.instance.canPan()){
$.fancybox.stop(self.$content);
self.$content.css("transition-duration", "");
self.isPanning=true;
}else{
self.isSwiping=true;
}
self.$container.addClass("fancybox-controls--isGrabbing");
}
if(self.startPoints.length===2&¤t.type==="image"&&(current.isLoaded||current.$ghost)){
self.canTap=false;
self.isSwiping=false;
self.isPanning=false;
self.isZooming=true;
$.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();
self.percentageOfImageAtPinchPointX=(self.centerPointStartX - self.contentStartPos.left) / self.contentStartPos.width;
self.percentageOfImageAtPinchPointY=(self.centerPointStartY - self.contentStartPos.top) / self.contentStartPos.height;
self.startDistanceBetweenFingers=distance(self.startPoints[0], self.startPoints[1]);
}};
Guestures.prototype.onscroll=function(e){
var self=this;
self.isScrolling=true;
document.removeEventListener("scroll", self.onscroll, true);
};
Guestures.prototype.ontouchmove=function(e){
var self=this,
$target=$(e.target);
if(e.originalEvent.buttons!==undefined&&e.originalEvent.buttons===0){
self.ontouchend(e);
return;
}
if(self.isScrolling||!($target.is(self.$stage)||self.$stage.find($target).length)){
self.canTap=false;
return;
}
self.newPoints=getPointerXY(e);
if(!(self.opts||self.instance.canPan())||!self.newPoints.length||!self.newPoints.length){
return;
}
if(!(self.isSwiping&&self.isSwiping===true)){
e.preventDefault();
}
self.distanceX=distance(self.newPoints[0], self.startPoints[0], "x");
self.distanceY=distance(self.newPoints[0], self.startPoints[0], "y");
self.distance=distance(self.newPoints[0], self.startPoints[0]);
if(self.distance > 0){
if(self.isSwiping){
self.onSwipe(e);
}else if(self.isPanning){
self.onPan();
}else if(self.isZooming){
self.onZoom();
}}
};
Guestures.prototype.onSwipe=function(e){
var self=this,
swiping=self.isSwiping,
left=self.sliderStartPos.left||0,
angle;
if(swiping===true){
if(Math.abs(self.distance) > 10){
self.canTap=false;
if(self.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)){
self.isSwiping="x";
}else{
angle=Math.abs(Math.atan2(self.distanceY, self.distanceX) * 180 / Math.PI);
self.isSwiping=angle > 45&&angle < 135 ? "y":"x";
}
self.canTap=false;
if(self.isSwiping==="y"&&$.fancybox.isMobile&&(isScrollable(self.$target)||isScrollable(self.$target.parent()))){
self.isScrolling=true;
return;
}
self.instance.isDragging=self.isSwiping;
self.startPoints=self.newPoints;
$.each(self.instance.slides, function(index, slide){
$.fancybox.stop(slide.$slide);
slide.$slide.css("transition-duration", "");
slide.inTransition=false;
if(slide.pos===self.instance.current.pos){
self.sliderStartPos.left=$.fancybox.getTranslate(slide.$slide).left - $.fancybox.getTranslate(self.instance.$refs.stage).left;
}});
if(self.instance.SlideShow&&self.instance.SlideShow.isActive){
self.instance.SlideShow.stop();
}}
return;
}
if(swiping=="x"){
if(self.distanceX > 0 &&
(self.instance.group.length < 2||(self.instance.current.index===0&&!self.instance.current.opts.loop))
){
left=left + Math.pow(self.distanceX, 0.8);
}else if(self.distanceX < 0 &&
(self.instance.group.length < 2 ||
(self.instance.current.index===self.instance.group.length - 1&&!self.instance.current.opts.loop))
){
left=left - Math.pow(-self.distanceX, 0.8);
}else{
left=left + self.distanceX;
}}
self.sliderLastPos={
top: swiping=="x" ? 0:self.sliderStartPos.top + self.distanceY,
left: left
};
if(self.requestId){
cancelAFrame(self.requestId);
self.requestId=null;
}
self.requestId=requestAFrame(function(){
if(self.sliderLastPos){
$.each(self.instance.slides, function(index, slide){
var pos=slide.pos - self.instance.currPos;
$.fancybox.setTranslate(slide.$slide, {
top: self.sliderLastPos.top,
left: self.sliderLastPos.left + pos * self.canvasWidth + pos * slide.opts.gutter
});
});
self.$container.addClass("fancybox-is-sliding");
}});
};
Guestures.prototype.onPan=function(){
var self=this;
if(distance(self.newPoints[0], self.realPoints[0]) < ($.fancybox.isMobile ? 10:5)){
self.startPoints=self.newPoints;
return;
}
self.canTap=false;
self.contentLastPos=self.limitMovement();
if(self.requestId){
cancelAFrame(self.requestId);
self.requestId=null;
}
self.requestId=requestAFrame(function(){
$.fancybox.setTranslate(self.$content, self.contentLastPos);
});
};
Guestures.prototype.limitMovement=function(){
var self=this;
var canvasWidth=self.canvasWidth;
var canvasHeight=self.canvasHeight;
var distanceX=self.distanceX;
var distanceY=self.distanceY;
var contentStartPos=self.contentStartPos;
var currentOffsetX=contentStartPos.left;
var currentOffsetY=contentStartPos.top;
var currentWidth=contentStartPos.width;
var currentHeight=contentStartPos.height;
var minTranslateX, minTranslateY, maxTranslateX, maxTranslateY, newOffsetX, newOffsetY;
if(currentWidth > canvasWidth){
newOffsetX=currentOffsetX + distanceX;
}else{
newOffsetX=currentOffsetX;
}
newOffsetY=currentOffsetY + distanceY;
minTranslateX=Math.max(0, canvasWidth * 0.5 - currentWidth * 0.5);
minTranslateY=Math.max(0, canvasHeight * 0.5 - currentHeight * 0.5);
maxTranslateX=Math.min(canvasWidth - currentWidth, canvasWidth * 0.5 - currentWidth * 0.5);
maxTranslateY=Math.min(canvasHeight - currentHeight, canvasHeight * 0.5 - currentHeight * 0.5);
if(distanceX > 0&&newOffsetX > minTranslateX){
newOffsetX=minTranslateX - 1 + Math.pow(-minTranslateX + currentOffsetX + distanceX, 0.8)||0;
}
if(distanceX < 0&&newOffsetX < maxTranslateX){
newOffsetX=maxTranslateX + 1 - Math.pow(maxTranslateX - currentOffsetX - distanceX, 0.8)||0;
}
if(distanceY > 0&&newOffsetY > minTranslateY){
newOffsetY=minTranslateY - 1 + Math.pow(-minTranslateY + currentOffsetY + distanceY, 0.8)||0;
}
if(distanceY < 0&&newOffsetY < maxTranslateY){
newOffsetY=maxTranslateY + 1 - Math.pow(maxTranslateY - currentOffsetY - distanceY, 0.8)||0;
}
return {
top: newOffsetY,
left: newOffsetX
};};
Guestures.prototype.limitPosition=function(newOffsetX, newOffsetY, newWidth, newHeight){
var self=this;
var canvasWidth=self.canvasWidth;
var canvasHeight=self.canvasHeight;
if(newWidth > canvasWidth){
newOffsetX=newOffsetX > 0 ? 0:newOffsetX;
newOffsetX=newOffsetX < canvasWidth - newWidth ? canvasWidth - newWidth:newOffsetX;
}else{
newOffsetX=Math.max(0, canvasWidth / 2 - newWidth / 2);
}
if(newHeight > canvasHeight){
newOffsetY=newOffsetY > 0 ? 0:newOffsetY;
newOffsetY=newOffsetY < canvasHeight - newHeight ? canvasHeight - newHeight:newOffsetY;
}else{
newOffsetY=Math.max(0, canvasHeight / 2 - newHeight / 2);
}
return {
top: newOffsetY,
left: newOffsetX
};};
Guestures.prototype.onZoom=function(){
var self=this;
var contentStartPos=self.contentStartPos;
var currentWidth=contentStartPos.width;
var currentHeight=contentStartPos.height;
var currentOffsetX=contentStartPos.left;
var currentOffsetY=contentStartPos.top;
var endDistanceBetweenFingers=distance(self.newPoints[0], self.newPoints[1]);
var pinchRatio=endDistanceBetweenFingers / self.startDistanceBetweenFingers;
var newWidth=Math.floor(currentWidth * pinchRatio);
var newHeight=Math.floor(currentHeight * pinchRatio);
var translateFromZoomingX=(currentWidth - newWidth) * self.percentageOfImageAtPinchPointX;
var translateFromZoomingY=(currentHeight - newHeight) * self.percentageOfImageAtPinchPointY;
var centerPointEndX=(self.newPoints[0].x + self.newPoints[1].x) / 2 - $(window).scrollLeft();
var centerPointEndY=(self.newPoints[0].y + self.newPoints[1].y) / 2 - $(window).scrollTop();
var translateFromTranslatingX=centerPointEndX - self.centerPointStartX;
var translateFromTranslatingY=centerPointEndY - self.centerPointStartY;
var newOffsetX=currentOffsetX + (translateFromZoomingX + translateFromTranslatingX);
var newOffsetY=currentOffsetY + (translateFromZoomingY + translateFromTranslatingY);
var newPos={
top: newOffsetY,
left: newOffsetX,
scaleX: pinchRatio,
scaleY: pinchRatio
};
self.canTap=false;
self.newWidth=newWidth;
self.newHeight=newHeight;
self.contentLastPos=newPos;
if(self.requestId){
cancelAFrame(self.requestId);
self.requestId=null;
}
self.requestId=requestAFrame(function(){
$.fancybox.setTranslate(self.$content, self.contentLastPos);
});
};
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;
var zooming=self.isZooming;
var scrolling=self.isScrolling;
self.endPoints=getPointerXY(e);
self.$container.removeClass("fancybox-controls--isGrabbing");
$(document).off(".fb.touch");
document.removeEventListener("scroll", self.onscroll, true);
if(self.requestId){
cancelAFrame(self.requestId);
self.requestId=null;
}
self.isSwiping=false;
self.isPanning=false;
self.isZooming=false;
self.isScrolling=false;
self.instance.isDragging=false;
if(self.canTap){
return self.onTap(e);
}
self.speed=366;
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));
if(panning){
self.endPanning();
}else if(zooming){
self.endZooming();
}else{
self.endSwiping(swiping, scrolling);
}
return;
};
Guestures.prototype.endSwiping=function(swiping, scrolling){
var self=this,
ret=false,
len=self.instance.group.length;
self.sliderLastPos=null;
if(swiping=="y"&&!scrolling&&Math.abs(self.distanceY) > 50){
$.fancybox.animate(self.instance.current.$slide,
{
top: self.sliderStartPos.top + self.distanceY + self.velocityY * 150,
opacity: 0
},
200
);
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);
}
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.$container.removeClass("fancybox-is-sliding");
};
Guestures.prototype.endPanning=function(){
var self=this;
var newOffsetX, newOffsetY, newPos;
if(!self.contentLastPos){
return;
}
if(self.opts.momentum===false){
newOffsetX=self.contentLastPos.left;
newOffsetY=self.contentLastPos.top;
}else{
newOffsetX=self.contentLastPos.left + self.velocityX * self.speed;
newOffsetY=self.contentLastPos.top + self.velocityY * self.speed;
}
newPos=self.limitPosition(newOffsetX, newOffsetY, self.contentStartPos.width, self.contentStartPos.height);
newPos.width=self.contentStartPos.width;
newPos.height=self.contentStartPos.height;
$.fancybox.animate(self.$content, newPos, 330);
};
Guestures.prototype.endZooming=function(){
var self=this;
var current=self.instance.current;
var newOffsetX, newOffsetY, newPos, reset;
var newWidth=self.newWidth;
var newHeight=self.newHeight;
if(!self.contentLastPos){
return;
}
newOffsetX=self.contentLastPos.left;
newOffsetY=self.contentLastPos.top;
reset={
top: newOffsetY,
left: newOffsetX,
width: newWidth,
height: newHeight,
scaleX: 1,
scaleY: 1
};
$.fancybox.setTranslate(self.$content, reset);
if(newWidth < self.canvasWidth&&newHeight < self.canvasHeight){
self.instance.scaleToFit(150);
}else if(newWidth > current.width||newHeight > current.height){
self.instance.scaleToActual(self.centerPointStartX, self.centerPointStartY, 150);
}else{
newPos=self.limitPosition(newOffsetX, newOffsetY, newWidth, newHeight);
$.fancybox.setTranslate(self.$content, $.fancybox.getTranslate(self.$content));
$.fancybox.animate(self.$content, newPos, 150);
}};
Guestures.prototype.onTap=function(e){
var self=this;
var $target=$(e.target);
var instance=self.instance;
var current=instance.current;
var endPoints=(e&&getPointerXY(e))||self.startPoints;
var tapX=endPoints[0] ? endPoints[0].x - $(window).scrollLeft() - self.stagePos.left:0;
var tapY=endPoints[0] ? endPoints[0].y - $(window).scrollTop() - self.stagePos.top:0;
var where;
var process=function(prefix){
var action=current.opts[prefix];
if($.isFunction(action)){
action=action.apply(instance, [current, e]);
}
if(!action){
return;
}
switch (action){
case "close":
instance.close(self.startEvent);
break;
case "toggleControls":
instance.toggleControls(true);
break;
case "next":
instance.next();
break;
case "nextOrClose":
if(instance.group.length > 1){
instance.next();
}else{
instance.close(self.startEvent);
}
break;
case "zoom":
if(current.type=="image"&&(current.isLoaded||current.$ghost)){
if(instance.canPan()){
instance.scaleToFit();
}else if(instance.isScaledDown()){
instance.scaleToActual(tapX, tapY);
}else if(instance.group.length < 2){
instance.close(self.startEvent);
}}
break;
}};
if(e.originalEvent&&e.originalEvent.button==2){
return;
}
if(!$target.is("img")&&tapX > $target[0].clientWidth + $target.offset().left){
return;
}
if($target.is(".fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-container")){
where="Outside";
}else if($target.is(".fancybox-slide")){
where="Slide";
}else if(instance.current.$content &&
instance.current.$content
.find($target)
.addBack()
.filter($target).length
){
where="Content";
}else{
return;
}
if(self.tapped){
clearTimeout(self.tapped);
self.tapped=null;
if(Math.abs(tapX - self.tapX) > 50||Math.abs(tapY - self.tapY) > 50){
return this;
}
process("dblclick" + where);
}else{
self.tapX=tapX;
self.tapY=tapY;
if(current.opts["dblclick" + where]&¤t.opts["dblclick" + where]!==current.opts["click" + where]){
self.tapped=setTimeout(function(){
self.tapped=null;
process("click" + where);
}, 500);
}else{
process("click" + where);
}}
return this;
};
$(document).on("onActivate.fb", function(e, instance){
if(instance&&!instance.Guestures){
instance.Guestures=new Guestures(instance);
}});
})(window, document, window.jQuery||jQuery);
(function(document, $){
"use strict";
$.extend(true, $.fancybox.defaults, {
btnTpl: {
slideShow:
'
"
},
slideShow: {
autoStart: false,
speed: 3000
}});
var SlideShow=function(instance){
this.instance=instance;
this.init();
};
$.extend(SlideShow.prototype, {
timer: null,
isActive: false,
$button: null,
init: function(){
var self=this;
self.$button=self.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){
self.$button.hide();
}},
set: function(force){
var self=this;
if(self.instance &&
self.instance.current &&
(force===true||self.instance.current.opts.loop||self.instance.currIndex < self.instance.group.length - 1)
){
self.timer=setTimeout(function(){
if(self.isActive){
self.instance.jumpTo((self.instance.currIndex + 1) % self.instance.group.length);
}}, self.instance.current.opts.slideShow.speed);
}else{
self.stop();
self.instance.idleSecondsCounter=0;
self.instance.showControls();
}},
clear: function(){
var self=this;
clearTimeout(self.timer);
self.timer=null;
},
start: function(){
var self=this;
var current=self.instance.current;
if(current){
self.isActive=true;
self.$button
.attr("title", current.opts.i18n[current.opts.lang].PLAY_STOP)
.removeClass("fancybox-button--play")
.addClass("fancybox-button--pause");
self.set(true);
}},
stop: function(){
var self=this;
var current=self.instance.current;
self.clear();
self.$button
.attr("title", current.opts.i18n[current.opts.lang].PLAY_START)
.removeClass("fancybox-button--pause")
.addClass("fancybox-button--play");
self.isActive=false;
},
toggle: function(){
var self=this;
if(self.isActive){
self.stop();
}else{
self.start();
}}
});
$(document).on({
"onInit.fb": function(e, instance){
if(instance&&!instance.SlideShow){
instance.SlideShow=new SlideShow(instance);
}},
"beforeShow.fb": function(e, instance, current, firstRun){
var SlideShow=instance&&instance.SlideShow;
if(firstRun){
if(SlideShow&¤t.opts.slideShow.autoStart){
SlideShow.start();
}}else if(SlideShow&&SlideShow.isActive){
SlideShow.clear();
}},
"afterShow.fb": function(e, instance, current){
var SlideShow=instance&&instance.SlideShow;
if(SlideShow&&SlideShow.isActive){
SlideShow.set();
}},
"afterKeydown.fb": function(e, instance, current, keypress, keycode){
var SlideShow=instance&&instance.SlideShow;
if(SlideShow&¤t.opts.slideShow&&(keycode===80||keycode===32)&&!$(document.activeElement).is("button,a,input")){
keypress.preventDefault();
SlideShow.toggle();
}},
"beforeClose.fb onDeactivate.fb": function(e, instance){
var SlideShow=instance&&instance.SlideShow;
if(SlideShow){
SlideShow.stop();
}}
});
$(document).on("visibilitychange", function(){
var instance=$.fancybox.getInstance();
var SlideShow=instance&&instance.SlideShow;
if(SlideShow&&SlideShow.isActive){
if(document.hidden){
SlideShow.clear();
}else{
SlideShow.set();
}}
});
})(document, window.jQuery||jQuery);
(function(document, $){
"use strict";
var fn=(function(){
var fnMap=[
["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror"],
[
"webkitRequestFullscreen",
"webkitExitFullscreen",
"webkitFullscreenElement",
"webkitFullscreenEnabled",
"webkitfullscreenchange",
"webkitfullscreenerror"
],
[
"webkitRequestFullScreen",
"webkitCancelFullScreen",
"webkitCurrentFullScreenElement",
"webkitCancelFullScreen",
"webkitfullscreenchange",
"webkitfullscreenerror"
],
[
"mozRequestFullScreen",
"mozCancelFullScreen",
"mozFullScreenElement",
"mozFullScreenEnabled",
"mozfullscreenchange",
"mozfullscreenerror"
],
["msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError"]
];
var ret={};
for (var i=0; i < fnMap.length; i++){
var val=fnMap[i];
if(val&&val[1] in document){
for (var j=0; j < val.length; j++){
ret[fnMap[0][j]]=val[j];
}
return ret;
}}
return false;
})();
if(!fn){
if($&&$.fancybox){
$.fancybox.defaults.btnTpl.fullScreen=false;
}
return;
}
var FullScreen={
request: function(elem){
elem=elem||document.documentElement;
elem[fn.requestFullscreen](elem.ALLOW_KEYBOARD_INPUT);
},
exit: function(){
document[fn.exitFullscreen]();
},
toggle: function(elem){
elem=elem||document.documentElement;
if(this.isFullscreen()){
this.exit();
}else{
this.request(elem);
}},
isFullscreen: function(){
return Boolean(document[fn.fullscreenElement]);
},
enabled: function(){
return Boolean(document[fn.fullscreenEnabled]);
}};
$.extend(true, $.fancybox.defaults, {
btnTpl: {
fullScreen:
'
"
},
fullScreen: {
autoStart: false
}});
$(document).on({
"onInit.fb": function(e, instance){
var $container;
if(instance&&instance.group[instance.currIndex].opts.fullScreen){
$container=instance.$refs.container;
$container.on("click.fb-fullscreen", "[data-fancybox-fullscreen]", function(e){
e.stopPropagation();
e.preventDefault();
FullScreen.toggle();
});
if(instance.opts.fullScreen&&instance.opts.fullScreen.autoStart===true){
FullScreen.request();
}
instance.FullScreen=FullScreen;
}else if(instance){
instance.$refs.toolbar.find("[data-fancybox-fullscreen]").hide();
}},
"afterKeydown.fb": function(e, instance, current, keypress, keycode){
if(instance&&instance.FullScreen&&keycode===70){
keypress.preventDefault();
instance.FullScreen.toggle();
}},
"beforeClose.fb": function(e, instance){
if(instance&&instance.FullScreen&&instance.$refs.container.hasClass("fancybox-is-fullscreen")){
FullScreen.exit();
}}
});
$(document).on(fn.fullscreenchange, function(){
var isFullscreen=FullScreen.isFullscreen(),
instance=$.fancybox.getInstance();
if(instance){
if(instance.current&&instance.current.type==="image"&&instance.isAnimating){
instance.current.$content.css("transition", "none");
instance.isAnimating=false;
instance.update(true, true, 0);
}
instance.trigger("onFullscreenChange", isFullscreen);
instance.$refs.container.toggleClass("fancybox-is-fullscreen", isFullscreen);
}});
})(document, window.jQuery||jQuery);
(function(document, $){
"use strict";
var CLASS="fancybox-thumbs",
CLASS_ACTIVE=CLASS + "-active",
CLASS_LOAD=CLASS + "-loading";
$.fancybox.defaults=$.extend(true,
{
btnTpl: {
thumbs:
'
"
},
thumbs: {
autoStart: false,
hideOnClose: true,
parentEl: ".fancybox-container",
axis: "y"
}},
$.fancybox.defaults
);
var FancyThumbs=function(instance){
this.init(instance);
};
$.extend(FancyThumbs.prototype, {
$button: null,
$grid: null,
$list: null,
isVisible: false,
isActive: false,
init: function(instance){
var self=this,
first,
second;
self.instance=instance;
instance.Thumbs=self;
self.opts=instance.group[instance.currIndex].opts.thumbs;
first=instance.group[0];
first=first.opts.thumb||(first.opts.$thumb&&first.opts.$thumb.length ? first.opts.$thumb.attr("src"):false);
if(instance.group.length > 1){
second=instance.group[1];
second=second.opts.thumb||(second.opts.$thumb&&second.opts.$thumb.length ? second.opts.$thumb.attr("src"):false);
}
self.$button=instance.$refs.toolbar.find("[data-fancybox-thumbs]");
if(self.opts&&first&&second&&first&&second){
self.$button.show().on("click", function(){
self.toggle();
});
self.isActive=true;
}else{
self.$button.hide();
}},
create: function(){
var self=this,
instance=self.instance,
parentEl=self.opts.parentEl,
list=[],
src;
if(!self.$grid){
self.$grid=$('
').appendTo(instance.$refs.container
.find(parentEl)
.addBack()
.filter(parentEl)
);
self.$grid.on("click", "li", function(){
instance.jumpTo($(this).attr("data-index"));
});
}
if(!self.$list){
self.$list=$("