/* * 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('