;(function ($, w){
"use strict";
var methods=(function (){
var c={
bcClass: 'sf-breadcrumb',
menuClass: 'sf-js-enabled',
anchorClass: 'sf-with-ul',
menuArrowClass: 'sf-arrows'
},
ios=(function (){
var ios=/^(?![\w\W]*Windows Phone)[\w\W]*(iPhone|iPad|iPod)/i.test(navigator.userAgent);
if(ios){
$('html').css('cursor', 'pointer').on('click', $.noop);
}
return ios;
})(),
wp7=(function (){
var style=document.documentElement.style;
return ('behavior' in style&&'fill' in style&&/iemobile/i.test(navigator.userAgent));
})(),
unprefixedPointerEvents=(function (){
return (!!w.PointerEvent);
})(),
toggleMenuClasses=function ($menu, o, add){
var classes=c.menuClass,
method;
if(o.cssArrows){
classes +=' ' + c.menuArrowClass;
}
method=(add) ? 'addClass':'removeClass';
$menu[method](classes);
},
setPathToCurrent=function ($menu, o){
return $menu.find('li.' + o.pathClass).slice(0, o.pathLevels)
.addClass(o.hoverClass + ' ' + c.bcClass)
.filter(function (){
return ($(this).children(o.popUpSelector).hide().show().length);
}).removeClass(o.pathClass);
},
toggleAnchorClass=function ($li, add){
var method=(add) ? 'addClass':'removeClass';
$li.children('a')[method](c.anchorClass);
},
toggleTouchAction=function ($menu){
var msTouchAction=$menu.css('ms-touch-action');
var touchAction=$menu.css('touch-action');
touchAction=touchAction||msTouchAction;
touchAction=(touchAction==='pan-y') ? 'auto':'pan-y';
$menu.css({
'ms-touch-action': touchAction,
'touch-action': touchAction
});
},
getMenu=function ($el){
return $el.closest('.' + c.menuClass);
},
getOptions=function ($el){
return getMenu($el).data('sfOptions');
},
over=function (){
var $this=$(this),
o=getOptions($this);
clearTimeout(o.sfTimer);
$this.siblings().superfish('hide').end().superfish('show');
},
close=function (o){
o.retainPath=($.inArray(this[0], o.$path) > -1);
this.superfish('hide');
if(!this.parents('.' + o.hoverClass).length){
o.onIdle.call(getMenu(this));
if(o.$path.length){
$.proxy(over, o.$path)();
}}
},
out=function (){
var $this=$(this),
o=getOptions($this);
if(ios){
$.proxy(close, $this, o)();
}else{
clearTimeout(o.sfTimer);
o.sfTimer=setTimeout($.proxy(close, $this, o), o.delay);
}},
touchHandler=function (e){
var $this=$(this),
o=getOptions($this),
$ul=$this.siblings(e.data.popUpSelector);
if(o.onHandleTouch.call($ul)===false){
return this;
}
if($ul.length > 0&&$ul.is(':hidden')){
$this.one('click.superfish', false);
if(e.type==='MSPointerDown'||e.type==='pointerdown'){
$this.trigger('focus');
}else{
$.proxy(over, $this.parent('li'))();
}}
},
applyHandlers=function ($menu, o){
var targets='li:has(' + o.popUpSelector + ')';
if($.fn.hoverIntent&&!o.disableHI){
$menu.hoverIntent(over, out, targets);
}else{
$menu
.on('mouseenter.superfish', targets, over)
.on('mouseleave.superfish', targets, out);
}
var touchevent='MSPointerDown.superfish';
if(unprefixedPointerEvents){
touchevent='pointerdown.superfish';
}
if(!ios){
touchevent +=' touchend.superfish';
}
if(wp7){
touchevent +=' mousedown.superfish';
}
$menu
.on('focusin.superfish', 'li', over)
.on('focusout.superfish', 'li', out)
.on(touchevent, 'a', o, touchHandler);
};
return {
hide: function (instant){
if(this.length){
var $this=this,
o=getOptions($this);
if(!o){
return this;
}
var not=(o.retainPath===true) ? o.$path:'',
$ul=$this.find('li.' + o.hoverClass).add(this).not(not).removeClass(o.hoverClass).children(o.popUpSelector),
speed=o.speedOut;
if(instant){
$ul.show();
speed=0;
}
o.retainPath=false;
if(o.onBeforeHide.call($ul)===false){
return this;
}
$ul.stop(true, true).animate(o.animationOut, speed, function (){
var $this=$(this);
o.onHide.call($this);
});
}
return this;
},
show: function (){
var o=getOptions(this);
if(!o){
return this;
}
var $this=this.addClass(o.hoverClass),
$ul=$this.children(o.popUpSelector);
if(o.onBeforeShow.call($ul)===false){
return this;
}
$ul.stop(true, true).animate(o.animation, o.speed, function (){
o.onShow.call($ul);
});
return this;
},
destroy: function (){
return this.each(function (){
var $this=$(this),
o=$this.data('sfOptions'),
$hasPopUp;
if(!o){
return false;
}
$hasPopUp=$this.find(o.popUpSelector).parent('li');
clearTimeout(o.sfTimer);
toggleMenuClasses($this, o);
toggleAnchorClass($hasPopUp);
toggleTouchAction($this);
$this.off('.superfish').off('.hoverIntent');
$hasPopUp.children(o.popUpSelector).attr('style', function (i, style){
if(typeof style!=='undefined'){
return style.replace(/display[^;]+;?/g, '');
}});
o.$path.removeClass(o.hoverClass + ' ' + c.bcClass).addClass(o.pathClass);
$this.find('.' + o.hoverClass).removeClass(o.hoverClass);
o.onDestroy.call($this);
$this.removeData('sfOptions');
});
},
init: function (op){
return this.each(function (){
var $this=$(this);
if($this.data('sfOptions')){
return false;
}
var o=$.extend({}, $.fn.superfish.defaults, op),
$hasPopUp=$this.find(o.popUpSelector).parent('li');
o.$path=setPathToCurrent($this, o);
$this.data('sfOptions', o);
toggleMenuClasses($this, o, true);
toggleAnchorClass($hasPopUp, true);
toggleTouchAction($this);
applyHandlers($this, o);
$hasPopUp.not('.' + c.bcClass).superfish('hide', true);
o.onInit.call(this);
});
}};})();
$.fn.superfish=function (method, args){
if(methods[method]){
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
}
else if(typeof method==='object'||! method){
return methods.init.apply(this, arguments);
}else{
return $.error('Method ' +  method + ' does not exist on jQuery.fn.superfish');
}};
$.fn.superfish.defaults={
popUpSelector: 'ul,.sf-mega',
hoverClass: 'sfHover',
pathClass: 'overrideThisToUse',
pathLevels: 1,
delay: 800,
animation: {opacity: 'show'},
animationOut: {opacity: 'hide'},
speed: 'normal',
speedOut: 'fast',
cssArrows: true,
disableHI: false,
onInit: $.noop,
onBeforeShow: $.noop,
onShow: $.noop,
onBeforeHide: $.noop,
onHide: $.noop,
onIdle: $.noop,
onDestroy: $.noop,
onHandleTouch: $.noop
};})(jQuery, window);
;(function ($, document, window){
var
defaults={
label: 'MENU',
duplicate: true,
duration: 200,
easingOpen: 'swing',
easingClose: 'swing',
closedSymbol: '&#9658;',
openedSymbol: '&#9660;',
prependTo: 'body',
appendTo: '',
parentTag: 'a',
closeOnClick: false,
allowParentLinks: false,
nestedParentLinks: true,
showChildren: false,
removeIds: true,
removeClasses: false,
removeStyles: false,
brand: '',
animations: 'jquery',
init: function (){},
beforeOpen: function (){},
beforeClose: function (){},
afterOpen: function (){},
afterClose: function (){}},
mobileMenu='slicknav',
prefix='slicknav',
Keyboard={
DOWN: 40,
ENTER: 13,
ESCAPE: 27,
LEFT: 37,
RIGHT: 39,
SPACE: 32,
TAB: 9,
UP: 38,
};
function Plugin(element, options){
this.element=element;
this.settings=$.extend({}, defaults, options);
if(!this.settings.duplicate&&!options.hasOwnProperty("removeIds")){
this.settings.removeIds=false;
}
this._defaults=defaults;
this._name=mobileMenu;
this.init();
}
Plugin.prototype.init=function (){
var $this=this,
menu=$(this.element),
settings=this.settings,
iconClass,
menuBar;
if(settings.duplicate){
$this.mobileNav=menu.clone();
}else{
$this.mobileNav=menu;
}
if(settings.removeIds){
$this.mobileNav.removeAttr('id');
$this.mobileNav.find('*').each(function (i, e){
$(e).removeAttr('id');
});
}
if(settings.removeClasses){
$this.mobileNav.removeAttr('class');
$this.mobileNav.find('*').each(function (i, e){
$(e).removeAttr('class');
});
}
if(settings.removeStyles){
$this.mobileNav.removeAttr('style');
$this.mobileNav.find('*').each(function (i, e){
$(e).removeAttr('style');
});
}
iconClass=prefix + '_icon';
if(settings.label===''){
iconClass +=' ' + prefix + '_no-text';
}
if(settings.parentTag=='a'){
settings.parentTag='a href="#"';
}
$this.mobileNav.attr('class', prefix + '_nav');
menuBar=$('<div class="' + prefix + '_menu"></div>');
if(settings.brand!==''){
var brand=$('<div class="' + prefix + '_brand">'+settings.brand+'</div>');
$(menuBar).append(brand);
}
$this.btn=$(
['<' + settings.parentTag + ' aria-haspopup="true" role="button" tabindex="0" class="' + prefix + '_btn ' + prefix + '_collapsed">',
'<span class="' + prefix + '_menutxt">' + settings.label + '</span>',
'<span class="' + iconClass + '">',
'<span class="' + prefix + '_icon-bar"></span>',
'<span class="' + prefix + '_icon-bar"></span>',
'<span class="' + prefix + '_icon-bar"></span>',
'</span>',
'</' + settings.parentTag + '>'
].join('')
);
$(menuBar).append($this.btn);
if(settings.appendTo!==''){
$(settings.appendTo).append(menuBar);
}else{
$(settings.prependTo).prepend(menuBar);
}
menuBar.append($this.mobileNav);
var items=$this.mobileNav.find('li');
$(items).each(function (){
var item=$(this),
data={};
data.children=item.children('ul').attr('role', 'menu');
item.data('menu', data);
if(data.children.length > 0){
var a=item.contents(),
containsAnchor=false,
nodes=[];
$(a).each(function (){
if(!$(this).is('ul')){
nodes.push(this);
}else{
return false;
}
if($(this).is("a")){
containsAnchor=true;
}});
var wrapElement=$(
'<' + settings.parentTag + ' role="menuitem" aria-haspopup="true" tabindex="-1" class="' + prefix + '_item"/>'
);
if((!settings.allowParentLinks||settings.nestedParentLinks)||!containsAnchor){
var $wrap=$(nodes).wrapAll(wrapElement).parent();
$wrap.addClass(prefix+'_row');
} else
$(nodes).wrapAll('<span class="'+prefix+'_parent-link '+prefix+'_row"/>').parent();
if(!settings.showChildren){
item.addClass(prefix+'_collapsed');
}else{
item.addClass(prefix+'_open');
}
item.addClass(prefix+'_parent');
var arrowElement=$('<span class="'+prefix+'_arrow">'+(settings.showChildren?settings.openedSymbol:settings.closedSymbol)+'</span>');
if(settings.allowParentLinks&&!settings.nestedParentLinks&&containsAnchor)
arrowElement=arrowElement.wrap(wrapElement).parent();
$(nodes).last().after(arrowElement);
}else if(item.children().length===0){
item.addClass(prefix+'_txtnode');
}
item.children('a').attr('role', 'menuitem').click(function(event){
if(settings.closeOnClick&&!$(event.target).parent().closest('li').hasClass(prefix+'_parent')){
$($this.btn).click();
}});
if(settings.closeOnClick&&settings.allowParentLinks){
item.children('a').children('a').click(function (event){
$($this.btn).click();
});
item.find('.'+prefix+'_parent-link a:not(.'+prefix+'_item)').click(function(event){
$($this.btn).click();
});
}});
$(items).each(function (){
var data=$(this).data('menu');
if(!settings.showChildren){
$this._visibilityToggle(data.children, null, false, null, true);
}});
$this._visibilityToggle($this.mobileNav, null, false, 'init', true);
$this.mobileNav.attr('role','menu');
$(document).mousedown(function(){
$this._outlines(false);
});
$(document).keyup(function(){
$this._outlines(true);
});
$($this.btn).click(function (e){
e.preventDefault();
$this._menuToggle();
});
$this.mobileNav.on('click', '.' + prefix + '_item', function (e){
e.preventDefault();
$this._itemClick($(this));
});
$($this.btn).keydown(function (e){
var ev=e||event;
switch(ev.keyCode){
case Keyboard.ENTER:
case Keyboard.SPACE:
case Keyboard.DOWN:
e.preventDefault();
if(ev.keyCode!==Keyboard.DOWN||!$($this.btn).hasClass(prefix+'_open')){
$this._menuToggle();
}
$($this.btn).next().find('[role="menuitem"]').first().focus();
break;
}});
$this.mobileNav.on('keydown', '.'+prefix+'_item', function(e){
var ev=e||event;
switch(ev.keyCode){
case Keyboard.ENTER:
e.preventDefault();
$this._itemClick($(e.target));
break;
case Keyboard.RIGHT:
e.preventDefault();
if($(e.target).parent().hasClass(prefix+'_collapsed')){
$this._itemClick($(e.target));
}
$(e.target).next().find('[role="menuitem"]').first().focus();
break;
}});
$this.mobileNav.on('keydown', '[role="menuitem"]', function(e){
var ev=e||event;
switch(ev.keyCode){
case Keyboard.DOWN:
e.preventDefault();
var allItems=$(e.target).parent().parent().children().children('[role="menuitem"]:visible');
var idx=allItems.index(e.target);
var nextIdx=idx + 1;
if(allItems.length <=nextIdx){
nextIdx=0;
}
var next=allItems.eq(nextIdx);
next.focus();
break;
case Keyboard.UP:
e.preventDefault();
var allItems=$(e.target).parent().parent().children().children('[role="menuitem"]:visible');
var idx=allItems.index(e.target);
var next=allItems.eq(idx - 1);
next.focus();
break;
case Keyboard.LEFT:
e.preventDefault();
if($(e.target).parent().parent().parent().hasClass(prefix+'_open')){
var parent=$(e.target).parent().parent().prev();
parent.focus();
$this._itemClick(parent);
}else if($(e.target).parent().parent().hasClass(prefix+'_nav')){
$this._menuToggle();
$($this.btn).focus();
}
break;
case Keyboard.ESCAPE:
e.preventDefault();
$this._menuToggle();
$($this.btn).focus();
break;
}});
if(settings.allowParentLinks&&settings.nestedParentLinks){
$('.'+prefix+'_item a').click(function(e){
e.stopImmediatePropagation();
});
}};
Plugin.prototype._menuToggle=function (el){
var $this=this;
var btn=$this.btn;
var mobileNav=$this.mobileNav;
if(btn.hasClass(prefix+'_collapsed')){
btn.removeClass(prefix+'_collapsed');
btn.addClass(prefix+'_open');
}else{
btn.removeClass(prefix+'_open');
btn.addClass(prefix+'_collapsed');
}
btn.addClass(prefix+'_animating');
$this._visibilityToggle(mobileNav, btn.parent(), true, btn);
};
Plugin.prototype._itemClick=function (el){
var $this=this;
var settings=$this.settings;
var data=el.data('menu');
if(!data){
data={};
data.arrow=el.children('.'+prefix+'_arrow');
data.ul=el.next('ul');
data.parent=el.parent();
if(data.parent.hasClass(prefix+'_parent-link')){
data.parent=el.parent().parent();
data.ul=el.parent().next('ul');
}
el.data('menu', data);
}
if(data.parent.hasClass(prefix+'_collapsed')){
data.arrow.html(settings.openedSymbol);
data.parent.removeClass(prefix+'_collapsed');
data.parent.addClass(prefix+'_open');
data.parent.addClass(prefix+'_animating');
$this._visibilityToggle(data.ul, data.parent, true, el);
}else{
data.arrow.html(settings.closedSymbol);
data.parent.addClass(prefix+'_collapsed');
data.parent.removeClass(prefix+'_open');
data.parent.addClass(prefix+'_animating');
$this._visibilityToggle(data.ul, data.parent, true, el);
}};
Plugin.prototype._visibilityToggle=function(el, parent, animate, trigger, init){
var $this=this;
var settings=$this.settings;
var items=$this._getActionItems(el);
var duration=0;
if(animate){
duration=settings.duration;
}
function afterOpen(trigger, parent){
$(trigger).removeClass(prefix+'_animating');
$(parent).removeClass(prefix+'_animating');
if(!init){
settings.afterOpen(trigger);
}}
function afterClose(trigger, parent){
el.attr('aria-hidden','true');
items.attr('tabindex', '-1');
$this._setVisAttr(el, true);
el.hide();
$(trigger).removeClass(prefix+'_animating');
$(parent).removeClass(prefix+'_animating');
if(!init){
settings.afterClose(trigger);
}else if(trigger=='init'){
settings.init();
}}
if(el.hasClass(prefix+'_hidden')){
el.removeClass(prefix+'_hidden');
if(!init){
settings.beforeOpen(trigger);
}
if(settings.animations==='jquery'){
el.stop(true,true).slideDown(duration, settings.easingOpen, function(){
afterOpen(trigger, parent);
});
}else if(settings.animations==='velocity'){
el.velocity("finish").velocity("slideDown", {
duration: duration,
easing: settings.easingOpen,
complete: function(){
afterOpen(trigger, parent);
}});
}
el.attr('aria-hidden','false');
items.attr('tabindex', '0');
$this._setVisAttr(el, false);
}else{
el.addClass(prefix+'_hidden');
if(!init){
settings.beforeClose(trigger);
}
if(settings.animations==='jquery'){
el.stop(true,true).slideUp(duration, this.settings.easingClose, function(){
afterClose(trigger, parent)
});
}else if(settings.animations==='velocity'){
el.velocity("finish").velocity("slideUp", {
duration: duration,
easing: settings.easingClose,
complete: function(){
afterClose(trigger, parent);
}});
}}
};
Plugin.prototype._setVisAttr=function(el, hidden){
var $this=this;
var nonHidden=el.children('li').children('ul').not('.'+prefix+'_hidden');
if(!hidden){
nonHidden.each(function(){
var ul=$(this);
ul.attr('aria-hidden','false');
var items=$this._getActionItems(ul);
items.attr('tabindex', '0');
$this._setVisAttr(ul, hidden);
});
}else{
nonHidden.each(function(){
var ul=$(this);
ul.attr('aria-hidden','true');
var items=$this._getActionItems(ul);
items.attr('tabindex', '-1');
$this._setVisAttr(ul, hidden);
});
}};
Plugin.prototype._getActionItems=function(el){
var data=el.data("menu");
if(!data){
data={};
var items=el.children('li');
var anchors=items.find('a');
data.links=anchors.add(items.find('.'+prefix+'_item'));
el.data('menu', data);
}
return data.links;
};
Plugin.prototype._outlines=function(state){
if(!state){
$('.'+prefix+'_item, .'+prefix+'_btn').css('outline','none');
}else{
$('.'+prefix+'_item, .'+prefix+'_btn').css('outline','');
}};
Plugin.prototype.toggle=function(){
var $this=this;
$this._menuToggle();
};
Plugin.prototype.open=function(){
var $this=this;
if($this.btn.hasClass(prefix+'_collapsed')){
$this._menuToggle();
}};
Plugin.prototype.close=function(){
var $this=this;
if($this.btn.hasClass(prefix+'_open')){
$this._menuToggle();
}};
$.fn[mobileMenu]=function(options){
var args=arguments;
if(options===undefined||typeof options==='object'){
return this.each(function (){
if(!$.data(this, 'plugin_' + mobileMenu)){
$.data(this, 'plugin_' + mobileMenu, new Plugin(this, options));
}});
}else if(typeof options==='string'&&options[0]!=='_'&&options!=='init'){
var returns;
this.each(function (){
var instance=$.data(this, 'plugin_' + mobileMenu);
if(instance instanceof Plugin&&typeof instance[options]==='function'){
returns=instance[options].apply(instance, Array.prototype.slice.call(args, 1) );
}});
return returns!==undefined ? returns:this;
}};}(jQuery, document, window));
(function(window, document, $, undefined){
"use strict";
window.console=window.console||{
info: function(stuff){}};
if(!$){
return;
}
if($.fn.fancybox){
console.info("fancyBox already initialized");
return;
}
var defaults={
loop: false,
gutter: 50,
keyboard: true,
arrows: true,
infobar: true,
smallBtn: "auto",
toolbar: "auto",
buttons: [
"zoom",
"thumbs",
"close"
],
idleTime: 3,
protect: false,
modal: false,
image: {
preload: false
},
ajax: {
settings: {
data: {
fancybox: true
}}
},
iframe: {
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>',
preload: true,
css: {},
attr: {
scrolling: "auto"
}},
defaultType: "image",
animationEffect: "zoom",
animationDuration: 366,
zoomOpacity: "auto",
transitionEffect: "fade",
transitionDuration: 366,
slideClass: "",
baseClass: "",
baseTpl:
'<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-toolbar">{{buttons}}</div>' +
'<div class="fancybox-navigation">{{arrows}}</div>' +
'<div class="fancybox-stage"></div>' +
'<div class="fancybox-caption"></div>' +
"</div>" +
"</div>",
spinnerTpl: '<div class="fancybox-loading"></div>',
errorTpl: '<div class="fancybox-error"><p>{{ERROR}}</p></div>',
btnTpl: {
download:
'<a download data-fancybox-download class="fancybox-button fancybox-button--download" title="{{DOWNLOAD}}" href="javascript:;">' +
'<svg viewBox="0 0 40 40">' +
'<path d="M13,16 L20,23 L27,16 M20,7 L20,23 M10,24 L10,28 L30,28 L30,24" />' +
"</svg>" +
"</a>",
zoom:
'<button data-fancybox-zoom class="fancybox-button fancybox-button--zoom" title="{{ZOOM}}">' +
'<svg viewBox="0 0 40 40">' +
'<path d="M18,17 m-8,0 a8,8 0 1,0 16,0 a8,8 0 1,0 -16,0 M24,22 L31,29" />' +
"</svg>" +
"</button>",
close:
'<button data-fancybox-close class="fancybox-button fancybox-button--close" title="{{CLOSE}}">' +
'<svg viewBox="0 0 40 40">' +
'<path d="M10,10 L30,30 M30,10 L10,30" />' +
"</svg>" +
"</button>",
smallBtn:
'<button data-fancybox-close class="fancybox-close-small" title="{{CLOSE}}"><svg viewBox="0 0 32 32"><path d="M10,10 L22,22 M22,10 L10,22"></path></svg></button>',
arrowLeft:
'<a data-fancybox-prev class="fancybox-button fancybox-button--arrow_left" title="{{PREV}}" href="javascript:;">' +
'<svg viewBox="0 0 40 40">' +
'<path d="M18,12 L10,20 L18,28 M10,20 L30,20"></path>' +
"</svg>" +
"</a>",
arrowRight:
'<a data-fancybox-next class="fancybox-button fancybox-button--arrow_right" title="{{NEXT}}" href="javascript:;">' +
'<svg viewBox="0 0 40 40">' +
'<path d="M10,20 L30,20 M22,12 L30,20 L22,28"></path>' +
"</svg>" +
"</a>"
},
parentEl: "body",
autoFocus: false,
backFocus: true,
trapFocus: true,
fullScreen: {
autoStart: false
},
touch: {
vertical: true,
momentum: true
},
hash: null,
media: {},
slideShow: {
autoStart: false,
speed: 4000
},
thumbs: {
autoStart: false,
hideOnClose: true,
parentEl: ".fancybox-container",
axis: "y"
},
wheel: "auto",
/*
afterShow: function(instance, current){
console.info('Clicked element:');
console.info(current.opts.$orig);
}
*/
onInit: $.noop,
beforeLoad: $.noop,
afterLoad: $.noop,
beforeShow: $.noop,
afterShow: $.noop,
beforeClose: $.noop,
afterClose: $.noop,
onActivate: $.noop,
onDeactivate: $.noop,
clickContent: function(current, event){
return current.type==="image" ? "zoom":false;
},
clickSlide: "close",
clickOutside: "close",
dblclickContent: false,
dblclickSlide: false,
dblclickOutside: false,
mobile: {
idleTime: false,
clickContent: function(current, event){
return current.type==="image" ? "toggleControls":false;
},
clickSlide: function(current, event){
return current.type==="image" ? "toggleControls":"close";
},
dblclickContent: function(current, event){
return current.type==="image" ? "zoom":false;
},
dblclickSlide: function(current, event){
return current.type==="image" ? "zoom":false;
}},
lang: "en",
i18n: {
en: {
CLOSE: "Close",
NEXT: "Next",
PREV: "Previous",
ERROR: "The requested content cannot be loaded. <br/> 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. <br/> 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"
}}
};
var $W=$(window);
var $D=$(document);
var called=0;
var isQuery=function(obj){
return obj&&obj.hasOwnProperty&&obj instanceof $;
};
var requestAFrame=(function(){
return (
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
function(callback){
return window.setTimeout(callback, 1000 / 60);
}
);
})();
var transitionEnd=(function(){
var el=document.createElement("fakeelement"),
t;
var transitions={
transition: "transitionend",
OTransition: "oTransitionEnd",
MozTransition: "transitionend",
WebkitTransition: "webkitTransitionEnd"
};
for (t in transitions){
if(el.style[t]!==undefined){
return transitions[t];
}}
return "transitionend";
})();
var forceRedraw=function($el){
return $el&&$el.length&&$el[0].offsetHeight;
};
var mergeOpts=function(opts1, opts2){
var rez=$.extend(true, {}, opts1, opts2);
$.each(opts2, function(key, value){
if($.isArray(value)){
rez[key]=value;
}});
return rez;
};
var FancyBox=function(content, opts, index){
var self=this;
self.opts=mergeOpts({index: index}, $.fancybox.defaults);
if($.isPlainObject(opts)){
self.opts=mergeOpts(self.opts, opts);
}
if($.fancybox.isMobile){
self.opts=mergeOpts(self.opts, self.opts.mobile);
}
self.id=self.opts.id||++called;
self.currIndex=parseInt(self.opts.index, 10)||0;
self.prevIndex=null;
self.prevPos=null;
self.currPos=0;
self.firstRun=true;
self.group=[];
self.slides={};
self.addContent(content);
if(!self.group.length){
return;
}
self.$lastFocus=$(document.activeElement).trigger("blur");
self.init();
};
$.extend(FancyBox.prototype, {
init: function(){
var self=this,
firstItem=self.group[self.currIndex],
firstItemOpts=firstItem.opts,
scrollbarWidth=$.fancybox.scrollbarWidth,
$scrollDiv,
$container,
buttonStr;
if(!$.fancybox.getInstance()&&firstItemOpts.hideScrollbar!==false){
$("body").addClass("fancybox-active");
if(!$.fancybox.isMobile&&document.body.scrollHeight > window.innerHeight){
if(scrollbarWidth===undefined){
$scrollDiv=$('<div style="width:100px;height:100px;overflow:scroll;" />').appendTo("body");
scrollbarWidth=$.fancybox.scrollbarWidth=$scrollDiv[0].offsetWidth - $scrollDiv[0].clientWidth;
$scrollDiv.remove();
}
$("head").append('<style id="fancybox-style-noscroll" type="text/css">.compensate-for-scrollbar { margin-right: ' +
scrollbarWidth +
"px; }</style>"
);
$("body").addClass("compensate-for-scrollbar");
}}
buttonStr="";
$.each(firstItemOpts.buttons, function(index, value){
buttonStr +=firstItemOpts.btnTpl[value]||"";
});
$container=$(
self.translate(self,
firstItemOpts.baseTpl
.replace("{{buttons}}", buttonStr)
.replace("{{arrows}}", firstItemOpts.btnTpl.arrowLeft + firstItemOpts.btnTpl.arrowRight)
)
)
.attr("id", "fancybox-container-" + self.id)
.addClass("fancybox-is-hidden")
.addClass(firstItemOpts.baseClass)
.data("FancyBox", self)
.appendTo(firstItemOpts.parentEl);
self.$refs={
container: $container
};
["bg", "inner", "infobar", "toolbar", "stage", "caption", "navigation"].forEach(function(item){
self.$refs[item]=$container.find(".fancybox-" + item);
});
self.trigger("onInit");
self.activate();
self.jumpTo(self.currIndex);
},
translate: function(obj, str){
var arr=obj.opts.i18n[obj.opts.lang];
return str.replace(/\{\{(\w+)\}\}/g, function(match, n){
var value=arr[n];
if(value===undefined){
return match;
}
return value;
});
},
addContent: function(content){
var self=this,
items=$.makeArray(content),
thumbs;
$.each(items, function(i, item){
var obj={},
opts={},
$item,
type,
found,
src,
srcParts;
if($.isPlainObject(item)){
obj=item;
opts=item.opts||item;
}else if($.type(item)==="object"&&$(item).length){
$item=$(item);
opts=$item.data()||{};
opts=$.extend(true, {}, opts, opts.options);
opts.$orig=$item;
obj.src=self.opts.src||opts.src||$item.attr("href");
if(!obj.type&&!obj.src){
obj.type="inline";
obj.src=item;
}}else{
obj={
type: "html",
src: item + ""
};}
obj.opts=$.extend(true, {}, self.opts, opts);
if($.isArray(opts.buttons)){
obj.opts.buttons=opts.buttons;
}
type=obj.type||obj.opts.type;
src=obj.src||"";
if(!type&&src){
if((found=src.match(/\.(mp4|mov|ogv)((\?|#).*)?$/i))){
type="video";
if(!obj.opts.videoFormat){
obj.opts.videoFormat="video/" + (found[1]==="ogv" ? "ogg":found[1]);
}}else if(src.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)){
type="image";
}else if(src.match(/\.(pdf)((\?|#).*)?$/i)){
type="iframe";
}else if(src.charAt(0)==="#"){
type="inline";
}}
if(type){
obj.type=type;
}else{
self.trigger("objectNeedsType", obj);
}
if(!obj.contentType){
obj.contentType=$.inArray(obj.type, ["html", "inline", "ajax"]) > -1 ? "html":obj.type;
}
obj.index=self.group.length;
if(obj.opts.smallBtn=="auto"){
obj.opts.smallBtn=$.inArray(obj.type, ["html", "inline", "ajax"]) > -1;
}
if(obj.opts.toolbar==="auto"){
obj.opts.toolbar = !obj.opts.smallBtn;
}
if(obj.opts.$trigger&&obj.index===self.opts.index){
obj.opts.$thumb=obj.opts.$trigger.find("img:first");
}
if((!obj.opts.$thumb||!obj.opts.$thumb.length)&&obj.opts.$orig){
obj.opts.$thumb=obj.opts.$orig.find("img:first");
}
if($.type(obj.opts.caption)==="function"){
obj.opts.caption=obj.opts.caption.apply(item, [self, obj]);
}
if($.type(self.opts.caption)==="function"){
obj.opts.caption=self.opts.caption.apply(item, [self, obj]);
}
if(!(obj.opts.caption instanceof $)){
obj.opts.caption=obj.opts.caption===undefined ? "":obj.opts.caption + "";
}
if(obj.type==="ajax"){
srcParts=src.split(/\s+/, 2);
if(srcParts.length > 1){
obj.src=srcParts.shift();
obj.opts.filter=srcParts.shift();
}}
if(obj.opts.modal){
obj.opts=$.extend(true, obj.opts, {
infobar: 0,
toolbar: 0,
smallBtn: 0,
keyboard: 0,
slideShow: 0,
fullScreen: 0,
thumbs: 0,
touch: 0,
clickContent: false,
clickSlide: false,
clickOutside: false,
dblclickContent: false,
dblclickSlide: false,
dblclickOutside: false
});
}
self.group.push(obj);
});
if(Object.keys(self.slides).length){
self.updateControls();
thumbs=self.Thumbs;
if(thumbs&&thumbs.isActive){
thumbs.create();
thumbs.focus();
}}
},
addEvents: function(){
var self=this;
self.removeEvents();
self.$refs.container
.on("click.fb-close", "[data-fancybox-close]", function(e){
e.stopPropagation();
e.preventDefault();
self.close(e);
})
.on("touchstart.fb-prev click.fb-prev", "[data-fancybox-prev]", function(e){
e.stopPropagation();
e.preventDefault();
self.previous();
})
.on("touchstart.fb-next click.fb-next", "[data-fancybox-next]", function(e){
e.stopPropagation();
e.preventDefault();
self.next();
})
.on("click.fb", "[data-fancybox-zoom]", function(e){
self[self.isScaledDown() ? "scaleToActual":"scaleToFit"]();
});
$W.on("orientationchange.fb resize.fb", function(e){
if(e&&e.originalEvent&&e.originalEvent.type==="resize"){
requestAFrame(function(){
self.update();
});
}else{
self.$refs.stage.hide();
setTimeout(function(){
self.$refs.stage.show();
self.update();
}, $.fancybox.isMobile ? 600:250);
}});
$D.on("focusin.fb", function(e){
var instance=$.fancybox ? $.fancybox.getInstance():null;
if(instance.isClosing ||
!instance.current ||
!instance.current.opts.trapFocus ||
$(e.target).hasClass("fancybox-container") ||
$(e.target).is(document)
){
return;
}
if(instance&&$(e.target).css("position")!=="fixed"&&!instance.$refs.container.has(e.target).length){
e.stopPropagation();
instance.focus();
}});
$D.on("keydown.fb", function(e){
var current=self.current,
keycode=e.keyCode||e.which;
if(!current||!current.opts.keyboard){
return;
}
if(e.ctrlKey||e.altKey||e.shiftKey||$(e.target).is("input")||$(e.target).is("textarea")){
return;
}
if(keycode===8||keycode===27){
e.preventDefault();
self.close(e);
return;
}
if(keycode===37||keycode===38){
e.preventDefault();
self.previous();
return;
}
if(keycode===39||keycode===40){
e.preventDefault();
self.next();
return;
}
self.trigger("afterKeydown", e, keycode);
});
if(self.group[self.currIndex].opts.idleTime){
self.idleSecondsCounter=0;
$D.on("mousemove.fb-idle mouseleave.fb-idle mousedown.fb-idle touchstart.fb-idle touchmove.fb-idle scroll.fb-idle keydown.fb-idle",
function(e){
self.idleSecondsCounter=0;
if(self.isIdle){
self.showControls();
}
self.isIdle=false;
}
);
self.idleInterval=window.setInterval(function(){
self.idleSecondsCounter++;
if(self.idleSecondsCounter >=self.group[self.currIndex].opts.idleTime&&!self.isDragging){
self.isIdle=true;
self.idleSecondsCounter=0;
self.hideControls();
}}, 1000);
}},
removeEvents: function(){
var self=this;
$W.off("orientationchange.fb resize.fb");
$D.off("focusin.fb keydown.fb .fb-idle");
this.$refs.container.off(".fb-close .fb-prev .fb-next");
if(self.idleInterval){
window.clearInterval(self.idleInterval);
self.idleInterval=null;
}},
previous: function(duration){
return this.jumpTo(this.currPos - 1, duration);
},
next: function(duration){
return this.jumpTo(this.currPos + 1, duration);
},
jumpTo: function(pos, duration){
var self=this,
groupLen=self.group.length,
firstRun,
loop,
current,
previous,
canvasWidth,
currentPos,
transitionProps;
if(self.isDragging||self.isClosing||(self.isAnimating&&self.firstRun)){
return;
}
pos=parseInt(pos, 10);
loop=self.current ? self.current.opts.loop:self.opts.loop;
if(!loop&&(pos < 0||pos >=groupLen)){
return false;
}
firstRun=self.firstRun = !Object.keys(self.slides).length;
if(groupLen < 2&&!firstRun&&!!self.isDragging){
return;
}
previous=self.current;
self.prevIndex=self.currIndex;
self.prevPos=self.currPos;
current=self.createSlide(pos);
if(groupLen > 1){
if(loop||current.index > 0){
self.createSlide(pos - 1);
}
if(loop||current.index < groupLen - 1){
self.createSlide(pos + 1);
}}
self.current=current;
self.currIndex=current.index;
self.currPos=current.pos;
self.trigger("beforeShow", firstRun);
self.updateControls();
currentPos=$.fancybox.getTranslate(current.$slide);
current.isMoved=(currentPos.left!==0||currentPos.top!==0)&&!current.$slide.hasClass("fancybox-animated");
current.forcedDuration=undefined;
if($.isNumeric(duration)){
current.forcedDuration=duration;
}else{
duration=current.opts[firstRun ? "animationDuration":"transitionDuration"];
}
duration=parseInt(duration, 10);
if(firstRun){
if(current.opts.animationEffect&&duration){
self.$refs.container.css("transition-duration", duration + "ms");
}
self.$refs.container.removeClass("fancybox-is-hidden");
forceRedraw(self.$refs.container);
self.$refs.container.addClass("fancybox-is-open");
forceRedraw(self.$refs.container);
current.$slide.addClass("fancybox-slide--previous");
self.loadSlide(current);
current.$slide.removeClass("fancybox-slide--previous").addClass("fancybox-slide--current");
self.preload("image");
return;
}
$.each(self.slides, function(index, slide){
$.fancybox.stop(slide.$slide);
});
current.$slide.removeClass("fancybox-slide--next fancybox-slide--previous").addClass("fancybox-slide--current");
if(current.isMoved){
canvasWidth=Math.round(current.$slide.width());
$.each(self.slides, function(index, slide){
var pos=slide.pos - current.pos;
$.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");
if(slide.pos===self.currPos){
current.isMoved=false;
self.complete();
}}
);
});
}else{
self.$refs.stage.children().removeAttr("style");
}
if(current.isLoaded){
self.revealContent(current);
}else{
self.loadSlide(current);
}
self.preload("image");
if(previous.pos===current.pos){
return;
}
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||(!current.isMoved&&!current.opts.transitionEffect)){
return;
}
if(current.isMoved){
previous.$slide.addClass(transitionProps);
}else{
transitionProps="fancybox-animated " + transitionProps + " fancybox-fx-" + current.opts.transitionEffect;
$.fancybox.animate(previous.$slide, transitionProps, duration, function(){
previous.$slide.removeClass(transitionProps).removeAttr("style");
});
}},
createSlide: function(pos){
var self=this,
$slide,
index;
index=pos % self.group.length;
index=index < 0 ? self.group.length + index:index;
if(!self.slides[pos]&&self.group[index]){
$slide=$('<div class="fancybox-slide"></div>').appendTo(self.$refs.stage);
self.slides[pos]=$.extend(true, {}, self.group[index], {
pos: pos,
$slide: $slide,
isLoaded: false
});
self.updateSlide(self.slides[pos]);
}
return self.slides[pos];
},
scaleToActual: function(x, y, duration){
var self=this,
current=self.current,
$content=current.$content,
canvasWidth=$.fancybox.getTranslate(current.$slide).width,
canvasHeight=$.fancybox.getTranslate(current.$slide).height,
newImgWidth=current.width,
newImgHeight=current.height,
imgPos,
posX,
posY,
scaleX,
scaleY;
if(self.isAnimating||!$content||!(current.type=="image"&&current.isLoaded&&!current.hasError)){
return;
}
$.fancybox.stop($content);
self.isAnimating=true;
x=x===undefined ? canvasWidth * 0.5:x;
y=y===undefined ? canvasHeight * 0.5:y;
imgPos=$.fancybox.getTranslate($content);
imgPos.top -=$.fancybox.getTranslate(current.$slide).top;
imgPos.left -=$.fancybox.getTranslate(current.$slide).left;
scaleX=newImgWidth / imgPos.width;
scaleY=newImgHeight / imgPos.height;
posX=canvasWidth * 0.5 - newImgWidth * 0.5;
posY=canvasHeight * 0.5 - newImgHeight * 0.5;
if(newImgWidth > canvasWidth){
posX=imgPos.left * scaleX - (x * scaleX - x);
if(posX > 0){
posX=0;
}
if(posX < canvasWidth - newImgWidth){
posX=canvasWidth - newImgWidth;
}}
if(newImgHeight > canvasHeight){
posY=imgPos.top * scaleY - (y * scaleY - y);
if(posY > 0){
posY=0;
}
if(posY < canvasHeight - newImgHeight){
posY=canvasHeight - newImgHeight;
}}
self.updateCursor(newImgWidth, newImgHeight);
$.fancybox.animate($content,
{
top: posY,
left: posX,
scaleX: scaleX,
scaleY: scaleY
},
duration||330,
function(){
self.isAnimating=false;
}
);
if(self.SlideShow&&self.SlideShow.isActive){
self.SlideShow.stop();
}},
scaleToFit: function(duration){
var self=this,
current=self.current,
$content=current.$content,
end;
if(self.isAnimating||!$content||!(current.type=="image"&&current.isLoaded&&!current.hasError)){
return;
}
$.fancybox.stop($content);
self.isAnimating=true;
end=self.getFitPos(current);
self.updateCursor(end.width, end.height);
$.fancybox.animate($content,
{
top: end.top,
left: end.left,
scaleX: end.width / $content.width(),
scaleY: end.height / $content.height()
},
duration||330,
function(){
self.isAnimating=false;
}
);
},
getFitPos: function(slide){
var self=this,
$content=slide.$content,
width=slide.width||slide.opts.width,
height=slide.height||slide.opts.height,
maxWidth,
maxHeight,
minRatio,
margin,
aspectRatio,
rez={};
if(!slide.isLoaded||!$content||!$content.length){
return false;
}
margin={
top: parseInt(slide.$slide.css("paddingTop"), 10),
right: parseInt(slide.$slide.css("paddingRight"), 10),
bottom: parseInt(slide.$slide.css("paddingBottom"), 10),
left: parseInt(slide.$slide.css("paddingLeft"), 10)
};
maxWidth=parseInt(self.$refs.stage.width(), 10) - (margin.left + margin.right);
maxHeight=parseInt(self.$refs.stage.height(), 10) - (margin.top + margin.bottom);
if(!width||!height){
width=maxWidth;
height=maxHeight;
}
minRatio=Math.min(1, maxWidth / width, maxHeight / height);
width=Math.floor(minRatio * width);
height=Math.floor(minRatio * height);
if(slide.type==="image"){
rez.top=Math.floor((maxHeight - height) * 0.5) + margin.top;
rez.left=Math.floor((maxWidth - width) * 0.5) + margin.left;
}else if(slide.contentType==="video"){
aspectRatio=slide.opts.width&&slide.opts.height ? width / height:slide.opts.ratio||16 / 9;
if(height > width / aspectRatio){
height=width / aspectRatio;
}else if(width > height * aspectRatio){
width=height * aspectRatio;
}}
rez.width=width;
rez.height=height;
return rez;
},
update: function(){
var self=this;
$.each(self.slides, function(key, slide){
self.updateSlide(slide);
});
},
updateSlide: function(slide, duration){
var self=this,
$content=slide&&slide.$content,
width=slide.width||slide.opts.width,
height=slide.height||slide.opts.height;
if($content&&(width||height||slide.contentType==="video")&&!slide.hasError){
$.fancybox.stop($content);
$.fancybox.setTranslate($content, self.getFitPos(slide));
if(slide.pos===self.currPos){
self.isAnimating=false;
self.updateCursor();
}}
slide.$slide.trigger("refresh");
self.$refs.toolbar.toggleClass("compensate-for-scrollbar", slide.$slide.get(0).scrollHeight > slide.$slide.get(0).clientHeight);
self.trigger("onUpdate", slide);
},
centerSlide: function(slide, duration){
var self=this,
canvasWidth,
pos;
if(self.current){
canvasWidth=Math.round(slide.$slide.width());
pos=slide.pos - self.current.pos;
$.fancybox.animate(slide.$slide,
{
top: 0,
left: pos * canvasWidth + pos * slide.opts.gutter,
opacity: 1
},
duration===undefined ? 0:duration,
null,
false
);
}},
updateCursor: function(nextWidth, nextHeight){
var self=this,
current=self.current,
$container=self.$refs.container.removeClass("fancybox-is-zoomable fancybox-can-zoomIn fancybox-can-drag fancybox-can-zoomOut"),
isZoomable;
if(!current||self.isClosing){
return;
}
isZoomable=self.isZoomable();
$container.toggleClass("fancybox-is-zoomable", isZoomable);
$("[data-fancybox-zoom]").prop("disabled", !isZoomable);
if(isZoomable &&
(current.opts.clickContent==="zoom"||($.isFunction(current.opts.clickContent)&&current.opts.clickContent(current)==="zoom"))
){
if(self.isScaledDown(nextWidth, nextHeight)){
$container.addClass("fancybox-can-zoomIn");
}else{
if(current.opts.touch){
$container.addClass("fancybox-can-drag");
}else{
$container.addClass("fancybox-can-zoomOut");
}}
}else if(current.opts.touch&&current.contentType!=="video"){
$container.addClass("fancybox-can-drag");
}},
isZoomable: function(){
var self=this,
current=self.current,
fitPos;
if(current&&!self.isClosing&&current.type==="image"&&!current.hasError){
if(!current.isLoaded){
return true;
}
fitPos=self.getFitPos(current);
if(current.width > fitPos.width||current.height > fitPos.height){
return true;
}}
return false;
},
isScaledDown: function(nextWidth, nextHeight){
var self=this,
rez=false,
current=self.current,
$content=current.$content;
if(nextWidth!==undefined&&nextHeight!==undefined){
rez=nextWidth < current.width&&nextHeight < current.height;
}else if($content){
rez=$.fancybox.getTranslate($content);
rez=rez.width < current.width&&rez.height < current.height;
}
return rez;
},
canPan: function(){
var self=this,
rez=false,
current=self.current,
$content;
if(current.type==="image"&&($content=current.$content)&&!current.hasError){
rez=self.getFitPos(current);
rez=Math.abs($content.width() - rez.width) > 1||Math.abs($content.height() - rez.height) > 1;
}
return rez;
},
loadSlide: function(slide){
var self=this,
type,
$slide,
ajaxLoad;
if(slide.isLoading||slide.isLoaded){
return;
}
slide.isLoading=true;
self.trigger("beforeLoad", slide);
type=slide.type;
$slide=slide.$slide;
$slide
.off("refresh")
.trigger("onReset")
.addClass(slide.opts.slideClass);
switch (type){
case "image":
self.setImage(slide);
break;
case "iframe":
self.setIframe(slide);
break;
case "html":
self.setContent(slide, slide.src||slide.content);
break;
case "video":
self.setContent(slide,
'<video class="fancybox-video" controls controlsList="nodownload">' +
'<source src="' +
slide.src +
'" type="' +
slide.opts.videoFormat +
'">' +
"Your browser doesn't support HTML5 video" +
"</video"
);
break;
case "inline":
if($(slide.src).length){
self.setContent(slide, $(slide.src));
}else{
self.setError(slide);
}
break;
case "ajax":
self.showLoading(slide);
ajaxLoad=$.ajax($.extend({}, slide.opts.ajax.settings, {
url: slide.src,
success: function(data, textStatus){
if(textStatus==="success"){
self.setContent(slide, data);
}},
error: function(jqXHR, textStatus){
if(jqXHR&&textStatus!=="abort"){
self.setError(slide);
}}
})
);
$slide.one("onReset", function(){
ajaxLoad.abort();
});
break;
default:
self.setError(slide);
break;
}
return true;
},
setImage: function(slide){
var self=this,
srcset=slide.opts.srcset||slide.opts.image.srcset,
thumbSrc,
found,
temp,
pxRatio,
windowWidth;
slide.timouts=setTimeout(function(){
var $img=slide.$image;
if(slide.isLoading&&(!$img||!$img[0].complete)&&!slide.hasError){
self.showLoading(slide);
}}, 350);
if(srcset){
pxRatio=window.devicePixelRatio||1;
windowWidth=window.innerWidth * pxRatio;
temp=srcset.split(",").map(function(el){
var ret={};
el
.trim()
.split(/\s+/)
.forEach(function(el, i){
var value=parseInt(el.substring(0, el.length - 1), 10);
if(i===0){
return (ret.url=el);
}
if(value){
ret.value=value;
ret.postfix=el[el.length - 1];
}});
return ret;
});
temp.sort(function(a, b){
return a.value - b.value;
});
for (var j=0; j < temp.length; j++){
var el=temp[j];
if((el.postfix==="w"&&el.value >=windowWidth)||(el.postfix==="x"&&el.value >=pxRatio)){
found=el;
break;
}}
if(!found&&temp.length){
found=temp[temp.length - 1];
}
if(found){
slide.src=found.url;
if(slide.width&&slide.height&&found.postfix=="w"){
slide.height=slide.width / slide.height * found.value;
slide.width=found.value;
}
slide.opts.srcset=srcset;
}}
slide.$content=$('<div class="fancybox-content"></div>')
.addClass("fancybox-is-hidden")
.appendTo(slide.$slide.addClass("fancybox-slide--image"));
thumbSrc=slide.opts.thumb||(slide.opts.$thumb&&slide.opts.$thumb.length ? slide.opts.$thumb.attr("src"):false);
if(slide.opts.preload!==false&&slide.opts.width&&slide.opts.height&&thumbSrc){
slide.width=slide.opts.width;
slide.height=slide.opts.height;
slide.$ghost=$("<img />")
.one("error", function(){
$(this).remove();
slide.$ghost=null;
})
.one("load", function(){
self.afterLoad(slide);
})
.addClass("fancybox-image")
.appendTo(slide.$content)
.attr("src", thumbSrc);
}
self.setBigImage(slide);
},
setBigImage: function(slide){
var self=this,
$img=$("<img />");
slide.$image=$img
.one("error", function(){
self.setError(slide);
})
.one("load", function(){
var sizes;
if(!slide.$ghost){
self.resolveImageSlideSize(slide, this.naturalWidth, this.naturalHeight);
self.afterLoad(slide);
}
if(slide.timouts){
clearTimeout(slide.timouts);
slide.timouts=null;
}
if(self.isClosing){
return;
}
if(slide.opts.srcset){
sizes=slide.opts.sizes;
if(!sizes||sizes==="auto"){
sizes =
(slide.width / slide.height > 1&&$W.width() / $W.height() > 1 ? "100":Math.round(slide.width / slide.height * 100)) +
"vw";
}
$img.attr("sizes", sizes).attr("srcset", slide.opts.srcset);
}
if(slide.$ghost){
setTimeout(function(){
if(slide.$ghost&&!self.isClosing){
slide.$ghost.hide();
}}, Math.min(300, Math.max(1000, slide.height / 1600)));
}
self.hideLoading(slide);
})
.addClass("fancybox-image")
.attr("src", slide.src)
.appendTo(slide.$content);
if(($img[0].complete||$img[0].readyState=="complete")&&$img[0].naturalWidth&&$img[0].naturalHeight){
$img.trigger("load");
}else if($img[0].error){
$img.trigger("error");
}},
resolveImageSlideSize: function(slide, imgWidth, imgHeight){
var maxWidth=parseInt(slide.opts.width, 10),
maxHeight=parseInt(slide.opts.height, 10);
slide.width=imgWidth;
slide.height=imgHeight;
if(maxWidth > 0){
slide.width=maxWidth;
slide.height=Math.floor(maxWidth * imgHeight / imgWidth);
}
if(maxHeight > 0){
slide.width=Math.floor(maxHeight * imgWidth / imgHeight);
slide.height=maxHeight;
}},
setIframe: function(slide){
var self=this,
opts=slide.opts.iframe,
$slide=slide.$slide,
$iframe;
slide.$content=$('<div class="fancybox-content' + (opts.preload ? " fancybox-is-hidden":"") + '"></div>')
.css(opts.css)
.appendTo($slide);
$slide.addClass("fancybox-slide--" + slide.contentType);
slide.$iframe=$iframe=$(opts.tpl.replace(/\{rnd\}/g, new Date().getTime()))
.attr(opts.attr)
.appendTo(slide.$content);
if(opts.preload){
self.showLoading(slide);
$iframe.on("load.fb error.fb", function(e){
this.isReady=1;
slide.$slide.trigger("refresh");
self.afterLoad(slide);
});
$slide.on("refresh.fb", function(){
var $content=slide.$content,
frameWidth=opts.css.width,
frameHeight=opts.css.height,
$contents,
$body;
if($iframe[0].isReady!==1){
return;
}
try {
$contents=$iframe.contents();
$body=$contents.find("body");
} catch (ignore){}
if($body&&$body.length&&$body.children().length){
$content.css({
width: "",
height: ""
});
if(frameWidth===undefined){
frameWidth=Math.ceil(Math.max($body[0].clientWidth, $body.outerWidth(true)));
}
if(frameWidth){
$content.width(frameWidth);
}
if(frameHeight===undefined){
frameHeight=Math.ceil(Math.max($body[0].clientHeight, $body.outerHeight(true)));
}
if(frameHeight){
$content.height(frameHeight);
}}
$content.removeClass("fancybox-is-hidden");
});
}else{
this.afterLoad(slide);
}
$iframe.attr("src", slide.src);
$slide.one("onReset", function(){
try {
$(this)
.find("iframe")
.hide()
.unbind()
.attr("src", "//about:blank");
} catch (ignore){}
$(this)
.off("refresh.fb")
.empty();
slide.isLoaded=false;
});
},
setContent: function(slide, content){
var self=this;
if(self.isClosing){
return;
}
self.hideLoading(slide);
if(slide.$content){
$.fancybox.stop(slide.$content);
}
slide.$slide.empty();
if(isQuery(content)&&content.parent().length){
content
.parent()
.parent(".fancybox-slide--inline")
.trigger("onReset");
slide.$placeholder=$("<div>")
.hide()
.insertAfter(content);
content.css("display", "inline-block");
}else if(!slide.hasError){
if($.type(content)==="string"){
content=$("<div>")
.append($.trim(content))
.contents();
if(content[0].nodeType===3){
content=$("<div>").html(content);
}}
if(slide.opts.filter){
content=$("<div>")
.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("<div></div>");
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"){
$('<div class="fancybox-spaceball"></div>').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&&current.isComplete&&current.$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&&current.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&&current.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]&&current.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:
'<button data-fancybox-play class="fancybox-button fancybox-button--play" title="{{PLAY_START}}">' +
'<svg viewBox="0 0 40 40">' +
'<path d="M13,12 L27,20 L13,27 Z" />' +
'<path d="M15,10 v19 M23,10 v19" />' +
"</svg>" +
"</button>"
},
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&&current.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&&current.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:
'<button data-fancybox-fullscreen class="fancybox-button fancybox-button--fullscreen" title="{{FULL_SCREEN}}">' +
'<svg viewBox="0 0 40 40">' +
'<path d="M9,12 v16 h22 v-16 h-22 v8" />' +
"</svg>" +
"</button>"
},
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:
'<button data-fancybox-thumbs class="fancybox-button fancybox-button--thumbs" title="{{THUMBS}}">' +
'<svg viewBox="0 0 120 120">' +
'<path d="M30,30 h14 v14 h-14 Z M50,30 h14 v14 h-14 Z M70,30 h14 v14 h-14 Z M30,50 h14 v14 h-14 Z M50,50 h14 v14 h-14 Z M70,50 h14 v14 h-14 Z M30,70 h14 v14 h-14 Z M50,70 h14 v14 h-14 Z M70,70 h14 v14 h-14 Z" />' +
"</svg>" +
"</button>"
},
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=$('<div class="' + CLASS + " " + CLASS + "-" + self.opts.axis + '"></div>').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=$("<ul>").appendTo(self.$grid);
}
$.each(instance.group, function(i, item){
src=item.opts.thumb||(item.opts.$thumb ? item.opts.$thumb.attr("src"):null);
if(!src&&item.type==="image"){
src=item.src;
}
list.push('<li data-index="' +
i +
'" tabindex="0" class="' +
CLASS_LOAD +
'"' +
(src&&src.length ? ' style="background-image:url(' + src + ')" />':"") +
"></li>"
);
});
self.$list[0].innerHTML=list.join("");
if(self.opts.axis==="x"){
self.$list.width(parseInt(self.$grid.css("padding-right"), 10) +
instance.group.length *
self.$list
.children()
.eq(0)
.outerWidth(true)
);
}},
focus: function(duration){
var self=this,
$list=self.$list,
$grid=self.$grid,
thumb,
thumbPos;
if(!self.instance.current){
return;
}
thumb=$list
.children()
.removeClass(CLASS_ACTIVE)
.filter('[data-index="' + self.instance.current.index + '"]')
.addClass(CLASS_ACTIVE);
thumbPos=thumb.position();
if(self.opts.axis==="y"&&(thumbPos.top < 0||thumbPos.top > $list.height() - thumb.outerHeight())){
$list.stop().animate({
scrollTop: $list.scrollTop() + thumbPos.top
},
duration
);
}else if(self.opts.axis==="x" &&
(thumbPos.left < $grid.scrollLeft()||thumbPos.left > $grid.scrollLeft() + ($grid.width() - thumb.outerWidth()))
){
$list
.parent()
.stop()
.animate({
scrollLeft: thumbPos.left
},
duration
);
}},
update: function(){
var that=this;
that.instance.$refs.container.toggleClass("fancybox-show-thumbs", this.isVisible);
if(that.isVisible){
if(!that.$grid){
that.create();
}
that.instance.trigger("onThumbsShow");
that.focus(0);
}else if(that.$grid){
that.instance.trigger("onThumbsHide");
}
that.instance.update();
},
hide: function(){
this.isVisible=false;
this.update();
},
show: function(){
this.isVisible=true;
this.update();
},
toggle: function(){
this.isVisible = !this.isVisible;
this.update();
}});
$(document).on({
"onInit.fb": function(e, instance){
var Thumbs;
if(instance&&!instance.Thumbs){
Thumbs=new FancyThumbs(instance);
if(Thumbs.isActive&&Thumbs.opts.autoStart===true){
Thumbs.show();
}}
},
"beforeShow.fb": function(e, instance, item, firstRun){
var Thumbs=instance&&instance.Thumbs;
if(Thumbs&&Thumbs.isVisible){
Thumbs.focus(firstRun ? 0:250);
}},
"afterKeydown.fb": function(e, instance, current, keypress, keycode){
var Thumbs=instance&&instance.Thumbs;
if(Thumbs&&Thumbs.isActive&&keycode===71){
keypress.preventDefault();
Thumbs.toggle();
}},
"beforeClose.fb": function(e, instance){
var Thumbs=instance&&instance.Thumbs;
if(Thumbs&&Thumbs.isVisible&&Thumbs.opts.hideOnClose!==false){
Thumbs.$grid.hide();
}}
});
})(document, window.jQuery||jQuery);
(function(document, $){
"use strict";
$.extend(true, $.fancybox.defaults, {
btnTpl: {
share:
'<button data-fancybox-share class="fancybox-button fancybox-button--share" title="{{SHARE}}">' +
'<svg viewBox="0 0 40 40">' +
'<path d="M6,30 C8,18 19,16 23,16 L23,16 L23,10 L33,20 L23,29 L23,24 C19,24 8,27 6,30 Z">' +
"</svg>" +
"</button>"
},
share: {
url: function(instance, item){
return (
(!instance.currentHash&&!(item.type==="inline"||item.type==="html") ? item.origSrc||item.src:false)||window.location
);
},
tpl:
'<div class="fancybox-share">' +
"<h1>{{SHARE}}</h1>" +
"<p>" +
'<a class="fancybox-share__button fancybox-share__button--fb" href="https://www.facebook.com/sharer/sharer.php?u={{url}}">' +
'<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m287 456v-299c0-21 6-35 35-35h38v-63c-7-1-29-3-55-3-54 0-91 33-91 94v306m143-254h-205v72h196" /></svg>' +
"<span>Facebook</span>" +
"</a>" +
'<a class="fancybox-share__button fancybox-share__button--tw" href="https://twitter.com/intent/tweet?url={{url}}&text={{descr}}">' +
'<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m456 133c-14 7-31 11-47 13 17-10 30-27 37-46-15 10-34 16-52 20-61-62-157-7-141 75-68-3-129-35-169-85-22 37-11 86 26 109-13 0-26-4-37-9 0 39 28 72 65 80-12 3-25 4-37 2 10 33 41 57 77 57-42 30-77 38-122 34 170 111 378-32 359-208 16-11 30-25 41-42z" /></svg>' +
"<span>Twitter</span>" +
"</a>" +
'<a class="fancybox-share__button fancybox-share__button--pt" href="https://www.pinterest.com/pin/create/button/?url={{url}}&description={{descr}}&media={{media}}">' +
'<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m265 56c-109 0-164 78-164 144 0 39 15 74 47 87 5 2 10 0 12-5l4-19c2-6 1-8-3-13-9-11-15-25-15-45 0-58 43-110 113-110 62 0 96 38 96 88 0 67-30 122-73 122-24 0-42-19-36-44 6-29 20-60 20-81 0-19-10-35-31-35-25 0-44 26-44 60 0 21 7 36 7 36l-30 125c-8 37-1 83 0 87 0 3 4 4 5 2 2-3 32-39 42-75l16-64c8 16 31 29 56 29 74 0 124-67 124-157 0-69-58-132-146-132z" fill="#fff"/></svg>' +
"<span>Pinterest</span>" +
"</a>" +
"</p>" +
'<p><input class="fancybox-share__input" type="text" value="{{url_raw}}" /></p>' +
"</div>"
}});
function escapeHtml(string){
var entityMap={
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#39;",
"/": "&#x2F;",
"`": "&#x60;",
"=": "&#x3D;"
};
return String(string).replace(/[&<>"'`=\/]/g, function(s){
return entityMap[s];
});
}
$(document).on("click", "[data-fancybox-share]", function(){
var instance=$.fancybox.getInstance(),
current=instance.current||null,
url,
tpl;
if(!current){
return;
}
if($.type(current.opts.share.url)==="function"){
url=current.opts.share.url.apply(current, [instance, current]);
}
tpl=current.opts.share.tpl
.replace(/\{\{media\}\}/g, current.type==="image" ? encodeURIComponent(current.src):"")
.replace(/\{\{url\}\}/g, encodeURIComponent(url))
.replace(/\{\{url_raw\}\}/g, escapeHtml(url))
.replace(/\{\{descr\}\}/g, instance.$caption ? encodeURIComponent(instance.$caption.text()):"");
$.fancybox.open({
src: instance.translate(instance, tpl),
type: "html",
opts: {
animationEffect: false,
afterLoad: function(shareInstance, shareCurrent){
instance.$refs.container.one("beforeClose.fb", function(){
shareInstance.close(null, 0);
});
shareCurrent.$content.find(".fancybox-share__links a").click(function(){
window.open(this.href, "Share", "width=550, height=450");
return false;
});
}}
});
});
})(document, window.jQuery||jQuery);
(function(document, window, $){
"use strict";
if(!$.escapeSelector){
$.escapeSelector=function(sel){
var rcssescape=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
var fcssescape=function(ch, asCodePoint){
if(asCodePoint){
if(ch==="\0"){
return "\uFFFD";
}
return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
}
return "\\" + ch;
};
return (sel + "").replace(rcssescape, fcssescape);
};}
function parseUrl(){
var hash=window.location.hash.substr(1),
rez=hash.split("-"),
index=rez.length > 1&&/^\+?\d+$/.test(rez[rez.length - 1]) ? parseInt(rez.pop(-1), 10)||1:1,
gallery=rez.join("-");
return {
hash: hash,
index: index < 1 ? 1:index,
gallery: gallery
};}
function triggerFromUrl(url){
var $el;
if(url.gallery!==""){
$el=$("[data-fancybox='" + $.escapeSelector(url.gallery) + "']")
.eq(url.index - 1)
.trigger("click.fb-start");
}}
function getGalleryID(instance){
var opts, ret;
if(!instance){
return false;
}
opts=instance.current ? instance.current.opts:instance.opts;
ret=opts.hash||(opts.$orig ? opts.$orig.data("fancybox"):"");
return ret==="" ? false:ret;
}
$(function(){
if($.fancybox.defaults.hash===false){
return;
}
$(document).on({
"onInit.fb": function(e, instance){
var url, gallery;
if(instance.group[instance.currIndex].opts.hash===false){
return;
}
url=parseUrl();
gallery=getGalleryID(instance);
if(gallery&&url.gallery&&gallery==url.gallery){
instance.currIndex=url.index - 1;
}},
"beforeShow.fb": function(e, instance, current, firstRun){
var gallery;
if(!current||current.opts.hash===false){
return;
}
gallery=getGalleryID(instance);
if(!gallery){
return;
}
instance.currentHash=gallery + (instance.group.length > 1 ? "-" + (current.index + 1):"");
if(window.location.hash==="#" + instance.currentHash){
return;
}
if(!instance.origHash){
instance.origHash=window.location.hash;
}
if(instance.hashTimer){
clearTimeout(instance.hashTimer);
}
instance.hashTimer=setTimeout(function(){
if("replaceState" in window.history){
window.history[firstRun ? "pushState":"replaceState"](
{},
document.title,
window.location.pathname + window.location.search + "#" + instance.currentHash
);
if(firstRun){
instance.hasCreatedHistory=true;
}}else{
window.location.hash=instance.currentHash;
}
instance.hashTimer=null;
}, 300);
},
"beforeClose.fb": function(e, instance, current){
var gallery;
if(current.opts.hash===false){
return;
}
gallery=getGalleryID(instance);
if(instance.currentHash&&instance.hasCreatedHistory){
window.history.back();
}else if(instance.currentHash){
if("replaceState" in window.history){
window.history.replaceState({}, document.title, window.location.pathname + window.location.search + (instance.origHash||""));
}else{
window.location.hash=instance.origHash;
}}
instance.currentHash=null;
clearTimeout(instance.hashTimer);
}});
$(window).on("hashchange.fb", function(){
var url=parseUrl(),
fb;
$.each($(".fancybox-container")
.get()
.reverse(),
function(index, value){
var tmp=$(value).data("FancyBox");
if(tmp.currentHash){
fb=tmp;
return false;
}}
);
if(fb){
if(fb.currentHash&&fb.currentHash!==url.gallery + "-" + url.index&&!(url.index===1&&fb.currentHash==url.gallery)){
fb.currentHash=null;
fb.close();
}}else if(url.gallery!==""){
triggerFromUrl(url);
}});
setTimeout(function(){
if(!$.fancybox.getInstance()){
triggerFromUrl(parseUrl());
}}, 50);
});
})(document, window, window.jQuery||jQuery);
(function(document, $){
"use strict";
var prevTime=new Date().getTime();
$(document).on({
"onInit.fb": function(e, instance, current){
instance.$refs.stage.on("mousewheel DOMMouseScroll wheel MozMousePixelScroll", function(e){
var current=instance.current,
currTime=new Date().getTime();
if(instance.group.length < 2||current.opts.wheel===false||(current.opts.wheel==="auto"&&current.type!=="image")){
return;
}
e.preventDefault();
e.stopPropagation();
if(current.$slide.hasClass("fancybox-animated")){
return;
}
e=e.originalEvent||e;
if(currTime - prevTime < 250){
return;
}
prevTime=currTime;
instance[(-e.deltaY||-e.deltaX||e.wheelDelta||-e.detail) < 0 ? "next":"previous"]();
});
}});
})(document, window.jQuery||jQuery);
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('jquery-bridget/jquery-bridget',[ 'jquery' ], function(jQuery){
return factory(window, jQuery);
});
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
window,
require('jquery')
);
}else{
window.jQueryBridget=factory(
window,
window.jQuery
);
}}(window, function factory(window, jQuery){
'use strict';
var arraySlice=Array.prototype.slice;
var console=window.console;
var logError=typeof console=='undefined' ? function(){} :
function(message){
console.error(message);
};
function jQueryBridget(namespace, PluginClass, $){
$=$||jQuery||window.jQuery;
if(!$){
return;
}
if(!PluginClass.prototype.option){
PluginClass.prototype.option=function(opts){
if(!$.isPlainObject(opts) ){
return;
}
this.options=$.extend(true, this.options, opts);
};}
$.fn[ namespace ]=function(arg0 ){
if(typeof arg0=='string'){
var args=arraySlice.call(arguments, 1);
return methodCall(this, arg0, args);
}
plainCall(this, arg0);
return this;
};
function methodCall($elems, methodName, args){
var returnValue;
var pluginMethodStr='$().' + namespace + '("' + methodName + '")';
$elems.each(function(i, elem){
var instance=$.data(elem, namespace);
if(!instance){
logError(namespace + ' not initialized. Cannot call methods, i.e. ' +
pluginMethodStr);
return;
}
var method=instance[ methodName ];
if(!method||methodName.charAt(0)=='_'){
logError(pluginMethodStr + ' is not a valid method');
return;
}
var value=method.apply(instance, args);
returnValue=returnValue===undefined ? value:returnValue;
});
return returnValue!==undefined ? returnValue:$elems;
}
function plainCall($elems, options){
$elems.each(function(i, elem){
var instance=$.data(elem, namespace);
if(instance){
instance.option(options);
instance._init();
}else{
instance=new PluginClass(elem, options);
$.data(elem, namespace, instance);
}});
}
updateJQuery($);
}
function updateJQuery($){
if(!$||($&&$.bridget) ){
return;
}
$.bridget=jQueryBridget;
}
updateJQuery(jQuery||window.jQuery);
return jQueryBridget;
}));
(function(global, factory){
if(typeof define=='function'&&define.amd){
define('ev-emitter/ev-emitter',factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory();
}else{
global.EvEmitter=factory();
}}(typeof window!='undefined' ? window:this, function(){
function EvEmitter(){}
var proto=EvEmitter.prototype;
proto.on=function(eventName, listener){
if(!eventName||!listener){
return;
}
var events=this._events=this._events||{};
var listeners=events[ eventName ]=events[ eventName ]||[];
if(listeners.indexOf(listener)==-1){
listeners.push(listener);
}
return this;
};
proto.once=function(eventName, listener){
if(!eventName||!listener){
return;
}
this.on(eventName, listener);
var onceEvents=this._onceEvents=this._onceEvents||{};
var onceListeners=onceEvents[ eventName ]=onceEvents[ eventName ]||{};
onceListeners[ listener ]=true;
return this;
};
proto.off=function(eventName, listener){
var listeners=this._events&&this._events[ eventName ];
if(!listeners||!listeners.length){
return;
}
var index=listeners.indexOf(listener);
if(index!=-1){
listeners.splice(index, 1);
}
return this;
};
proto.emitEvent=function(eventName, args){
var listeners=this._events&&this._events[ eventName ];
if(!listeners||!listeners.length){
return;
}
listeners=listeners.slice(0);
args=args||[];
var onceListeners=this._onceEvents&&this._onceEvents[ eventName ];
for(var i=0; i < listeners.length; i++){
var listener=listeners[i]
var isOnce=onceListeners&&onceListeners[ listener ];
if(isOnce){
this.off(eventName, listener);
delete onceListeners[ listener ];
}
listener.apply(this, args);
}
return this;
};
proto.allOff=function(){
delete this._events;
delete this._onceEvents;
};
return EvEmitter;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('get-size/get-size',factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory();
}else{
window.getSize=factory();
}})(window, function factory(){
'use strict';
function getStyleSize(value){
var num=parseFloat(value);
var isValid=value.indexOf('%')==-1&&!isNaN(num);
return isValid&&num;
}
function noop(){}
var logError=typeof console=='undefined' ? noop :
function(message){
console.error(message);
};
var measurements=[
'paddingLeft',
'paddingRight',
'paddingTop',
'paddingBottom',
'marginLeft',
'marginRight',
'marginTop',
'marginBottom',
'borderLeftWidth',
'borderRightWidth',
'borderTopWidth',
'borderBottomWidth'
];
var measurementsLength=measurements.length;
function getZeroSize(){
var size={
width: 0,
height: 0,
innerWidth: 0,
innerHeight: 0,
outerWidth: 0,
outerHeight: 0
};
for(var i=0; i < measurementsLength; i++){
var measurement=measurements[i];
size[ measurement ]=0;
}
return size;
}
function getStyle(elem){
var style=getComputedStyle(elem);
if(!style){
logError('Style returned ' + style +
'. Are you running this code in a hidden iframe on Firefox? ' +
'See https://bit.ly/getsizebug1');
}
return style;
}
var isSetup=false;
var isBoxSizeOuter;
function setup(){
if(isSetup){
return;
}
isSetup=true;
var div=document.createElement('div');
div.style.width='200px';
div.style.padding='1px 2px 3px 4px';
div.style.borderStyle='solid';
div.style.borderWidth='1px 2px 3px 4px';
div.style.boxSizing='border-box';
var body=document.body||document.documentElement;
body.appendChild(div);
var style=getStyle(div);
isBoxSizeOuter=Math.round(getStyleSize(style.width) )==200;
getSize.isBoxSizeOuter=isBoxSizeOuter;
body.removeChild(div);
}
function getSize(elem){
setup();
if(typeof elem=='string'){
elem=document.querySelector(elem);
}
if(!elem||typeof elem!='object'||!elem.nodeType){
return;
}
var style=getStyle(elem);
if(style.display=='none'){
return getZeroSize();
}
var size={};
size.width=elem.offsetWidth;
size.height=elem.offsetHeight;
var isBorderBox=size.isBorderBox=style.boxSizing=='border-box';
for(var i=0; i < measurementsLength; i++){
var measurement=measurements[i];
var value=style[ measurement ];
var num=parseFloat(value);
size[ measurement ] = !isNaN(num) ? num:0;
}
var paddingWidth=size.paddingLeft + size.paddingRight;
var paddingHeight=size.paddingTop + size.paddingBottom;
var marginWidth=size.marginLeft + size.marginRight;
var marginHeight=size.marginTop + size.marginBottom;
var borderWidth=size.borderLeftWidth + size.borderRightWidth;
var borderHeight=size.borderTopWidth + size.borderBottomWidth;
var isBorderBoxSizeOuter=isBorderBox&&isBoxSizeOuter;
var styleWidth=getStyleSize(style.width);
if(styleWidth!==false){
size.width=styleWidth +
(isBorderBoxSizeOuter ? 0:paddingWidth + borderWidth);
}
var styleHeight=getStyleSize(style.height);
if(styleHeight!==false){
size.height=styleHeight +
(isBorderBoxSizeOuter ? 0:paddingHeight + borderHeight);
}
size.innerWidth=size.width -(paddingWidth + borderWidth);
size.innerHeight=size.height -(paddingHeight + borderHeight);
size.outerWidth=size.width + marginWidth;
size.outerHeight=size.height + marginHeight;
return size;
}
return getSize;
});
(function(window, factory){
'use strict';
if(typeof define=='function'&&define.amd){
define('desandro-matches-selector/matches-selector',factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory();
}else{
window.matchesSelector=factory();
}}(window, function factory(){
'use strict';
var matchesMethod=(function(){
var ElemProto=window.Element.prototype;
if(ElemProto.matches){
return 'matches';
}
if(ElemProto.matchesSelector){
return 'matchesSelector';
}
var prefixes=[ 'webkit', 'moz', 'ms', 'o' ];
for(var i=0; i < prefixes.length; i++){
var prefix=prefixes[i];
var method=prefix + 'MatchesSelector';
if(ElemProto[ method ]){
return method;
}}
})();
return function matchesSelector(elem, selector){
return elem[ matchesMethod ](selector);
};}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('fizzy-ui-utils/utils',[
'desandro-matches-selector/matches-selector'
], function(matchesSelector){
return factory(window, matchesSelector);
});
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
window,
require('desandro-matches-selector')
);
}else{
window.fizzyUIUtils=factory(
window,
window.matchesSelector
);
}}(window, function factory(window, matchesSelector){
var utils={};
utils.extend=function(a, b){
for(var prop in b){
a[ prop ]=b[ prop ];
}
return a;
};
utils.modulo=function(num, div){
return(( num % div) + div) % div;
};
var arraySlice=Array.prototype.slice;
utils.makeArray=function(obj){
if(Array.isArray(obj) ){
return obj;
}
if(obj===null||obj===undefined){
return [];
}
var isArrayLike=typeof obj=='object'&&typeof obj.length=='number';
if(isArrayLike){
return arraySlice.call(obj);
}
return [ obj ];
};
utils.removeFrom=function(ary, obj){
var index=ary.indexOf(obj);
if(index!=-1){
ary.splice(index, 1);
}};
utils.getParent=function(elem, selector){
while(elem.parentNode&&elem!=document.body){
elem=elem.parentNode;
if(matchesSelector(elem, selector) ){
return elem;
}}
};
utils.getQueryElement=function(elem){
if(typeof elem=='string'){
return document.querySelector(elem);
}
return elem;
};
utils.handleEvent=function(event){
var method='on' + event.type;
if(this[ method ]){
this[ method ](event);
}};
utils.filterFindElements=function(elems, selector){
elems=utils.makeArray(elems);
var ffElems=[];
elems.forEach(function(elem){
if(!(elem instanceof HTMLElement) ){
return;
}
if(!selector){
ffElems.push(elem);
return;
}
if(matchesSelector(elem, selector) ){
ffElems.push(elem);
}
var childElems=elem.querySelectorAll(selector);
for(var i=0; i < childElems.length; i++){
ffElems.push(childElems[i]);
}});
return ffElems;
};
utils.debounceMethod=function(_class, methodName, threshold){
threshold=threshold||100;
var method=_class.prototype[ methodName ];
var timeoutName=methodName + 'Timeout';
_class.prototype[ methodName ]=function(){
var timeout=this[ timeoutName ];
clearTimeout(timeout);
var args=arguments;
var _this=this;
this[ timeoutName ]=setTimeout(function(){
method.apply(_this, args);
delete _this[ timeoutName ];
}, threshold);
};};
utils.docReady=function(callback){
var readyState=document.readyState;
if(readyState=='complete'||readyState=='interactive'){
setTimeout(callback);
}else{
document.addEventListener('DOMContentLoaded', callback);
}};
utils.toDashed=function(str){
return str.replace(/(.)([A-Z])/g, function(match, $1, $2){
return $1 + '-' + $2;
}).toLowerCase();
};
var console=window.console;
utils.htmlInit=function(WidgetClass, namespace){
utils.docReady(function(){
var dashedNamespace=utils.toDashed(namespace);
var dataAttr='data-' + dashedNamespace;
var dataAttrElems=document.querySelectorAll('[' + dataAttr + ']');
var jsDashElems=document.querySelectorAll('.js-' + dashedNamespace);
var elems=utils.makeArray(dataAttrElems)
.concat(utils.makeArray(jsDashElems) );
var dataOptionsAttr=dataAttr + '-options';
var jQuery=window.jQuery;
elems.forEach(function(elem){
var attr=elem.getAttribute(dataAttr) ||
elem.getAttribute(dataOptionsAttr);
var options;
try {
options=attr&&JSON.parse(attr);
} catch(error){
if(console){
console.error('Error parsing ' + dataAttr + ' on ' + elem.className +
': ' + error);
}
return;
}
var instance=new WidgetClass(elem, options);
if(jQuery){
jQuery.data(elem, namespace, instance);
}});
});
};
return utils;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('outlayer/item',[
'ev-emitter/ev-emitter',
'get-size/get-size'
],
factory
);
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
require('ev-emitter'),
require('get-size')
);
}else{
window.Outlayer={};
window.Outlayer.Item=factory(
window.EvEmitter,
window.getSize
);
}}(window, function factory(EvEmitter, getSize){
'use strict';
function isEmptyObj(obj){
for(var prop in obj){
return false;
}
prop=null;
return true;
}
var docElemStyle=document.documentElement.style;
var transitionProperty=typeof docElemStyle.transition=='string' ?
'transition':'WebkitTransition';
var transformProperty=typeof docElemStyle.transform=='string' ?
'transform':'WebkitTransform';
var transitionEndEvent={
WebkitTransition: 'webkitTransitionEnd',
transition: 'transitionend'
}[ transitionProperty ];
var vendorProperties={
transform: transformProperty,
transition: transitionProperty,
transitionDuration: transitionProperty + 'Duration',
transitionProperty: transitionProperty + 'Property',
transitionDelay: transitionProperty + 'Delay'
};
function Item(element, layout){
if(!element){
return;
}
this.element=element;
this.layout=layout;
this.position={
x: 0,
y: 0
};
this._create();
}
var proto=Item.prototype=Object.create(EvEmitter.prototype);
proto.constructor=Item;
proto._create=function(){
this._transn={
ingProperties: {},
clean: {},
onEnd: {}};
this.css({
position: 'absolute'
});
};
proto.handleEvent=function(event){
var method='on' + event.type;
if(this[ method ]){
this[ method ](event);
}};
proto.getSize=function(){
this.size=getSize(this.element);
};
proto.css=function(style){
var elemStyle=this.element.style;
for(var prop in style){
var supportedProp=vendorProperties[ prop ]||prop;
elemStyle[ supportedProp ]=style[ prop ];
}};
proto.getPosition=function(){
var style=getComputedStyle(this.element);
var isOriginLeft=this.layout._getOption('originLeft');
var isOriginTop=this.layout._getOption('originTop');
var xValue=style[ isOriginLeft ? 'left':'right' ];
var yValue=style[ isOriginTop ? 'top':'bottom' ];
var x=parseFloat(xValue);
var y=parseFloat(yValue);
var layoutSize=this.layout.size;
if(xValue.indexOf('%')!=-1){
x=(x / 100) * layoutSize.width;
}
if(yValue.indexOf('%')!=-1){
y=(y / 100) * layoutSize.height;
}
x=isNaN(x) ? 0:x;
y=isNaN(y) ? 0:y;
x -=isOriginLeft ? layoutSize.paddingLeft:layoutSize.paddingRight;
y -=isOriginTop ? layoutSize.paddingTop:layoutSize.paddingBottom;
this.position.x=x;
this.position.y=y;
};
proto.layoutPosition=function(){
var layoutSize=this.layout.size;
var style={};
var isOriginLeft=this.layout._getOption('originLeft');
var isOriginTop=this.layout._getOption('originTop');
var xPadding=isOriginLeft ? 'paddingLeft':'paddingRight';
var xProperty=isOriginLeft ? 'left':'right';
var xResetProperty=isOriginLeft ? 'right':'left';
var x=this.position.x + layoutSize[ xPadding ];
style[ xProperty ]=this.getXValue(x);
style[ xResetProperty ]='';
var yPadding=isOriginTop ? 'paddingTop':'paddingBottom';
var yProperty=isOriginTop ? 'top':'bottom';
var yResetProperty=isOriginTop ? 'bottom':'top';
var y=this.position.y + layoutSize[ yPadding ];
style[ yProperty ]=this.getYValue(y);
style[ yResetProperty ]='';
this.css(style);
this.emitEvent('layout', [ this ]);
};
proto.getXValue=function(x){
var isHorizontal=this.layout._getOption('horizontal');
return this.layout.options.percentPosition&&!isHorizontal ?
(( x / this.layout.size.width) * 100) + '%':x + 'px';
};
proto.getYValue=function(y){
var isHorizontal=this.layout._getOption('horizontal');
return this.layout.options.percentPosition&&isHorizontal ?
(( y / this.layout.size.height) * 100) + '%':y + 'px';
};
proto._transitionTo=function(x, y){
this.getPosition();
var curX=this.position.x;
var curY=this.position.y;
var didNotMove=x==this.position.x&&y==this.position.y;
this.setPosition(x, y);
if(didNotMove&&!this.isTransitioning){
this.layoutPosition();
return;
}
var transX=x - curX;
var transY=y - curY;
var transitionStyle={};
transitionStyle.transform=this.getTranslate(transX, transY);
this.transition({
to: transitionStyle,
onTransitionEnd: {
transform: this.layoutPosition
},
isCleaning: true
});
};
proto.getTranslate=function(x, y){
var isOriginLeft=this.layout._getOption('originLeft');
var isOriginTop=this.layout._getOption('originTop');
x=isOriginLeft ? x:-x;
y=isOriginTop ? y:-y;
return 'translate3d(' + x + 'px, ' + y + 'px, 0)';
};
proto.goTo=function(x, y){
this.setPosition(x, y);
this.layoutPosition();
};
proto.moveTo=proto._transitionTo;
proto.setPosition=function(x, y){
this.position.x=parseFloat(x);
this.position.y=parseFloat(y);
};
proto._nonTransition=function(args){
this.css(args.to);
if(args.isCleaning){
this._removeStyles(args.to);
}
for(var prop in args.onTransitionEnd){
args.onTransitionEnd[ prop ].call(this);
}};
proto.transition=function(args){
if(!parseFloat(this.layout.options.transitionDuration) ){
this._nonTransition(args);
return;
}
var _transition=this._transn;
for(var prop in args.onTransitionEnd){
_transition.onEnd[ prop ]=args.onTransitionEnd[ prop ];
}
for(prop in args.to){
_transition.ingProperties[ prop ]=true;
if(args.isCleaning){
_transition.clean[ prop ]=true;
}}
if(args.from){
this.css(args.from);
var h=this.element.offsetHeight;
h=null;
}
this.enableTransition(args.to);
this.css(args.to);
this.isTransitioning=true;
};
function toDashedAll(str){
return str.replace(/([A-Z])/g, function($1){
return '-' + $1.toLowerCase();
});
}
var transitionProps='opacity,' + toDashedAll(transformProperty);
proto.enableTransition=function(){
if(this.isTransitioning){
return;
}
var duration=this.layout.options.transitionDuration;
duration=typeof duration=='number' ? duration + 'ms':duration;
this.css({
transitionProperty: transitionProps,
transitionDuration: duration,
transitionDelay: this.staggerDelay||0
});
this.element.addEventListener(transitionEndEvent, this, false);
};
proto.onwebkitTransitionEnd=function(event){
this.ontransitionend(event);
};
proto.onotransitionend=function(event){
this.ontransitionend(event);
};
var dashedVendorProperties={
'-webkit-transform': 'transform'
};
proto.ontransitionend=function(event){
if(event.target!==this.element){
return;
}
var _transition=this._transn;
var propertyName=dashedVendorProperties[ event.propertyName ]||event.propertyName;
delete _transition.ingProperties[ propertyName ];
if(isEmptyObj(_transition.ingProperties) ){
this.disableTransition();
}
if(propertyName in _transition.clean){
this.element.style[ event.propertyName ]='';
delete _transition.clean[ propertyName ];
}
if(propertyName in _transition.onEnd){
var onTransitionEnd=_transition.onEnd[ propertyName ];
onTransitionEnd.call(this);
delete _transition.onEnd[ propertyName ];
}
this.emitEvent('transitionEnd', [ this ]);
};
proto.disableTransition=function(){
this.removeTransitionStyles();
this.element.removeEventListener(transitionEndEvent, this, false);
this.isTransitioning=false;
};
proto._removeStyles=function(style){
var cleanStyle={};
for(var prop in style){
cleanStyle[ prop ]='';
}
this.css(cleanStyle);
};
var cleanTransitionStyle={
transitionProperty: '',
transitionDuration: '',
transitionDelay: ''
};
proto.removeTransitionStyles=function(){
this.css(cleanTransitionStyle);
};
proto.stagger=function(delay){
delay=isNaN(delay) ? 0:delay;
this.staggerDelay=delay + 'ms';
};
proto.removeElem=function(){
this.element.parentNode.removeChild(this.element);
this.css({ display: '' });
this.emitEvent('remove', [ this ]);
};
proto.remove=function(){
if(!transitionProperty||!parseFloat(this.layout.options.transitionDuration) ){
this.removeElem();
return;
}
this.once('transitionEnd', function(){
this.removeElem();
});
this.hide();
};
proto.reveal=function(){
delete this.isHidden;
this.css({ display: '' });
var options=this.layout.options;
var onTransitionEnd={};
var transitionEndProperty=this.getHideRevealTransitionEndProperty('visibleStyle');
onTransitionEnd[ transitionEndProperty ]=this.onRevealTransitionEnd;
this.transition({
from: options.hiddenStyle,
to: options.visibleStyle,
isCleaning: true,
onTransitionEnd: onTransitionEnd
});
};
proto.onRevealTransitionEnd=function(){
if(!this.isHidden){
this.emitEvent('reveal');
}};
proto.getHideRevealTransitionEndProperty=function(styleProperty){
var optionStyle=this.layout.options[ styleProperty ];
if(optionStyle.opacity){
return 'opacity';
}
for(var prop in optionStyle){
return prop;
}};
proto.hide=function(){
this.isHidden=true;
this.css({ display: '' });
var options=this.layout.options;
var onTransitionEnd={};
var transitionEndProperty=this.getHideRevealTransitionEndProperty('hiddenStyle');
onTransitionEnd[ transitionEndProperty ]=this.onHideTransitionEnd;
this.transition({
from: options.visibleStyle,
to: options.hiddenStyle,
isCleaning: true,
onTransitionEnd: onTransitionEnd
});
};
proto.onHideTransitionEnd=function(){
if(this.isHidden){
this.css({ display: 'none' });
this.emitEvent('hide');
}};
proto.destroy=function(){
this.css({
position: '',
left: '',
right: '',
top: '',
bottom: '',
transition: '',
transform: ''
});
};
return Item;
}));
(function(window, factory){
'use strict';
if(typeof define=='function'&&define.amd){
define('outlayer/outlayer',[
'ev-emitter/ev-emitter',
'get-size/get-size',
'fizzy-ui-utils/utils',
'./item'
],
function(EvEmitter, getSize, utils, Item){
return factory(window, EvEmitter, getSize, utils, Item);
}
);
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
window,
require('ev-emitter'),
require('get-size'),
require('fizzy-ui-utils'),
require('./item')
);
}else{
window.Outlayer=factory(
window,
window.EvEmitter,
window.getSize,
window.fizzyUIUtils,
window.Outlayer.Item
);
}}(window, function factory(window, EvEmitter, getSize, utils, Item){
'use strict';
var console=window.console;
var jQuery=window.jQuery;
var noop=function(){};
var GUID=0;
var instances={};
function Outlayer(element, options){
var queryElement=utils.getQueryElement(element);
if(!queryElement){
if(console){
console.error('Bad element for ' + this.constructor.namespace +
': ' +(queryElement||element) );
}
return;
}
this.element=queryElement;
if(jQuery){
this.$element=jQuery(this.element);
}
this.options=utils.extend({}, this.constructor.defaults);
this.option(options);
var id=++GUID;
this.element.outlayerGUID=id;
instances[ id ]=this;
this._create();
var isInitLayout=this._getOption('initLayout');
if(isInitLayout){
this.layout();
}}
Outlayer.namespace='outlayer';
Outlayer.Item=Item;
Outlayer.defaults={
containerStyle: {
position: 'relative'
},
initLayout: true,
originLeft: true,
originTop: true,
resize: true,
resizeContainer: true,
transitionDuration: '0.4s',
hiddenStyle: {
opacity: 0,
transform: 'scale(0.001)'
},
visibleStyle: {
opacity: 1,
transform: 'scale(1)'
}};
var proto=Outlayer.prototype;
utils.extend(proto, EvEmitter.prototype);
proto.option=function(opts){
utils.extend(this.options, opts);
};
proto._getOption=function(option){
var oldOption=this.constructor.compatOptions[ option ];
return oldOption&&this.options[ oldOption ]!==undefined ?
this.options[ oldOption ]:this.options[ option ];
};
Outlayer.compatOptions={
initLayout: 'isInitLayout',
horizontal: 'isHorizontal',
layoutInstant: 'isLayoutInstant',
originLeft: 'isOriginLeft',
originTop: 'isOriginTop',
resize: 'isResizeBound',
resizeContainer: 'isResizingContainer'
};
proto._create=function(){
this.reloadItems();
this.stamps=[];
this.stamp(this.options.stamp);
utils.extend(this.element.style, this.options.containerStyle);
var canBindResize=this._getOption('resize');
if(canBindResize){
this.bindResize();
}};
proto.reloadItems=function(){
this.items=this._itemize(this.element.children);
};
proto._itemize=function(elems){
var itemElems=this._filterFindItemElements(elems);
var Item=this.constructor.Item;
var items=[];
for(var i=0; i < itemElems.length; i++){
var elem=itemElems[i];
var item=new Item(elem, this);
items.push(item);
}
return items;
};
proto._filterFindItemElements=function(elems){
return utils.filterFindElements(elems, this.options.itemSelector);
};
proto.getItemElements=function(){
return this.items.map(function(item){
return item.element;
});
};
proto.layout=function(){
this._resetLayout();
this._manageStamps();
var layoutInstant=this._getOption('layoutInstant');
var isInstant=layoutInstant!==undefined ?
layoutInstant:!this._isLayoutInited;
this.layoutItems(this.items, isInstant);
this._isLayoutInited=true;
};
proto._init=proto.layout;
proto._resetLayout=function(){
this.getSize();
};
proto.getSize=function(){
this.size=getSize(this.element);
};
proto._getMeasurement=function(measurement, size){
var option=this.options[ measurement ];
var elem;
if(!option){
this[ measurement ]=0;
}else{
if(typeof option=='string'){
elem=this.element.querySelector(option);
}else if(option instanceof HTMLElement){
elem=option;
}
this[ measurement ]=elem ? getSize(elem)[ size ]:option;
}};
proto.layoutItems=function(items, isInstant){
items=this._getItemsForLayout(items);
this._layoutItems(items, isInstant);
this._postLayout();
};
proto._getItemsForLayout=function(items){
return items.filter(function(item){
return !item.isIgnored;
});
};
proto._layoutItems=function(items, isInstant){
this._emitCompleteOnItems('layout', items);
if(!items||!items.length){
return;
}
var queue=[];
items.forEach(function(item){
var position=this._getItemLayoutPosition(item);
position.item=item;
position.isInstant=isInstant||item.isLayoutInstant;
queue.push(position);
}, this);
this._processLayoutQueue(queue);
};
proto._getItemLayoutPosition=function(){
return {
x: 0,
y: 0
};};
proto._processLayoutQueue=function(queue){
this.updateStagger();
queue.forEach(function(obj, i){
this._positionItem(obj.item, obj.x, obj.y, obj.isInstant, i);
}, this);
};
proto.updateStagger=function(){
var stagger=this.options.stagger;
if(stagger===null||stagger===undefined){
this.stagger=0;
return;
}
this.stagger=getMilliseconds(stagger);
return this.stagger;
};
proto._positionItem=function(item, x, y, isInstant, i){
if(isInstant){
item.goTo(x, y);
}else{
item.stagger(i * this.stagger);
item.moveTo(x, y);
}};
proto._postLayout=function(){
this.resizeContainer();
};
proto.resizeContainer=function(){
var isResizingContainer=this._getOption('resizeContainer');
if(!isResizingContainer){
return;
}
var size=this._getContainerSize();
if(size){
this._setContainerMeasure(size.width, true);
this._setContainerMeasure(size.height, false);
}};
proto._getContainerSize=noop;
proto._setContainerMeasure=function(measure, isWidth){
if(measure===undefined){
return;
}
var elemSize=this.size;
if(elemSize.isBorderBox){
measure +=isWidth ? elemSize.paddingLeft + elemSize.paddingRight +
elemSize.borderLeftWidth + elemSize.borderRightWidth :
elemSize.paddingBottom + elemSize.paddingTop +
elemSize.borderTopWidth + elemSize.borderBottomWidth;
}
measure=Math.max(measure, 0);
this.element.style[ isWidth ? 'width':'height' ]=measure + 'px';
};
proto._emitCompleteOnItems=function(eventName, items){
var _this=this;
function onComplete(){
_this.dispatchEvent(eventName + 'Complete', null, [ items ]);
}
var count=items.length;
if(!items||!count){
onComplete();
return;
}
var doneCount=0;
function tick(){
doneCount++;
if(doneCount==count){
onComplete();
}}
items.forEach(function(item){
item.once(eventName, tick);
});
};
proto.dispatchEvent=function(type, event, args){
var emitArgs=event ? [ event ].concat(args):args;
this.emitEvent(type, emitArgs);
if(jQuery){
this.$element=this.$element||jQuery(this.element);
if(event){
var $event=jQuery.Event(event);
$event.type=type;
this.$element.trigger($event, args);
}else{
this.$element.trigger(type, args);
}}
};
proto.ignore=function(elem){
var item=this.getItem(elem);
if(item){
item.isIgnored=true;
}};
proto.unignore=function(elem){
var item=this.getItem(elem);
if(item){
delete item.isIgnored;
}};
proto.stamp=function(elems){
elems=this._find(elems);
if(!elems){
return;
}
this.stamps=this.stamps.concat(elems);
elems.forEach(this.ignore, this);
};
proto.unstamp=function(elems){
elems=this._find(elems);
if(!elems){
return;
}
elems.forEach(function(elem){
utils.removeFrom(this.stamps, elem);
this.unignore(elem);
}, this);
};
proto._find=function(elems){
if(!elems){
return;
}
if(typeof elems=='string'){
elems=this.element.querySelectorAll(elems);
}
elems=utils.makeArray(elems);
return elems;
};
proto._manageStamps=function(){
if(!this.stamps||!this.stamps.length){
return;
}
this._getBoundingRect();
this.stamps.forEach(this._manageStamp, this);
};
proto._getBoundingRect=function(){
var boundingRect=this.element.getBoundingClientRect();
var size=this.size;
this._boundingRect={
left: boundingRect.left + size.paddingLeft + size.borderLeftWidth,
top: boundingRect.top + size.paddingTop + size.borderTopWidth,
right: boundingRect.right -(size.paddingRight + size.borderRightWidth),
bottom: boundingRect.bottom -(size.paddingBottom + size.borderBottomWidth)
};};
proto._manageStamp=noop;
proto._getElementOffset=function(elem){
var boundingRect=elem.getBoundingClientRect();
var thisRect=this._boundingRect;
var size=getSize(elem);
var offset={
left: boundingRect.left - thisRect.left - size.marginLeft,
top: boundingRect.top - thisRect.top - size.marginTop,
right: thisRect.right - boundingRect.right - size.marginRight,
bottom: thisRect.bottom - boundingRect.bottom - size.marginBottom
};
return offset;
};
proto.handleEvent=utils.handleEvent;
proto.bindResize=function(){
window.addEventListener('resize', this);
this.isResizeBound=true;
};
proto.unbindResize=function(){
window.removeEventListener('resize', this);
this.isResizeBound=false;
};
proto.onresize=function(){
this.resize();
};
utils.debounceMethod(Outlayer, 'onresize', 100);
proto.resize=function(){
if(!this.isResizeBound||!this.needsResizeLayout()){
return;
}
this.layout();
};
proto.needsResizeLayout=function(){
var size=getSize(this.element);
var hasSizes=this.size&&size;
return hasSizes&&size.innerWidth!==this.size.innerWidth;
};
proto.addItems=function(elems){
var items=this._itemize(elems);
if(items.length){
this.items=this.items.concat(items);
}
return items;
};
proto.appended=function(elems){
var items=this.addItems(elems);
if(!items.length){
return;
}
this.layoutItems(items, true);
this.reveal(items);
};
proto.prepended=function(elems){
var items=this._itemize(elems);
if(!items.length){
return;
}
var previousItems=this.items.slice(0);
this.items=items.concat(previousItems);
this._resetLayout();
this._manageStamps();
this.layoutItems(items, true);
this.reveal(items);
this.layoutItems(previousItems);
};
proto.reveal=function(items){
this._emitCompleteOnItems('reveal', items);
if(!items||!items.length){
return;
}
var stagger=this.updateStagger();
items.forEach(function(item, i){
item.stagger(i * stagger);
item.reveal();
});
};
proto.hide=function(items){
this._emitCompleteOnItems('hide', items);
if(!items||!items.length){
return;
}
var stagger=this.updateStagger();
items.forEach(function(item, i){
item.stagger(i * stagger);
item.hide();
});
};
proto.revealItemElements=function(elems){
var items=this.getItems(elems);
this.reveal(items);
};
proto.hideItemElements=function(elems){
var items=this.getItems(elems);
this.hide(items);
};
proto.getItem=function(elem){
for(var i=0; i < this.items.length; i++){
var item=this.items[i];
if(item.element==elem){
return item;
}}
};
proto.getItems=function(elems){
elems=utils.makeArray(elems);
var items=[];
elems.forEach(function(elem){
var item=this.getItem(elem);
if(item){
items.push(item);
}}, this);
return items;
};
proto.remove=function(elems){
var removeItems=this.getItems(elems);
this._emitCompleteOnItems('remove', removeItems);
if(!removeItems||!removeItems.length){
return;
}
removeItems.forEach(function(item){
item.remove();
utils.removeFrom(this.items, item);
}, this);
};
proto.destroy=function(){
var style=this.element.style;
style.height='';
style.position='';
style.width='';
this.items.forEach(function(item){
item.destroy();
});
this.unbindResize();
var id=this.element.outlayerGUID;
delete instances[ id ];
delete this.element.outlayerGUID;
if(jQuery){
jQuery.removeData(this.element, this.constructor.namespace);
}};
Outlayer.data=function(elem){
elem=utils.getQueryElement(elem);
var id=elem&&elem.outlayerGUID;
return id&&instances[ id ];
};
Outlayer.create=function(namespace, options){
var Layout=subclass(Outlayer);
Layout.defaults=utils.extend({}, Outlayer.defaults);
utils.extend(Layout.defaults, options);
Layout.compatOptions=utils.extend({}, Outlayer.compatOptions);
Layout.namespace=namespace;
Layout.data=Outlayer.data;
Layout.Item=subclass(Item);
utils.htmlInit(Layout, namespace);
if(jQuery&&jQuery.bridget){
jQuery.bridget(namespace, Layout);
}
return Layout;
};
function subclass(Parent){
function SubClass(){
Parent.apply(this, arguments);
}
SubClass.prototype=Object.create(Parent.prototype);
SubClass.prototype.constructor=SubClass;
return SubClass;
}
var msUnits={
ms: 1,
s: 1000
};
function getMilliseconds(time){
if(typeof time=='number'){
return time;
}
var matches=time.match(/(^\d*\.?\d*)(\w*)/);
var num=matches&&matches[1];
var unit=matches&&matches[2];
if(!num.length){
return 0;
}
num=parseFloat(num);
var mult=msUnits[ unit ]||1;
return num * mult;
}
Outlayer.Item=Item;
return Outlayer;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('isotope-layout/js/item',[
'outlayer/outlayer'
],
factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
require('outlayer')
);
}else{
window.Isotope=window.Isotope||{};
window.Isotope.Item=factory(
window.Outlayer
);
}}(window, function factory(Outlayer){
'use strict';
function Item(){
Outlayer.Item.apply(this, arguments);
}
var proto=Item.prototype=Object.create(Outlayer.Item.prototype);
var _create=proto._create;
proto._create=function(){
this.id=this.layout.itemGUID++;
_create.call(this);
this.sortData={};};
proto.updateSortData=function(){
if(this.isIgnored){
return;
}
this.sortData.id=this.id;
this.sortData['original-order']=this.id;
this.sortData.random=Math.random();
var getSortData=this.layout.options.getSortData;
var sorters=this.layout._sorters;
for(var key in getSortData){
var sorter=sorters[ key ];
this.sortData[ key ]=sorter(this.element, this);
}};
var _destroy=proto.destroy;
proto.destroy=function(){
_destroy.apply(this, arguments);
this.css({
display: ''
});
};
return Item;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('isotope-layout/js/layout-mode',[
'get-size/get-size',
'outlayer/outlayer'
],
factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
require('get-size'),
require('outlayer')
);
}else{
window.Isotope=window.Isotope||{};
window.Isotope.LayoutMode=factory(
window.getSize,
window.Outlayer
);
}}(window, function factory(getSize, Outlayer){
'use strict';
function LayoutMode(isotope){
this.isotope=isotope;
if(isotope){
this.options=isotope.options[ this.namespace ];
this.element=isotope.element;
this.items=isotope.filteredItems;
this.size=isotope.size;
}}
var proto=LayoutMode.prototype;
var facadeMethods=[
'_resetLayout',
'_getItemLayoutPosition',
'_manageStamp',
'_getContainerSize',
'_getElementOffset',
'needsResizeLayout',
'_getOption'
];
facadeMethods.forEach(function(methodName){
proto[ methodName ]=function(){
return Outlayer.prototype[ methodName ].apply(this.isotope, arguments);
};});
proto.needsVerticalResizeLayout=function(){
var size=getSize(this.isotope.element);
var hasSizes=this.isotope.size&&size;
return hasSizes&&size.innerHeight!=this.isotope.size.innerHeight;
};
proto._getMeasurement=function(){
this.isotope._getMeasurement.apply(this, arguments);
};
proto.getColumnWidth=function(){
this.getSegmentSize('column', 'Width');
};
proto.getRowHeight=function(){
this.getSegmentSize('row', 'Height');
};
proto.getSegmentSize=function(segment, size){
var segmentName=segment + size;
var outerSize='outer' + size;
this._getMeasurement(segmentName, outerSize);
if(this[ segmentName ]){
return;
}
var firstItemSize=this.getFirstItemSize();
this[ segmentName ]=firstItemSize&&firstItemSize[ outerSize ] ||
this.isotope.size[ 'inner' + size ];
};
proto.getFirstItemSize=function(){
var firstItem=this.isotope.filteredItems[0];
return firstItem&&firstItem.element&&getSize(firstItem.element);
};
proto.layout=function(){
this.isotope.layout.apply(this.isotope, arguments);
};
proto.getSize=function(){
this.isotope.getSize();
this.size=this.isotope.size;
};
LayoutMode.modes={};
LayoutMode.create=function(namespace, options){
function Mode(){
LayoutMode.apply(this, arguments);
}
Mode.prototype=Object.create(proto);
Mode.prototype.constructor=Mode;
if(options){
Mode.options=options;
}
Mode.prototype.namespace=namespace;
LayoutMode.modes[ namespace ]=Mode;
return Mode;
};
return LayoutMode;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('masonry-layout/masonry',[
'outlayer/outlayer',
'get-size/get-size'
],
factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
require('outlayer'),
require('get-size')
);
}else{
window.Masonry=factory(
window.Outlayer,
window.getSize
);
}}(window, function factory(Outlayer, getSize){
var Masonry=Outlayer.create('masonry');
Masonry.compatOptions.fitWidth='isFitWidth';
var proto=Masonry.prototype;
proto._resetLayout=function(){
this.getSize();
this._getMeasurement('columnWidth', 'outerWidth');
this._getMeasurement('gutter', 'outerWidth');
this.measureColumns();
this.colYs=[];
for(var i=0; i < this.cols; i++){
this.colYs.push(0);
}
this.maxY=0;
this.horizontalColIndex=0;
};
proto.measureColumns=function(){
this.getContainerWidth();
if(!this.columnWidth){
var firstItem=this.items[0];
var firstItemElem=firstItem&&firstItem.element;
this.columnWidth=firstItemElem&&getSize(firstItemElem).outerWidth ||
this.containerWidth;
}
var columnWidth=this.columnWidth +=this.gutter;
var containerWidth=this.containerWidth + this.gutter;
var cols=containerWidth / columnWidth;
var excess=columnWidth - containerWidth % columnWidth;
var mathMethod=excess&&excess < 1 ? 'round':'floor';
cols=Math[ mathMethod ](cols);
this.cols=Math.max(cols, 1);
};
proto.getContainerWidth=function(){
var isFitWidth=this._getOption('fitWidth');
var container=isFitWidth ? this.element.parentNode:this.element;
var size=getSize(container);
this.containerWidth=size&&size.innerWidth;
};
proto._getItemLayoutPosition=function(item){
item.getSize();
var remainder=item.size.outerWidth % this.columnWidth;
var mathMethod=remainder&&remainder < 1 ? 'round':'ceil';
var colSpan=Math[ mathMethod ](item.size.outerWidth / this.columnWidth);
colSpan=Math.min(colSpan, this.cols);
var colPosMethod=this.options.horizontalOrder ?
'_getHorizontalColPosition':'_getTopColPosition';
var colPosition=this[ colPosMethod ](colSpan, item);
var position={
x: this.columnWidth * colPosition.col,
y: colPosition.y
};
var setHeight=colPosition.y + item.size.outerHeight;
var setMax=colSpan + colPosition.col;
for(var i=colPosition.col; i < setMax; i++){
this.colYs[i]=setHeight;
}
return position;
};
proto._getTopColPosition=function(colSpan){
var colGroup=this._getTopColGroup(colSpan);
var minimumY=Math.min.apply(Math, colGroup);
return {
col: colGroup.indexOf(minimumY),
y: minimumY,
};};
proto._getTopColGroup=function(colSpan){
if(colSpan < 2){
return this.colYs;
}
var colGroup=[];
var groupCount=this.cols + 1 - colSpan;
for(var i=0; i < groupCount; i++){
colGroup[i]=this._getColGroupY(i, colSpan);
}
return colGroup;
};
proto._getColGroupY=function(col, colSpan){
if(colSpan < 2){
return this.colYs[ col ];
}
var groupColYs=this.colYs.slice(col, col + colSpan);
return Math.max.apply(Math, groupColYs);
};
proto._getHorizontalColPosition=function(colSpan, item){
var col=this.horizontalColIndex % this.cols;
var isOver=colSpan > 1&&col + colSpan > this.cols;
col=isOver ? 0:col;
var hasSize=item.size.outerWidth&&item.size.outerHeight;
this.horizontalColIndex=hasSize ? col + colSpan:this.horizontalColIndex;
return {
col: col,
y: this._getColGroupY(col, colSpan),
};};
proto._manageStamp=function(stamp){
var stampSize=getSize(stamp);
var offset=this._getElementOffset(stamp);
var isOriginLeft=this._getOption('originLeft');
var firstX=isOriginLeft ? offset.left:offset.right;
var lastX=firstX + stampSize.outerWidth;
var firstCol=Math.floor(firstX / this.columnWidth);
firstCol=Math.max(0, firstCol);
var lastCol=Math.floor(lastX / this.columnWidth);
lastCol -=lastX % this.columnWidth ? 0:1;
lastCol=Math.min(this.cols - 1, lastCol);
var isOriginTop=this._getOption('originTop');
var stampMaxY=(isOriginTop ? offset.top:offset.bottom) +
stampSize.outerHeight;
for(var i=firstCol; i <=lastCol; i++){
this.colYs[i]=Math.max(stampMaxY, this.colYs[i]);
}};
proto._getContainerSize=function(){
this.maxY=Math.max.apply(Math, this.colYs);
var size={
height: this.maxY
};
if(this._getOption('fitWidth')){
size.width=this._getContainerFitWidth();
}
return size;
};
proto._getContainerFitWidth=function(){
var unusedCols=0;
var i=this.cols;
while(--i){
if(this.colYs[i]!==0){
break;
}
unusedCols++;
}
return(this.cols - unusedCols) * this.columnWidth - this.gutter;
};
proto.needsResizeLayout=function(){
var previousWidth=this.containerWidth;
this.getContainerWidth();
return previousWidth!=this.containerWidth;
};
return Masonry;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('isotope-layout/js/layout-modes/masonry',[
'../layout-mode',
'masonry-layout/masonry'
],
factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
require('../layout-mode'),
require('masonry-layout')
);
}else{
factory(
window.Isotope.LayoutMode,
window.Masonry
);
}}(window, function factory(LayoutMode, Masonry){
'use strict';
var MasonryMode=LayoutMode.create('masonry');
var proto=MasonryMode.prototype;
var keepModeMethods={
_getElementOffset: true,
layout: true,
_getMeasurement: true
};
for(var method in Masonry.prototype){
if(!keepModeMethods[ method ]){
proto[ method ]=Masonry.prototype[ method ];
}}
var measureColumns=proto.measureColumns;
proto.measureColumns=function(){
this.items=this.isotope.filteredItems;
measureColumns.call(this);
};
var _getOption=proto._getOption;
proto._getOption=function(option){
if(option=='fitWidth'){
return this.options.isFitWidth!==undefined ?
this.options.isFitWidth:this.options.fitWidth;
}
return _getOption.apply(this.isotope, arguments);
};
return MasonryMode;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('isotope-layout/js/layout-modes/fit-rows',[
'../layout-mode'
],
factory);
}else if(typeof exports=='object'){
module.exports=factory(
require('../layout-mode')
);
}else{
factory(
window.Isotope.LayoutMode
);
}}(window, function factory(LayoutMode){
'use strict';
var FitRows=LayoutMode.create('fitRows');
var proto=FitRows.prototype;
proto._resetLayout=function(){
this.x=0;
this.y=0;
this.maxY=0;
this._getMeasurement('gutter', 'outerWidth');
};
proto._getItemLayoutPosition=function(item){
item.getSize();
var itemWidth=item.size.outerWidth + this.gutter;
var containerWidth=this.isotope.size.innerWidth + this.gutter;
if(this.x!==0&&itemWidth + this.x > containerWidth){
this.x=0;
this.y=this.maxY;
}
var position={
x: this.x,
y: this.y
};
this.maxY=Math.max(this.maxY, this.y + item.size.outerHeight);
this.x +=itemWidth;
return position;
};
proto._getContainerSize=function(){
return { height: this.maxY };};
return FitRows;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('isotope-layout/js/layout-modes/vertical',[
'../layout-mode'
],
factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
require('../layout-mode')
);
}else{
factory(
window.Isotope.LayoutMode
);
}}(window, function factory(LayoutMode){
'use strict';
var Vertical=LayoutMode.create('vertical', {
horizontalAlignment: 0
});
var proto=Vertical.prototype;
proto._resetLayout=function(){
this.y=0;
};
proto._getItemLayoutPosition=function(item){
item.getSize();
var x=(this.isotope.size.innerWidth - item.size.outerWidth) *
this.options.horizontalAlignment;
var y=this.y;
this.y +=item.size.outerHeight;
return { x: x, y: y };};
proto._getContainerSize=function(){
return { height: this.y };};
return Vertical;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define([
'outlayer/outlayer',
'get-size/get-size',
'desandro-matches-selector/matches-selector',
'fizzy-ui-utils/utils',
'isotope-layout/js/item',
'isotope-layout/js/layout-mode',
'isotope-layout/js/layout-modes/masonry',
'isotope-layout/js/layout-modes/fit-rows',
'isotope-layout/js/layout-modes/vertical'
],
function(Outlayer, getSize, matchesSelector, utils, Item, LayoutMode){
return factory(window, Outlayer, getSize, matchesSelector, utils, Item, LayoutMode);
});
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
window,
require('outlayer'),
require('get-size'),
require('desandro-matches-selector'),
require('fizzy-ui-utils'),
require('isotope-layout/js/item'),
require('isotope-layout/js/layout-mode'),
require('isotope-layout/js/layout-modes/masonry'),
require('isotope-layout/js/layout-modes/fit-rows'),
require('isotope-layout/js/layout-modes/vertical')
);
}else{
window.Isotope=factory(
window,
window.Outlayer,
window.getSize,
window.matchesSelector,
window.fizzyUIUtils,
window.Isotope.Item,
window.Isotope.LayoutMode
);
}}(window, function factory(window, Outlayer, getSize, matchesSelector, utils,
Item, LayoutMode){
var jQuery=window.jQuery;
var trim=String.prototype.trim ?
function(str){
return str.trim();
} :
function(str){
return str.replace(/^\s+|\s+$/g, '');
};
var Isotope=Outlayer.create('isotope', {
layoutMode: 'masonry',
isJQueryFiltering: true,
sortAscending: true
});
Isotope.Item=Item;
Isotope.LayoutMode=LayoutMode;
var proto=Isotope.prototype;
proto._create=function(){
this.itemGUID=0;
this._sorters={};
this._getSorters();
Outlayer.prototype._create.call(this);
this.modes={};
this.filteredItems=this.items;
this.sortHistory=[ 'original-order' ];
for(var name in LayoutMode.modes){
this._initLayoutMode(name);
}};
proto.reloadItems=function(){
this.itemGUID=0;
Outlayer.prototype.reloadItems.call(this);
};
proto._itemize=function(){
var items=Outlayer.prototype._itemize.apply(this, arguments);
for(var i=0; i < items.length; i++){
var item=items[i];
item.id=this.itemGUID++;
}
this._updateItemsSortData(items);
return items;
};
proto._initLayoutMode=function(name){
var Mode=LayoutMode.modes[ name ];
var initialOpts=this.options[ name ]||{};
this.options[ name ]=Mode.options ?
utils.extend(Mode.options, initialOpts):initialOpts;
this.modes[ name ]=new Mode(this);
};
proto.layout=function(){
if(!this._isLayoutInited&&this._getOption('initLayout')){
this.arrange();
return;
}
this._layout();
};
proto._layout=function(){
var isInstant=this._getIsInstant();
this._resetLayout();
this._manageStamps();
this.layoutItems(this.filteredItems, isInstant);
this._isLayoutInited=true;
};
proto.arrange=function(opts){
this.option(opts);
this._getIsInstant();
var filtered=this._filter(this.items);
this.filteredItems=filtered.matches;
this._bindArrangeComplete();
if(this._isInstant){
this._noTransition(this._hideReveal, [ filtered ]);
}else{
this._hideReveal(filtered);
}
this._sort();
this._layout();
};
proto._init=proto.arrange;
proto._hideReveal=function(filtered){
this.reveal(filtered.needReveal);
this.hide(filtered.needHide);
};
proto._getIsInstant=function(){
var isLayoutInstant=this._getOption('layoutInstant');
var isInstant=isLayoutInstant!==undefined ? isLayoutInstant :
!this._isLayoutInited;
this._isInstant=isInstant;
return isInstant;
};
proto._bindArrangeComplete=function(){
var isLayoutComplete, isHideComplete, isRevealComplete;
var _this=this;
function arrangeParallelCallback(){
if(isLayoutComplete&&isHideComplete&&isRevealComplete){
_this.dispatchEvent('arrangeComplete', null, [ _this.filteredItems ]);
}}
this.once('layoutComplete', function(){
isLayoutComplete=true;
arrangeParallelCallback();
});
this.once('hideComplete', function(){
isHideComplete=true;
arrangeParallelCallback();
});
this.once('revealComplete', function(){
isRevealComplete=true;
arrangeParallelCallback();
});
};
proto._filter=function(items){
var filter=this.options.filter;
filter=filter||'*';
var matches=[];
var hiddenMatched=[];
var visibleUnmatched=[];
var test=this._getFilterTest(filter);
for(var i=0; i < items.length; i++){
var item=items[i];
if(item.isIgnored){
continue;
}
var isMatched=test(item);
if(isMatched){
matches.push(item);
}
if(isMatched&&item.isHidden){
hiddenMatched.push(item);
}else if(!isMatched&&!item.isHidden){
visibleUnmatched.push(item);
}}
return {
matches: matches,
needReveal: hiddenMatched,
needHide: visibleUnmatched
};};
proto._getFilterTest=function(filter){
if(jQuery&&this.options.isJQueryFiltering){
return function(item){
return jQuery(item.element).is(filter);
};}
if(typeof filter=='function'){
return function(item){
return filter(item.element);
};}
return function(item){
return matchesSelector(item.element, filter);
};};
proto.updateSortData=function(elems){
var items;
if(elems){
elems=utils.makeArray(elems);
items=this.getItems(elems);
}else{
items=this.items;
}
this._getSorters();
this._updateItemsSortData(items);
};
proto._getSorters=function(){
var getSortData=this.options.getSortData;
for(var key in getSortData){
var sorter=getSortData[ key ];
this._sorters[ key ]=mungeSorter(sorter);
}};
proto._updateItemsSortData=function(items){
var len=items&&items.length;
for(var i=0; len&&i < len; i++){
var item=items[i];
item.updateSortData();
}};
var mungeSorter=(function(){
function mungeSorter(sorter){
if(typeof sorter!='string'){
return sorter;
}
var args=trim(sorter).split(' ');
var query=args[0];
var attrMatch=query.match(/^\[(.+)\]$/);
var attr=attrMatch&&attrMatch[1];
var getValue=getValueGetter(attr, query);
var parser=Isotope.sortDataParsers[ args[1] ];
sorter=parser ? function(elem){
return elem&&parser(getValue(elem) );
} :
function(elem){
return elem&&getValue(elem);
};
return sorter;
}
function getValueGetter(attr, query){
if(attr){
return function getAttribute(elem){
return elem.getAttribute(attr);
};}
return function getChildText(elem){
var child=elem.querySelector(query);
return child&&child.textContent;
};}
return mungeSorter;
})();
Isotope.sortDataParsers={
'parseInt': function(val){
return parseInt(val, 10);
},
'parseFloat': function(val){
return parseFloat(val);
}};
proto._sort=function(){
if(!this.options.sortBy){
return;
}
var sortBys=utils.makeArray(this.options.sortBy);
if(!this._getIsSameSortBy(sortBys) ){
this.sortHistory=sortBys.concat(this.sortHistory);
}
var itemSorter=getItemSorter(this.sortHistory, this.options.sortAscending);
this.filteredItems.sort(itemSorter);
};
proto._getIsSameSortBy=function(sortBys){
for(var i=0; i < sortBys.length; i++){
if(sortBys[i]!=this.sortHistory[i]){
return false;
}}
return true;
};
function getItemSorter(sortBys, sortAsc){
return function sorter(itemA, itemB){
for(var i=0; i < sortBys.length; i++){
var sortBy=sortBys[i];
var a=itemA.sortData[ sortBy ];
var b=itemB.sortData[ sortBy ];
if(a > b||a < b){
var isAscending=sortAsc[ sortBy ]!==undefined ? sortAsc[ sortBy ]:sortAsc;
var direction=isAscending ? 1:-1;
return(a > b ? 1:-1) * direction;
}}
return 0;
};}
proto._mode=function(){
var layoutMode=this.options.layoutMode;
var mode=this.modes[ layoutMode ];
if(!mode){
throw new Error('No layout mode: ' + layoutMode);
}
mode.options=this.options[ layoutMode ];
return mode;
};
proto._resetLayout=function(){
Outlayer.prototype._resetLayout.call(this);
this._mode()._resetLayout();
};
proto._getItemLayoutPosition=function(item){
return this._mode()._getItemLayoutPosition(item);
};
proto._manageStamp=function(stamp){
this._mode()._manageStamp(stamp);
};
proto._getContainerSize=function(){
return this._mode()._getContainerSize();
};
proto.needsResizeLayout=function(){
return this._mode().needsResizeLayout();
};
proto.appended=function(elems){
var items=this.addItems(elems);
if(!items.length){
return;
}
var filteredItems=this._filterRevealAdded(items);
this.filteredItems=this.filteredItems.concat(filteredItems);
};
proto.prepended=function(elems){
var items=this._itemize(elems);
if(!items.length){
return;
}
this._resetLayout();
this._manageStamps();
var filteredItems=this._filterRevealAdded(items);
this.layoutItems(this.filteredItems);
this.filteredItems=filteredItems.concat(this.filteredItems);
this.items=items.concat(this.items);
};
proto._filterRevealAdded=function(items){
var filtered=this._filter(items);
this.hide(filtered.needHide);
this.reveal(filtered.matches);
this.layoutItems(filtered.matches, true);
return filtered.matches;
};
proto.insert=function(elems){
var items=this.addItems(elems);
if(!items.length){
return;
}
var i, item;
var len=items.length;
for(i=0; i < len; i++){
item=items[i];
this.element.appendChild(item.element);
}
var filteredInsertItems=this._filter(items).matches;
for(i=0; i < len; i++){
items[i].isLayoutInstant=true;
}
this.arrange();
for(i=0; i < len; i++){
delete items[i].isLayoutInstant;
}
this.reveal(filteredInsertItems);
};
var _remove=proto.remove;
proto.remove=function(elems){
elems=utils.makeArray(elems);
var removeItems=this.getItems(elems);
_remove.call(this, elems);
var len=removeItems&&removeItems.length;
for(var i=0; len&&i < len; i++){
var item=removeItems[i];
utils.removeFrom(this.filteredItems, item);
}};
proto.shuffle=function(){
for(var i=0; i < this.items.length; i++){
var item=this.items[i];
item.sortData.random=Math.random();
}
this.options.sortBy='random';
this._sort();
this._layout();
};
proto._noTransition=function(fn, args){
var transitionDuration=this.options.transitionDuration;
this.options.transitionDuration=0;
var returnValue=fn.apply(this, args);
this.options.transitionDuration=transitionDuration;
return returnValue;
};
proto.getFilteredItemElements=function(){
return this.filteredItems.map(function(item){
return item.element;
});
};
return Isotope;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('packery/js/rect',factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory();
}else{
window.Packery=window.Packery||{};
window.Packery.Rect=factory();
}}(window, function factory(){
function Rect(props){
for(var prop in Rect.defaults){
this[ prop ]=Rect.defaults[ prop ];
}
for(prop in props){
this[ prop ]=props[ prop ];
}}
Rect.defaults={
x: 0,
y: 0,
width: 0,
height: 0
};
var proto=Rect.prototype;
proto.contains=function(rect){
var otherWidth=rect.width||0;
var otherHeight=rect.height||0;
return this.x <=rect.x &&
this.y <=rect.y &&
this.x + this.width >=rect.x + otherWidth &&
this.y + this.height >=rect.y + otherHeight;
};
proto.overlaps=function(rect){
var thisRight=this.x + this.width;
var thisBottom=this.y + this.height;
var rectRight=rect.x + rect.width;
var rectBottom=rect.y + rect.height;
return this.x < rectRight &&
thisRight > rect.x &&
this.y < rectBottom &&
thisBottom > rect.y;
};
proto.getMaximalFreeRects=function(rect){
if(!this.overlaps(rect) ){
return false;
}
var freeRects=[];
var freeRect;
var thisRight=this.x + this.width;
var thisBottom=this.y + this.height;
var rectRight=rect.x + rect.width;
var rectBottom=rect.y + rect.height;
if(this.y < rect.y){
freeRect=new Rect({
x: this.x,
y: this.y,
width: this.width,
height: rect.y - this.y
});
freeRects.push(freeRect);
}
if(thisRight > rectRight){
freeRect=new Rect({
x: rectRight,
y: this.y,
width: thisRight - rectRight,
height: this.height
});
freeRects.push(freeRect);
}
if(thisBottom > rectBottom){
freeRect=new Rect({
x: this.x,
y: rectBottom,
width: this.width,
height: thisBottom - rectBottom
});
freeRects.push(freeRect);
}
if(this.x < rect.x){
freeRect=new Rect({
x: this.x,
y: this.y,
width: rect.x - this.x,
height: this.height
});
freeRects.push(freeRect);
}
return freeRects;
};
proto.canFit=function(rect){
return this.width >=rect.width&&this.height >=rect.height;
};
return Rect;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('packery/js/packer',[ './rect' ], factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
require('./rect')
);
}else{
var Packery=window.Packery=window.Packery||{};
Packery.Packer=factory(Packery.Rect);
}}(window, function factory(Rect){
function Packer(width, height, sortDirection){
this.width=width||0;
this.height=height||0;
this.sortDirection=sortDirection||'downwardLeftToRight';
this.reset();
}
var proto=Packer.prototype;
proto.reset=function(){
this.spaces=[];
var initialSpace=new Rect({
x: 0,
y: 0,
width: this.width,
height: this.height
});
this.spaces.push(initialSpace);
this.sorter=sorters[ this.sortDirection ]||sorters.downwardLeftToRight;
};
proto.pack=function(rect){
for(var i=0; i < this.spaces.length; i++){
var space=this.spaces[i];
if(space.canFit(rect) ){
this.placeInSpace(rect, space);
break;
}}
};
proto.columnPack=function(rect){
for(var i=0; i < this.spaces.length; i++){
var space=this.spaces[i];
var canFitInSpaceColumn=space.x <=rect.x &&
space.x + space.width >=rect.x + rect.width &&
space.height >=rect.height - 0.01;
if(canFitInSpaceColumn){
rect.y=space.y;
this.placed(rect);
break;
}}
};
proto.rowPack=function(rect){
for(var i=0; i < this.spaces.length; i++){
var space=this.spaces[i];
var canFitInSpaceRow=space.y <=rect.y &&
space.y + space.height >=rect.y + rect.height &&
space.width >=rect.width - 0.01;
if(canFitInSpaceRow){
rect.x=space.x;
this.placed(rect);
break;
}}
};
proto.placeInSpace=function(rect, space){
rect.x=space.x;
rect.y=space.y;
this.placed(rect);
};
proto.placed=function(rect){
var revisedSpaces=[];
for(var i=0; i < this.spaces.length; i++){
var space=this.spaces[i];
var newSpaces=space.getMaximalFreeRects(rect);
if(newSpaces){
revisedSpaces.push.apply(revisedSpaces, newSpaces);
}else{
revisedSpaces.push(space);
}}
this.spaces=revisedSpaces;
this.mergeSortSpaces();
};
proto.mergeSortSpaces=function(){
Packer.mergeRects(this.spaces);
this.spaces.sort(this.sorter);
};
proto.addSpace=function(rect){
this.spaces.push(rect);
this.mergeSortSpaces();
};
Packer.mergeRects=function(rects){
var i=0;
var rect=rects[i];
rectLoop:
while(rect){
var j=0;
var compareRect=rects[ i + j ];
while(compareRect){
if(compareRect==rect){
j++;
}else if(compareRect.contains(rect) ){
rects.splice(i, 1);
rect=rects[i];
continue rectLoop;
}else if(rect.contains(compareRect) ){
rects.splice(i + j, 1);
}else{
j++;
}
compareRect=rects[ i + j ];
}
i++;
rect=rects[i];
}
return rects;
};
var sorters={
downwardLeftToRight: function(a, b){
return a.y - b.y||a.x - b.x;
},
rightwardTopToBottom: function(a, b){
return a.x - b.x||a.y - b.y;
}};
return Packer;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('packery/js/item',[
'outlayer/outlayer',
'./rect'
],
factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
require('outlayer'),
require('./rect')
);
}else{
window.Packery.Item=factory(
window.Outlayer,
window.Packery.Rect
);
}}(window, function factory(Outlayer, Rect){
var docElemStyle=document.documentElement.style;
var transformProperty=typeof docElemStyle.transform=='string' ?
'transform':'WebkitTransform';
var Item=function PackeryItem(){
Outlayer.Item.apply(this, arguments);
};
var proto=Item.prototype=Object.create(Outlayer.Item.prototype);
var __create=proto._create;
proto._create=function(){
__create.call(this);
this.rect=new Rect();
};
var _moveTo=proto.moveTo;
proto.moveTo=function(x, y){
var dx=Math.abs(this.position.x - x);
var dy=Math.abs(this.position.y - y);
var canHackGoTo=this.layout.dragItemCount&&!this.isPlacing &&
!this.isTransitioning&&dx < 1&&dy < 1;
if(canHackGoTo){
this.goTo(x, y);
return;
}
_moveTo.apply(this, arguments);
};
proto.enablePlacing=function(){
this.removeTransitionStyles();
if(this.isTransitioning&&transformProperty){
this.element.style[ transformProperty ]='none';
}
this.isTransitioning=false;
this.getSize();
this.layout._setRectSize(this.element, this.rect);
this.isPlacing=true;
};
proto.disablePlacing=function(){
this.isPlacing=false;
};
proto.removeElem=function(){
this.element.parentNode.removeChild(this.element);
this.layout.packer.addSpace(this.rect);
this.emitEvent('remove', [ this ]);
};
proto.showDropPlaceholder=function(){
var dropPlaceholder=this.dropPlaceholder;
if(!dropPlaceholder){
dropPlaceholder=this.dropPlaceholder=document.createElement('div');
dropPlaceholder.className='packery-drop-placeholder';
dropPlaceholder.style.position='absolute';
}
dropPlaceholder.style.width=this.size.width + 'px';
dropPlaceholder.style.height=this.size.height + 'px';
this.positionDropPlaceholder();
this.layout.element.appendChild(dropPlaceholder);
};
proto.positionDropPlaceholder=function(){
this.dropPlaceholder.style[ transformProperty ]='translate(' +
this.rect.x + 'px, ' + this.rect.y + 'px)';
};
proto.hideDropPlaceholder=function(){
this.layout.element.removeChild(this.dropPlaceholder);
};
return Item;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('packery/js/packery',[
'get-size/get-size',
'outlayer/outlayer',
'./rect',
'./packer',
'./item'
],
factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
require('get-size'),
require('outlayer'),
require('./rect'),
require('./packer'),
require('./item')
);
}else{
window.Packery=factory(
window.getSize,
window.Outlayer,
window.Packery.Rect,
window.Packery.Packer,
window.Packery.Item
);
}}(window, function factory(getSize, Outlayer, Rect, Packer, Item){
Rect.prototype.canFit=function(rect){
return this.width >=rect.width - 1&&this.height >=rect.height - 1;
};
var Packery=Outlayer.create('packery');
Packery.Item=Item;
var proto=Packery.prototype;
proto._create=function(){
Outlayer.prototype._create.call(this);
this.packer=new Packer();
this.shiftPacker=new Packer();
this.isEnabled=true;
this.dragItemCount=0;
var _this=this;
this.handleDraggabilly={
dragStart: function(){
_this.itemDragStart(this.element);
},
dragMove: function(){
_this.itemDragMove(this.element, this.position.x, this.position.y);
},
dragEnd: function(){
_this.itemDragEnd(this.element);
}};
this.handleUIDraggable={
start: function handleUIDraggableStart(event, ui){
if(!ui){
return;
}
_this.itemDragStart(event.currentTarget);
},
drag: function handleUIDraggableDrag(event, ui){
if(!ui){
return;
}
_this.itemDragMove(event.currentTarget, ui.position.left, ui.position.top);
},
stop: function handleUIDraggableStop(event, ui){
if(!ui){
return;
}
_this.itemDragEnd(event.currentTarget);
}};};
proto._resetLayout=function(){
this.getSize();
this._getMeasurements();
var width, height, sortDirection;
if(this._getOption('horizontal')){
width=Infinity;
height=this.size.innerHeight + this.gutter;
sortDirection='rightwardTopToBottom';
}else{
width=this.size.innerWidth + this.gutter;
height=Infinity;
sortDirection='downwardLeftToRight';
}
this.packer.width=this.shiftPacker.width=width;
this.packer.height=this.shiftPacker.height=height;
this.packer.sortDirection=this.shiftPacker.sortDirection=sortDirection;
this.packer.reset();
this.maxY=0;
this.maxX=0;
};
proto._getMeasurements=function(){
this._getMeasurement('columnWidth', 'width');
this._getMeasurement('rowHeight', 'height');
this._getMeasurement('gutter', 'width');
};
proto._getItemLayoutPosition=function(item){
this._setRectSize(item.element, item.rect);
if(this.isShifting||this.dragItemCount > 0){
var packMethod=this._getPackMethod();
this.packer[ packMethod ](item.rect);
}else{
this.packer.pack(item.rect);
}
this._setMaxXY(item.rect);
return item.rect;
};
proto.shiftLayout=function(){
this.isShifting=true;
this.layout();
delete this.isShifting;
};
proto._getPackMethod=function(){
return this._getOption('horizontal') ? 'rowPack':'columnPack';
};
proto._setMaxXY=function(rect){
this.maxX=Math.max(rect.x + rect.width, this.maxX);
this.maxY=Math.max(rect.y + rect.height, this.maxY);
};
proto._setRectSize=function(elem, rect){
var size=getSize(elem);
var w=size.outerWidth;
var h=size.outerHeight;
if(w||h){
w=this._applyGridGutter(w, this.columnWidth);
h=this._applyGridGutter(h, this.rowHeight);
}
rect.width=Math.min(w, this.packer.width);
rect.height=Math.min(h, this.packer.height);
};
proto._applyGridGutter=function(measurement, gridSize){
if(!gridSize){
return measurement + this.gutter;
}
gridSize +=this.gutter;
var remainder=measurement % gridSize;
var mathMethod=remainder&&remainder < 1 ? 'round':'ceil';
measurement=Math[ mathMethod ](measurement / gridSize) * gridSize;
return measurement;
};
proto._getContainerSize=function(){
if(this._getOption('horizontal')){
return {
width: this.maxX - this.gutter
};}else{
return {
height: this.maxY - this.gutter
};}};
proto._manageStamp=function(elem){
var item=this.getItem(elem);
var rect;
if(item&&item.isPlacing){
rect=item.rect;
}else{
var offset=this._getElementOffset(elem);
rect=new Rect({
x: this._getOption('originLeft') ? offset.left:offset.right,
y: this._getOption('originTop') ? offset.top:offset.bottom
});
}
this._setRectSize(elem, rect);
this.packer.placed(rect);
this._setMaxXY(rect);
};
function verticalSorter(a, b){
return a.position.y - b.position.y||a.position.x - b.position.x;
}
function horizontalSorter(a, b){
return a.position.x - b.position.x||a.position.y - b.position.y;
}
proto.sortItemsByPosition=function(){
var sorter=this._getOption('horizontal') ? horizontalSorter:verticalSorter;
this.items.sort(sorter);
};
proto.fit=function(elem, x, y){
var item=this.getItem(elem);
if(!item){
return;
}
this.stamp(item.element);
item.enablePlacing();
this.updateShiftTargets(item);
x=x===undefined ? item.rect.x: x;
y=y===undefined ? item.rect.y: y;
this.shift(item, x, y);
this._bindFitEvents(item);
item.moveTo(item.rect.x, item.rect.y);
this.shiftLayout();
this.unstamp(item.element);
this.sortItemsByPosition();
item.disablePlacing();
};
proto._bindFitEvents=function(item){
var _this=this;
var ticks=0;
function onLayout(){
ticks++;
if(ticks!=2){
return;
}
_this.dispatchEvent('fitComplete', null, [ item ]);
}
item.once('layout', onLayout);
this.once('layoutComplete', onLayout);
};
proto.resize=function(){
if(!this.isResizeBound||!this.needsResizeLayout()){
return;
}
if(this.options.shiftPercentResize){
this.resizeShiftPercentLayout();
}else{
this.layout();
}};
proto.needsResizeLayout=function(){
var size=getSize(this.element);
var innerSize=this._getOption('horizontal') ? 'innerHeight':'innerWidth';
return size[ innerSize ]!=this.size[ innerSize ];
};
proto.resizeShiftPercentLayout=function(){
var items=this._getItemsForLayout(this.items);
var isHorizontal=this._getOption('horizontal');
var coord=isHorizontal ? 'y':'x';
var measure=isHorizontal ? 'height':'width';
var segmentName=isHorizontal ? 'rowHeight':'columnWidth';
var innerSize=isHorizontal ? 'innerHeight':'innerWidth';
var previousSegment=this[ segmentName ];
previousSegment=previousSegment&&previousSegment + this.gutter;
if(previousSegment){
this._getMeasurements();
var currentSegment=this[ segmentName ] + this.gutter;
items.forEach(function(item){
var seg=Math.round(item.rect[ coord ] / previousSegment);
item.rect[ coord ]=seg * currentSegment;
});
}else{
var currentSize=getSize(this.element)[ innerSize ] + this.gutter;
var previousSize=this.packer[ measure ];
items.forEach(function(item){
item.rect[ coord ]=(item.rect[ coord ] / previousSize) * currentSize;
});
}
this.shiftLayout();
};
proto.itemDragStart=function(elem){
if(!this.isEnabled){
return;
}
this.stamp(elem);
var item=this.getItem(elem);
if(!item){
return;
}
item.enablePlacing();
item.showDropPlaceholder();
this.dragItemCount++;
this.updateShiftTargets(item);
};
proto.updateShiftTargets=function(dropItem){
this.shiftPacker.reset();
this._getBoundingRect();
var isOriginLeft=this._getOption('originLeft');
var isOriginTop=this._getOption('originTop');
this.stamps.forEach(function(stamp){
var item=this.getItem(stamp);
if(item&&item.isPlacing){
return;
}
var offset=this._getElementOffset(stamp);
var rect=new Rect({
x: isOriginLeft ? offset.left:offset.right,
y: isOriginTop ? offset.top:offset.bottom
});
this._setRectSize(stamp, rect);
this.shiftPacker.placed(rect);
}, this);
var isHorizontal=this._getOption('horizontal');
var segmentName=isHorizontal ? 'rowHeight':'columnWidth';
var measure=isHorizontal ? 'height':'width';
this.shiftTargetKeys=[];
this.shiftTargets=[];
var boundsSize;
var segment=this[ segmentName ];
segment=segment&&segment + this.gutter;
if(segment){
var segmentSpan=Math.ceil(dropItem.rect[ measure ] / segment);
var segs=Math.floor(( this.shiftPacker[ measure ] + this.gutter) / segment);
boundsSize=(segs - segmentSpan) * segment;
for(var i=0; i < segs; i++){
this._addShiftTarget(i * segment, 0, boundsSize);
}}else{
boundsSize=(this.shiftPacker[ measure ] + this.gutter) - dropItem.rect[ measure ];
this._addShiftTarget(0, 0, boundsSize);
}
var items=this._getItemsForLayout(this.items);
var packMethod=this._getPackMethod();
items.forEach(function(item){
var rect=item.rect;
this._setRectSize(item.element, rect);
this.shiftPacker[ packMethod ](rect);
this._addShiftTarget(rect.x, rect.y, boundsSize);
var cornerX=isHorizontal ? rect.x + rect.width:rect.x;
var cornerY=isHorizontal ? rect.y:rect.y + rect.height;
this._addShiftTarget(cornerX, cornerY, boundsSize);
if(segment){
var segSpan=Math.round(rect[ measure ] / segment);
for(var i=1; i < segSpan; i++){
var segX=isHorizontal ? cornerX:rect.x + segment * i;
var segY=isHorizontal ? rect.y + segment * i:cornerY;
this._addShiftTarget(segX, segY, boundsSize);
}}
}, this);
};
proto._addShiftTarget=function(x, y, boundsSize){
var checkCoord=this._getOption('horizontal') ? y:x;
if(checkCoord!==0&&checkCoord > boundsSize){
return;
}
var key=x + ',' + y;
var hasKey=this.shiftTargetKeys.indexOf(key)!=-1;
if(hasKey){
return;
}
this.shiftTargetKeys.push(key);
this.shiftTargets.push({ x: x, y: y });
};
proto.shift=function(item, x, y){
var shiftPosition;
var minDistance=Infinity;
var position={ x: x, y: y };
this.shiftTargets.forEach(function(target){
var distance=getDistance(target, position);
if(distance < minDistance){
shiftPosition=target;
minDistance=distance;
}});
item.rect.x=shiftPosition.x;
item.rect.y=shiftPosition.y;
};
function getDistance(a, b){
var dx=b.x - a.x;
var dy=b.y - a.y;
return Math.sqrt(dx * dx + dy * dy);
}
var DRAG_THROTTLE_TIME=120;
proto.itemDragMove=function(elem, x, y){
var item=this.isEnabled&&this.getItem(elem);
if(!item){
return;
}
x -=this.size.paddingLeft;
y -=this.size.paddingTop;
var _this=this;
function onDrag(){
_this.shift(item, x, y);
item.positionDropPlaceholder();
_this.layout();
}
var now=new Date();
if(this._itemDragTime&&now - this._itemDragTime < DRAG_THROTTLE_TIME){
clearTimeout(this.dragTimeout);
this.dragTimeout=setTimeout(onDrag, DRAG_THROTTLE_TIME);
}else{
onDrag();
this._itemDragTime=now;
}};
proto.itemDragEnd=function(elem){
var item=this.isEnabled&&this.getItem(elem);
if(!item){
return;
}
clearTimeout(this.dragTimeout);
item.element.classList.add('is-positioning-post-drag');
var completeCount=0;
var _this=this;
function onDragEndLayoutComplete(){
completeCount++;
if(completeCount!=2){
return;
}
item.element.classList.remove('is-positioning-post-drag');
item.hideDropPlaceholder();
_this.dispatchEvent('dragItemPositioned', null, [ item ]);
}
item.once('layout', onDragEndLayoutComplete);
this.once('layoutComplete', onDragEndLayoutComplete);
item.moveTo(item.rect.x, item.rect.y);
this.layout();
this.dragItemCount=Math.max(0, this.dragItemCount - 1);
this.sortItemsByPosition();
item.disablePlacing();
this.unstamp(item.element);
};
proto.bindDraggabillyEvents=function(draggie){
this._bindDraggabillyEvents(draggie, 'on');
};
proto.unbindDraggabillyEvents=function(draggie){
this._bindDraggabillyEvents(draggie, 'off');
};
proto._bindDraggabillyEvents=function(draggie, method){
var handlers=this.handleDraggabilly;
draggie[ method ]('dragStart', handlers.dragStart);
draggie[ method ]('dragMove', handlers.dragMove);
draggie[ method ]('dragEnd', handlers.dragEnd);
};
proto.bindUIDraggableEvents=function($elems){
this._bindUIDraggableEvents($elems, 'on');
};
proto.unbindUIDraggableEvents=function($elems){
this._bindUIDraggableEvents($elems, 'off');
};
proto._bindUIDraggableEvents=function($elems, method){
var handlers=this.handleUIDraggable;
$elems
[ method ]('dragstart', handlers.start)
[ method ]('drag', handlers.drag)
[ method ]('dragstop', handlers.stop);
};
var _destroy=proto.destroy;
proto.destroy=function(){
_destroy.apply(this, arguments);
this.isEnabled=false;
};
Packery.Rect=Rect;
Packery.Packer=Packer;
return Packery;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define([
'isotope-layout/js/layout-mode',
'packery/js/packery'
],
factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
require('isotope-layout/js/layout-mode'),
require('packery')
);
}else{
factory(
window.Isotope.LayoutMode,
window.Packery
);
}}(window, function factor(LayoutMode, Packery){
var PackeryMode=LayoutMode.create('packery');
var proto=PackeryMode.prototype;
var keepModeMethods={
_getElementOffset: true,
_getMeasurement: true
};
for(var method in Packery.prototype){
if(!keepModeMethods[ method ]){
proto[ method ]=Packery.prototype[ method ];
}}
var _resetLayout=proto._resetLayout;
proto._resetLayout=function(){
this.packer=this.packer||new Packery.Packer();
this.shiftPacker=this.shiftPacker||new Packery.Packer();
_resetLayout.apply(this, arguments);
};
var _getItemLayoutPosition=proto._getItemLayoutPosition;
proto._getItemLayoutPosition=function(item){
item.rect=item.rect||new Packery.Rect();
return _getItemLayoutPosition.call(this, item);
};
var _needsResizeLayout=proto.needsResizeLayout;
proto.needsResizeLayout=function(){
if(this._getOption('horizontal')){
return this.needsVerticalResizeLayout();
}else{
return _needsResizeLayout.call(this);
}};
var _getOption=proto._getOption;
proto._getOption=function(option){
if(option=='horizontal'){
return this.options.isHorizontal!==undefined ?
this.options.isHorizontal:this.options.horizontal;
}
return _getOption.apply(this.isotope, arguments);
};
return PackeryMode;
}));
!function(t,e){"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,(function(){function t(){}let e=t.prototype;return e.on=function(t,e){if(!t||!e)return this;let i=this._events=this._events||{},s=i[t]=i[t]||[];return s.includes(e)||s.push(e),this},e.once=function(t,e){if(!t||!e)return this;this.on(t,e);let i=this._onceEvents=this._onceEvents||{};return(i[t]=i[t]||{})[e]=!0,this},e.off=function(t,e){let i=this._events&&this._events[t];if(!i||!i.length)return this;let s=i.indexOf(e);return-1!=s&&i.splice(s,1),this},e.emitEvent=function(t,e){let i=this._events&&this._events[t];if(!i||!i.length)return this;i=i.slice(0),e=e||[];let s=this._onceEvents&&this._onceEvents[t];for(let n of i){s&&s[n]&&(this.off(t,n),delete s[n]),n.apply(this,e)}return this},e.allOff=function(){return delete this._events,delete this._onceEvents,this},t})),
function(t,e){"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter")):t.imagesLoaded=e(t,t.EvEmitter)}("undefined"!=typeof window?window:this,(function(t,e){let i=t.jQuery,s=t.console;function n(t,e,o){if(!(this instanceof n))return new n(t,e,o);let r=t;var h;("string"==typeof t&&(r=document.querySelectorAll(t)),r)?(this.elements=(h=r,Array.isArray(h)?h:"object"==typeof h&&"number"==typeof h.length?[...h]:[h]),this.options={},"function"==typeof e?o=e:Object.assign(this.options,e),o&&this.on("always",o),this.getImages(),i&&(this.jqDeferred=new i.Deferred),setTimeout(this.check.bind(this))):s.error(`Bad element for imagesLoaded ${r||t}`)}n.prototype=Object.create(e.prototype),n.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)};const o=[1,9,11];n.prototype.addElementImages=function(t){"IMG"===t.nodeName&&this.addImage(t),!0===this.options.background&&this.addElementBackgroundImages(t);let{nodeType:e}=t;if(!e||!o.includes(e))return;let i=t.querySelectorAll("img");for(let t of i)this.addImage(t);if("string"==typeof this.options.background){let e=t.querySelectorAll(this.options.background);for(let t of e)this.addElementBackgroundImages(t)}};const r=/url\((['"])?(.*?)\1\)/gi;function h(t){this.img=t}function d(t,e){this.url=t,this.element=e,this.img=new Image}return n.prototype.addElementBackgroundImages=function(t){let e=getComputedStyle(t);if(!e)return;let i=r.exec(e.backgroundImage);for(;null!==i;){let s=i&&i[2];s&&this.addBackground(s,t),i=r.exec(e.backgroundImage)}},n.prototype.addImage=function(t){let e=new h(t);this.images.push(e)},n.prototype.addBackground=function(t,e){let i=new d(t,e);this.images.push(i)},n.prototype.check=function(){if(this.progressedCount=0,this.hasAnyBroken=!1,!this.images.length)return void this.complete();let t=(t,e,i)=>{setTimeout((()=>{this.progress(t,e,i)}))};this.images.forEach((function(e){e.once("progress",t),e.check()}))},n.prototype.progress=function(t,e,i){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!t.isLoaded,this.emitEvent("progress",[this,t,e]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,t),this.progressedCount===this.images.length&&this.complete(),this.options.debug&&s&&s.log(`progress: ${i}`,t,e)},n.prototype.complete=function(){let t=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(t,[this]),this.emitEvent("always",[this]),this.jqDeferred){let t=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[t](this)}},h.prototype=Object.create(e.prototype),h.prototype.check=function(){this.getIsImageComplete()?this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.img.crossOrigin&&(this.proxyImage.crossOrigin=this.img.crossOrigin),this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.proxyImage.src=this.img.currentSrc||this.img.src)},h.prototype.getIsImageComplete=function(){return this.img.complete&&this.img.naturalWidth},h.prototype.confirm=function(t,e){this.isLoaded=t;let{parentNode:i}=this.img,s="PICTURE"===i.nodeName?i:this.img;this.emitEvent("progress",[this,s,e])},h.prototype.handleEvent=function(t){let e="on"+t.type;this[e]&&this[e](t)},h.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},h.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},h.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},d.prototype=Object.create(h.prototype),d.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url,this.getIsImageComplete()&&(this.confirm(0!==this.img.naturalWidth,"naturalWidth"),this.unbindEvents())},d.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},d.prototype.confirm=function(t,e){this.isLoaded=t,this.emitEvent("progress",[this,this.element,e])},n.makeJQueryPlugin=function(e){(e=e||t.jQuery)&&(i=e,i.fn.imagesLoaded=function(t,e){return new n(this,t,e).jqDeferred.promise(i(this))})},n.makeJQueryPlugin(),n}));
jQuery(document).ready(function($){
"use strict";
var waitForFinalEvent=(function (){
var timers={};
return function (callback, ms, uniqueId){
if(!uniqueId){
uniqueId="Don't call this twice without a uniqueId";
}
if(timers[uniqueId]){
clearTimeout (timers[uniqueId]);
}
timers[uniqueId]=setTimeout(callback, ms);
};})();
adjustTaglineLocation();
function adjustTaglineLocation(){
if($('#root-container').hasClass('logo-right') ){
if(checkModernizr()){
if(Modernizr.mq('(max-width: 1100px)')){
$('.logo-tagline-wrapper').append($('.tagline') );
}else{
$('.logo-tagline-wrapper').prepend($('.tagline') );
}}
}}
adjustMenuLocation();
function adjustMenuLocation(){
if(! $('#root-container').hasClass('logo-center') ){
if(checkModernizr()){
if(Modernizr.mq('(max-width: 1100px)')){
$('.site-menu').css({
marginTop: '',
opacity: 1,
});
}else{
$('.site-menu').css({
marginTop: $('.logo-tagline-wrapper').height() - $('.site-menu').height(),
opacity: 1,
});
}}
}}
if($('script[src*="customize-preview"]').length > 0){
window.setInterval(function(){
adjustMenuLocation();
}, 3000);
}
setPortfolioCategoryMenuLocation();
function setPortfolioCategoryMenuLocation(){
var $mainContainer=$('#main-container');
var $categoryContainer=$('.portfolio-category-wrapper');
if(Modernizr.mq('(min-width: 1101px)')){
if($categoryContainer.hasClass('fixed-position') ){
$categoryContainer.css({
top: $mainContainer.offset().top + getIntValueFromCSSAttribute($mainContainer.css('padding-top') ),
left: $mainContainer.offset().left + $mainContainer.outerWidth() -(getIntValueFromCSSAttribute($('.inner-portfolio-list').css('margin-right') ) * -2),
padding: 0.046 * $mainContainer.outerWidth(),
width: 0.172 * $mainContainer.outerWidth(),
}).animate({
opacity: 1,
}, 200);
}else{
$categoryContainer.css({
right:($('#root-container').outerWidth() - $mainContainer.outerWidth() - 15) * -1,
top: getIntValueFromCSSAttribute($mainContainer.css('padding-top') ),
}).animate({
opacity: 1,
}, 200);
}}else{
$categoryContainer.css({
padding: '',
width: '',
});
}}
var countItems=$('.portfolio-item, .portfolio-format-item').length;
var $portfolioList;
$('.inner-portfolio-list, .image-format-group').imagesLoaded()
.always(function(instance){
initPortfolioLayout();
})
.progress(function(instance, image){
if(image.isLoaded){
$(image.img).closest('.portfolio-item, .portfolio-format-item').addClass('loaded');
var countLoadedImages=$('.portfolio-item.loaded, .portfolio-format-item.loaded').length;
var width=100 *(countLoadedImages / countItems);
$('.progress-bar').css({
'width':width + '%',
});
}});
function initPortfolioLayout(){
$('.portfolio-loading-wrapper').animate({
opacity: 0,
}, function(){
$('body').css('overflow', 'auto');
$('#main-container').css('height', 'auto');
$('.page-template-template-portfolio .post-item').css('display', 'block').animate({
opacity:1,
});
var itemSelectorValue='.portfolio-item';
if($('.image-format-group').length > 0){
itemSelectorValue='.image-wrapper';
}
if(jQuery().isotope){
$portfolioList=$('.inner-portfolio-list, .image-format-group').isotope({
itemSelector: itemSelectorValue,
layoutMode: 'packery',
percentPosition: true,
packery: {
columnWidth: '.grid-sizer',
},
});
$portfolioList.on('layoutComplete', function(event, laidOutItems){
$('.portfolio-item, .portfolio-format-item').each(function(index){
displayItems($(this), $('.portfolio-item').length, index);
});
showHidePortfolioCategoryMenu();
$('.inner-portfolio-list, .image-format-group').stop().animate({
opacity: 1,
});
}).isotope();
waitForFinalEvent(function(){
$portfolioList.isotope('layout');
}, 500, 'portfolio_relayout');
}
$('.portfolio-loading-wrapper').css('display', 'none');
$('.portfolio-format-item.video-format').css('visibility', 'visible').animate({
opacity:1,
});
});
}
function showHidePortfolioCategoryMenu(){
if(Modernizr.mq('(min-width: 1101px)')){
var $categoryContainer=$('.portfolio-category-wrapper');
var $footerContainer=$('.footer-container');
if($categoryContainer.length > 0&&$footerContainer.length > 0){
var categoryFromTopViewport=$categoryContainer.offset().top - $(window).scrollTop() + $categoryContainer.outerHeight() + 300;
var footerFromTopViewport=$footerContainer.offset().top - $(window).scrollTop();
if(categoryFromTopViewport >=footerFromTopViewport){
if(! $categoryContainer.hasClass('js-hidden') ){
$categoryContainer.stop().animate({
opacity: 0,
}, 200).addClass('js-hidden');
}}else{
$categoryContainer.stop().animate({
opacity: 1,
}).removeClass('js-hidden');
}}
}}
$(window).on('scroll', function(){
showHidePortfolioCategoryMenu();
});
var $blogList;
initBlogLayout();
function initBlogLayout(){
$('.blog-list, .search-result-list').imagesLoaded(function(){
if(jQuery().isotope){
$blogList=$('.blog-list, .search-result-list').isotope({
itemSelector: '.post-item',
layoutMode: 'packery',
percentPosition: true,
packery: {
horizontalOrder: true,
},
});
$blogList.on('layoutComplete', function(event, laidOutItems){
$('.post-item').each(function(index){
displayItems($(this), $('.post-item').length, index);
});
$('.blog-list, .search-result-list').stop().animate({
opacity: 1,
});
}).isotope();
waitForFinalEvent(function(){
$blogList.isotope('layout');
}, 500, 'blog_relayout');
}});
}
function displayItems($item, total, index){
var finalMultiplier=index;
var displayMode='sequential';
if('random'===displayMode){
finalMultiplier=randomizeNumberFromRange(0, total);
}
$item.css('visibility', 'visible').delay(50 * finalMultiplier).animate({
opacity:1,
}, 100, function(){
$item.addClass('visible');
});
}
$('.post-image').imagesLoaded(function(){
$('.post-image').each(function(index){
var $postImage=$(this);
$postImage.find('img').css('visibility', 'visible').delay(90 * index).animate({
opacity:1,
}, 300, function(){
$(this).addClass('visible');
});
});
});
if($('.next-prev-post-navigation').is(':empty') ){
$('.next-prev-post-navigation').css('display', 'none');
}else{
$('.next-prev-post-navigation a').addClass('content-style hover-style');
}
adjustAlignfullElements();
function adjustAlignfullElements(){
if(Modernizr.mq('(max-width: 1360px)')){
var $contentContainer=$('#content-container');
var contentWidth=$('.content-width').width();
var marginValue=(( $contentContainer.width() - contentWidth) / 2) / contentWidth * -100;
$('.alignfull').css({
marginLeft: marginValue + '%',
marginRight: marginValue + '%',
maxWidth: $contentContainer.width(),
opacity: 1,
});
}else{
$('.alignfull').css({
marginLeft: '',
marginRight: '',
maxWidth: '',
opacity: 1,
});
}}
if(jQuery().superfish){
$('.menu-list').superfish({
popUpSelector: '.sub-menu, .children',
animation: {
opacity: 'show',
},
speed: 300,
speedOut: 400,
delay: 500	
});
}
if(jQuery().slicknav){
$('.menu-list').slicknav({
allowParentLinks: true,
});
$('.site-menu').prepend($('.slicknav_menu') );
}
showSearchButton();
function showSearchButton(){
var showSearchButton=ThemeOptions.show_search_button,
$searchButton=$('.search-button-wrapper');
if(''!==showSearchButton&&'0'!==showSearchButton){
if(checkModernizr()){
if(Modernizr.mq('(max-width: 767px)')){
$('.slicknav_btn').after($searchButton);
}else{
$('.site-menu').append($searchButton);
}}
}
$('.site-menu').css('opacity', 1);
}
$('#search-panel-wrapper .search-field').attr('placeholder', ThemeOptions.modal_search_input_text);
var isSearchOpened=false;
$('.search-button, .search-icon-button').on('click', function(){
$('#search-panel-wrapper').css('display', 'block').stop().animate({
opacity: 1,
}, 300, function(){
$('#search-panel-wrapper .search-field').focus();
isSearchOpened=true;
});
});
$('#search-close-button').on('click', function(){
closeSearchPanel();
});
$(document).on('keyup', function(e){
if(27===e.keyCode){
closeSearchPanel();
}});
function closeSearchPanel(){
if(isSearchOpened){
$('#search-panel-wrapper').stop().animate({
opacity: 0,
}, 300, function(){
$(this).css('display', 'none');
isSearchOpened=false;
});
}}
var enableLightbox=ThemeOptions.enable_lightbox_wp_gallery;
if('0'===enableLightbox||''===enableLightbox){
enableLightbox=false;
}else{
enableLightbox=true;
}
if(enableLightbox){
registerFancyBoxToWPGallery($('.gallery'), '.gallery-item');
registerFancyBoxToWPGallery($('.wp-block-gallery'), '.blocks-gallery-item');
registerFancyBoxToWPImage();
}
function registerFancyBoxToWPGallery($gallery, itemSelector){
var $wpGallery=$gallery;
$wpGallery.each(function(){
var mainId=randomizeNumberFromRange(10000, 90000);
var items=$(this).find(itemSelector).find('a');
items.each(function(){
var href=$(this).attr('href');
if(href.toLowerCase().indexOf('.jpg') >=0||href.toLowerCase().indexOf('.jpeg') >=0||href.toLowerCase().indexOf('.png') >=0||href.toLowerCase().indexOf('.gif') >=0){
$(this).addClass('image-lightbox');
$(this).attr('data-fancybox', mainId);
}});
});
}
function registerFancyBoxToWPImage(){
$('img[class*="wp-image-"]').each(function(){
var $parentAnchor=$(this).closest('a');
if($parentAnchor.length > 0){
var href=$parentAnchor.attr('href');
if(href.toLowerCase().indexOf('.jpg') >=0||href.toLowerCase().indexOf('.jpeg') >=0||href.toLowerCase().indexOf('.png') >=0||href.toLowerCase().indexOf('.gif') >=0){
$parentAnchor.addClass('image-lightbox no-slideshow');
}}
});
}
callFancyBoxScript();
function callFancyBoxScript(){
if(jQuery().fancybox){
$('.image-lightbox').fancybox({
buttons: [
'zoom',
'slideShow',
'fullScreen',
'thumbs',
'close',
],
caption:function(instance, item){
return getImageCaptionText($(this) );
},
afterLoad: function(instance, current){
var pixelRatio=window.devicePixelRatio||1;
if(pixelRatio > 1.5){
current.width=current.width  / pixelRatio;
current.height=current.height / pixelRatio;
}},
lang: 'en',
i18n: {
en: {
CLOSE: ThemeOptions.lightbox_close_text,
NEXT: ThemeOptions.lightbox_next_text,
PREV: ThemeOptions.lightbox_prev_text,
ERROR: ThemeOptions.lightbox_error_text,
PLAY_START: ThemeOptions.lightbox_start_slide_text,
PLAY_STOP: ThemeOptions.lightbox_pause_slide_text,
FULL_SCREEN: ThemeOptions.lightbox_fullscreen_text,
THUMBS: ThemeOptions.lightbox_thumbnails_text,
DOWNLOAD: ThemeOptions.lightbox_download_text,
SHARE: ThemeOptions.lightbox_share_text,
ZOOM: ThemeOptions.lightbox_zoom_text,
},
},
});
}}
function getImageCaptionText($element){
if($element.closest('.gallery-item').length > 0){
return $element.closest('.gallery-item').find('.wp-caption-text').html();
}else if($element.closest('.blocks-gallery-item').length > 0){
return $element .closest('.blocks-gallery-item').find('figcaption').html();
}else if($element.closest('.image-wrapper').length > 0){
return $element.closest('.image-wrapper').find('.image-caption').html();
}else{
return $element.closest('.wp-caption').find('.wp-caption-text').html();
}}
var $wpImages=$('img[class*="wp-image-"], img[class*="attachment-"], .widget-item img');
if($wpImages.closest('a').length > 0){
$wpImages.closest('a').addClass('no-border');
}
function randomizeNumberFromRange(min, max){
return Math.floor(Math.random() *(max - min + 1) + min);
}
function checkModernizr(){
if('undefined'!==typeof Modernizr){
return true;
}else{
return false;
}}
function getIntValueFromCSSAttribute($attr){
return parseInt($attr.replace('px', ''), 10);
}
var windowWidth=$(window).width();
var timeoutId=0;
function doneResizing(){
if('undefined'!==typeof $portfolioList){
$portfolioList.isotope('layout');
}
if('undefined'!==typeof $blogList){
$blogList.isotope('layout');
}}
$(window).on('resize', function(){
if($(window).width()!=windowWidth){
windowWidth=$(window).width();
adjustTaglineLocation();
adjustMenuLocation();
setPortfolioCategoryMenuLocation();
adjustAlignfullElements();
showSearchButton();
clearTimeout(timeoutId);
timeoutId=setTimeout(doneResizing, 300);
}});
});
(()=>{"use strict";var e={};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();const t="email",n="phone",r="name",l={[t]:["email","e-mail","mail","email address"],[n]:["phone","tel","mobile","cell","telephone","phone number"],[r]:["name","full-name","full name","full_name","fullname","first-name","first name","first_name","firstname","last-name","last name","last_name","lastname","given-name","given name","given_name","givenname","family-name","family name","family_name","familyname","fname","lname","first","last","your-name","your name"]};function a(e){return e&&"string"==typeof e?e.trim().toLowerCase():""}function i(e){const t=a(e),n=t.lastIndexOf("@");if(-1===n)return t;const r=t.slice(n+1);return["gmail.com","googlemail.com"].includes(r)?`${t.slice(0,n).replace(/\./g,"")}@${r}`:t}function u(e){const t=a(e),n=t.replace(/\D/g,"");return t.startsWith("+")?`+${n}`:n}function s(e){const t=e.filter(e=>{let{type:t}=e;return t===r}).map(e=>{let{value:t}=e;return a(t)}).filter(Boolean);if(!t.length)return;const[n,...l]=1===t.length?t[0].split(" "):t;return{first_name:n,...l?.length>0?{last_name:l.join(" ")}:{}}}function o(e){return e.find(e=>{let{type:n}=e;return n===t})?.value}function c(e){return e.find(e=>{let{type:t}=e;return t===n})?.value}e.g.document.addEventListener("wpcf7mailsent",m=>{const f=e.g._googlesitekit?.gtagUserData,g=f?function(e){if(!(e&&e instanceof HTMLFormElement))return;const m=new FormData(e);return function(e){const t=[["address",s(e)],["email",o(e)],["phone_number",c(e)]].filter(e=>{let[,t]=e;return t});if(0!==t.length)return Object.fromEntries(t)}(Array.from(m.entries()).map(s=>{let[o,c]=s;const m=e.querySelector(`[name='${o}']`),f=m?.type;return"hidden"===f||"submit"===f?null:function(e){let{type:s,name:o,value:c,label:m}=e||{};switch(s=a(s),o=a(o),c=a(c),m=function(e){return e&&"string"==typeof e?e.trim().toLowerCase().replace(/\s*\*+\s*$/,"").replace(/\s*\(required\)\s*$/i,"").replace(/\s*:\s*$/,"").trim():""}(m),s){case"email":return{type:t,value:i(c)};case"tel":return{type:n,value:u(c)}}return function(e){if(!e)return!1;const t=i(e);return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)}(c)||l[t].includes(o)||l[t].includes(m)?{type:t,value:i(c)}:l[n].includes(o)||l[n].includes(m)?{type:n,value:u(c)}:l[r].includes(o)||l[r].includes(m)?{type:r,value:a(c)}:function(e){if(!e)return!1;if(!function(e){const t=e.replace(/\D/g,"");return!(t.length<7||t.length<e.length/2)&&/^[\s\-()+.\d]*$/.test(e)}(e))return!1;const t=u(e);if(!/^\+?\d{7,}$/.test(t))return!1;const n=/[\s\-()+.]/.test(e),r=e.trim().startsWith("+");return!(!n&&!r)}(c)?{type:n,value:u(c)}:null}({type:f,label:m?.id?e.querySelector(`label[for='${m?.id}']`)?.textContent:void 0,name:o,value:c})}).filter(Boolean))}(m.target):null;e.g._googlesitekit?.gtagEvent?.("contact",{event_category:m.detail.contactFormId,event_label:m.detail.unitTag,...g?{user_data:g}:{}})})})();