/*! * Fresco - A Beautiful Responsive Lightbox - v2.2.4 * (c) 2012-2018 Nick Stakenburg * * http://www.frescojs.com * * License: http://www.frescojs.com/license */ !function(a,b){"function"==typeof define&&define.amd?define(["jquery"],b):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):a.Fresco=b(jQuery)}(this,function($){function baseToString(a){return"string"==typeof a?a:null==a?"":a+""}function Timers(){return this.initialize.apply(this,_slice.call(arguments))}function getURIData(a){var b={type:"image"};return $.each(Types,function(c,d){var e=d.data(a);e&&(b=e,b.type=c,b.url=a)}),b}function detectExtension(a){var b=(a||"").replace(/\?.*/g,"").match(/\.([^.]{3,4})$/);return b?b[1].toLowerCase():null}function View(){this.initialize.apply(this,_slice.call(arguments))}function Thumbnail(){this.initialize.apply(this,_slice.call(arguments))}var Fresco={};$.extend(Fresco,{version:"2.2.4"}),Fresco.Skins={fresco:{}};var Bounds={viewport:function(){var a={width:$(window).width()};if(Browser.MobileSafari||Browser.Android&&Browser.Gecko){var b=document.documentElement.clientWidth/window.innerWidth;a.height=window.innerHeight*b}else a.height=$(window).height();return a}},Browser=function(a){function b(b){var c=new RegExp(b+"([\\d.]+)").exec(a);return c?parseFloat(c[1]):!0}return{IE:!(!window.attachEvent||-1!==a.indexOf("Opera"))&&b("MSIE "),Opera:a.indexOf("Opera")>-1&&(!!window.opera&&opera.version&&parseFloat(opera.version())||7.55),WebKit:a.indexOf("AppleWebKit/")>-1&&b("AppleWebKit/"),Gecko:a.indexOf("Gecko")>-1&&-1===a.indexOf("KHTML")&&b("rv:"),MobileSafari:!!a.match(/Apple.*Mobile.*Safari/),Chrome:a.indexOf("Chrome")>-1&&b("Chrome/"),ChromeMobile:a.indexOf("CrMo")>-1&&b("CrMo/"),Android:a.indexOf("Android")>-1&&b("Android "),IEMobile:a.indexOf("IEMobile")>-1&&b("IEMobile/")}}(navigator.userAgent),_slice=Array.prototype.slice,_={isElement:function(a){return a&&1==a.nodeType},String:{capitalize:function(a){return a=baseToString(a),a&&a.charAt(0).toUpperCase()+a.slice(1)}}};!function(){function a(a){var b;if(a.originalEvent.wheelDelta?b=a.originalEvent.wheelDelta/120:a.originalEvent.detail&&(b=-a.originalEvent.detail/3),b){var c=$.Event("fresco:mousewheel");$(a.target).trigger(c,b),c.isPropagationStopped()&&a.stopPropagation(),c.isDefaultPrevented()&&a.preventDefault()}}$(document.documentElement).on("mousewheel DOMMouseScroll",a)}();var Fit={within:function(a,b){for(var c=$.extend({height:!0,width:!0},arguments[2]||{}),d=$.extend({},b),e=1,f=5,g={width:c.width,height:c.height};f>0&&(g.width&&d.width>a.width||g.height&&d.height>a.height);){var h=1,i=1;g.width&&d.width>a.width&&(h=a.width/d.width),g.height&&d.height>a.height&&(i=a.height/d.height);var e=Math.min(h,i);d={width:b.width*e,height:b.height*e},f--}return d.width=Math.max(d.width,0),d.height=Math.max(d.height,0),d}};$.extend($.easing,{frescoEaseInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},frescoEaseInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},frescoEaseOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c}});var Support=function(){function a(a){return c(a,"prefix")}function b(a,b){for(var c in a)if(void 0!==d.style[a[c]])return"prefix"==b?a[c]:!0;return!1}function c(a,c){var d=a.charAt(0).toUpperCase()+a.substr(1),f=(a+" "+e.join(d+" ")+d).split(" ");return b(f,c)}var d=document.createElement("div"),e="Webkit Moz O ms Khtml".split(" ");return{canvas:function(){var a=document.createElement("canvas");return!(!a.getContext||!a.getContext("2d"))}(),css:{animation:c("animation"),transform:c("transform"),prefixed:a},svg:!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect,touch:function(){try{return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)}catch(a){return!1}}()}}();Support.detectMobileTouch=function(){Support.mobileTouch=Support.touch&&(Browser.MobileSafari||Browser.Android||Browser.IEMobile||Browser.ChromeMobile||!/^(Win|Mac|Linux)/.test(navigator.platform))},Support.detectMobileTouch();var ImageReady=function(){return this.initialize.apply(this,Array.prototype.slice.call(arguments))};$.extend(ImageReady.prototype,{supports:{naturalWidth:function(){return"naturalWidth"in new Image}()},initialize:function(a,b,c){return this.img=$(a)[0],this.successCallback=b,this.errorCallback=c,this.isLoaded=!1,this.options=$.extend({method:"naturalWidth",pollFallbackAfter:1e3},arguments[3]||{}),this.supports.naturalWidth&&"onload"!=this.options.method?this.img.complete&&"undefined"!=$.type(this.img.naturalWidth)?void setTimeout($.proxy(function(){this.img.naturalWidth>0?this.success():this.error()},this)):($(this.img).bind("error",$.proxy(function(){setTimeout($.proxy(function(){this.error()},this))},this)),this.intervals=[[1e3,10],[2e3,50],[4e3,100],[2e4,500]],this._ipos=0,this._time=0,this._delay=this.intervals[this._ipos][1],void this.poll()):void setTimeout($.proxy(this.fallback,this))},poll:function(){this._polling=setTimeout($.proxy(function(){if(this.img.naturalWidth>0)return void this.success();if(this._time+=this._delay,this.options.pollFallbackAfter&&this._time>=this.options.pollFallbackAfter&&!this._usedPollFallback&&(this._usedPollFallback=!0,this.fallback()),this._time>this.intervals[this._ipos][0]){if(!this.intervals[this._ipos+1])return void this.error();this._ipos++,this._delay=this.intervals[this._ipos][1]}this.poll()},this),this._delay)},fallback:function(){var a=new Image;this._fallbackImg=a,a.onload=$.proxy(function(){a.onload=function(){},this.supports.naturalWidth||(this.img.naturalWidth=a.width,this.img.naturalHeight=a.height),this.success()},this),a.onerror=$.proxy(this.error,this),a.src=this.img.src},abort:function(){this._fallbackImg&&(this._fallbackImg.onload=function(){}),this._polling&&(clearTimeout(this._polling),this._polling=null)},success:function(){this._calledSuccess||(this._calledSuccess=!0,this.isLoaded=!0,this.successCallback(this))},error:function(){this._calledError||(this._calledError=!0,this.abort(),this.errorCallback&&this.errorCallback(this))}}),$.extend(Timers.prototype,{initialize:function(){this._timers={}},set:function(a,b,c){this._timers[a]=setTimeout(b,c)},get:function(a){return this._timers[a]},clear:function(a){a?this._timers[a]&&(clearTimeout(this._timers[a]),delete this._timers[a]):this.clearAll()},clearAll:function(){$.each(this._timers,function(a,b){clearTimeout(b)}),this._timers={}}});var Type={isVideo:function(a){return/^(youtube|vimeo)$/.test(a)}},Types={image:{extensions:"bmp gif jpeg jpg png webp",detect:function(a){return $.inArray(detectExtension(a),this.extensions.split(" "))>-1},data:function(a){return this.detect()?{extension:detectExtension(a)}:!1}},vimeo:{detect:function(a){var b=/(vimeo\.com)\/([a-zA-Z0-9-_]+)(?:\S+)?$/i.exec(a);return b&&b[2]?b[2]:!1},data:function(a){var b=this.detect(a);return b?{id:b}:!1}},youtube:{detect:function(a){var b=/(youtube\.com|youtu\.be)\/watch\?(?=.*vi?=([a-zA-Z0-9-_]+))(?:\S+)?$/.exec(a);return b&&b[2]?b[2]:(b=/(youtube\.com|youtu\.be)\/(vi?\/|u\/|embed\/)?([a-zA-Z0-9-_]+)(?:\S+)?$/i.exec(a),b&&b[3]?b[3]:!1)},data:function(a){var b=this.detect(a);return b?{id:b}:!1}}},VimeoThumbnail=function(){var a=function(){return this.initialize.apply(this,_slice.call(arguments))};$.extend(a.prototype,{initialize:function(a,b,c){this.url=a,this.successCallback=b,this.errorCallback=c,this.load()},load:function(){var a=b.get(this.url);if(a)return this.successCallback(a.data.url);var c="http"+(window.location&&"https:"==window.location.protocol?"s":"")+":",d=getURIData(this.url).id;this._xhr=$.getJSON(c+"//vimeo.com/api/oembed.json?url="+c+"//vimeo.com/"+d+"&callback=?",$.proxy(function(a){if(a&&a.thumbnail_url){var a={url:a.thumbnail_url};b.set(this.url,a),this.successCallback(a.url)}else this.errorCallback()},this))},abort:function(){this._xhr&&(this._xhr.abort(),this._xhr=null)}});var b={cache:[],get:function(a){for(var b=null,c=0;c").addClass("fr-overlay").hide().append($("
").addClass("fr-overlay-background")),this.element.on("click",$.proxy(function(){var a=Pages.page;a&&a.view&&a.view.options.overlay&&!a.view.options.overlay.close||Window.hide()},this)),Support.mobileTouch&&this.element.addClass("fr-mobile-touch"),this.element.on("fresco:mousewheel",function(a){a.preventDefault()})},setSkin:function(a){this.skin&&this.element.removeClass("fr-overlay-skin-"+this.skin),this.element.addClass("fr-overlay-skin-"+a),this.skin=a},attach:function(){$(document.body).append(this.element)},detach:function(){this.element.detach()},show:function(a,b){if(this.visible)return void(a&&a());this.visible=!0,this.attach(),this.max();var c=Pages.page&&Pages.page.view.options.effects.window.show||0,d=("number"==$.type(b)?b:c)||0;this.element.stop(!0).fadeTo(d,1,a)},hide:function(a,b){if(!this.visible)return void(a&&a());var c=Pages.page&&Pages.page.view.options.effects.window.hide||0,d=("number"==$.type(b)?b:c)||0;this.element.stop(!0).fadeOut(d||0,$.proxy(function(){this.detach(),this.visible=!1,a&&a()},this))},getScrollDimensions:function(){var a={};return $.each(["width","height"],function(b,c){var d=c.substr(0,1).toUpperCase()+c.substr(1),e=document.documentElement;a[c]=(Browser.IE?Math.max(e["offset"+d],e["scroll"+d]):Browser.WebKit?document.body["scroll"+d]:e["scroll"+d])||0}),a},max:function(){var a;if(Browser.MobileSafari&&Browser.WebKit&&Browser.WebKit<533.18&&(a=this.getScrollDimensions(),this.element.css(a)),Browser.IE&&Browser.IE<9){var b=Bounds.viewport();this.element.css({height:b.height,width:b.width})}Support.mobileTouch&&!a&&this.element.css({height:this.getScrollDimensions().height})}},Window={initialize:function(){this.queues=[],this.queues.hide=$({}),this.pages=[],this._tracking=[],this._first=!0,this.timers=new Timers,this.build(),this.setSkin(Options.defaults.skin)},build:function(){if(this.element=$("
").addClass("fr-window fr-measured").hide().append(this._box=$("
").addClass("fr-box").append(this._pages=$("
").addClass("fr-pages"))).append(this._thumbnails=$("
").addClass("fr-thumbnails")),Overlay.initialize(),Pages.initialize(this._pages),Thumbnails.initialize(this._thumbnails),Spinner.initialize(),UI.initialize(),this.element.addClass("fr"+(Support.mobileTouch?"":"-no")+"-mobile-touch"),this.element.addClass("fr"+(Support.svg?"":"-no")+"-svg"),Browser.IE)for(var a=7;9>=a;a++)Browser.IE1?Math.min(.5*c,50):1)},_show:function(a,b){var c=("number"==$.type(b)?b:Pages.page&&Pages.page.view.options.effects.window.show)||0;this.element.stop(!0).fadeTo(c,1,a)},hide:function(a){if(this.view){var b=this.queues.hide;b.queue([]),this.timers.clear("show-window"),this.timers.clear("hide-overlay");var c=Pages.page?Pages.page.view.options.effects.window.hide:0;b.queue($.proxy(function(a){Pages.stop(),Spinner.hide(),a()},this)),b.queue($.proxy(function(a){UI.disable(),UI.hide(null,c),Keyboard.disable(),a()},this)),b.queue($.proxy(function(a){var b=2;this._hide(function(){--b<1&&a()},c),this.timers.set("hide-overlay",$.proxy(function(){Overlay.hide(function(){--b<1&&a()},c)},this),c>1?Math.min(.5*c,150):1),this._first=!0},this)),b.queue($.proxy(function(a){this._reset(),this.stopObservingResize(),Pages.removeAll(),Thumbnails.clear(),this.timers.clear(),this._position=-1;var b=Pages.page&&Pages.page.view.options.afterHide;"function"==$.type(b)&&b.call(Fresco),this.view=null,this.opening=!1,this.closing=!1,this.detach(),a()},this)),"function"==$.type(a)&&b.queue($.proxy(function(b){a(),b()},this))}},_hide:function(a,b){var c=("number"==$.type(b)?b:Pages.page&&Pages.page.view.options.effects.window.hide)||0;this.element.stop(!0).fadeOut(c,a)},load:function(a,b){this.views=a,this.attach(),Thumbnails.load(a),Pages.load(a),this.startObservingResize(),b&&this.setPosition(b)},setPosition:function(a,b){this._position=a,this.view=this.views[a-1],this.stopHideQueue(),this.page=Pages.show(a,$.proxy(function(){b&&b()},this))},stopHideQueue:function(){this.queues.hide.queue([])},_reset:function(){this.visible=!1,UI.hide(null,0),UI.reset()},mayPrevious:function(){return this.view&&this.view.options.loop&&this.views&&this.views.length>1||1!=this._position},previous:function(a){var b=this.mayPrevious();(a||b)&&this.setPosition(this.getSurroundingIndexes().previous)},mayNext:function(){var a=this.views&&this.views.length>1;return this.view&&this.view.options.loop&&a||a&&1!=this.getSurroundingIndexes().next},next:function(a){var b=this.mayNext();(a||b)&&this.setPosition(this.getSurroundingIndexes().next)},getSurroundingIndexes:function(){if(!this.views)return{};var a=this._position,b=this.views.length,c=1>=a?b:a-1,d=a>=b?1:a+1;return{previous:c,next:d}}},Keyboard={enabled:!1,keyCode:{left:37,right:39,esc:27},enable:function(a){this.disable(),a&&($(document).on("keydown",this._onKeyDownHandler=$.proxy(this.onKeyDown,this)).on("keyup",this._onKeyUpHandler=$.proxy(this.onKeyUp,this)),this.enabled=a)},disable:function(){this.enabled=!1,this._onKeyUpHandler&&($(document).off("keyup",this._onKeyUpHandler).off("keydown",this._onKeyDownHandler),this._onKeyUpHandler=this._onKeyDownHandler=null)},onKeyDown:function(a){if(this.enabled){var b=this.getKeyByKeyCode(a.keyCode);if(b&&(!b||!this.enabled||this.enabled[b]))switch(a.preventDefault(),a.stopPropagation(),b){case"left":Window.previous();break;case"right":Window.next()}}},onKeyUp:function(a){if(this.enabled){var b=this.getKeyByKeyCode(a.keyCode);if(b&&(!b||!this.enabled||this.enabled[b]))switch(b){case"esc":Window.hide()}}},getKeyByKeyCode:function(a){for(var b in this.keyCode)if(this.keyCode[b]==a)return b;return null}},Page=function(){function a(){return this.initialize.apply(this,_slice.call(arguments))}var b=0,c={},d=$("
").addClass("fr-stroke fr-stroke-top fr-stroke-horizontal").append($("
").addClass("fr-stroke-color")).add($("
").addClass("fr-stroke fr-stroke-bottom fr-stroke-horizontal").append($("
").addClass("fr-stroke-color"))).add($("
").addClass("fr-stroke fr-stroke-left fr-stroke-vertical").append($("
").addClass("fr-stroke-color"))).add($("
").addClass("fr-stroke fr-stroke-right fr-stroke-vertical").append($("
").addClass("fr-stroke-color")));return $.extend(a.prototype,{initialize:function(a,c,d){this.view=a,this.dimensions={width:0,height:0},this.uid=b++,this._position=c,this._total=d,this._fullClick=!1,this._visible=!1,this.queues={},this.queues.showhide=$({})},create:function(){if(!this._created){Pages.element.append(this.element=$("
").addClass("fr-page").append(this.container=$("
").addClass("fr-container")).css({opacity:0}).hide());var a=this.view.options.position&&this._total>1;if(a&&this.element.addClass("fr-has-position"),(this.view.caption||a)&&(this.element.append(this.info=$("
").addClass("fr-info").append($("
").addClass("fr-info-background")).append(d.clone(!0)).append(this.infoPadder=$("
").addClass("fr-info-padder"))),a&&(this.element.addClass("fr-has-position"),this.infoPadder.append(this.pos=$("
").addClass("fr-position").append($("").addClass("fr-position-text").html(this._position+" / "+this._total)))),this.view.caption&&this.infoPadder.append(this.caption=$("
").addClass("fr-caption").html(this.view.caption))),this.container.append(this.background=$("
").addClass("fr-content-background")).append(this.content=$("
").addClass("fr-content")),"image"==this.view.type&&(this.content.append(this.image=$("").addClass("fr-content-element").attr({src:this.view.url})),this.content.append(d.clone(!0))),a&&"outside"==this.view.options.ui&&this.container.append(this.positionOutside=$("
").addClass("fr-position-outside").append($("
").addClass("fr-position-background")).append($("").addClass("fr-position-text").html(this._position+" / "+this._total))),"inside"==this.view.options.ui){this.content.append(this.previousInside=$("
").addClass("fr-side fr-side-previous fr-toggle-ui").append($("
").addClass("fr-side-button").append($("
").addClass("fr-side-button-background")).append($("
").addClass("fr-side-button-icon")))).append(this.nextInside=$("
").addClass("fr-side fr-side-next fr-toggle-ui").append($("
").addClass("fr-side-button").append($("
").addClass("fr-side-button-background")).append($("
").addClass("fr-side-button-icon")))).append(this.closeInside=$("
").addClass("fr-close fr-toggle-ui").append($("
").addClass("fr-close-background")).append($("
").addClass("fr-close-icon"))),(this.view.caption||a&&this.view.grouped.caption)&&(this.content.append(this.infoInside=$("
").addClass("fr-info fr-toggle-ui").append($("
").addClass("fr-info-background")).append(d.clone(!0)).append(this.infoPadderInside=$("
").addClass("fr-info-padder"))),a&&this.infoPadderInside.append(this.posInside=$("
").addClass("fr-position").append($("").addClass("fr-position-text").html(this._position+" / "+this._total))),this.view.caption&&this.infoPadderInside.append(this.captionInside=$("
").addClass("fr-caption").html(this.view.caption))),this.view.caption||!a||this.view.grouped.caption||this.content.append(this.positionInside=$("
").addClass("fr-position-inside fr-toggle-ui").append($("
").addClass("fr-position-background")).append($("").addClass("fr-position-text").html(this._position+" / "+this._total)));var b=this.view.options.loop&&this._total>1||1!=this._position,c=this.view.options.loop&&this._total>1||this._position=f;f++){var g=Pages.pages[f-1];g._position!=e&&b.push(g)}for(var f=e;f>=c;f--){var g=Pages.pages[f-1];g._position!=e&&b.push(g)}return b},preloadSurroundingImages:function(){var a=this._getSurroundingPages();$.each(a,$.proxy(function(a,b){b.preload()},this))},preload:function(){this.preloading||this.preloaded||"image"!=this.view.type||!this.view.options.preload||this.loaded||(this.create(),this.preloading=!0,this.preloadReady=new ImageReady(this.image[0],$.proxy(function(a){this.loaded=!0,c[this.view.url]=!0,this.preloading=!1,this.preloaded=!0,this.dimensions={width:a.img.naturalWidth,height:a.img.naturalHeight}},this),null,{method:"naturalWidth"}))},load:function(a,b){if(this.create(),this.loaded)return void(a&&a());switch(this.abort(),this.loading=!0,this.view.options.spinner&&(this._spinnerDelay=setTimeout($.proxy(function(){Spinner.show()},this),this.view.options.spinnerDelay||0)),this.view.type){case"image":if(this.error)return void(a&&a());this.imageReady=new ImageReady(this.image[0],$.proxy(function(b){this._markAsLoaded(),this.setDimensions({width:b.img.naturalWidth,height:b.img.naturalHeight}),a&&a()},this),$.proxy(function(){this._markAsLoaded(),this.image.hide(),this.content.prepend(this.error=$("
").addClass("fr-error fr-content-element").append($("
").addClass("fr-error-icon"))),this.element.addClass("fr-has-error"),this.setDimensions({width:this.error.outerWidth(),height:this.error.outerHeight()}),this.error.css({width:"100%",height:"100%"}),a&&a()},this),{method:this.view.options.loadedMethod});break;case"vimeo":this.vimeoReady=new VimeoReady(this.view.url,$.proxy(function(b){this._markAsLoaded(),this.setDimensions({width:b.dimensions.width,height:b.dimensions.height}),a&&a()},this));break;case"youtube":this._markAsLoaded(),this.setDimensions({width:this.view.options.width,height:this.view.options.height}),a&&a()}},setDimensions:function(a){if(this.dimensions=a,this.view.options.maxWidth||this.view.options.maxHeight){var b=this.view.options,c={width:b.maxWidth?b.maxWidth:this.dimensions.width,height:b.maxHeight?b.maxHeight:this.dimensions.height};this.dimensions=Fit.within(c,this.dimensions)}},_markAsLoaded:function(){this._abortSpinnerDelay(),this.loading=!1,this.loaded=!0,c[this.view.url]=!0,Spinner.hide(null,null,this._position)},isVideo:function(){return Type.isVideo(this.view.type)},insertVideo:function(a){if(this.playerIframe||!this.isVideo())return void(a&&a());var b="http"+(window.location&&"https:"==window.location.protocol?"s":"")+":",c=$.extend({},this.view.options[this.view.type]||{}),d=$.param(c),e={vimeo:b+"//player.vimeo.com/video/{id}?{queryString}",youtube:b+"//www.youtube.com/embed/{id}?{queryString}"},f=e[this.view.type].replace("{id}",this.view._data.id).replace("{queryString}",d);this.content.prepend(this.playerIframe=$("