'use strict';
/**
* Copyright Marc J. Schmidt. See the LICENSE file at the top-level
* directory of this distribution and at
* https://github.com/marcj/css-element-queries/blob/master/LICENSE.
*/
(function (root, factory) {
if (typeof define === "function" && define.amd) {
define(factory);
} else if (typeof exports === "object") {
module.exports = factory();
} else {
root.ResizeSensor = factory();
}
}(typeof window !== 'undefined' ? window : this, function () {
// Make sure it does not throw in a SSR (Server Side Rendering) situation
if (typeof window === "undefined") {
return null;
}
// Only used for the dirty checking, so the event callback count is limited to max 1 call per fps per sensor.
// In combination with the event based resize sensor this saves cpu time, because the sensor is too fast and
// would generate too many unnecessary events.
var requestAnimationFrame = window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
function (fn) {
return window.setTimeout(fn, 20);
};
/**
* Iterate over each of the provided element(s).
*
* @param {HTMLElement|HTMLElement[]} elements
* @param {Function} callback
*/
function forEachElement(elements, callback){
var elementsType = Object.prototype.toString.call(elements);
var isCollectionTyped = ('[object Array]' === elementsType
|| ('[object NodeList]' === elementsType)
|| ('[object HTMLCollection]' === elementsType)
|| ('[object Object]' === elementsType)
|| ('undefined' !== typeof jQuery && elements instanceof jQuery) //jquery
|| ('undefined' !== typeof Elements && elements instanceof Elements) //mootools
);
var i = 0, j = elements.length;
if (isCollectionTyped) {
for (; i < j; i++) {
callback(elements[i]);
}
} else {
callback(elements);
}
}
/**
* Get element size
* @param {HTMLElement} element
* @returns {Object} {width, height}
*/
function getElementSize(element) {
if (!element.getBoundingClientRect) {
return {
width: element.offsetWidth,
height: element.offsetHeight
}
}
var rect = element.getBoundingClientRect();
return {
width: Math.round(rect.width),
height: Math.round(rect.height)
}
}
/**
* Class for dimension change detection.
*
* @param {Element|Element[]|Elements|jQuery} element
* @param {Function} callback
*
* @constructor
*/
var ResizeSensor = function(element, callback) {
/**
*
* @constructor
*/
function EventQueue() {
var q = [];
this.add = function(ev) {
q.push(ev);
};
var i, j;
this.call = function() {
for (i = 0, j = q.length; i < j; i++) {
q[i].call();
}
};
this.remove = function(ev) {
var newQueue = [];
for(i = 0, j = q.length; i < j; i++) {
if(q[i] !== ev) newQueue.push(q[i]);
}
q = newQueue;
};
this.length = function() {
return q.length;
}
}
/**
*
* @param {HTMLElement} element
* @param {Function} resized
*/
function attachResizeEvent(element, resized) {
if (!element) return;
if (element.resizedAttached) {
element.resizedAttached.add(resized);
return;
}
element.resizedAttached = new EventQueue();
element.resizedAttached.add(resized);
element.resizeSensor = document.createElement('div');
element.resizeSensor.dir = 'ltr';
element.resizeSensor.className = 'resize-sensor';
var style = 'position: absolute; left: -10px; top: -10px; right: 0; bottom: 0; overflow: hidden; z-index: -1; visibility: hidden;';
var styleChild = 'position: absolute; left: 0; top: 0; transition: 0s;';
element.resizeSensor.style.cssText = style;
element.resizeSensor.innerHTML =
'
' +
'' +
'
' +
'
' +
'' +
'
';
element.appendChild(element.resizeSensor);
var position = window.getComputedStyle(element).getPropertyPriority('position');
if ('absolute' !== position && 'relative' !== position && 'fixed' !== position) {
element.style.position = 'relative';
}
var expand = element.resizeSensor.childNodes[0];
var expandChild = expand.childNodes[0];
var shrink = element.resizeSensor.childNodes[1];
var dirty, rafId, newWidth, newHeight;
var size = getElementSize(element);
var lastWidth = size.width;
var lastHeight = size.height;
var reset = function() {
//set display to block, necessary otherwise hidden elements won't ever work
var invisible = element.offsetWidth === 0 && element.offsetHeight === 0;
if (invisible) {
var saveDisplay = element.style.display;
element.style.display = 'block';
}
expandChild.style.width = '100000px';
expandChild.style.height = '100000px';
expand.scrollLeft = 100000;
expand.scrollTop = 100000;
shrink.scrollLeft = 100000;
shrink.scrollTop = 100000;
if (invisible) {
element.style.display = saveDisplay;
}
};
element.resizeSensor.resetSensor = reset;
var onResized = function() {
rafId = 0;
if (!dirty) return;
lastWidth = newWidth;
lastHeight = newHeight;
if (element.resizedAttached) {
element.resizedAttached.call();
}
};
var onScroll = function() {
var size = getElementSize(element);
var newWidth = size.width;
var newHeight = size.height;
dirty = newWidth != lastWidth || newHeight != lastHeight;
if (dirty && !rafId) {
rafId = requestAnimationFrame(onResized);
}
reset();
};
var addEvent = function(el, name, cb) {
if (el.attachEvent) {
el.attachEvent('on' + name, cb);
} else {
el.addEventListener(name, cb);
}
};
addEvent(expand, 'scroll', onScroll);
addEvent(shrink, 'scroll', onScroll);
// Fix for custom Elements
requestAnimationFrame(reset);
}
forEachElement(element, function(elem){
attachResizeEvent(elem, callback);
});
this.detach = function(ev) {
ResizeSensor.detach(element, ev);
};
this.reset = function() {
element.resizeSensor.resetSensor();
};
};
ResizeSensor.reset = function(element, ev) {
forEachElement(element, function(elem){
elem.resizeSensor.resetSensor();
});
};
ResizeSensor.detach = function(element, ev) {
forEachElement(element, function(elem){
if (!elem) return;
if(elem.resizedAttached && typeof ev === "function"){
elem.resizedAttached.remove(ev);
if(elem.resizedAttached.length()) return;
}
if (elem.resizeSensor) {
if (elem.contains(elem.resizeSensor)) {
elem.removeChild(elem.resizeSensor);
}
delete elem.resizeSensor;
delete elem.resizedAttached;
}
});
};
return ResizeSensor;
}));
(function($) {
'use strict';
if (!$.isEmptyObject(window.MK)) {return}
var MK = window.MK || {};
window.MK = MK;
MK.utils = window.MK.utils || {};
/**
* Gets user browser and its version
* @return {Object} => {name, version}
*/
MK.utils.browser = (function() {
var dataBrowser = [
{string: navigator.userAgent, subString: "Edge", identity: "Edge"},
{string: navigator.userAgent, subString: "Chrome", identity: "Chrome"},
{string: navigator.userAgent, subString: "MSIE", identity: "IE"},
{string: navigator.userAgent, subString: "Trident", identity: "IE"},
{string: navigator.userAgent, subString: "Firefox", identity: "Firefox"},
{string: navigator.userAgent, subString: "Safari", identity: "Safari"},
{string: navigator.userAgent, subString: "Opera", identity: "Opera"}
];
var versionSearchString = null;
var searchString = function (data) {
for (var i = 0; i < data.length; i++) {
var dataString = data[i].string;
versionSearchString = data[i].subString;
if (dataString.indexOf(data[i].subString) !== -1) {
return data[i].identity;
}
}
};
var searchVersion = function (dataString) {
var index = dataString.indexOf(versionSearchString);
if (index === -1) {
return;
}
var rv = dataString.indexOf("rv:");
if (versionSearchString === "Trident" && rv !== -1) {
return parseFloat(dataString.substring(rv + 3));
} else {
return parseFloat(dataString.substring(index + versionSearchString.length + 1));
}
};
var name = searchString(dataBrowser) || "Other";
var version = searchVersion(navigator.userAgent) || searchVersion(navigator.appVersion) || "Unknown";
// Expose for css
$('html').addClass(name).addClass(name + version);
return {
name : name,
version : version
};
})();
/**
* Gets user operating system
* @return {String}
*/
MK.utils.OS = (function() {
if (navigator.appVersion.indexOf("Win")!=-1) return "Windows";
if (navigator.appVersion.indexOf("Mac")!=-1) return "OSX";
if (navigator.appVersion.indexOf("X11")!=-1) return "UNIX";
if (navigator.appVersion.indexOf("Linux")!=-1) return "Linux";
})();
/**
* Check if mobile device.
* @return {Boolean}
*/
MK.utils.isMobile = function() {
// Problems with bigger tablets as users raport differences with behaviour. Switch to navigator sniffing
// return ('ontouchstart' in document.documentElement) && matchMedia( '(max-width: 1024px)' ).matches;
// http://www.abeautifulsite.net/detecting-mobile-devices-with-javascript/
// if it still brings problem try to move to more sophisticated solution like
// apachemobilefilter.org
// detectright.com
// web.wurfl.io
//
// Seems as best solution here:
// hgoebl.github.io/mobile-detect.js
function android() {
return navigator.userAgent.match(/Android/i);
}
function blackBerry() {
return navigator.userAgent.match(/BlackBerry/i);
}
function iOS() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
}
function opera() {
return navigator.userAgent.match(/Opera Mini/i);
}
function windows() {
return navigator.userAgent.match(/IEMobile/i);
}
return (android() || blackBerry() || iOS() || opera() || windows() || matchMedia( '(max-width: 1024px)' ).matches);
};
/**
* Check if menu is switched to responsive state based on user width settings
* @return {Boolean}
*/
MK.utils.isResponsiveMenuState = function() {
return window.matchMedia( '(max-width: '+ mk_responsive_nav_width +'px)').matches;
};
MK.utils.getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
MK.utils.throttle = function( delay, fn ) {
var last;
var deferTimer;
return function() {
var context = this;
var args = arguments;
var now = +new Date;
if( last && now < last + delay ) {
clearTimeout( deferTimer );
deferTimer = setTimeout( function() {
last = now; fn.apply( context, args );
}, delay );
} else {
last = now;
fn.apply( context, args );
}
};
};
/**
* This should be invoked only on page load.
* Scrolls to anchor from address bar
*/
MK.utils.scrollToURLHash = function() {
var loc = window.location,
hash = loc.hash;
if ( hash.length && hash.substring(1).length ) {
// !loading is added early after DOM is ready to prevent native jump to anchor
hash = hash.replace( '!loading', '' );
// Wait for one second before animating
// Most of UI animations should be done by then and async operations complited
setTimeout( function() {
MK.utils.scrollToAnchor( hash );
}, 1000 );
// Right after reset back address bar
setTimeout( function() {
window.history.replaceState(undefined, undefined, hash);
}, 1001);
}
};
/**
* Controls native scroll behaviour
* @return {Object} => {disable, enable}
*/
MK.utils.scroll = (function() {
// 37 - left arror, 38 - up arrow, 39 right arrow, 40 down arrow
var keys = [38, 40];
function preventDefault(e) {
e = e || window.event;
e.preventDefault();
e.returnValue = false;
}
function wheel(e) {
preventDefault(e);
}
function keydown(e) {
for (var i = keys.length; i--;) {
if (e.keyCode === keys[i]) {
preventDefault(e);
return;
}
}
}
function disableScroll() {
if (window.addEventListener) {
window.addEventListener('DOMMouseScroll', wheel, false);
}
window.onmousewheel = document.onmousewheel = wheel;
document.onkeydown = keydown;
}
function enableScroll() {
if (window.removeEventListener) {
window.removeEventListener('DOMMouseScroll', wheel, false);
}
window.onmousewheel = document.onmousewheel = document.onkeydown = null;
}
return {
disable : disableScroll,
enable : enableScroll
};
})();
MK.utils.launchIntoFullscreen = function ( element ) {
if(element.requestFullscreen) {
element.requestFullscreen();
} else if(element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if(element.webkitRequestFullscreen) {
element.webkitRequestFullscreen();
} else if(element.msRequestFullscreen) {
element.msRequestFullscreen();
}
};
MK.utils.exitFullscreen = function () {
if(document.exitFullscreen) {
document.exitFullscreen();
} else if(document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if(document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
};
/**
* Scroll Spy implementation. Spy dynamic offsets of elements or static pixel offset
* @param {Number|Element}
* @param {Object} => callback object {before, active, after}
*/
MK.utils.scrollSpy = function( toSpy, config ) {
var $window = $( window ),
container = $('.jupiterx-site')[0],
isObj = ( typeof toSpy === 'object' ),
offset = (isObj) ? MK.val.dynamicOffset( toSpy, config.position, config.threshold ) : function() { return toSpy; },
height = (isObj) ? MK.val.dynamicHeight( toSpy ) : function() { return 0; },
cacheVals = {},
_p = 'before'; // current position
var checkPosition = function() {
var s = MK.val.scroll(),
o = offset(),
h = height();
if( s < o && _p !== 'before' ) {
// console.log( toSpy, 'before' );
if( config.before ) config.before();
_p = 'before';
}
else if( s >= o && s <= o + h && _p !== 'active' ) {
// console.log( toSpy, 'active' );
if( config.active ) config.active( o );
_p = 'active';
}
else if( s > o + h && _p !== 'after' ) {
// console.log( toSpy, 'after' );
if( config.after) config.after( o + h );
_p = 'after';
}
};
var rAF = function() {
window.requestAnimationFrame( checkPosition );
};
var exportVals = function() {
return cacheVals;
};
var updateCache = function() {
var o = offset(),
h = height();
cacheVals = {
before : o - $window.height(),
active : o,
after : o + h
};
};
if( config.cache ) {
config.cache( exportVals );
}
checkPosition();
$window.on( 'load', checkPosition );
$window.on( 'resize', checkPosition );
$window.on( 'mouseup', checkPosition );
window.addResizeListener( container, checkPosition );
$window.on( 'scroll', rAF );
updateCache();
$window.on( 'load', updateCache );
$window.on( 'resize', updateCache );
window.addResizeListener( container, updateCache );
};
/**
* Scrolls page to static pixel offset
* @param {Number}
*/
MK.utils.scrollTo = function( offset ) {
$('html, body').stop().animate({
scrollTop: offset
}, {
duration: 1200,
});
};
MK.utils.isElementInViewport = function( el ) {
var elemTop = el.getBoundingClientRect().top;
var isVisible = (elemTop < window.innerHeight);
return isVisible;
};
/**
* Scrolls to element passed in as object or DOM reference
* @param {String|Object}
*/
MK.utils.scrollToAnchor = function( hash ) {
// Escape meta-chars from hash name only.
hash = hash.substring(1).replace(/[!"#$%&'()*+,./:;<=>?@[\]^`{|}~]/g, "\\$&");
hash = "#" + hash;
var $target = $( hash );
// console.log( hash );
if( ! $target.length ) return;
var offset = $target.offset().top;
offset = offset - MK.val.offsetHeaderHeight( offset );
if( hash === '#top-of-page' ) window.history.replaceState( undefined, undefined, ' ' );
else window.history.replaceState( undefined, undefined, hash );
MK.utils.scrollTo( offset );
};
/**
* Basic implementation of pub / sub pattern to avoid tight coupling with direct module communication
* @type {Object}
*/
MK.utils.eventManager = {};
/**
* Subscribe to custom event and run callbacks
* @param {String}
* @param {Function}
*
* @usage MK.utils.eventManager.subscribe('event', function(e, params) {} )
*/
MK.utils.eventManager.subscribe = function(evt, func) {
$(this).on(evt, func);
};
/**
* Unsubscribe from custom event
* @param {String}
* @param {Function}
*/
MK.utils.eventManager.unsubscribe = function(evt, func) {
$(this).off(evt, func);
};
/**
* Publish custom event to notify appliaction about state change
* @param {String}
*
* @usage MK.utils.eventManager.publish('event', {
* param: val
* })
*/
MK.utils.eventManager.publish = function(evt, params) {
$(this).trigger(evt, [params]);
};
/**
* Get all top offsets from jQuery collection
*
* @param {$Objects}
* @return {Aray}
*/
MK.utils.offsets = function( $els ) {
return $.map( $els, function( el ) {
return $( el ).offset().top;
});
};
/**
* Retrive from array of numbers first number that is higher than given parameter
*
* @param {Number}
* @param {Array}
* @return {Number}
*/
MK.utils.nextHigherVal = function( val, arr ) {
var i = 0,
higher = null;
var check = function() {
if( val > arr[ i ]) {
i += 1;
check();
} else {
higher = arr[ i ];
}
};
check();
return higher;
};
}(jQuery));
(function($) {
'use strict';
var MK = window.MK || {};
/**
* MK.core holds most important methods that bootstraps whole application
*
* @type {Object}
*/
MK.core = {};
/**
* State for referance of already loaded script files
* @type {Array}
*/
var _loadedDependencies = [];
/**
* State of queue represented as pairs of script ref => callback
* @type {Object}
*/
var _inQueue = {};
/**
* Initializes all components in given scope (object or DOM reference) based on data attribute and 'pointer' css class '.js-el'.
* DOM work is reduced by single traversing for pointer class and later filtering through cached object. It expects init() method
* on every component. Component itself should be defined in MK.component namespace and assign to DOM element via data-mk-component.
* Use it once on DOM ready with document as a scope. For partial initialization after ajax operations pass as a scope element
* where new DOM was inserted.
*
* @param {string|object}
*/
MK.core.initAll = function( scope ) {
var $el = $( scope ).find( '.js-el' ), // single traversing
$components = $el.filter( '[data-mk-component]' ),
component = null;
// initialize component
var init = function init(name, el) {
var $el = $(el);
if ( $el.data('init-' + name) ) return; // do not initialize the same module twice
if ( typeof MK.component[ name ] !== 'function' ) console.log('Component init error: ', name);
else {
component = new MK.component[ name ]( el );
component.init();
$el.data('init-' + name, true); // mark as initialised
// TODO add name
MK.utils.eventManager.publish('component-inited');
}
};
$components.each( function() {
var self = this,
$this = $( this ),
names = $this.data( 'mk-component' );
if( typeof names === 'string' ) {
var name = names; // containes only single name. Keep it transparent.
init(name, self);
} else {
names.forEach( function( name ) {
init(name, self);
});
}
});
};
/**
* Async loader for 3rd party plugins available from within theme or external CDNs / APIs.
* Take one argument as callback which is run when loading is finished. Also keeps track of already loaded scripts
* and prevent duplication. Holds in queue multiple callbacks that where defined in different places but depend on the
* same plugin.
*
* TODO: heavy test for multiple dependencies and crosssharing one dependency and different one dependency in queue,
* bulletproof with single dependency
*
* @example MK.core.loadDependencies([MK.core.path.plugins + 'plugin.js'], function() {
* // do something when plugin is loaded
* })
*
* @param {array}
* @param {function}
*/
MK.core.loadDependencies = function( dependencies, callback ) {
var _callback = callback || function() {};
if( !dependencies ) {
// If no dependencies defined then run _callback imidietelly
_callback();
return;
}
// Check for new dependencies
var newDeps = dependencies.map( function( dep ) {
if( _loadedDependencies.indexOf( dep ) === -1 ) {
if( typeof _inQueue[ dep ] === 'undefined' ) {
// console.log( dep );
return dep;
} else {
_inQueue[ dep ].push( _callback );
return true;
}
} else {
return false;
}
});
// The dependency is not new but it's not resolved yet
// Callback is added to queue that will be run after the script is loaded
// Don't run callback just yet.
if( newDeps[0] === true ) {
// console.log('Waiting for ' + dependencies[0]);
return;
}
// Dependency was loaded previously. We can run callback safely
if( newDeps[0] === false ) {
_callback();
return;
}
// Create queue and relationship script -> callback array to track
// all callbacks that waits for ths script
var queue = newDeps.map( function( script ) {
// console.log( script );
_inQueue[ script ] = [ _callback ];
return $.getCachedScript( script );
});
// Callbacks invoking
var onLoad = function onLoad() {
var index;
newDeps.map( function( loaded ) {
_inQueue[ loaded ].forEach( function( callback ) {
callback();
});
delete _inQueue[ loaded ];
_loadedDependencies.push( loaded );
});
};
// Run callbacks when promise is resolved
$.when.apply( null, queue ).done( onLoad );
};
/**
* Single namespace for all paths recuired in application.
* @type {Object}
*/
MK.core.path = {
theme: jupiterDonutVars.themeUrl,
plugins: jupiterDonutVars.assetsUrl + '/lib/js/',
ajaxUrl: jupiterDonutVars.ajaxUrl
};
})(jQuery);
(function($) {
'use strict';
/**
* Entry point of application. Runs all components
*/
$( window ).on( 'load', function() {
MK.core.initAll( document );
MK.utils.scrollToURLHash();
});
/**
* VC frontend editor. Init all components.
*/
$( window ).on( 'vc_reload', function() {
setTimeout(function(){
MK.core.initAll( document );
}, 100);
});
/**
* Assign global click handlers
*/
$( document ).on( 'click', '.js-smooth-scroll, .js-main-nav a', smoothScrollToAnchor);
$( '.side_dashboard_menu a' ).on( 'click', smoothScrollToAnchor);
function smoothScrollToAnchor( evt ) {
var anchor = MK.utils.detectAnchor( this );
var $this = $(evt.currentTarget);
var loc = window.location;
var currentPage = loc.origin + loc.pathname;
var href = $this.attr( 'href' );
var linkSplit = (href) ? href.split( '#' ) : '';
var hrefPage = linkSplit[0] ? linkSplit[0] : '';
var hrefHash = linkSplit[1] ? linkSplit[1] : '';
if( anchor.length ) {
if(hrefPage === currentPage || hrefPage === '') evt.preventDefault();
MK.utils.scrollToAnchor( anchor );
} else if( $this.attr( 'href' ) === '#' ) {
evt.preventDefault();
}
}
}(jQuery));
'use strict';
/**
* Copyright Marc J. Schmidt. See the LICENSE file at the top-level
* directory of this distribution and at
* https://github.com/marcj/css-element-queries/blob/master/LICENSE.
*/
(function (root, factory) {
if (typeof define === "function" && define.amd) {
define(['./ResizeSensor.js'], factory);
} else if (typeof exports === "object") {
module.exports = factory(require('./ResizeSensor.js'));
} else {
root.ElementQueries = factory(root.ResizeSensor);
root.ElementQueries.listen();
}
}(typeof window !== 'undefined' ? window : this, function (ResizeSensor) {
/**
*
* @type {Function}
* @constructor
*/
var ElementQueries = function () {
//"),h("body").addClass("compensate-for-scrollbar")),n="",h.each(i.buttons,function(t,e){n+=i.btnTpl[e]||""}),e=h(o.translate(o,i.baseTpl.replace("{{buttons}}",n).replace("{{arrows}}",i.btnTpl.arrowLeft+i.btnTpl.arrowRight))).attr("id","fancybox-container-"+o.id).addClass(i.baseClass).data("FancyBox",o).appendTo(i.parentEl),o.$refs={container:e},["bg","inner","infobar","toolbar","stage","caption","navigation"].forEach(function(t){o.$refs[t]=e.find(".fancybox-"+t)}),o.trigger("onInit"),o.activate(),o.jumpTo(o.currIndex)},translate:function(t,e){var n=t.opts.i18n[t.opts.lang]||t.opts.i18n.en;return e.replace(/\{\{(\w+)\}\}/g,function(t,e){return n[e]===g?t:n[e]})},addContent:function(t){var r=this,t=h.makeArray(t);h.each(t,function(t,e){var n,o,i,s={},a={};h.isPlainObject(e)?a=(s=e).opts||e:"object"===h.type(e)&&h(e).length?(a=(o=h(e)).data()||{},(a=h.extend(!0,{},a,a.options)).$orig=o,s.src=r.opts.src||a.src||o.attr("href"),s.type||s.src||(s.type="inline",s.src=e)):s={type:"html",src:e+""},s.opts=h.extend(!0,{},r.opts,a),h.isArray(a.buttons)&&(s.opts.buttons=a.buttons),h.fancybox.isMobile&&s.opts.mobile&&(s.opts=u(s.opts,s.opts.mobile)),n=s.type||s.opts.type,o=s.src||"",!n&&o&&((a=o.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(n="video",s.opts.video.format||(s.opts.video.format="video/"+("ogv"===a[1]?"ogg":a[1]))):o.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?n="image":o.match(/\.(pdf)((\?|#).*)?$/i)?(n="iframe",s=h.extend(!0,s,{contentType:"pdf",opts:{iframe:{preload:!1}}})):"#"===o.charAt(0)&&(n="inline")),n?s.type=n:r.trigger("objectNeedsType",s),s.contentType||(s.contentType=-1=o.group[o.currIndex].opts.idleTime&&!o.isDragging&&(o.isIdle=!0,o.idleSecondsCounter=0,o.hideControls())},1e3))},removeEvents:function(){i.off("orientationchange.fb resize.fb"),s.off("keydown.fb .fb-idle"),this.$refs.container.off(".fb-close .fb-prev .fb-next"),this.idleInterval&&(c.clearInterval(this.idleInterval),this.idleInterval=null)},previous:function(t){return this.jumpTo(this.currPos-1,t)},next:function(t){return this.jumpTo(this.currPos+1,t)},jumpTo:function(t,o){var e,n,i,s,a,r,c,l,d=this,u=d.group.length;if(!(d.isDragging||d.isClosing||d.isAnimating&&d.firstRun))return t=parseInt(t,10),!(!(n=(d.current||d).opts.loop)&&(t<0||u<=t))&&(e=d.firstRun=!Object.keys(d.slides).length,s=d.current,d.prevIndex=d.currIndex,d.prevPos=d.currPos,i=d.createSlide(t),1i.pos?"next":"previous")),f(e.$slide),h.fancybox.animate(e.$slide,{top:0,left:(e.pos-i.pos)*a.width+(e.pos-i.pos)*e.opts.gutter},o,function(){e.$slide.css({transform:"",opacity:""}).removeClass("fancybox-slide--next fancybox-slide--previous"),e.pos===d.currPos&&d.complete()})})):o&&i.opts.transitionEffect&&(c="fancybox-animated fancybox-fx-"+i.opts.transitionEffect,s.$slide.addClass("fancybox-slide--"+(s.pos>i.pos?"next":"previous")),h.fancybox.animate(s.$slide,c,o,function(){s.$slide.removeClass(c).removeClass("fancybox-slide--next fancybox-slide--previous")},!1)),i.isLoaded?d.revealContent(i):d.loadSlide(i)),void d.preload("image"))},createSlide:function(t){var e,n=this,o=t%n.group.length;return o=o<0?n.group.length+o:o,!n.slides[t]&&n.group[o]&&(e=h('').appendTo(n.$refs.stage),n.slides[t]=h.extend(!0,{},n.group[o],{pos:t,$slide:e,isLoaded:!1}),n.updateSlide(n.slides[t])),n.slides[t]},scaleToActual:function(t,e,n){var o,i,s,a,r=this,c=r.current,l=c.$content,d=h.fancybox.getTranslate(c.$slide).width,u=h.fancybox.getTranslate(c.$slide).height,f=c.width,p=c.height;r.isAnimating||r.isMoved()||!l||"image"!=c.type||!c.isLoaded||c.hasError||(r.isAnimating=!0,h.fancybox.stop(l),t=t===g?.5*d:t,e=e===g?.5*u:e,(o=h.fancybox.getTranslate(l)).top-=h.fancybox.getTranslate(c.$slide).top,o.left-=h.fancybox.getTranslate(c.$slide).left,s=f/o.width,a=p/o.height,i=.5*d-.5*f,c=.5*u-.5*p,da.get(0).clientHeight)),n.trigger("onUpdate",t,e)},centerSlide:function(t){var e=this,n=e.current,o=n.$slide;!e.isClosing&&n&&(o.siblings().css({transform:"",opacity:""}),o.parent().children().removeClass("fancybox-slide--previous fancybox-slide--next"),h.fancybox.animate(o,{top:0,left:0,opacity:1},t===g?0:t,function(){o.css({transform:"",opacity:""}),n.isComplete||e.complete()},!1))},isMoved:function(t){var e,n=t||this.current;return!!n&&(e=h.fancybox.getTranslate(this.$refs.stage),t=h.fancybox.getTranslate(n.$slide),!n.$slide.hasClass("fancybox-animated")&&(.5t.width||e.height>t.height))return!0}return!1},isScaledDown:function(t,e){var n=!1,o=this.current,i=o.$content;return t!==g&&e!==g?n=t').addClass("fancybox-is-hidden").appendTo(e.$slide.addClass("fancybox-slide--image")),!1!==e.opts.preload&&e.opts.width&&e.opts.height&&e.thumb&&(e.width=e.opts.width,e.height=e.opts.height,(t=a.createElement("img")).onerror=function(){h(this).remove(),e.$ghost=null},t.onload=function(){n.afterLoad(e)},e.$ghost=h(t).addClass("fancybox-image").appendTo(e.$content).attr("src",e.thumb)),n.setBigImage(e)},checkSrcset:function(t){var e,n,o,i,s=t.opts.srcset||t.opts.image.srcset;if(s){o=c.devicePixelRatio||1,i=c.innerWidth*o,(n=s.split(",").map(function(t){var o={};return t.trim().split(/\s+/).forEach(function(t,e){var n=parseInt(t.substring(0,t.length-1),10);if(0===e)return o.url=t;n&&(o.value=n,o.postfix=t[t.length-1])}),o})).sort(function(t,e){return t.value-e.value});for(var a=0;a=i||"x"===r.postfix&&r.value>=o){e=r;break}}!e&&n.length&&(e=n[n.length-1]),e&&(t.src=e.url,t.width&&t.height&&"w"==e.postfix&&(t.height=t.width/t.height*e.value,t.width=e.value),t.opts.srcset=s)}},setBigImage:function(e){var n=this,t=a.createElement("img"),o=h(t);e.$image=o.one("error",function(){n.setError(e)}).one("load",function(){var t;e.$ghost||(n.resolveImageSlideSize(e,this.naturalWidth,this.naturalHeight),n.afterLoad(e)),n.isClosing||(e.opts.srcset&&((t=e.opts.sizes)&&"auto"!==t||(t=(1').css(a.css).appendTo(r),r.addClass("fancybox-slide--"+i.contentType),i.$iframe=s=h(a.tpl.replace(/\{rnd\}/g,(new Date).getTime())).attr(a.attr).appendTo(i.$content),a.preload?(e.showLoading(i),s.on("load.fb error.fb",function(t){this.isReady=1,i.$slide.trigger("refresh"),e.afterLoad(i)}),r.on("refresh.fb",function(){var t,e=i.$content,n=a.css.width,o=a.css.height;if(1===s[0].isReady){try{t=s.contents().find("body")}catch(t){}t&&t.length&&t.children().length&&(r.css("overflow","visible"),e.css({width:"100%","max-width":"100%",height:"9999px"}),n===g&&(n=Math.ceil(Math.max(t[0].clientWidth,t.outerWidth(!0)))),e.css("width",n||"").css("max-width",""),o===g&&(o=Math.ceil(Math.max(t[0].clientHeight,t.outerHeight(!0)))),e.css("height",o||""),r.css("overflow","auto")),e.removeClass("fancybox-is-hidden")}})):e.afterLoad(i),s.attr("src",i.src),r.one("onReset",function(){try{h(this).find("iframe").hide().unbind().attr("src","//about:blank")}catch(t){}h(this).off("refresh.fb").empty(),i.isLoaded=!1,i.isRevealed=!1})},setContent:function(t,e){var n;this.isClosing||(this.hideLoading(t),t.$content&&h.fancybox.stop(t.$content),t.$slide.empty(),(n=e)&&n.hasOwnProperty&&n instanceof h&&e.parent().length?((e.hasClass("fancybox-content")||e.parent().hasClass("fancybox-content"))&&e.parents(".fancybox-slide").trigger("onReset"),t.$placeholder=h("