/* * Boxer v3.0.3 - 2014-01-12 * A jQuery plugin for displaying images, videos or content in a modal overlay. Part of the Formstone Library. * http://formstone.it/boxer/ * * Copyright 2014 Ben Plum; MIT Licensed */ !function(a,b){"use strict";function c(b){return G.formatter=j,a(this).on("click.boxer",a.extend({},G,b||{}),d)}function d(c){var d=a(this),f=c.data.$object,g=d[0].attributes?d.attr("href")||"":"",i=g.toLowerCase().split("."),j=i[i.length-1],l="",m="image"===l||"jpeg"===j||"jpg"===j||"gif"===j||"png"===j||"data:image"===g.substr(0,10),o=g.indexOf("youtube.com/embed")>-1||g.indexOf("player.vimeo.com/video")>-1,p="url"===l||!m&&!o&&"http"===g.substr(0,4),w="element"===l||!m&&!o&&!p&&"#"===g.substr(0,1),x="undefined"!=typeof f;if(!(a("#boxer").length>1)&&(m||o||p||w||x)){if(D(c),E=a.extend({},{$window:a(b),$body:a("body"),$target:d,$object:f,visible:!1,resizeTimer:null,touchTimer:null,gallery:{active:!1},isMobile:F||c.data.mobile},c.data),E.margin*=2,E.containerHeight=E.height,E.containerWidth=E.width,E.type=m?"image":o?"video":"element",m||o){var y=E.$target.attr("rel");"undefined"!=typeof y&&y!==!1&&(E.gallery.active=!0,E.gallery.rel=y,E.gallery.$items=a("a[rel= "+E.gallery.rel+"]"),E.gallery.index=E.gallery.$items.index(E.$target),E.gallery.total=E.gallery.$items.length-1)}var z="";return E.isMobile||(z+='
'),z+='
",z+='
",z+='",z+='

"+E.labels.count+' '+(E.gallery.total+1)+"",z+="

",z+='"),z+="
",E.$body.append(z),E.$overlay=a("#boxer-overlay"),E.$boxer=a("#boxer"),E.$container=E.$boxer.find(".boxer-container"),E.$content=E.$boxer.find(".boxer-content"),E.$meta=E.$boxer.find(".boxer-meta"),E.$position=E.$boxer.find(".boxer-position"),E.$caption=E.$boxer.find(".boxer-caption"),E.$arrows=E.$boxer.find(".boxer-arrow"),E.$animatables=a("#boxer-overlay, #boxer, .boxer-container"),E.paddingVertical=parseInt(E.$boxer.css("paddingTop"),10)+parseInt(E.$boxer.css("paddingBottom"),10),E.paddingHorizontal=parseInt(E.$boxer.css("paddingLeft"),10)+parseInt(E.$boxer.css("paddingRight"),10),h(),E.gallery.active&&r(),E.$window.on("resize.boxer",H.resize).on("keydown.boxer",s),E.$body.on("touchstart.boxer click.boxer","#boxer-overlay, #boxer .boxer-close",e).on("touchmove.boxer",D),E.gallery.active&&E.$boxer.on("touchstart.boxer click.boxer",".boxer-arrow",q),E.$overlay.stop().animate({opacity:E.opacity},E.duration),E.$boxer.stop().animate({opacity:1},E.duration,function(){m?k(g):o?n(g):p?u(g):w?t(g):x?v(E.$object):a.error("BOXER: '"+g+"' is not valid.")}),x?E.$boxer:void 0}}function e(b){D(b),"undefined"!=typeof E.$animatables&&(E.$animatables.stop().animate({opacity:0},E.duration,function(){a(this).remove()}),B(E.resizeTimer),E.$window.off(".boxer"),E.$body.off(".boxer").removeClass("boxer-open"),E.gallery.active&&E.$boxer.off(".boxer"),E.isMobile&&"image"===E.type&&E.gallery.active&&E.$container.off(".boxer"),E.$window.trigger("close.boxer"),E={})}function f(){var a=i(),b=0,c=E.isMobile?0:E.duration;E.isMobile||(b=E.$arrows.outerHeight(),E.$arrows.css({marginTop:(E.contentHeight-E.metaHeight-b)/2})),!E.visible&&E.isMobile&&E.gallery.active&&E.$content.on("touchstart.boxer",".boxer-image",x),(E.isMobile||E.fixed)&&E.$body.addClass("boxer-open"),E.$boxer.stop().animate({left:a.left,top:a.top},c),E.$container.show().stop().animate({height:E.containerHeight,width:E.containerWidth},c,function(){E.$content.stop().animate({opacity:1},E.duration),E.$boxer.removeClass("loading").find(".boxer-close").stop().animate({opacity:1},E.duration),E.visible=!0,E.callback.apply(E.$boxer),E.$window.trigger("open.boxer"),E.gallery.active&&p()})}function g(a){if(a=a||!1,E.visible){var b=i(),c=0;E.isMobile||(c=E.$arrows.outerHeight(),E.$arrows.css({marginTop:(E.contentHeight-E.metaHeight-c)/2})),a?(E.$boxer.stop().animate({left:b.left,top:b.top},E.duration),E.$container.show().stop().animate({height:E.containerHeight,width:E.containerWidth})):(E.$boxer.css({left:b.left,top:b.top}),E.$container.css({height:E.containerHeight,width:E.containerWidth}))}}function h(){var a=i();E.$boxer.css({left:a.left,top:a.top})}function i(){if(E.isMobile)return{left:0,top:0};var a={left:(E.$window.width()-E.containerWidth-E.paddingHorizontal)/2,top:E.top<=0?(E.$window.height()-E.containerHeight-E.paddingVertical)/2:E.top};return E.fixed!==!0&&(a.top+=E.$window.scrollTop()),a}function j(a){var b=a.attr("title");return""!==b&&void 0!==b?'

'+b+"

":""}function k(b){E.$image=a(""),E.$image.one("load.boxer",function(){var a=C(E.$image);E.naturalHeight=a.naturalHeight,E.naturalWidth=a.naturalWidth,E.retina&&(E.naturalHeight/=2,E.naturalWidth/=2),E.$content.prepend(E.$image),""===E.$caption.html()?E.$caption.hide():E.$caption.show(),l(),f()}).attr("src",b).addClass("boxer-image"),(E.$image[0].complete||4===E.$image[0].readyState)&&E.$image.trigger("load")}function l(){var a=0;for(E.windowHeight=E.viewportHeight=E.$window[0].innerHeight,E.windowWidth=E.viewportWidth=E.$window[0].innerWidth,E.containerHeight=1/0,E.contentHeight=0,E.containerWidth=1/0,E.contentWidth=0,E.imageMarginTop=0,E.imageMarginLeft=0;E.containerHeight>E.viewportHeight&&2>a;)E.imageHeight=0===a?E.naturalHeight:E.$image.outerHeight(),E.imageWidth=0===a?E.naturalWidth:E.$image.outerWidth(),E.metaHeight=0===a?0:E.metaHeight,0===a&&(E.ratioHorizontal=E.imageHeight/E.imageWidth,E.ratioVertical=E.imageWidth/E.imageHeight,E.isWide=E.imageWidth>E.imageHeight),E.imageHeighta&&(E.targetImageHeight=a,E.targetImageWidth=E.targetImageHeight*E.ratioVertical)):(E.targetImageHeight=a,E.targetImageWidth=E.targetImageHeight*E.ratioVertical,E.targetImageWidth>b&&(E.targetImageWidth=b,E.targetImageHeight=E.targetImageWidth*E.ratioHorizontal)),(E.targetImageWidth>E.imageWidth||E.targetImageHeight>E.imageHeight)&&(E.targetImageHeight=E.imageHeight,E.targetImageWidth=E.imageWidth),(E.targetImageWidth'),E.$video=a('