fotoramajs 4.2.3 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,2829 @@
1
1
  /*!
2
- * Fotorama 4.2.3 | http://fotorama.io/license/
2
+ * Fotorama 4.3.0 | http://fotorama.io/license/
3
3
  */
4
- !function(a,b,c,d){"use strict";function e(a){var b="bez_"+c.makeArray(arguments).join("_").replace(".","p");if("function"!=typeof c.easing[b]){var d=function(a,b){var c=[null,null],d=[null,null],e=[null,null],f=function(f,g){return e[g]=3*a[g],d[g]=3*(b[g]-a[g])-e[g],c[g]=1-e[g]-d[g],f*(e[g]+f*(d[g]+f*c[g]))},g=function(a){return e[0]+a*(2*d[0]+3*c[0]*a)},h=function(a){for(var b,c=a,d=0;++d<14&&(b=f(c,0)-a,!(Math.abs(b)<.001));)c-=b/g(c);return c};return function(a){return f(h(a),1)}};c.easing[b]=function(b,c,e,f,g){return f*d([a[0],a[1]],[a[2],a[3]])(c/g)+e}}return b}function f(){}function g(a,b,c){return Math.max(isNaN(b)?-1/0:b,Math.min(isNaN(c)?1/0:c,a))}function h(a){return a.match(/^m/)&&a.match(/-?\d+/g)[4]}function i(a){return lc?+h(a.css("transform")):+a.css("left").replace("px","")}function j(a){var b={};return lc?b.transform="translate3d("+a+"px,0,0)":b.left=a,b}function k(a){return{"transition-duration":a+"ms"}}function l(a,b){return+String(a).replace(b||"px","")}function m(a){return/%$/.test(a)&&l(a,"%")}function n(a){return(!!l(a)||!!l(a,"%"))&&a}function o(a,b,c,d){return(a-(d||0))*(b+(c||0))}function p(a,b,c,d){return-Math.round(a/(b+(c||0))-(d||0))}function q(a){var b=a.data();if(!b.tEnd){var c=a[0],d={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",msTransition:"MSTransitionEnd",transition:"transitionend"};c.addEventListener(d[T.prefixed("transition")],function(a){b.tProp&&a.propertyName.match(b.tProp)&&b.onEndFn.call(this)}),b.tEnd=!0}}function r(a,b,c){var d,e=a.data();e&&(e.onEndFn=function(){d||(c.call(this),d=!0)},e.tProp=b,q(a))}function s(a,b){if(a.length){lc?a.css(k(0)).data("onEndFn",f):a.stop();var c=b||i(a);return a.css(j(c)),c}}function t(a,b){return Math.round(a+(b-a)/1.5)}function u(){return u.p=u.p||("https://"===location.protocol?"https://":"http://"),u.p}function v(a){var c=b.createElement("a");return c.href=a,c}function w(a,b){if("string"!=typeof a)return a;a=v(a);var c,d;if(a.host.match(/youtube\.com/)&&a.search){if(c=a.search.split("v=")[1]){var e=c.indexOf("&");-1!==e&&(c=c.substring(0,e)),d="youtube"}}else a.host.match(/youtube\.com|youtu\.be/)?(c=a.pathname.replace(/^\/(embed\/|v\/)?/,"").replace(/\/.*/,""),d="youtube"):a.host.match(/vimeo\.com/)&&(d="vimeo",c=a.pathname.replace(/^\/(video\/)?/,"").replace(/\/.*/,""));return c&&d||!b||(c=a.href,d="custom"),c?{id:c,type:d}:!1}function x(a,b,d){var e,f,g=a.video;return"youtube"===g.type?(f=u()+"img.youtube.com/vi/"+g.id+"/default.jpg",e=f.replace(/\/default.jpg$/,"/hqdefault.jpg"),a.thumbsReady=!0):"vimeo"===g.type?c.ajax({url:u()+"vimeo.com/api/v2/video/"+g.id+".json",dataType:"jsonp",success:function(c){a.thumbsReady=!0,y(b,{img:c[0].thumbnail_large,thumb:c[0].thumbnail_small},a.i,d)}}):a.thumbsReady=!0,{img:e,thumb:f}}function y(a,b,d,e){for(var f=0,g=a.length;g>f;f++){var h=a[f];if(h.i===d&&h.thumbsReady){var i={videoReady:!0};i[uc]=i[wc]=i[vc]=!1,e.splice(f,1,c.extend({},h,i,b));break}}}function z(a){function b(a,b){var c=a.data(),e=a.children("img").eq(0),f=a.attr("href"),g=a.attr("src"),h=e.attr("src"),i=c.video,j=b?w(f,i===!0):!1;j?f=!1:j=w(i,i);var k=c.img||f||g||h,m=c.thumb||h||g||f,n=k!==m,o=l(c.width||a.attr("width")),p=l(c.height||a.attr("height")),q=l(c.thumbWidth||e.attr("width")||n||o),r=l(c.thumbHeight||e.attr("height")||n||p);return{video:j,img:k,width:o||d,height:p||d,thumb:m,thumbRatio:q/r||d}}var e=[];return a.children().each(function(){var a=c(this),d=c.extend(a.data(),{id:a.attr("id")});if(a.is("a, img"))c.extend(d,b(a,!0));else{if(a.is(":empty"))return;c.extend(d,{html:this,_html:a.html()})}e.push(d)}),e}function A(a){return 0===a.offsetWidth&&0===a.offsetHeight}function B(a){return!c.contains(b.documentElement,a)}function C(a,b,c){a()?b():setTimeout(function(){C(a,b)},c||100)}function D(a){location.replace(location.protocol+"//"+location.host+location.pathname.replace(/^\/?/,"/")+location.search+"#"+a)}function E(a,b,c){var d=a.data(),e=d.measures;if(e&&(!d.l||d.l.W!==e.width||d.l.H!==e.height||d.l.r!==e.ratio||d.l.w!==b.w||d.l.h!==b.h||d.l.m!==c)){var f=e.width,h=e.height,i=b.w/b.h,j=e.ratio>=i,k="scale-down"===c,l="contain"===c,m="cover"===c;j&&(k||l)||!j&&m?(f=g(b.w,0,k?f:1/0),h=f/e.ratio):(j&&m||!j&&(k||l))&&(h=g(b.h,0,k?h:1/0),f=h*e.ratio),a.css({width:Math.ceil(f),height:Math.ceil(h),marginLeft:Math.floor(-f/2),marginTop:Math.floor(-h/2)}),d.l={W:e.width,H:e.height,r:e.ratio,w:b.w,h:b.h,m:c}}return!0}function F(a,b){var c=a[0];c.styleSheet?c.styleSheet.cssText=b:a.html(b)}function G(a,b,c){return b===c?!1:b>=a?"left":a>=c?"right":"left right"}function H(a,b,c){if(!c)return!1;if(!isNaN(a))return a-1;for(var d,e=0,f=b.length;f>e;e++){var g=b[e];if(g.id===a){d=e;break}}return d}function I(a,b,d){d=d||{},a.each(function(){var a,e=c(this),g=e.data();g.clickOn||(g.clickOn=!0,c.extend(O(e,{onStart:function(b){a=b,(d.onStart||f).call(this,b)},onMove:d.onMove||f,onEnd:function(c){c.moved||d.tail.checked||b.call(this,a)}}),d.tail))})}function J(a,b){return'<div class="'+a+'">'+(b||"")+"</div>"}function K(a){for(var b=a.length;b;){var c=Math.floor(Math.random()*b--),d=a[b];a[b]=a[c],a[c]=d}return a}function L(a,b){var d=Math.round(b.pos),e=b.onEnd||f;"undefined"!=typeof b.overPos&&b.overPos!==b.pos&&(d=b.overPos,e=function(){L(a,c.extend({},b,{overPos:b.pos,time:Math.max(oc,b.time/2)}))});var g=c.extend(j(d),{width:b.width});lc?(a.css(c.extend(k(b.time),g)),b.time>10?r(a,"transform",e,b.time):e()):a.stop().animate(g,b.time,xc,e)}function M(a,b,d,e){a=a||c(a),b=b||c(b);var g=a[0],h=b[0],i="crossfade"===e.method,j=function(){j.done||((e.onEnd||f)(),j.done=!0)},l=k(e.time),m=k(0),n={opacity:0},o={opacity:1};d.removeClass(Ib+" "+Hb),a.addClass(Ib),b.addClass(Hb),lc?(s(a),s(b),i&&h&&a.css(c.extend(m,n)).width(),a.css(c.extend(i?l:m,o)),b.css(c.extend(l,n)),e.time>10&&(g||h)?(r(a,"opacity",j,e.time),r(b,"opacity",j,e.time)):j()):(a.stop(),b.stop(),i&&h&&a.fadeTo(0,0),a.fadeTo(i?e.time:0,1,i&&j),b.fadeTo(e.time,0,j),g&&i||h||j())}function N(a,b){a._x=b?a.touches[0].pageX:a.pageX,a._y=b?a.touches[0].pageY:a.pageY}function O(a,b){function d(a){return l=c(a.target),r.checked=i=k=o=p=!1,h||r.flow||a.touches&&a.touches.length>1||a.which>1||$&&$.type!==a.type&&ab||(o=b.select&&l.is(b.select,q))?o:(n=a.type.match("touch"),p=l.is("a, a *",q),N(a,n),$=a,_=a.type.replace(/down|start/,"move"),j=a,m=r.control,(b.onStart||f).call(q,a,{control:m,$target:l}),r.flow=h=!0,n||a.preventDefault(),void 0)}function e(a){if(!h||a.touches&&a.touches.length>1)return g(),void 0;if(_===a.type){N(a,n);var c=Math.abs(a._x-j._x),d=Math.abs(a._y-j._y),e=c-d,l=!r.stable||e>=3,m=-3>=e;k=k||l||m,n&&!r.checked?((l||m)&&(r.checked=!0,i=l),(!r.checked||i)&&a.preventDefault()):!n||i?(a.preventDefault(),(b.onMove||f).call(q,a,{touch:n})):h=!1,r.checked=r.checked||l||m}}function g(a){var c=h;r.flow=r.control=h=!1,!c||p&&!r.checked||(a&&a.preventDefault(),ab=!0,clearTimeout(bb),bb=setTimeout(function(){ab=!1},1e3),(b.onEnd||f).call(q,{moved:k,$target:l,control:m,startEvent:j,aborted:!a,touch:n}))}var h,i,j,k,l,m,n,o,p,q=a[0],r={};return q.addEventListener&&(q.addEventListener("touchstart",d),q.addEventListener("touchmove",e),q.addEventListener("touchend",g)),a.on("mousedown",d),ic.on("mousemove",e).on("mouseup",g),a.on("click","a",function(a){r.checked&&a.preventDefault()}),r}function P(a,b){function d(c){k=l=c._x,p=[[+new Date,k]],m=n=s(a,b.getPos&&b.getPos()),z=C.stable=!(m%v),!z&&c.preventDefault(),(b.onStart||f).call(A,c,{pos:m})}function e(a,b){r=B.minPos,u=B.maxPos,v=B.snap,w=a.altKey,y=!1,x=b.control,x||d(a)}function h(c,e){x&&(x=!1,d(c)),C.noSwipe||(l=c._x,p.push([(new Date).getTime(),l]),n=m-(k-l),o=G(n,r,u),r>=n?n=t(n,r):n>=u&&(n=t(n,u)),C.noMove||(a.css(j(n)),y||(y=!0,e.touch||a.addClass(Xb)),(b.onMove||f).call(A,c,{pos:n,edge:o})))}function i(d){if(!x){d.touch||a.removeClass(Xb),q=(new Date).getTime();for(var e,h,i,j,k,o,s,t,y,z=q-nc,B=null,C=oc,D=b.friction,E=p.length-1;E>=0;E--){if(e=p[E][0],h=Math.abs(e-z),null===B||i>h)B=e,j=p[E][1];else if(B===z||h>i)break;i=h}s=g(n,r,u);var F=j-l,G=F>=0,H=q-B,I=H>nc,J=!I&&n!==m&&s===n;v&&(s=g(Math[J?G?"floor":"ceil":"round"](n/v)*v,r,u),r=u=s),J&&(v||s===n)&&(y=-(F/H),C*=g(Math.abs(y),b.timeLow,b.timeHigh),k=Math.round(n+y*C/D),v||(s=k),(!G&&k>u||G&&r>k)&&(o=G?r:u,t=k-o,v||(s=o),t=g(s+.03*t,o-50,o+50),C=Math.abs((n-t)/(y/D)))),C*=w?10:1,(b.onEnd||f).call(A,c.extend(d,{pos:n,newPos:s,overPos:t,time:C,moved:I&&v||d.moved}))}}var k,l,m,n,o,p,q,r,u,v,w,x,y,z,A=a[0],B=a.data(),C={};return C=c.extend(O(b.$wrap,{onStart:e,onMove:h,onEnd:i,select:b.select,control:b.control}),C)}function Q(a){R(!0),yc.appendTo(a),db=0,zc(),cb=setInterval(zc,200)}function R(a){a||yc.detach(),clearInterval(cb)}var S={},T=function(a,b,c){function d(a){r.cssText=a}function e(a,b){return typeof a===b}function f(a,b){return!!~(""+a).indexOf(b)}function g(a,b){for(var d in a){var e=a[d];if(!f(e,"-")&&r[e]!==c)return"pfx"==b?e:!0}return!1}function h(a,b,d){for(var f in a){var g=b[a[f]];if(g!==c)return d===!1?a[f]:e(g,"function")?g.bind(d||b):g}return!1}function i(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),f=(a+" "+u.join(d+" ")+d).split(" ");return e(b,"string")||e(b,"undefined")?g(f,b):(f=(a+" "+v.join(d+" ")+d).split(" "),h(f,b,c))}var j,k,l,m="2.6.2",n={},o=b.documentElement,p="modernizr",q=b.createElement(p),r=q.style,s=({}.toString," -webkit- -moz- -o- -ms- ".split(" ")),t="Webkit Moz O ms",u=t.split(" "),v=t.toLowerCase().split(" "),w={},x=[],y=x.slice,z=function(a,c,d,e){var f,g,h,i,j=b.createElement("div"),k=b.body,l=k||b.createElement("body");if(parseInt(d,10))for(;d--;)h=b.createElement("div"),h.id=e?e[d]:p+(d+1),j.appendChild(h);return f=["&#173;",'<style id="s',p,'">',a,"</style>"].join(""),j.id=p,(k?j:l).innerHTML+=f,l.appendChild(j),k||(l.style.background="",l.style.overflow="hidden",i=o.style.overflow,o.style.overflow="hidden",o.appendChild(l)),g=c(j,a),k?j.parentNode.removeChild(j):(l.parentNode.removeChild(l),o.style.overflow=i),!!g},A={}.hasOwnProperty;l=e(A,"undefined")||e(A.call,"undefined")?function(a,b){return b in a&&e(a.constructor.prototype[b],"undefined")}:function(a,b){return A.call(a,b)},Function.prototype.bind||(Function.prototype.bind=function(a){var b=this;if("function"!=typeof b)throw new TypeError;var c=y.call(arguments,1),d=function(){if(this instanceof d){var e=function(){};e.prototype=b.prototype;var f=new e,g=b.apply(f,c.concat(y.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(y.call(arguments)))};return d}),w.csstransforms3d=function(){var a=!!i("perspective");return a};for(var B in w)l(w,B)&&(k=B.toLowerCase(),n[k]=w[B](),x.push((n[k]?"":"no-")+k));return n.addTest=function(a,b){if("object"==typeof a)for(var d in a)l(a,d)&&n.addTest(d,a[d]);else{if(a=a.toLowerCase(),n[a]!==c)return n;b="function"==typeof b?b():b,"undefined"!=typeof enableClasses&&enableClasses&&(o.className+=" "+(b?"":"no-")+a),n[a]=b}return n},d(""),q=j=null,n._version=m,n._prefixes=s,n._domPrefixes=v,n._cssomPrefixes=u,n.testProp=function(a){return g([a])},n.testAllProps=i,n.testStyles=z,n.prefixed=function(a,b,c){return b?i(a,b,c):i(a,"pfx")},n}(a,b),U={ok:!1,is:function(){return!1},request:function(){},cancel:function(){},event:"",prefix:""},V="webkit moz o ms khtml".split(" ");if("undefined"!=typeof b.cancelFullScreen)U.ok=!0;else for(var W=0,X=V.length;X>W;W++)if(U.prefix=V[W],"undefined"!=typeof b[U.prefix+"CancelFullScreen"]){U.ok=!0;break}U.ok&&(U.event=U.prefix+"fullscreenchange",U.is=function(){switch(this.prefix){case"":return b.fullScreen;case"webkit":return b.webkitIsFullScreen;default:return b[this.prefix+"FullScreen"]}},U.request=function(a){return""===this.prefix?a.requestFullScreen():a[this.prefix+"RequestFullScreen"]()},U.cancel=function(){return""===this.prefix?b.cancelFullScreen():b[this.prefix+"CancelFullScreen"]()});var Y,Z,$,_,ab,bb,cb,db,eb="fotorama",fb="fullscreen",gb=eb+"__wrap",hb=gb+"--css3",ib=gb+"--video",jb=gb+"--fade",kb=gb+"--slide",lb=gb+"--no-controls",mb=eb+"__stage",nb=mb+"__frame",ob=nb+"--video",pb=mb+"__shaft",qb=mb+"--only-active",rb=eb+"__grab",sb=eb+"__pointer",tb=eb+"__arr",ub=tb+"--disabled",vb=tb+"--prev",wb=tb+"--next",xb=tb+"__arr",yb=eb+"__nav",zb=yb+"-wrap",Ab=yb+"__shaft",Bb=yb+"--dots",Cb=yb+"--thumbs",Db=yb+"__frame",Eb=Db+"--dot",Fb=Db+"--thumb",Gb=eb+"__fade",Hb=Gb+"-front",Ib=Gb+"-rear",Jb=eb+"__shadow",Kb=Jb+"s",Lb=Kb+"--left",Mb=Kb+"--right",Nb=eb+"__active",Ob=eb+"__select",Pb=eb+"--hidden",Qb=eb+"--fullscreen",Rb=eb+"__fullscreen-icon",Sb=eb+"__error",Tb=eb+"__loading",Ub=eb+"__loaded",Vb=Ub+"--full",Wb=Ub+"--img",Xb=eb+"__grabbing",Yb=eb+"__img",Zb=Yb+"--full",$b=eb+"__dot",_b=eb+"__thumb",ac=_b+"-border",bc=eb+"__html",cc=eb+"__video",dc=cc+"-play",ec=cc+"-close",fc=eb+"__caption",gc=eb+"__oooo",hc=c(a),ic=c(b),jc="CSS1Compat"===b.compatMode,kc="quirks"===location.hash.replace("#",""),lc=T.csstransforms3d&&!kc,mc=U.ok,nc=250,oc=300,pc=5e3,qc=2,rc=64,sc=500,tc=333,uc="$stageFrame",vc="$navDotFrame",wc="$navThumbFrame",xc=e([.1,0,.25,1]),yc=c(J("",J(gc))),zc=function(){yc.attr("class",gc+" "+gc+"--"+db),db++,db>4&&(db=0)};jQuery.Fotorama=function(e,f){function h(){c.each(Rc,function(a,b){if(!b.i){b.i=yd++;var c=w(b.video,!0);if(c){var d={};b.video=c,b.img||b.thumb?b.thumbsReady=!0:d=x(b,Rc,td),y(Rc,{img:d.img,thumb:d.thumb},b.i,td)}}})}function i(a){a!==i.f&&(a?(e.html("").addClass(wd).append(Cd).before(Ad).before(Bd),c.Fotorama.size++):(Cd.detach(),Ad.detach(),Bd.detach(),e.html(zd.urtext).removeClass(wd),c.Fotorama.size--),i.f=a)}function q(){Rc=td.data=Rc||z(e),Sc=td.size=Rc.length,!Qc.ok&&f.shuffle&&K(Rc),h(),Wd=N(Wd),Sc&&i(!0)}function r(){Zd.noMove=2>Sc||Uc||gd,Zd.noSwipe=!f.swipe||Uc,Ed.toggleClass(rb,!Zd.noMove&&!Zd.noSwipe)}function t(a){a===!0&&(a=""),f.autoplay=Math.max(+a||pc,1.5*jd)}function u(a){return a?"add":"remove"}function v(){gd="crossfade"===f.transition||"dissolve"===f.transition,bd=f.loop&&(Sc>2||gd),jd=+f.transitionDuration||oc;var a={add:[],remove:[]};Sc>1?(cd=f.nav,dd="top"===f.navPosition,a.remove.push(Ob),Id.toggle(f.arrows),Xb()):(cd=!1,Id.hide()),f.autoplay&&t(f.autoplay),hd=l(f.thumbWidth)||rc,id=l(f.thumbHeight)||rc,r(),Cc(f,!0),"thumbs"===cd?(bb(Sc,"navThumb"),Tc=Nd,sd=wc,F(Ad,c.Fotorama.jst.style({w:hd,h:id,m:qc,s:vd,q:!jc})),Kd.addClass(Cb).removeClass(Bb)):"dots"===cd?(bb(Sc,"navDot"),Tc=Md,sd=vc,Kd.addClass(Bb).removeClass(Cb)):(cd=!1,Kd.removeClass(Cb+" "+Bb)),cd&&(dd?Jd.insertBefore(Dd):Jd.insertAfter(Dd),Hb.nav=!1,Hb(Tc,Ld,"nav")),ed=f.allowFullScreen,e.insertAfter(Bd).removeClass(Pb),ed?(Rd.appendTo(Dd),fd=mc&&"native"===ed):(Rd.detach(),fd=!1),a[u(gd)].push(jb),a[u(!gd)].push(kb),R(),Cd.addClass(a.add.join(" ")).removeClass(a.remove.join(" ")),Xd=c.extend({},f)}function A(a){return 0>a?(Sc+a%Sc)%Sc:a>=Sc?a%Sc:a}function N(a){return g(a,0,Sc-1)}function O(a){return bd?A(a):N(a)}function S(a){return a>0||bd?a-1:!1}function T(a){return Sc-1>a||bd?a+1:!1}function V(){Od.minPos=bd?-1/0:-o(Sc-1,Yd.w,qc,Xc),Od.maxPos=bd?1/0:-o(0,Yd.w,qc,Xc),Od.snap=Yd.w+qc}function W(){Pd.minPos=Math.min(0,Yd.w-Ld.width()),Pd.maxPos=0,$d.noMove=Pd.minPos===Pd.maxPos,Ld.toggleClass(rb,!$d.noMove)}function X(a,b,d){if("number"==typeof a){a=new Array(a);var e=!0}return c.each(a,function(a,c){if(e&&(c=a),"number"==typeof c){var f=Rc[A(c)],g="$"+b+"Frame",h=f[g];d.call(this,a,c,f,h,g,h&&h.data())}})}function $(a,b,c,d){(!kd||"*"===kd&&d===ad)&&(a=n(f.width)||n(a)||sc,b=n(f.height)||n(b)||tc,td.resize({width:a,ratio:f.ratio||c||a/b},0,d===ad?!0:"*"))}function _(a,b,d,e,g){X(a,b,function(a,h,i,j,k,l){function m(a){var b=A(h);Dc(a,{index:b,src:v,frame:Rc[b]})}function n(){s.remove(),c.Fotorama.cache[v]="error",i.html&&"stage"===b||!w||w===v?(v&&!i.html?(j.trigger("f:error").removeClass(Tb).addClass(Sb),m("error")):"stage"===b&&(j.trigger("f:load").removeClass(Tb+" "+Sb).addClass(Ub),m("load"),$()),l.state="error",!(Sc>1)||i.html||i.deleted||i.video||q||(i.deleted=!0,td.splice(h,1))):(i[u]=v=w,_([h],b,d,e,!0))}function o(){var a=r.width,g=r.height,k=a/g;t.measures={width:a,height:g,ratio:k},$(a,g,k,h),s.off("load error").addClass(Yb+(q?" "+Zb:"")).prependTo(j),E(s,d||Yd,e||i.fit||f.fit),c.Fotorama.cache[v]="loaded",l.state="loaded",setTimeout(function(){j.trigger("f:load").removeClass(Tb+" "+Sb).addClass(Ub+" "+(q?Vb:Wb)),"stage"===b&&m("load")},5)}function p(){C(function(){return!rd},function(){o()})}if(j){var q=td.fullScreen&&i.full&&!l.$full&&"stage"===b;if(!l.$img||g||q){var r=new Image,s=c(r),t=s.data();l[q?"$full":"$img"]=s;var u="stage"===b?q?"full":"img":"thumb",v=i[u],w=q?null:i["stage"===b?"thumb":"img"];if("navThumb"===b&&(j=l.$wrap),!v)return n(),void 0;c.Fotorama.cache[v]?function x(){"error"===c.Fotorama.cache[v]?n():"loaded"===c.Fotorama.cache[v]?setTimeout(p,0):setTimeout(x,100)}():(c.Fotorama.cache[v]="*",s.on("load",p).on("error",n)),r.src=v}}})}function ab(){var a=td.activeFrame[uc];a&&!a.data().state&&(Q(a),a.on("f:load f:error",function(){a.off("f:load f:error"),R()}))}function bb(a,b){X(a,b,function(a,d,e,g,h,i){g||(g=e[h]=Cd[h].clone(),i=g.data(),i.data=e,"stage"===b?(e.html&&c('<div class="'+bc+'"></div>').append(c(e.html).removeAttr("id").html(e._html)).appendTo(g),f.captions&&e.caption&&c('<div class="'+fc+'"></div>').append(e.caption).appendTo(g),e.video&&g.addClass(ob).append(Td.clone()),Fd=Fd.add(g)):"navDot"===b?Md=Md.add(g):"navThumb"===b&&(i.$wrap=g.children(":first"),Nd=Nd.add(g),e.video&&g.append(Td.clone())))})}function cb(a,b,c){return a&&a.length&&E(a,b,c)}function db(a){X(a,"stage",function(a,b,d,e,g,h){if(e){ae[uc].push(e.css(c.extend({left:gd?0:o(b,Yd.w,qc,Xc)},gd&&k(0)))),B(e[0])&&(e.appendTo(Ed),Kc(d.$video));var i=d.fit||f.fit;cb(h.$img,Yd,i),cb(h.$full,Yd,i)}})}function Gb(a,b){if("thumbs"===cd&&!isNaN(a)){var d=-a,e=-a+Yd.w;Nd.each(function(){var a=c(this),f=a.data(),g=f.eq,h={h:id},i="cover";h.w=f.w,f.l+f.w<d||f.l>e||cb(f.$img,h,i)||b&&_([g],"navThumb",h,i)})}}function Hb(a,b,d){if(!Hb[d]){var e="nav"===d&&"thumbs"===cd,f=0;b.append(a.filter(function(){for(var a,b=c(this),d=b.data(),e=0,f=Rc.length;f>e;e++)if(d.data===Rc[e]){a=!0,d.eq=e;break}return a||b.remove()&&!1}).sort(function(a,b){return c(a).data().eq-c(b).data().eq}).each(function(){if(e){var a=c(this),b=a.data(),d=Math.round(id*b.data.thumbRatio||hd);b.l=f,b.w=d,a.css({width:d}),f+=d+qc}})),Hb[d]=!0}}function Ib(a){return a-be>Yd.w/3}function Jb(a){return!(bd||Wd+a&&Wd-Sc+a||Uc)}function Xb(){Id.each(function(a){c(this).toggleClass(ub,Jb(a))})}function cc(a){return a.l+a.w/2}function gc(a){var b=td.activeFrame[sd].data();L(Qd,{time:.9*a,pos:b.l,width:b.w-2*qc})}function kc(a){if(Rc[a.guessIndex][sd]){var b=g(a.coo-cc(Rc[a.guessIndex][sd].data()),Pd.minPos,Pd.maxPos),c=.9*a.time;L(Ld,{time:c,pos:b,onEnd:function(){Gb(b,!0)}}),c&&Gb(b),Jc(Kd,G(b,Pd.minPos,Pd.maxPos))}}function xc(){yc(sd),_d[sd].push(td.activeFrame[sd].addClass(Nb))}function yc(a){for(var b=_d[a];b.length;)b.shift().removeClass(Nb)}function zc(a){for(var b=ae[a];b.length;){var c=b.shift();td.activeFrame[a]!==c&&c.detach()}}function Bc(){Xc=Yc=Wd;var a=td.activeFrame,b=a[uc];b&&(yc(uc),_d[uc].push(b.addClass(Nb)),s(Ed.css(j(0))),zc(uc),db(Wc),V(),W())}function Cc(a,b){a&&c.extend(Yd,{width:a.width||Yd.width,height:a.height,minWidth:a.minWidth,maxWidth:a.maxWidth,minHeight:a.minHeight,maxHeight:a.maxHeight,ratio:function(a){if(a){var b=Number(a);return isNaN(b)?(b=a.split("/"),Number(b[0]/b[1])||d):b}}(a.ratio)})&&!b&&c.extend(f,{width:Yd.width,height:Yd.height,minWidth:Yd.minWidth,maxWidth:Yd.maxWidth,minHeight:Yd.minHeight,maxHeight:Yd.maxHeight,ratio:Yd.ratio})}function Dc(a,b){e.trigger(eb+":"+a,[td,b])}function Ec(){clearTimeout(Fc.t),rd=1,f.stopAutoplayOnTouch?td.stopAutoplay():od=!0}function Fc(){Fc.t=setTimeout(function(){rd=0},oc+nc)}function Gc(){od=!(!Uc&&!pd)}function Hc(){if(clearTimeout(Hc.t),!f.autoplay||od)return td.autoplay&&(td.autoplay=!1,Dc("stopautoplay")),void 0;td.autoplay||(td.autoplay=!0,Dc("startautoplay"));var a=Wd;Hc.t=setTimeout(function(){var b=td.activeFrame[uc].data();C(function(){return b.state||a!==Wd},function(){od||a!==Wd||td.show(bd?">":A(Wd+1))})},f.autoplay)}function Ic(){td.fullScreen&&(td.fullScreen=!1,mc&&U.cancel(xd),Z.removeClass(fb),e.removeClass(Qb).insertAfter(Bd),Dc("fullscreenexit"),Yd=c.extend({},qd),Kc(Uc,!0,!0),td.resize(),_(Wc,"stage"),hc.scrollLeft(md).scrollTop(ld))}function Jc(a,b){a.removeClass(Lb+" "+Mb),b&&!Uc&&a.addClass(b.replace(/^|\s/g," "+Kb+"--"))}function Kc(a,b,c){b&&(Cd.removeClass(ib),Uc=!1,r()),a&&a!==Uc&&(a.remove(),Dc("unloadvideo")),c&&(Gc(),Hc())}function Lc(a){Cd.toggleClass(lb,a)}function Mc(a){if(!Zd.flow){var b=a?a.pageX:Mc.x,c=!Jb(Ib(b))&&f.click;Mc.p===c||!gd&&f.swipe||!Dd.toggleClass(sb,c)||(Mc.p=c,Mc.x=b)}}function Nc(a,b){var d=a.target,e=c(d);e.hasClass(dc)?td.playVideo():d===Sd?td[(td.fullScreen?"cancel":"request")+"FullScreen"]():Uc?d===Vd&&Kc(Uc,!0,!0):b&&f.arrows?Lc():f.click&&td.show({index:a.shiftKey||!Ib(a._x)?"<":">",slow:a.altKey,direct:!0})}function Oc(a,b){var d=c(this).data().eq;td.show({index:d,slow:a.altKey,direct:!0,coo:a._x-Kd.offset().left,time:b})}function Pc(){q(),v(),Qc.ok||(f.hash&&location.hash&&(ad=H(location.hash.replace(/^#/,""),Rc,0===ud)),Wd=Xc=Yc=Zc=ad=O(ad)||0),Sc?(Uc&&Kc(Uc,!0),td.show({index:Wd,time:0}),td.resize()):td.destroy()}function Qc(){Qc.ok||(Qc.ok=!0,Dc("ready"))}Y=Y||c("html"),Z=Z||c("body");var Rc,Sc,Tc,Uc,Vc,Wc,Xc,Yc,Zc,$c,_c,ad,bd,cd,dd,ed,fd,gd,hd,id,jd,kd,ld,md,nd,od,pd,qd,rd,sd,td=this,ud=Ac,vd=+new Date,wd=eb+vd,xd=e[0],yd=1,zd=e.data(),Ad=c("<style></style>"),Bd=c(J(Pb)),Cd=c(J(gb)),Dd=c(J(mb)).appendTo(Cd),Ed=(Dd[0],c(J(pb)).appendTo(Dd)),Fd=c(),Gd=c(J(tb+" "+vb,J(xb))),Hd=c(J(tb+" "+wb,J(xb))),Id=Gd.add(Hd).appendTo(Dd),Jd=c(J(zb)),Kd=c(J(yb)).appendTo(Jd),Ld=c(J(Ab)).appendTo(Kd),Md=c(),Nd=c(),Od=Ed.data(),Pd=Ld.data(),Qd=c(J(ac)).appendTo(Ld),Rd=c(J(Rb)),Sd=Rd[0],Td=c(J(dc)),Ud=c(J(ec)).appendTo(Dd),Vd=Ud[0],Wd=!1,Xd={},Yd={},Zd={},$d={},_d={},ae={},be=0;Cd[uc]=c(J(nb)),Cd[wc]=c(J(Db+" "+Fb,J(_b))),Cd[vc]=c(J(Db+" "+Eb,J($b))),_d[uc]=[],_d[wc]=[],_d[vc]=[],ae[uc]=[],lc&&Cd.addClass(hb),zd.fotorama=this,td.options=f,Ac++,td.startAutoplay=function(a){return td.autoplay?this:(od=pd=!1,t(a||f.autoplay),Hc(),this)},td.stopAutoplay=function(){return td.autoplay&&(od=pd=!0,Hc()),this},td.show=function(a){function b(){ab(),_(Wc,"stage"),Bc(),Dc("showend",a.direct),Mc(),Gc(),Hc()}var c,d,e=jd;if("object"!=typeof a?(c=a,a={}):(c=a.index,e="number"==typeof a.time?a.time:e,d=a.overPos),a.slow&&(e*=10),c=">"===c?Yc+1:"<"===c?Yc-1:"<<"===c?0:">>"===c?Sc-1:c,c=isNaN(c)?H(c,Rc,!0):c,c="undefined"==typeof c?Wd||0:c,td.activeIndex=Wd=O(c),$c=S(Wd),_c=T(Wd),Wc=[Wd,$c,_c],Yc=bd?c:Wd,td.activeFrame=Vc=Rc[Wd],Kc(!1,Vc.i!==Rc[A(Xc)].i),bb([Wd,$c,_c],"stage"),db([Yc]),Dc("show",a.direct),gd){var h=Vc[uc],i=Wd!==Zc?Rc[Zc][uc]:null;M(h,i,Fd,{time:e,method:f.transition,onEnd:b})}else L(Ed,{pos:-o(Yc,Yd.w,qc,Xc),overPos:d,time:e,onEnd:b});if(Xb(),cd){xc();var j=N(Wd+g(Yc-Zc,-1,1)),k="undefined"==typeof a.coo;(k||j!==Wd)&&kc({time:e,coo:k?Yd.w/2:a.coo,guessIndex:k?Wd:j}),"thumbs"===cd&&gc(e)}return nd="undefined"!=typeof Zc&&Zc!==Wd,Zc=Wd,f.hash&&nd&&!td.eq&&D(Vc.id||Wd+1),this},td.requestFullScreen=function(){return ed&&!td.fullScreen&&(ld=hc.scrollTop(),md=hc.scrollLeft(),hc.scrollTop(0).scrollLeft(0),qd=c.extend({},Yd),e.addClass(Qb).appendTo(Z.addClass(fb)),Kc(Uc,!0,!0),td.fullScreen=!0,fd&&U.request(xd),td.resize(),_(Wc,"stage"),Dc("fullscreenenter")),this},td.cancelFullScreen=function(){return fd&&U.is()?U.cancel(b):Ic(),this},b.addEventListener&&b.addEventListener(U.event,function(){U.is()||Uc||Ic()}),ic.on("keydown",function(a){Uc&&27===a.keyCode?(a.preventDefault(),Kc(Uc,!0,!0)):(td.fullScreen||f.keyboard&&!ud)&&(27===a.keyCode?(a.preventDefault(),td.cancelFullScreen()):39===a.keyCode||40===a.keyCode&&td.fullScreen?(a.preventDefault(),td.show({index:">",slow:a.altKey,direct:!0})):(37===a.keyCode||38===a.keyCode&&td.fullScreen)&&(a.preventDefault(),td.show({index:"<",slow:a.altKey,direct:!0})))}),ud||ic.on("keydown","textarea, input, select",function(a){td.fullScreen||a.stopPropagation()}),td.resize=function(b){if(!Rc)return this;Cc(td.fullScreen?{width:"100%",maxWidth:null,minWidth:null,height:"100%",maxHeight:null,minHeight:null}:b,td.fullScreen);var c=arguments[1]||0,d=arguments[2],e=Yd.width,f=Yd.height,h=Yd.ratio,i=a.innerHeight-(cd?Kd.height():0);return n(e)&&(Cd.css({width:e,minWidth:Yd.minWidth,maxWidth:Yd.maxWidth}),e=Yd.w=Cd.width(),f=m(f)/100*i||l(f),f=f||h&&e/h,f&&(e=Math.round(e),f=Yd.h=Math.round(g(f,m(Yd.minHeight)/100*i||l(Yd.minHeight),m(Yd.maxHeight)/100*i||l(Yd.maxHeight))),Bc(),Dd.addClass(qb).stop().animate({width:e,height:f},c,function(){Dd.removeClass(qb)}),cd&&(Kd.stop().animate({width:e},c).css({left:0}),kc({guessIndex:Wd,time:c,coo:Yd.w/2}),"thumbs"===cd&&Hb.nav&&gc(c)),kd=d||!0,Qc())),be=Dd.offset().left,this},td.setOptions=function(a){return c.extend(f,a),Pc(),this},td.shuffle=function(){return Rc&&K(Rc)&&Pc(),this},td.destroy=function(){return td.cancelFullScreen(),td.stopAutoplay(),i(!1),Rc=td.data=null,this},td.playVideo=function(){var a=td.activeFrame,b=a.video,d=Wd;return"object"==typeof b&&a.videoReady&&(fd&&td.fullScreen&&td.cancelFullScreen(),C(function(){return!U.is()||d!==Wd},function(){d===Wd&&(a.$video=a.$video||c(c.Fotorama.jst.video(b)),a.$video.appendTo(a[uc]),Cd.addClass(ib),Uc=a.$video,r(),Dc("loadvideo"))})),this},td.stopVideo=function(){return Kc(Uc,!0,!0),this},Cd.hover(function(){Lc(!1)},function(){Lc(!0)}),Dd.on("mousemove",Mc),Zd=P(Ed,{onStart:Ec,onMove:function(a,b){Jc(Dd,b.edge)},onEnd:function(a){if(Jc(Dd),Fc(),a.moved||a.touch&&a.pos!==a.newPos){var b=p(a.newPos,Yd.w,qc,Xc);td.show({index:b,time:a.time,overPos:a.overPos,direct:!0})}else a.aborted||Nc(a.startEvent,a.touch)},getPos:function(){return-o(Yc,Yd.w,qc,Xc)},timeLow:1,timeHigh:1,friction:2,select:"."+Ob+", ."+Ob+" *",$wrap:Dd}),$d=P(Ld,{onStart:Ec,onMove:function(a,b){Jc(Kd,b.edge)},onEnd:function(a){function b(){Gc(),Hc(),Gb(a.newPos,!0)}if(Fc(),a.moved)a.pos!==a.newPos?(L(Ld,{time:a.time,pos:a.newPos,overPos:a.overPos,onEnd:b}),Gb(a.newPos),Jc(Kd,G(a.newPos,Pd.minPos,Pd.maxPos))):b();else{var c=a.$target.closest("."+Db,Ld)[0];c&&Oc.call(c,a.startEvent)}},timeLow:.5,timeHigh:2,friction:5,$wrap:Kd}),I(Id,function(a){a.preventDefault(),Uc?Kc(Uc,!0,!0):(Fc(),td.show({index:Id.index(this)?">":"<",slow:a.altKey,direct:!0}))},{onStart:function(){Ec(),Zd.control=!0},tail:Zd}),c.each("load push pop shift unshift reverse sort splice".split(" "),function(a,b){td[b]=function(){return Rc=Rc||[],"load"!==b?Array.prototype[b].apply(Rc,arguments):arguments[0]&&"object"==typeof arguments[0]&&arguments[0].length&&(Rc=arguments[0]),Pc(),td}}),hc.on("resize",td.resize),Pc()},c.fn.fotorama=function(a){return this.each(function(){var b=this,d=c(this),e=d.data(),f=e.fotorama;f?f.setOptions(a):C(function(){return!A(b)},function(){e.urtext=d.html(),new c.Fotorama(d,c.extend({},{width:null,minWidth:null,maxWidth:null,height:null,minHeight:null,maxHeight:null,ratio:null,nav:"dots",navPosition:"bottom",thumbWidth:rc,thumbHeight:rc,arrows:!0,click:!0,swipe:!0,allowFullScreen:!1,fit:"contain",transition:"slide",transitionDuration:oc,captions:!0,hash:!1,autoplay:!1,stopAutoplayOnTouch:!0,keyboard:!1,loop:!1,shuffle:!1},a,e))})})},c.Fotorama.cache={};var Ac=0;c.Fotorama.size=0,c(function(){c("."+eb+':not([data-auto="false"])').fotorama()}),c=c||{},c.Fotorama=c.Fotorama||{},c.Fotorama.jst=c.Fotorama.jst||{},c.Fotorama.jst.style=function(a){var b,c="";return S.escape,c+=".fotorama"+(null==(b=a.s)?"":b)+" .fotorama__nav--thumbs .fotorama__nav__frame{\npadding:"+(null==(b=a.m)?"":b)+"px;\npadding-left:0;\nheight:"+(null==(b=a.h)?"":b)+"px}\n.fotorama"+(null==(b=a.s)?"":b)+" .fotorama__nav--thumbs .fotorama__nav__frame:last-child{\npadding-right:0}\n.fotorama"+(null==(b=a.s)?"":b)+" .fotorama__thumb-border{\nheight:"+(null==(b=a.h-a.m*(a.q?0:2))?"":b)+"px;\nborder-width:"+(null==(b=a.m)?"":b)+"px;\nmargin-top:"+(null==(b=a.m)?"":b)+"px}"},c.Fotorama.jst.video=function(a){function b(){c+=d.call(arguments,"")}var c="",d=(S.escape,Array.prototype.join);return c+='<div class="fotorama__video"><iframe src="',b("youtube"==a.type?"http://youtube.com/embed/"+a.id+"?autoplay=1":"vimeo"==a.type?"http://player.vimeo.com/video/"+a.id+"?autoplay=1&amp;badge=0":a.id),c+='" frameborder="0" allowfullscreen></iframe></div>'}}(window,document,jQuery);
4
+ (function (window, document, $, undefined) {
5
+ "use strict";
6
+ // My Underscore :-)
7
+ var _ = {};
8
+ /* Modernizr 2.6.2 (Custom Build) | MIT & BSD
9
+ * Build: http://modernizr.com/download/#-csstransforms3d-prefixed-teststyles-testprop-testallprops-prefixes-domprefixes
10
+ */
11
+
12
+ var Modernizr = (function (window, document, undefined) {
13
+
14
+ var version = '2.6.2',
15
+
16
+ Modernizr = {},
17
+
18
+ docElement = document.documentElement,
19
+
20
+ mod = 'modernizr',
21
+ modElem = document.createElement(mod),
22
+ mStyle = modElem.style,
23
+
24
+ inputElem,
25
+
26
+ toString = {}.toString,
27
+
28
+ prefixes = ' -webkit- -moz- -o- -ms- '.split(' '),
29
+
30
+ omPrefixes = 'Webkit Moz O ms',
31
+
32
+ cssomPrefixes = omPrefixes.split(' '),
33
+
34
+ domPrefixes = omPrefixes.toLowerCase().split(' '),
35
+
36
+ tests = {},
37
+ inputs = {},
38
+ attrs = {},
39
+
40
+ classes = [],
41
+
42
+ slice = classes.slice,
43
+
44
+ featureName,
45
+
46
+ injectElementWithStyles = function (rule, callback, nodes, testnames) {
47
+
48
+ var style, ret, node, docOverflow,
49
+ div = document.createElement('div'),
50
+ body = document.body,
51
+ fakeBody = body || document.createElement('body');
52
+
53
+ if (parseInt(nodes, 10)) {
54
+ while (nodes--) {
55
+ node = document.createElement('div');
56
+ node.id = testnames ? testnames[nodes] : mod + (nodes + 1);
57
+ div.appendChild(node);
58
+ }
59
+ }
60
+
61
+ style = ['&#173;', '<style id="s', mod, '">', rule, '</style>'].join('');
62
+ div.id = mod;
63
+ (body ? div : fakeBody).innerHTML += style;
64
+ fakeBody.appendChild(div);
65
+ if (!body) {
66
+ fakeBody.style.background = '';
67
+ fakeBody.style.overflow = 'hidden';
68
+ docOverflow = docElement.style.overflow;
69
+ docElement.style.overflow = 'hidden';
70
+ docElement.appendChild(fakeBody);
71
+ }
72
+
73
+ ret = callback(div, rule);
74
+ if (!body) {
75
+ fakeBody.parentNode.removeChild(fakeBody);
76
+ docElement.style.overflow = docOverflow;
77
+ } else {
78
+ div.parentNode.removeChild(div);
79
+ }
80
+
81
+ return !!ret;
82
+
83
+ },
84
+ _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp;
85
+
86
+ if (!is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined')) {
87
+ hasOwnProp = function (object, property) {
88
+ return _hasOwnProperty.call(object, property);
89
+ };
90
+ }
91
+ else {
92
+ hasOwnProp = function (object, property) {
93
+ return ((property in object) && is(object.constructor.prototype[property], 'undefined'));
94
+ };
95
+ }
96
+
97
+
98
+ if (!Function.prototype.bind) {
99
+ Function.prototype.bind = function bind (that) {
100
+
101
+ var target = this;
102
+
103
+ if (typeof target != "function") {
104
+ throw new TypeError();
105
+ }
106
+
107
+ var args = slice.call(arguments, 1),
108
+ bound = function () {
109
+
110
+ if (this instanceof bound) {
111
+
112
+ var F = function () {
113
+ };
114
+ F.prototype = target.prototype;
115
+ var self = new F();
116
+
117
+ var result = target.apply(
118
+ self,
119
+ args.concat(slice.call(arguments))
120
+ );
121
+ if (Object(result) === result) {
122
+ return result;
123
+ }
124
+ return self;
125
+
126
+ } else {
127
+
128
+ return target.apply(
129
+ that,
130
+ args.concat(slice.call(arguments))
131
+ );
132
+
133
+ }
134
+
135
+ };
136
+
137
+ return bound;
138
+ };
139
+ }
140
+
141
+ function setCss (str) {
142
+ mStyle.cssText = str;
143
+ }
144
+
145
+ function setCssAll (str1, str2) {
146
+ return setCss(prefixes.join(str1 + ';') + ( str2 || '' ));
147
+ }
148
+
149
+ function is (obj, type) {
150
+ return typeof obj === type;
151
+ }
152
+
153
+ function contains (str, substr) {
154
+ return !!~('' + str).indexOf(substr);
155
+ }
156
+
157
+ function testProps (props, prefixed) {
158
+ for (var i in props) {
159
+ var prop = props[i];
160
+ if (!contains(prop, "-") && mStyle[prop] !== undefined) {
161
+ return prefixed == 'pfx' ? prop : true;
162
+ }
163
+ }
164
+ return false;
165
+ }
166
+
167
+ function testDOMProps (props, obj, elem) {
168
+ for (var i in props) {
169
+ var item = obj[props[i]];
170
+ if (item !== undefined) {
171
+
172
+ if (elem === false) return props[i];
173
+
174
+ if (is(item, 'function')) {
175
+ return item.bind(elem || obj);
176
+ }
177
+
178
+ return item;
179
+ }
180
+ }
181
+ return false;
182
+ }
183
+
184
+ function testPropsAll (prop, prefixed, elem) {
185
+
186
+ var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1),
187
+ props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' ');
188
+
189
+ if (is(prefixed, "string") || is(prefixed, "undefined")) {
190
+ return testProps(props, prefixed);
191
+
192
+ } else {
193
+ props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' ');
194
+ return testDOMProps(props, prefixed, elem);
195
+ }
196
+ }
197
+
198
+ tests['csstransforms3d'] = function () {
199
+
200
+ var ret = !!testPropsAll('perspective');
201
+
202
+ // Chrome fails that test, ignore
203
+ // if (ret && 'webkitPerspective' in docElement.style) {
204
+ //
205
+ // injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function (node, rule) {
206
+ // ret = node.offsetLeft === 9 && node.offsetHeight === 3;
207
+ // });
208
+ // }
209
+ return ret;
210
+ };
211
+
212
+ for (var feature in tests) {
213
+ if (hasOwnProp(tests, feature)) {
214
+ featureName = feature.toLowerCase();
215
+ Modernizr[featureName] = tests[feature]();
216
+
217
+ classes.push((Modernizr[featureName] ? '' : 'no-') + featureName);
218
+ }
219
+ }
220
+
221
+ Modernizr.addTest = function (feature, test) {
222
+ if (typeof feature == 'object') {
223
+ for (var key in feature) {
224
+ if (hasOwnProp(feature, key)) {
225
+ Modernizr.addTest(key, feature[ key ]);
226
+ }
227
+ }
228
+ } else {
229
+
230
+ feature = feature.toLowerCase();
231
+
232
+ if (Modernizr[feature] !== undefined) {
233
+ return Modernizr;
234
+ }
235
+
236
+ test = typeof test == 'function' ? test() : test;
237
+
238
+ if (typeof enableClasses !== "undefined" && enableClasses) {
239
+ docElement.className += ' ' + (test ? '' : 'no-') + feature;
240
+ }
241
+ Modernizr[feature] = test;
242
+
243
+ }
244
+
245
+ return Modernizr;
246
+ };
247
+
248
+
249
+ setCss('');
250
+ modElem = inputElem = null;
251
+
252
+
253
+ Modernizr._version = version;
254
+
255
+ Modernizr._prefixes = prefixes;
256
+ Modernizr._domPrefixes = domPrefixes;
257
+ Modernizr._cssomPrefixes = cssomPrefixes;
258
+
259
+ Modernizr.testProp = function (prop) {
260
+ return testProps([prop]);
261
+ };
262
+
263
+ Modernizr.testAllProps = testPropsAll;
264
+
265
+ Modernizr.testStyles = injectElementWithStyles;
266
+ Modernizr.prefixed = function (prop, obj, elem) {
267
+ if (!obj) {
268
+ return testPropsAll(prop, 'pfx');
269
+ } else {
270
+ return testPropsAll(prop, obj, elem);
271
+ }
272
+ };
273
+
274
+ return Modernizr;
275
+ })(window, document);
276
+ var
277
+ fullScreenApi = {
278
+ ok: false,
279
+ is: function () {
280
+ return false;
281
+ },
282
+ request: function () {
283
+ },
284
+ cancel: function () {
285
+ },
286
+ event: '',
287
+ prefix: ''
288
+ },
289
+ browserPrefixes = 'webkit moz o ms khtml'.split(' ');
290
+
291
+ // check for native support
292
+ if (typeof document.cancelFullScreen != 'undefined') {
293
+ fullScreenApi.ok = true;
294
+ } else {
295
+ // check for fullscreen support by vendor prefix
296
+ for (var i = 0, il = browserPrefixes.length; i < il; i++) {
297
+ fullScreenApi.prefix = browserPrefixes[i];
298
+ if (typeof document[fullScreenApi.prefix + 'CancelFullScreen' ] != 'undefined') {
299
+ fullScreenApi.ok = true;
300
+ break;
301
+ }
302
+ }
303
+ }
304
+
305
+ // update methods to do something useful
306
+ if (fullScreenApi.ok) {
307
+ fullScreenApi.event = fullScreenApi.prefix + 'fullscreenchange';
308
+ fullScreenApi.is = function () {
309
+ switch (this.prefix) {
310
+ case '':
311
+ return document.fullScreen;
312
+ case 'webkit':
313
+ return document.webkitIsFullScreen;
314
+ default:
315
+ return document[this.prefix + 'FullScreen'];
316
+ }
317
+ };
318
+ fullScreenApi.request = function (el) {
319
+ return (this.prefix === '') ? el.requestFullScreen() : el[this.prefix + 'RequestFullScreen']();
320
+ };
321
+ fullScreenApi.cancel = function (el) {
322
+ return (this.prefix === '') ? document.cancelFullScreen() : document[this.prefix + 'CancelFullScreen']();
323
+ };
324
+ }
325
+ /* Bez v1.0.10-g5ae0136
326
+ * http://github.com/rdallasgray/bez
327
+ *
328
+ * A plugin to convert CSS3 cubic-bezier co-ordinates to jQuery-compatible easing functions
329
+ *
330
+ * With thanks to Nikolay Nemshilov for clarification on the cubic-bezier maths
331
+ * See http://st-on-it.blogspot.com/2011/05/calculating-cubic-bezier-function.html
332
+ *
333
+ * Copyright 2011 Robert Dallas Gray. All rights reserved.
334
+ * Provided under the FreeBSD license: https://github.com/rdallasgray/bez/blob/master/LICENSE.txt
335
+ */
336
+ function bez (coOrdArray) {
337
+ var encodedFuncName = "bez_" + $.makeArray(arguments).join("_").replace(".", "p");
338
+ if (typeof $['easing'][encodedFuncName] !== "function") {
339
+ var polyBez = function (p1, p2) {
340
+ var A = [null, null],
341
+ B = [null, null],
342
+ C = [null, null],
343
+ bezCoOrd = function (t, ax) {
344
+ C[ax] = 3 * p1[ax];
345
+ B[ax] = 3 * (p2[ax] - p1[ax]) - C[ax];
346
+ A[ax] = 1 - C[ax] - B[ax];
347
+ return t * (C[ax] + t * (B[ax] + t * A[ax]));
348
+ },
349
+ xDeriv = function (t) {
350
+ return C[0] + t * (2 * B[0] + 3 * A[0] * t);
351
+ },
352
+ xForT = function (t) {
353
+ var x = t, i = 0, z;
354
+ while (++i < 14) {
355
+ z = bezCoOrd(x, 0) - t;
356
+ if (Math.abs(z) < 1e-3) break;
357
+ x -= z / xDeriv(x);
358
+ }
359
+ return x;
360
+ };
361
+ return function (t) {
362
+ return bezCoOrd(xForT(t), 1);
363
+ }
364
+ };
365
+ $['easing'][encodedFuncName] = function (x, t, b, c, d) {
366
+ return c * polyBez([coOrdArray[0], coOrdArray[1]], [coOrdArray[2], coOrdArray[3]])(t / d) + b;
367
+ }
368
+ }
369
+ return encodedFuncName;
370
+ }
371
+ var _fotoramaClass = 'fotorama',
372
+ _fullscreenClass = 'fullscreen',
373
+
374
+ wrapClass = _fotoramaClass + '__wrap',
375
+ wrapCss3Class = wrapClass + '--css3',
376
+ wrapVideoClass = wrapClass + '--video',
377
+ wrapFadeClass = wrapClass + '--fade',
378
+ wrapSlideClass = wrapClass + '--slide',
379
+ wrapNoControlsClass = wrapClass + '--no-controls',
380
+ wrapNoShadowsClass = wrapClass + '--no-shadows',
381
+ wrapPanYClass = wrapClass + '--pan-y',
382
+
383
+ stageClass = _fotoramaClass + '__stage',
384
+ stageFrameClass = stageClass + '__frame',
385
+ stageFrameVideoClass = stageFrameClass + '--video',
386
+ stageShaftClass = stageClass + '__shaft',
387
+ stageOnlyActiveClass = stageClass + '--only-active',
388
+
389
+ grabClass = _fotoramaClass + '__grab',
390
+ pointerClass = _fotoramaClass + '__pointer',
391
+
392
+ arrClass = _fotoramaClass + '__arr',
393
+ arrDisabledClass = arrClass + '--disabled',
394
+ arrPrevClass = arrClass + '--prev',
395
+ arrNextClass = arrClass + '--next',
396
+ arrArrClass = arrClass + '__arr',
397
+
398
+ navClass = _fotoramaClass + '__nav',
399
+ navWrapClass = navClass + '-wrap',
400
+ navShaftClass = navClass + '__shaft',
401
+ navDotsClass = navClass + '--dots',
402
+ navThumbsClass = navClass + '--thumbs',
403
+ navFrameClass = navClass + '__frame',
404
+ navFrameDotClass = navFrameClass + '--dot',
405
+ navFrameThumbClass = navFrameClass + '--thumb',
406
+
407
+ fadeClass = _fotoramaClass + '__fade',
408
+ fadeFrontClass = fadeClass + '-front',
409
+ fadeRearClass = fadeClass + '-rear',
410
+
411
+ shadowClass = _fotoramaClass + '__shadow',
412
+ shadowsClass = shadowClass + 's',
413
+ shadowsLeftClass = shadowsClass + '--left',
414
+ shadowsRightClass = shadowsClass + '--right',
415
+
416
+ activeClass = _fotoramaClass + '__active',
417
+ selectClass = _fotoramaClass + '__select',
418
+
419
+ hiddenClass = _fotoramaClass + '--hidden',
420
+
421
+ fullscreenClass = _fotoramaClass + '--fullscreen',
422
+ fullscreenIconClass = _fotoramaClass + '__fullscreen-icon',
423
+
424
+ errorClass = _fotoramaClass + '__error',
425
+ loadingClass = _fotoramaClass + '__loading',
426
+ loadedClass = _fotoramaClass + '__loaded',
427
+ loadedFullClass = loadedClass + '--full',
428
+ loadedImgClass = loadedClass + '--img',
429
+
430
+ grabbingClass = _fotoramaClass + '__grabbing',
431
+
432
+ imgClass = _fotoramaClass + '__img',
433
+ imgFullClass = imgClass + '--full',
434
+
435
+ dotClass = _fotoramaClass + '__dot',
436
+ thumbClass = _fotoramaClass + '__thumb',
437
+ thumbBorderClass = thumbClass + '-border',
438
+
439
+ htmlClass = _fotoramaClass + '__html',
440
+
441
+ videoClass = _fotoramaClass + '__video',
442
+ videoPlayClass = videoClass + '-play',
443
+ videoCloseClass = videoClass + '-close',
444
+
445
+ captionClass = _fotoramaClass + '__caption',
446
+
447
+ ooooClass = _fotoramaClass + '__oooo';
448
+ var $WINDOW = $(window),
449
+ $DOCUMENT = $(document),
450
+ $HTML,
451
+ $BODY,
452
+
453
+ COMPAT = document.compatMode === 'CSS1Compat',
454
+ QUIRKS_FORCE = location.hash.replace('#', '') === 'quirks',
455
+ CSS3 = Modernizr.csstransforms3d && !QUIRKS_FORCE,
456
+ FULLSCREEN = fullScreenApi.ok,
457
+
458
+ MOBILE = navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone/i),
459
+ SLOW = !CSS3 || MOBILE,
460
+
461
+ MS_POINTER = window.navigator.msPointerEnabled,
462
+
463
+ TOUCH_TIMEOUT = 250,
464
+ TRANSITION_DURATION = 300,
465
+ AUTOPLAY_INTERVAL = 5000,
466
+ MARGIN = 2,
467
+ THUMB_SIZE = 64,
468
+
469
+ WIDTH = 500,
470
+ HEIGHT = 333,
471
+
472
+
473
+ STAGE_FRAME_KEY = '$stageFrame',
474
+ NAV_DOT_FRAME_KEY = '$navDotFrame',
475
+ NAV_THUMB_FRAME_KEY = '$navThumbFrame',
476
+
477
+ BEZIER = bez([.1, 0, .25, 1]);
478
+ function noop () {}
479
+
480
+ function minMaxLimit (value, min, max) {
481
+ return Math.max(isNaN(min) ? -Infinity : min, Math.min(isNaN(max) ? Infinity : max, value));
482
+ }
483
+
484
+ function readTransform (css) {
485
+ return css.match(/ma/) && css.match(/-?\d+(?!d)/g)[css.match(/3d/) ? 12 : 4];
486
+ }
487
+
488
+ function readPosition ($el) {
489
+ if (CSS3) {
490
+ return +readTransform($el.css('transform'));
491
+ } else {
492
+ return +$el.css('left').replace('px', '');
493
+ }
494
+ }
495
+
496
+ function getTranslate (pos) {
497
+ var obj = {};
498
+ if (CSS3) {
499
+ obj.transform = 'translate3d(' + pos + 'px,0,0)';
500
+ } else {
501
+ obj.left = pos;
502
+ }
503
+ return obj;
504
+ }
505
+
506
+ function getDuration (time) {
507
+ return {'transition-duration': time + 'ms'};
508
+ }
509
+
510
+ function numberFromMeasure (value, measure) {
511
+ return +String(value).replace(measure || 'px', '');
512
+ }
513
+
514
+ function numberFromPercent (value) {
515
+ return /%$/.test(value) && numberFromMeasure(value, '%');
516
+ }
517
+
518
+ function measureIsValid (value) {
519
+ return (!!numberFromMeasure(value) || !!numberFromMeasure(value, '%')) && value;
520
+ }
521
+
522
+ function getPosByIndex (index, side, margin, baseIndex) {
523
+ return (index - (baseIndex || 0)) * (side + (margin || 0));
524
+ }
525
+
526
+ function getIndexByPos (pos, side, margin, baseIndex) {
527
+ return -Math.round(pos / (side + (margin || 0)) - (baseIndex || 0));
528
+ }
529
+
530
+ function bindTransitionEnd ($el) {
531
+ var elData = $el.data();
532
+
533
+ if (elData.tEnd) return;
534
+
535
+ var el = $el[0],
536
+ transitionEndEvent = {
537
+ WebkitTransition: 'webkitTransitionEnd',
538
+ MozTransition: 'transitionend',
539
+ OTransition: 'oTransitionEnd otransitionend',
540
+ msTransition: 'MSTransitionEnd',
541
+ transition: 'transitionend'
542
+ };
543
+ el.addEventListener(transitionEndEvent[Modernizr.prefixed('transition')], function (e) {
544
+ elData.tProp && e.propertyName.match(elData.tProp) && elData.onEndFn();
545
+ });
546
+ elData.tEnd = true;
547
+ }
548
+
549
+ function afterTransition ($el, property, fn, time) {
550
+ var ok,
551
+ elData = $el.data();
552
+
553
+ if (elData) {
554
+ elData.onEndFn = function () {
555
+ if (ok) return;
556
+ ok = true;
557
+ clearTimeout(elData.tT);
558
+ fn();
559
+ };
560
+ elData.tProp = property;
561
+
562
+ // Passive call, just in case of fail of native transition-end event
563
+ clearTimeout(elData.tT);
564
+ elData.tT = setTimeout(function () {
565
+ elData.onEndFn();
566
+ }, time * 1.5);
567
+
568
+ bindTransitionEnd($el);
569
+ }
570
+ }
571
+
572
+
573
+ function stop ($el, left) {
574
+ if ($el.length) {
575
+ var elData = $el.data();
576
+ if (CSS3) {
577
+ $el.css(getDuration(0));
578
+ elData.onEndFn = noop;
579
+ clearTimeout(elData.tT);
580
+ } else {
581
+ $el.stop();
582
+ }
583
+ var lockedLeft = getNumber(left, function () {
584
+ return readPosition($el);
585
+ });
586
+
587
+ $el.css(getTranslate(lockedLeft));//.width(); // `.width()` for reflow
588
+ return lockedLeft;
589
+ }
590
+ }
591
+
592
+ function getNumber () {
593
+ var number;
594
+ for (var _i = 0, _l = arguments.length; _i < _l; _i++) {
595
+ number = _i ? arguments[_i]() : arguments[_i];
596
+ if (typeof number === 'number') {
597
+ break;
598
+ }
599
+ }
600
+
601
+ return number;
602
+ }
603
+
604
+ function edgeResistance (pos, edge) {
605
+ return Math.round(pos + ((edge - pos) / 1.5));
606
+ }
607
+
608
+ function getProtocol () {
609
+ getProtocol.p = getProtocol.p || (location.protocol === 'https://' ? 'https://' : 'http://');
610
+ return getProtocol.p;
611
+ }
612
+
613
+ function parseHref (href) {
614
+ var a = document.createElement('a');
615
+ a.href = href;
616
+ return a;
617
+ }
618
+
619
+ function findVideoId (href, forceVideo) {
620
+ if (typeof href !== 'string') return href;
621
+ href = parseHref(href);
622
+
623
+ var id,
624
+ type;
625
+
626
+ if (href.host.match(/youtube\.com/) && href.search) {
627
+ //.log();
628
+ id = href.search.split('v=')[1];
629
+ if (id) {
630
+ var ampersandPosition = id.indexOf('&');
631
+ if (ampersandPosition !== -1) {
632
+ id = id.substring(0, ampersandPosition);
633
+ }
634
+ type = 'youtube';
635
+ }
636
+ } else if (href.host.match(/youtube\.com|youtu\.be/)) {
637
+ id = href.pathname.replace(/^\/(embed\/|v\/)?/, '').replace(/\/.*/, '');
638
+ type = 'youtube';
639
+ } else if (href.host.match(/vimeo\.com/)) {
640
+ type = 'vimeo';
641
+ id = href.pathname.replace(/^\/(video\/)?/, '').replace(/\/.*/, '');
642
+ }
643
+
644
+ if ((!id || !type) && forceVideo) {
645
+ id = href.href;
646
+ type = 'custom';
647
+ }
648
+
649
+ return id ? {id: id, type: type} : false;
650
+ }
651
+
652
+ function getVideoThumbs (dataFrame, data, api) {
653
+ var img, thumb, video = dataFrame.video;
654
+ if (video.type === 'youtube') {
655
+ thumb = getProtocol() + 'img.youtube.com/vi/' + video.id + '/default.jpg';
656
+ img = thumb.replace(/\/default.jpg$/, '/hqdefault.jpg');
657
+ dataFrame.thumbsReady = true;
658
+ } else if (video.type === 'vimeo') {
659
+ $.ajax({
660
+ url: getProtocol() + 'vimeo.com/api/v2/video/' + video.id + '.json',
661
+ dataType: 'jsonp',
662
+ success: function (json) {
663
+ dataFrame.thumbsReady = true;
664
+ updateData(data, {img: json[0].thumbnail_large, thumb: json[0].thumbnail_small}, dataFrame.i, api);
665
+ }
666
+ });
667
+ } else {
668
+ dataFrame.thumbsReady = true;
669
+ }
670
+
671
+ return {
672
+ img: img,
673
+ thumb: thumb
674
+ }
675
+ }
676
+
677
+ function updateData (data, _dataFrame, i, api) {
678
+ for (var _i = 0, _l = data.length; _i < _l; _i++) {
679
+ var dataFrame = data[_i];
680
+
681
+ if (dataFrame.i === i && dataFrame.thumbsReady) {
682
+ var clear = {videoReady: true};
683
+ clear[STAGE_FRAME_KEY] = clear[NAV_THUMB_FRAME_KEY] = clear[NAV_DOT_FRAME_KEY] = false;
684
+
685
+ api.splice(_i, 1, $.extend(
686
+ {},
687
+ dataFrame,
688
+ clear,
689
+ _dataFrame
690
+ ));
691
+
692
+ break;
693
+ }
694
+ }
695
+ }
696
+
697
+ function getDataFromHtml ($el) {
698
+ var data = [];
699
+
700
+ function getDataFromImg ($img, checkVideo) {
701
+ var imgData = $img.data(),
702
+ $child = $img.children('img').eq(0),
703
+ _imgHref = $img.attr('href'),
704
+ _imgSrc = $img.attr('src'),
705
+ _thumbSrc = $child.attr('src'),
706
+ _video = imgData.video,
707
+ video = checkVideo ? findVideoId(_imgHref, _video === true) : false;
708
+
709
+ if (video) {
710
+ _imgHref = false;
711
+ } else {
712
+ video = findVideoId(_video, _video);
713
+ }
714
+
715
+ var img = imgData.img || _imgHref || _imgSrc || _thumbSrc,
716
+ thumb = imgData.thumb || _thumbSrc || _imgSrc || _imgHref,
717
+ separateThumbFLAG = img !== thumb,
718
+ width = numberFromMeasure(imgData.width || $img.attr('width')),
719
+ height = numberFromMeasure(imgData.height || $img.attr('height')),
720
+ thumbWidth = numberFromMeasure(imgData.thumbWidth || $child.attr('width') || separateThumbFLAG || width),
721
+ thumbHeight = numberFromMeasure(imgData.thumbHeight || $child.attr('height') || separateThumbFLAG || height);
722
+
723
+ return {
724
+ video: video,
725
+ img: img,
726
+ width: width || undefined,
727
+ height: height || undefined,
728
+ thumb: thumb,
729
+ thumbRatio: thumbWidth / thumbHeight || undefined
730
+ }
731
+ }
732
+
733
+ $el.children().each(function (i) {
734
+ var $this = $(this),
735
+ dataFrame = $.extend($this.data(), {id: $this.attr('id')});
736
+ if ($this.is('a, img')) {
737
+ $.extend(dataFrame, getDataFromImg($this, true));
738
+ } else if (!$this.is(':empty')) {
739
+ $.extend(dataFrame, {
740
+ html: this,
741
+ _html: $this.html() // Because of IE
742
+ });
743
+ } else return;
744
+
745
+ data.push(dataFrame);
746
+ });
747
+
748
+ return data;
749
+ }
750
+
751
+ function isHidden (el) {
752
+ return el.offsetWidth === 0 && el.offsetHeight === 0;
753
+ }
754
+
755
+ function isDetached (el) {
756
+ return !$.contains(document.documentElement, el);
757
+ }
758
+
759
+ function waitFor (test, fn, timeout) {
760
+ if (test()) {
761
+ fn();
762
+ } else {
763
+ setTimeout(function () {
764
+ waitFor(test, fn);
765
+ }, timeout || 100);
766
+ }
767
+ }
768
+
769
+ function setHash (hash) {
770
+ location.replace(location.protocol
771
+ + '//'
772
+ + location.host
773
+ + location.pathname.replace(/^\/?/, '/')
774
+ + location.search
775
+ + '#' + hash);
776
+ }
777
+
778
+ function fit ($el, measuresToFit, method) {
779
+ var elData = $el.data(),
780
+ measures = elData.measures;
781
+
782
+ if (measures && (!elData.l ||
783
+ elData.l.W !== measures.width ||
784
+ elData.l.H !== measures.height ||
785
+ elData.l.r !== measures.ratio ||
786
+ elData.l.w !== measuresToFit.w ||
787
+ elData.l.h !== measuresToFit.h ||
788
+ elData.l.m !== method)) {
789
+ var width = measures.width,
790
+ height = measures.height,
791
+ ratio = measuresToFit.w / measuresToFit.h,
792
+ biggerRatioFLAG = measures.ratio >= ratio,
793
+ fitFLAG = method === 'scale-down',
794
+ containFLAG = method === 'contain',
795
+ coverFLAG = method === 'cover';
796
+
797
+ if (biggerRatioFLAG && (fitFLAG || containFLAG) || !biggerRatioFLAG && coverFLAG) {
798
+ width = minMaxLimit(measuresToFit.w, 0, fitFLAG ? width : Infinity);
799
+ height = width / measures.ratio;
800
+ } else if (biggerRatioFLAG && coverFLAG || !biggerRatioFLAG && (fitFLAG || containFLAG)) {
801
+ height = minMaxLimit(measuresToFit.h, 0, fitFLAG ? height : Infinity);
802
+ width = height * measures.ratio;
803
+ }
804
+
805
+ $el.css({
806
+ width: Math.ceil(width),
807
+ height: Math.ceil(height),
808
+ marginLeft: Math.floor(-width / 2),
809
+ marginTop: Math.floor(-height / 2)
810
+ });
811
+
812
+ elData.l = {
813
+ W: measures.width,
814
+ H: measures.height,
815
+ r: measures.ratio,
816
+ w: measuresToFit.w,
817
+ h: measuresToFit.h,
818
+ m: method
819
+ }
820
+ }
821
+
822
+ return true;
823
+ }
824
+
825
+ function setStyle ($el, style) {
826
+ var el = $el[0];
827
+ if (el.styleSheet) {
828
+ el.styleSheet.cssText = style;
829
+ } else {
830
+ $el.html(style);
831
+ }
832
+ }
833
+
834
+ function findShadowEdge (pos, min, max) {
835
+ return min === max ? false : pos <= min ? 'left' : pos >= max ? 'right' : 'left right';
836
+ }
837
+
838
+ function getIndexFromHash (hash, data, ok) {
839
+ if (!ok) return false;
840
+ if (!isNaN(hash)) return hash - 1;
841
+
842
+ var index;
843
+
844
+ for (var _i = 0, _l = data.length; _i < _l; _i++) {
845
+ var dataFrame = data[_i];
846
+
847
+ if (dataFrame.id === hash) {
848
+ index = _i;
849
+ break;
850
+ }
851
+ }
852
+
853
+ return index;
854
+ }
855
+
856
+ function smartClick ($el, fn, _options) {
857
+ _options = _options || {};
858
+
859
+ $el.each(function () {
860
+ var $this = $(this),
861
+ thisData = $this.data(),
862
+ startEvent;
863
+
864
+ if (thisData.clickOn) return;
865
+
866
+ thisData.clickOn = true;
867
+
868
+ $.extend(touch($this, {
869
+ onStart: function (e) {
870
+ startEvent = e;
871
+ (_options.onStart || noop).call(this, e);
872
+ },
873
+ onMove: _options.onMove || noop,
874
+ onEnd: function (result) {
875
+ if (result.moved || _options.tail.checked) return;
876
+ fn.call(this, startEvent);
877
+ }
878
+ }), _options.tail);
879
+
880
+ });
881
+ }
882
+
883
+ function div (classes, child) {
884
+ return '<div class="' + classes + '">' + (child || '') + '</div>';
885
+ }
886
+
887
+ // Fisher–Yates Shuffle
888
+ // http://bost.ocks.org/mike/shuffle/
889
+ function shuffle (array) {
890
+ // While there remain elements to shuffle
891
+ var l = array.length;
892
+ while (l) {
893
+ // Pick a remaining element
894
+ var i = Math.floor(Math.random() * l--);
895
+
896
+ // And swap it with the current element
897
+ var t = array[l];
898
+ array[l] = array[i];
899
+ array[i] = t;
900
+ }
901
+
902
+ return array;
903
+ }
904
+
905
+ function clone (array) {
906
+ return Object.prototype.toString.call(array) == '[object Array]'
907
+ && $.map(array, function (frame) {
908
+ return $.extend({}, frame);
909
+ });
910
+ }
911
+
912
+ function lockScroll (left, top) {
913
+ $WINDOW
914
+ .scrollLeft(left)
915
+ .scrollTop(top);
916
+ }
917
+ function slide ($el, options) {
918
+ var elPos = Math.round(options.pos),
919
+ onEndFn = options.onEnd || noop;
920
+
921
+ if (typeof options.overPos !== 'undefined' && options.overPos !== options.pos) {
922
+ elPos = options.overPos;
923
+ onEndFn = function () {
924
+ slide($el, $.extend({}, options, {overPos: options.pos, time: Math.max(TRANSITION_DURATION, options.time / 2)}))
925
+ };
926
+ }
927
+
928
+ var translate = $.extend(getTranslate(elPos), {width: options.width});
929
+
930
+ if (CSS3) {
931
+ $el.css($.extend(getDuration(options.time), translate));
932
+ if (options.time > 10) {
933
+ afterTransition($el, 'transform', onEndFn, options.time);
934
+ } else {
935
+ onEndFn();
936
+ }
937
+ } else {
938
+ $el.stop().animate(translate, options.time, BEZIER, onEndFn);
939
+ }
940
+ }
941
+
942
+ function fade ($el1, $el2, $frames, options) {
943
+ $el1 = $el1 || $($el1);
944
+ $el2 = $el2 || $($el2);
945
+ var _$el1 = $el1[0],
946
+ _$el2 = $el2[0],
947
+ crossfadeFLAG = options.method === 'crossfade',
948
+ onEndFn = function () {
949
+ if (!onEndFn.done) {
950
+ (options.onEnd || noop)();
951
+ onEndFn.done = true;
952
+ }
953
+ },
954
+ duration = getDuration(options.time),
955
+ duration0 = getDuration(0),
956
+ opacity0 = {opacity: 0},
957
+ opacity1 = {opacity: 1};
958
+
959
+ $frames.removeClass(fadeRearClass + ' ' + fadeFrontClass);
960
+
961
+ $el1.addClass(fadeRearClass);
962
+ $el2.addClass(fadeFrontClass);
963
+
964
+ if (CSS3) {
965
+ stop($el1);
966
+ stop($el2);
967
+
968
+ crossfadeFLAG && _$el2 && $el1.css($.extend(duration0, opacity0)).width(); // .width() for immediate reflow
969
+
970
+ $el1.css($.extend(crossfadeFLAG ? duration : duration0, opacity1));
971
+ $el2.css($.extend(duration, opacity0));
972
+
973
+ if (options.time > 10 && (_$el1 || _$el2)) {
974
+ afterTransition($el1, 'opacity', onEndFn, options.time);
975
+ afterTransition($el2, 'opacity', onEndFn, options.time);
976
+ } else {
977
+ onEndFn();
978
+ }
979
+
980
+ } else {
981
+ $el1.stop();
982
+ $el2.stop();
983
+
984
+ crossfadeFLAG && _$el2 && $el1.fadeTo(0, 0);
985
+
986
+ $el1.fadeTo(crossfadeFLAG ? options.time : 1, 1, crossfadeFLAG && onEndFn);
987
+ $el2.fadeTo(options.time, 0, onEndFn);
988
+
989
+ (_$el1 && crossfadeFLAG) || _$el2 || onEndFn();
990
+ }
991
+ }
992
+ var lastEvent,
993
+ moveEventType,
994
+ preventEvent,
995
+ preventEventTimeout,
996
+ addEventListener = 'addEventListener';
997
+
998
+ function extendEvent (e) {
999
+ var touch = (e.touches || [])[0] || e;
1000
+ e._x = touch.pageX;
1001
+ e._y = touch.clientY;
1002
+ }
1003
+
1004
+ function touch ($el, options) {
1005
+ var el = $el[0],
1006
+ docTouchTimeout,
1007
+ tail = {},
1008
+ touchEnabledFLAG,
1009
+ startEvent,
1010
+ $target,
1011
+ controlTouch,
1012
+ touchFLAG,
1013
+ targetIsSelectFLAG,
1014
+ targetIsLinkFlag;
1015
+
1016
+ function onStart (e) {
1017
+ $target = $(e.target);
1018
+ tail.checked = targetIsSelectFLAG = targetIsLinkFlag = false;
1019
+
1020
+ if (touchEnabledFLAG
1021
+ || tail.flow
1022
+ || (e.touches && e.touches.length > 1)
1023
+ || e.which > 1
1024
+ || (lastEvent && lastEvent.type !== e.type && preventEvent)
1025
+ || (targetIsSelectFLAG = options.select && $target.is(options.select, el))) return targetIsSelectFLAG;
1026
+
1027
+ touchFLAG = e.type.match(/^t/);
1028
+ targetIsLinkFlag = $target.is('a, a *', el);
1029
+
1030
+ extendEvent(e);
1031
+
1032
+ startEvent = lastEvent = e;
1033
+ moveEventType = e.type.replace(/down|start/, 'move').replace(/Down/, 'Move');
1034
+ controlTouch = tail.control;
1035
+
1036
+ (options.onStart || noop).call(el, e, {control: controlTouch, $target: $target});
1037
+
1038
+ touchEnabledFLAG = tail.flow = true;
1039
+
1040
+ if (!touchFLAG || tail.go) {
1041
+ e.preventDefault();
1042
+ }
1043
+ }
1044
+
1045
+ function onMove (e) {
1046
+ if ((e.touches && e.touches.length > 1)
1047
+ || (MS_POINTER && !e.isPrimary)
1048
+ || moveEventType !== e.type
1049
+ || !touchEnabledFLAG) {
1050
+ touchEnabledFLAG && onEnd();
1051
+ return;
1052
+ }
1053
+
1054
+ extendEvent(e);
1055
+
1056
+ var xDiff = Math.abs(e._x - startEvent._x), // opt _x → _pageX
1057
+ yDiff = Math.abs(e._y - startEvent._y),
1058
+ xyDiff = xDiff - yDiff,
1059
+ xWin = (tail.go || tail.x || xyDiff >= 0) && !tail.noSwipe,
1060
+ yWin = xyDiff < 0;
1061
+
1062
+ if (touchFLAG && !tail.checked) {
1063
+ touchEnabledFLAG = xWin;
1064
+ touchEnabledFLAG && e.preventDefault();
1065
+ } else {
1066
+ e.preventDefault();
1067
+ (options.onMove || noop).call(el, e, {touch: touchFLAG});
1068
+ }
1069
+
1070
+ tail.checked = tail.checked || xWin || yWin;
1071
+ }
1072
+
1073
+ function onEnd (e) {
1074
+ var _touchEnabledFLAG = touchEnabledFLAG;
1075
+ tail.control = touchEnabledFLAG = false;
1076
+
1077
+ if (_touchEnabledFLAG) {
1078
+ tail.flow = false;
1079
+ }
1080
+
1081
+ if (!_touchEnabledFLAG || (targetIsLinkFlag && !tail.checked)) return;
1082
+
1083
+ e && e.preventDefault();
1084
+
1085
+ preventEvent = true;
1086
+ clearTimeout(preventEventTimeout);
1087
+ preventEventTimeout = setTimeout(function () {
1088
+ preventEvent = false;
1089
+ }, 1000);
1090
+ (options.onEnd || noop).call(el, {moved: tail.checked, $target: $target, control: controlTouch, touch: touchFLAG, startEvent: startEvent, aborted: !e});
1091
+ }
1092
+
1093
+ function onOtherStart () {
1094
+ clearTimeout(docTouchTimeout);
1095
+ docTouchTimeout = setTimeout(function () {
1096
+ tail.flow = true;
1097
+ }, 10);
1098
+ }
1099
+
1100
+ function onOtherEnd () {
1101
+ clearTimeout(docTouchTimeout);
1102
+ docTouchTimeout = setTimeout(function () {
1103
+ tail.flow = false;
1104
+ }, TOUCH_TIMEOUT);
1105
+ }
1106
+
1107
+ if (MS_POINTER) {
1108
+ el[addEventListener]('MSPointerDown', onStart);
1109
+ document[addEventListener]('MSPointerMove', onMove);
1110
+ document[addEventListener]('MSPointerCancel', onEnd);
1111
+ document[addEventListener]('MSPointerUp', onEnd);
1112
+ } else {
1113
+ if (el[addEventListener]) {
1114
+ el[addEventListener]('touchstart', onStart);
1115
+ el[addEventListener]('touchmove', onMove);
1116
+ el[addEventListener]('touchend', onEnd);
1117
+
1118
+ document[addEventListener]('touchstart', onOtherStart);
1119
+ document[addEventListener]('touchend', onOtherEnd);
1120
+ window[addEventListener]('scroll', onOtherEnd);
1121
+ }
1122
+
1123
+ $el.on('mousedown', onStart);
1124
+ $DOCUMENT
1125
+ .on('mousemove', onMove)
1126
+ .on('mouseup', onEnd);
1127
+ }
1128
+
1129
+ $el.on('click', 'a', function (e) {
1130
+ tail.checked && e.preventDefault();
1131
+ });
1132
+
1133
+ return tail;
1134
+ }
1135
+
1136
+ function moveOnTouch ($el, options) {
1137
+ var el = $el[0],
1138
+ elData = $el.data(),
1139
+ tail = {},
1140
+ startCoo,
1141
+ coo,
1142
+ startElPos,
1143
+ moveElPos,
1144
+ edge,
1145
+ moveTrack,
1146
+ startTime,
1147
+ endTime,
1148
+ min,
1149
+ max,
1150
+ snap,
1151
+ slowFLAG,
1152
+ controlFLAG,
1153
+ movedFLAG;
1154
+
1155
+ function startTracking (e) {
1156
+ startCoo = coo = e._x;
1157
+ startTime = $.now();
1158
+
1159
+ moveTrack = [
1160
+ [startTime, startCoo]
1161
+ ];
1162
+
1163
+ startElPos = moveElPos = stop($el, options.getPos && options.getPos());
1164
+
1165
+ // startTime - endTime < TOUCH_TIMEOUT * 3 && e.preventDefault(); // double tap
1166
+
1167
+ (options.onStart || noop).call(el, e);
1168
+ }
1169
+
1170
+ function onStart (e, result) {
1171
+ min = elData.min;
1172
+ max = elData.max;
1173
+ snap = elData.snap;
1174
+
1175
+ slowFLAG = e.altKey;
1176
+ movedFLAG = false;
1177
+
1178
+ controlFLAG = result.control;
1179
+
1180
+ if (!controlFLAG) {
1181
+ startTracking(e);
1182
+ }
1183
+ }
1184
+
1185
+ function onMove (e, result) {
1186
+ if (controlFLAG) {
1187
+ controlFLAG = false;
1188
+ startTracking(e);
1189
+ }
1190
+
1191
+ if (!tail.noSwipe) {
1192
+ coo = e._x;
1193
+
1194
+ moveTrack.push([$.now(), coo]);
1195
+
1196
+ moveElPos = startElPos - (startCoo - coo);
1197
+
1198
+ edge = findShadowEdge(moveElPos, min, max);
1199
+
1200
+ if (moveElPos <= min) {
1201
+ moveElPos = edgeResistance(moveElPos, min);
1202
+ } else if (moveElPos >= max) {
1203
+ moveElPos = edgeResistance(moveElPos, max);
1204
+ }
1205
+
1206
+ if (!tail.noMove) {
1207
+ $el.css(getTranslate(moveElPos));
1208
+ if (!movedFLAG) {
1209
+ movedFLAG = true;
1210
+ // only for mouse
1211
+ result.touch || MS_POINTER || $el.addClass(grabbingClass);
1212
+ }
1213
+
1214
+ (options.onMove || noop).call(el, e, {pos: moveElPos, edge: edge});
1215
+ }
1216
+ }
1217
+ }
1218
+
1219
+ function onEnd (result) {
1220
+ if (controlFLAG) return;
1221
+
1222
+ result.touch || MS_POINTER || $el.removeClass(grabbingClass);
1223
+
1224
+ endTime = new Date().getTime();
1225
+
1226
+ var _backTimeIdeal = endTime - TOUCH_TIMEOUT,
1227
+ _backTime,
1228
+ _timeDiff,
1229
+ _timeDiffLast,
1230
+ backTime = null,
1231
+ backCoo,
1232
+ virtualPos,
1233
+ limitPos,
1234
+ newPos,
1235
+ overPos,
1236
+ time = TRANSITION_DURATION,
1237
+ speed,
1238
+ friction = options.friction;
1239
+
1240
+ for (var _i = moveTrack.length - 1; _i >= 0; _i--) {
1241
+ _backTime = moveTrack[_i][0];
1242
+ _timeDiff = Math.abs(_backTime - _backTimeIdeal);
1243
+ if (backTime === null || _timeDiff < _timeDiffLast) {
1244
+ backTime = _backTime;
1245
+ backCoo = moveTrack[_i][1];
1246
+ } else if (backTime === _backTimeIdeal || _timeDiff > _timeDiffLast) {
1247
+ break;
1248
+ }
1249
+ _timeDiffLast = _timeDiff;
1250
+ }
1251
+
1252
+ newPos = minMaxLimit(moveElPos, min, max);
1253
+
1254
+ var cooDiff = backCoo - coo,
1255
+ forwardFLAG = cooDiff >= 0,
1256
+ timeDiff = endTime - backTime,
1257
+ longTouchFLAG = timeDiff > TOUCH_TIMEOUT,
1258
+ swipeFLAG = !longTouchFLAG && moveElPos !== startElPos && newPos === moveElPos;
1259
+
1260
+ if (snap) {
1261
+ newPos = minMaxLimit(Math[swipeFLAG ? (forwardFLAG ? 'floor' : 'ceil') : 'round'](moveElPos / snap) * snap, min, max);
1262
+ min = max = newPos;
1263
+ }
1264
+
1265
+ if (swipeFLAG && (snap || newPos === moveElPos)) {
1266
+ speed = -(cooDiff / timeDiff);
1267
+ time *= minMaxLimit(Math.abs(speed), options.timeLow, options.timeHigh);
1268
+ virtualPos = Math.round(moveElPos + speed * time / friction);
1269
+
1270
+ if (!snap) {
1271
+ newPos = virtualPos;
1272
+ }
1273
+
1274
+ if (!forwardFLAG && virtualPos > max || forwardFLAG && virtualPos < min) {
1275
+ limitPos = forwardFLAG ? min : max;
1276
+ overPos = virtualPos - limitPos;
1277
+ if (!snap) {
1278
+ newPos = limitPos;
1279
+ }
1280
+ overPos = minMaxLimit(newPos + overPos * .03, limitPos - 50, limitPos + 50);
1281
+ time = Math.abs((moveElPos - overPos) / (speed / friction));
1282
+ }
1283
+ }
1284
+
1285
+ time *= slowFLAG ? 10 : 1;
1286
+
1287
+ (options.onEnd || noop).call(el, $.extend(result, {pos: moveElPos, newPos: newPos, overPos: overPos, time: time, moved: (longTouchFLAG && snap) || result.moved}));
1288
+ }
1289
+
1290
+ tail = $.extend(touch(options.$wrap, {
1291
+ onStart: onStart,
1292
+ onMove: onMove,
1293
+ onEnd: onEnd,
1294
+ select: options.select,
1295
+ control: options.control
1296
+ }), tail);
1297
+
1298
+ return tail;
1299
+ }
1300
+ var $oooo = $(div('', div(ooooClass))),
1301
+ ooooInterval,
1302
+ ooooStep = function () {
1303
+ $oooo.attr('class', ooooClass + ' ' + ooooClass + '--' + ooooI);
1304
+ ooooI++;
1305
+ if (ooooI > 4) ooooI = 0;
1306
+ },
1307
+ ooooI;
1308
+
1309
+ function ooooStart ($el) {
1310
+ ooooStop(true);
1311
+ $oooo.appendTo($el);
1312
+ ooooI = 0;
1313
+ ooooStep();
1314
+ ooooInterval = setInterval(ooooStep, 200);
1315
+ }
1316
+
1317
+ function ooooStop (leave) {
1318
+ leave || $oooo.detach();
1319
+ clearInterval(ooooInterval);
1320
+ }
1321
+
1322
+ jQuery.Fotorama = function ($fotorama, opts) {
1323
+ $HTML = $HTML || $('html');
1324
+ $BODY = $BODY || $('body');
1325
+
1326
+ var that = this,
1327
+ index = _size,
1328
+ stamp = $.now(),
1329
+ stampClass = _fotoramaClass + stamp,
1330
+ fotorama = $fotorama[0],
1331
+ data,
1332
+ dataFrameCount = 1,
1333
+ fotoramaData = $fotorama.data(),
1334
+ size,
1335
+
1336
+ $style = $('<style></style>'),
1337
+
1338
+ $anchor = $(div(hiddenClass)),
1339
+ $wrap = $(div(wrapClass)),
1340
+ $stage = $(div(stageClass)).appendTo($wrap),
1341
+ stage = $stage[0],
1342
+ $stageShaft = $(div(stageShaftClass)).appendTo($stage),
1343
+ $stageFrame = $(),
1344
+ $arrPrev = $(div(arrClass + ' ' + arrPrevClass, div(arrArrClass))),
1345
+ $arrNext = $(div(arrClass + ' ' + arrNextClass, div(arrArrClass))),
1346
+ $arrs = $arrPrev.add($arrNext).appendTo($stage),
1347
+ $navWrap = $(div(navWrapClass)),
1348
+ $nav = $(div(navClass)).appendTo($navWrap),
1349
+ $navShaft = $(div(navShaftClass)).appendTo($nav),
1350
+ $navFrame,
1351
+ $navDotFrame = $(),
1352
+ $navThumbFrame = $(),
1353
+
1354
+ stageShaftData = $stageShaft.data(),
1355
+ navShaftData = $navShaft.data(),
1356
+
1357
+ $thumbBorder = $(div(thumbBorderClass)).appendTo($navShaft),
1358
+
1359
+ $fullscreenIcon = $(div(fullscreenIconClass)),
1360
+ fullscreenIcon = $fullscreenIcon[0],
1361
+ $videoPlay = $(div(videoPlayClass)),
1362
+ $videoClose = $(div(videoCloseClass)).appendTo($stage),
1363
+ videoClose = $videoClose[0],
1364
+
1365
+ $videoPlaying,
1366
+
1367
+ activeIndex = false,
1368
+ activeFrame,
1369
+ activeIndexes,
1370
+ repositionIndex,
1371
+ dirtyIndex,
1372
+ lastActiveIndex,
1373
+ prevIndex,
1374
+ nextIndex,
1375
+ startIndex,
1376
+
1377
+ o_loop,
1378
+ o_nav,
1379
+ o_navThumbs,
1380
+ o_navTop,
1381
+ o_allowFullScreen,
1382
+ o_nativeFullScreen,
1383
+ o_fade,
1384
+ o_thumbSide,
1385
+ o_thumbSide2,
1386
+ o_transitionDuration,
1387
+ o_shadows,
1388
+ lastOptions = {},
1389
+
1390
+ measures = {},
1391
+ measuresSetFLAG,
1392
+
1393
+ stageShaftTouchTail = {},
1394
+ navShaftTouchTail = {},
1395
+
1396
+ scrollTop,
1397
+ scrollLeft,
1398
+
1399
+ showedFLAG,
1400
+ pausedAutoplayFLAG,
1401
+ stoppedAutoplayFLAG,
1402
+
1403
+ toDeactivate = {},
1404
+ toDetach = {},
1405
+
1406
+ measuresStash,
1407
+
1408
+ touchedFLAG,
1409
+
1410
+ hoverFLAG,
1411
+
1412
+ navFrameKey,
1413
+ stageLeft = 0;
1414
+
1415
+ $wrap[STAGE_FRAME_KEY] = $(div(stageFrameClass));
1416
+ $wrap[NAV_THUMB_FRAME_KEY] = $(div(navFrameClass + ' ' + navFrameThumbClass, div(thumbClass)));
1417
+ $wrap[NAV_DOT_FRAME_KEY] = $(div(navFrameClass + ' ' + navFrameDotClass, div(dotClass)));
1418
+
1419
+ toDeactivate[STAGE_FRAME_KEY] = [];
1420
+ toDeactivate[NAV_THUMB_FRAME_KEY] = [];
1421
+ toDeactivate[NAV_DOT_FRAME_KEY] = [];
1422
+ toDetach[STAGE_FRAME_KEY] = {};
1423
+
1424
+ if (CSS3) {
1425
+ $wrap.addClass(wrapCss3Class);
1426
+ }
1427
+
1428
+ fotoramaData.fotorama = this;
1429
+ that.options = opts;
1430
+ _size++;
1431
+
1432
+ function checkForVideo () {
1433
+ $.each(data, function (i, dataFrame) {
1434
+ if (!dataFrame.i) {
1435
+ dataFrame.i = dataFrameCount++;
1436
+ var video = findVideoId(dataFrame.video, true);
1437
+ if (video) {
1438
+ var thumbs = {};
1439
+ dataFrame.video = video;
1440
+ if (!dataFrame.img && !dataFrame.thumb) {
1441
+ thumbs = getVideoThumbs(dataFrame, data, that);
1442
+ } else {
1443
+ dataFrame.thumbsReady = true;
1444
+ }
1445
+ updateData(data, {img: thumbs.img, thumb: thumbs.thumb}, dataFrame.i, that);
1446
+ }
1447
+ }
1448
+ });
1449
+ }
1450
+
1451
+ function appendElements (FLAG) {
1452
+ if (FLAG === appendElements.f) return;
1453
+
1454
+ if (FLAG) {
1455
+ $fotorama
1456
+ .html('')
1457
+ .addClass(stampClass)
1458
+ .append($wrap)
1459
+ .before($style)
1460
+ .before($anchor);
1461
+
1462
+ $.Fotorama.size++;
1463
+ } else {
1464
+ $wrap.detach();
1465
+ $style.detach();
1466
+ $anchor.detach();
1467
+ $fotorama
1468
+ .html(fotoramaData.urtext)
1469
+ .removeClass(stampClass);
1470
+
1471
+ $.Fotorama.size--;
1472
+ }
1473
+
1474
+ appendElements.f = FLAG;
1475
+ }
1476
+
1477
+ function setData () {
1478
+ data = that.data = data || clone(opts.data) || getDataFromHtml($fotorama);
1479
+ size = that.size = data.length;
1480
+
1481
+ !ready.ok && opts.shuffle && shuffle(data);
1482
+
1483
+ checkForVideo();
1484
+
1485
+ activeIndex = limitIndex(activeIndex);
1486
+
1487
+ size && appendElements(true);
1488
+ }
1489
+
1490
+ function stageNoMove () {
1491
+ var _noMove = size < 2 || $videoPlaying;
1492
+ stageShaftTouchTail.noMove = _noMove || o_fade;
1493
+ stageShaftTouchTail.noSwipe = _noMove || !opts.swipe;
1494
+
1495
+ $stageShaft.toggleClass(grabClass, !stageShaftTouchTail.noMove && !stageShaftTouchTail.noSwipe);
1496
+ MS_POINTER && $wrap.toggleClass(wrapPanYClass, !stageShaftTouchTail.noSwipe);
1497
+ }
1498
+
1499
+ function setAutoplayInterval (interval) {
1500
+ if (interval === true) interval = '';
1501
+ opts.autoplay = Math.max(+interval || AUTOPLAY_INTERVAL, o_transitionDuration * 1.5);
1502
+ }
1503
+
1504
+ function addOrRemove (FLAG) {
1505
+ return FLAG ? 'add' : 'remove';
1506
+ }
1507
+
1508
+ /**
1509
+ * Options on the fly
1510
+ * */
1511
+ function setOptions () {
1512
+ o_fade = opts.transition === 'crossfade' || opts.transition === 'dissolve';
1513
+
1514
+ o_loop = opts.loop && (size > 2 || o_fade);
1515
+
1516
+ o_transitionDuration = +opts.transitionDuration || TRANSITION_DURATION;
1517
+
1518
+ var classes = {add: [], remove: []};
1519
+
1520
+ if (size > 1) {
1521
+ o_nav = opts.nav;
1522
+ o_navTop = opts.navPosition === 'top';
1523
+ classes.remove.push(selectClass);
1524
+
1525
+ $arrs.toggle(opts.arrows);
1526
+
1527
+ arrsUpdate();
1528
+ } else {
1529
+ o_nav = false;
1530
+ $arrs.hide();
1531
+ }
1532
+
1533
+ if (opts.autoplay) setAutoplayInterval(opts.autoplay);
1534
+
1535
+ o_thumbSide = numberFromMeasure(opts.thumbWidth) || THUMB_SIZE;
1536
+ o_thumbSide2 = numberFromMeasure(opts.thumbHeight) || THUMB_SIZE;
1537
+
1538
+ stageNoMove();
1539
+
1540
+ extendMeasures(opts, true);
1541
+
1542
+ o_navThumbs = o_nav === 'thumbs'
1543
+
1544
+ if (o_navThumbs) {
1545
+ frameDraw(size, 'navThumb');
1546
+
1547
+ $navFrame = $navThumbFrame;
1548
+ navFrameKey = NAV_THUMB_FRAME_KEY;
1549
+
1550
+ setStyle($style, $.Fotorama.jst.style({w: o_thumbSide, h: o_thumbSide2, m: MARGIN, s: stamp, q: !COMPAT}));
1551
+
1552
+ $nav
1553
+ .addClass(navThumbsClass)
1554
+ .removeClass(navDotsClass);
1555
+ } else if (o_nav === 'dots') {
1556
+ frameDraw(size, 'navDot');
1557
+
1558
+ $navFrame = $navDotFrame;
1559
+ navFrameKey = NAV_DOT_FRAME_KEY;
1560
+
1561
+ $nav
1562
+ .addClass(navDotsClass)
1563
+ .removeClass(navThumbsClass);
1564
+ } else {
1565
+ o_nav = false;
1566
+ $nav.removeClass(navThumbsClass + ' ' + navDotsClass);
1567
+ }
1568
+
1569
+ if (o_nav) {
1570
+ if (o_navTop) {
1571
+ $navWrap.insertBefore($stage);
1572
+ } else {
1573
+ $navWrap.insertAfter($stage);
1574
+ }
1575
+ frameAppend.nav = false;
1576
+ frameAppend($navFrame, $navShaft, 'nav');
1577
+ }
1578
+
1579
+ o_allowFullScreen = opts.allowFullScreen;
1580
+
1581
+ if (o_allowFullScreen) {
1582
+ $fullscreenIcon.appendTo($stage);
1583
+ o_nativeFullScreen = FULLSCREEN && o_allowFullScreen === 'native';
1584
+ } else {
1585
+ $fullscreenIcon.detach();
1586
+ o_nativeFullScreen = false;
1587
+ }
1588
+
1589
+ classes[addOrRemove(o_fade)].push(wrapFadeClass);
1590
+ classes[addOrRemove(!o_fade)].push(wrapSlideClass);
1591
+
1592
+ o_shadows = opts.shadows && !SLOW;
1593
+ classes[addOrRemove(!o_shadows)].push(wrapNoShadowsClass);
1594
+
1595
+ ooooStop();
1596
+
1597
+ $wrap
1598
+ .addClass(classes.add.join(' '))
1599
+ .removeClass(classes.remove.join(' '));
1600
+
1601
+ lastOptions = $.extend({}, opts);
1602
+ }
1603
+
1604
+ function normalizeIndex (index) {
1605
+ return index < 0 ? (size + (index % size)) % size : index >= size ? index % size : index;
1606
+ }
1607
+
1608
+ function limitIndex (index) {
1609
+ return minMaxLimit(index, 0, size - 1);
1610
+ }
1611
+
1612
+ function edgeIndex (index) {
1613
+ return o_loop ? normalizeIndex(index) : limitIndex(index);
1614
+ }
1615
+
1616
+ function getPrevIndex (index) {
1617
+ return index > 0 || o_loop ? index - 1 : false;
1618
+ }
1619
+
1620
+ function getNextIndex (index) {
1621
+ return index < size - 1 || o_loop ? index + 1 : false;
1622
+ }
1623
+
1624
+ function setStageShaftMinmaxAndSnap () {
1625
+ stageShaftData.min = o_loop ? -Infinity : -getPosByIndex(size - 1, measures.w, MARGIN, repositionIndex);
1626
+ stageShaftData.max = o_loop ? Infinity : -getPosByIndex(0, measures.w, MARGIN, repositionIndex);
1627
+ stageShaftData.snap = measures.w + MARGIN;
1628
+ }
1629
+
1630
+ function setNavShaftMinmax () {
1631
+ navShaftData.min = Math.min(0, measures.w - $navShaft.width());
1632
+ navShaftData.max = 0;
1633
+
1634
+ navShaftTouchTail.noMove = navShaftData.min === navShaftData.max;
1635
+
1636
+ $navShaft.toggleClass(grabClass, !navShaftTouchTail.noMove);
1637
+ }
1638
+
1639
+ function eachIndex (indexes, type, fn) {
1640
+ if (typeof indexes === 'number') {
1641
+ indexes = new Array(indexes);
1642
+ var rangeFLAG = true;
1643
+ }
1644
+ return $.each(indexes, function (i, index) {
1645
+ if (rangeFLAG) index = i;
1646
+ if (typeof(index) === 'number') {
1647
+ var dataFrame = data[normalizeIndex(index)],
1648
+ key = '$' + type + 'Frame',
1649
+ $frame = dataFrame[key];
1650
+
1651
+ fn.call(this, i, index, dataFrame, $frame, key, $frame && $frame.data());
1652
+ }
1653
+ });
1654
+ }
1655
+
1656
+ function setMeasures (width, height, ratio, index) {
1657
+ if (!measuresSetFLAG || (measuresSetFLAG === '*' && index === startIndex)) {
1658
+ width = measureIsValid(opts.width) || measureIsValid(width) || WIDTH;
1659
+ height = measureIsValid(opts.height) || measureIsValid(height) || HEIGHT;
1660
+ that.resize({
1661
+ width: width,
1662
+ ratio: opts.ratio || ratio || width / height
1663
+ }, 0, index === startIndex ? true : '*');
1664
+ }
1665
+ }
1666
+
1667
+ function loadImg (indexes, type, specialMeasures, specialFit, again) {
1668
+ eachIndex(indexes, type, function (i, index, dataFrame, $frame, key, frameData) {
1669
+
1670
+ if (!$frame) return;
1671
+
1672
+ var fullFLAG = that.fullScreen && dataFrame.full && !frameData.$full && type === 'stage';
1673
+
1674
+ if (frameData.$img && !again && !fullFLAG) return;
1675
+
1676
+ var img = new Image(),
1677
+ $img = $(img),
1678
+ imgData = $img.data();
1679
+
1680
+ frameData[fullFLAG ? '$full' : '$img'] = $img;
1681
+
1682
+ var srcKey = type === 'stage' ? (fullFLAG ? 'full' : 'img') : 'thumb',
1683
+ src = dataFrame[srcKey],
1684
+ dummy = fullFLAG ? null : dataFrame[type === 'stage' ? 'thumb' : 'img'];
1685
+
1686
+ if (type === 'navThumb') $frame = frameData.$wrap;
1687
+
1688
+ function triggerTriggerEvent (event) {
1689
+ var _index = normalizeIndex(index);
1690
+ triggerEvent(event, {
1691
+ index: _index,
1692
+ src: src,
1693
+ frame: data[_index]
1694
+ });
1695
+ }
1696
+
1697
+ function error () {
1698
+ $img.remove();
1699
+
1700
+ $.Fotorama.cache[src] = 'error';
1701
+
1702
+ if ((!dataFrame.html || type !== 'stage') && dummy && dummy !== src) {
1703
+ dataFrame[srcKey] = src = dummy;
1704
+ loadImg([index], type, specialMeasures, specialFit, true);
1705
+ } else {
1706
+ if (src && !dataFrame.html) {
1707
+ $frame
1708
+ .trigger('f:error')
1709
+ .removeClass(loadingClass)
1710
+ .addClass(errorClass);
1711
+
1712
+ triggerTriggerEvent('error');
1713
+ } else if (type === 'stage') {
1714
+ $frame
1715
+ .trigger('f:load')
1716
+ .removeClass(loadingClass + ' ' + errorClass)
1717
+ .addClass(loadedClass);
1718
+
1719
+ triggerTriggerEvent('load');
1720
+ setMeasures();
1721
+ }
1722
+
1723
+ frameData.state = 'error';
1724
+
1725
+ if (size > 1 && !dataFrame.html && !dataFrame.deleted && !dataFrame.video && !fullFLAG) {
1726
+ dataFrame.deleted = true;
1727
+ that.splice(index, 1);
1728
+ }
1729
+ }
1730
+ }
1731
+
1732
+ function loaded () {
1733
+ ////console.log('loaded: ' + src);
1734
+
1735
+ var width = img.width,
1736
+ height = img.height,
1737
+ ratio = width / height;
1738
+
1739
+ imgData.measures = {
1740
+ width: width,
1741
+ height: height,
1742
+ ratio: ratio
1743
+ };
1744
+
1745
+ setMeasures(width, height, ratio, index);
1746
+
1747
+ $img
1748
+ .off('load error')
1749
+ .addClass(imgClass + (fullFLAG ? ' ' + imgFullClass : ''))
1750
+ .prependTo($frame);
1751
+
1752
+ fit($img, specialMeasures || measures, specialFit || dataFrame.fit || opts.fit);
1753
+
1754
+ $.Fotorama.cache[src] = 'loaded';
1755
+ frameData.state = 'loaded';
1756
+
1757
+ setTimeout(function () {
1758
+ $frame
1759
+ .trigger('f:load')
1760
+ .removeClass(loadingClass + ' ' + errorClass)
1761
+ .addClass(loadedClass + ' ' + (fullFLAG ? loadedFullClass : loadedImgClass));
1762
+
1763
+ if (type === 'stage') {
1764
+ triggerTriggerEvent('load');
1765
+ }
1766
+ }, 5);
1767
+ }
1768
+
1769
+ if (!src) {
1770
+ error();
1771
+ return;
1772
+ }
1773
+
1774
+ function waitAndLoad () {
1775
+ var _i = 10;
1776
+ waitFor(function () {
1777
+ return !touchedFLAG || !_i-- && !SLOW;
1778
+ }, function () {
1779
+ loaded();
1780
+ });
1781
+ }
1782
+
1783
+ if (!$.Fotorama.cache[src]) {
1784
+ $.Fotorama.cache[src] = '*';
1785
+
1786
+ $img
1787
+ .on('load', waitAndLoad)
1788
+ .on('error', error);
1789
+ } else {
1790
+ (function justWait () {
1791
+ if ($.Fotorama.cache[src] === 'error') {
1792
+ error();
1793
+ } else if ($.Fotorama.cache[src] === 'loaded') {
1794
+ ////console.log('take from cache: ' + src);
1795
+ setTimeout(waitAndLoad, 0);
1796
+ } else {
1797
+ setTimeout(justWait, 100);
1798
+ }
1799
+ })();
1800
+ }
1801
+
1802
+ img.src = src;
1803
+ });
1804
+ }
1805
+
1806
+ function updateFotoramaState () {
1807
+ var $frame = that.activeFrame[STAGE_FRAME_KEY];
1808
+
1809
+ if ($frame && !$frame.data().state) {
1810
+ ooooStart($frame);
1811
+ $frame.on('f:load f:error', function () {
1812
+ $frame.off('f:load f:error');
1813
+ ooooStop();
1814
+ });
1815
+ }
1816
+ }
1817
+
1818
+ function frameDraw (indexes, type) {
1819
+ eachIndex(indexes, type, function (i, index, dataFrame, $frame, key, frameData) {
1820
+ if ($frame) return;
1821
+
1822
+ $frame = dataFrame[key] = $wrap[key].clone();
1823
+ frameData = $frame.data();
1824
+ frameData.data = dataFrame;
1825
+
1826
+ if (type === 'stage') {
1827
+
1828
+ if (dataFrame.html) {
1829
+ $('<div class="' + htmlClass + '"></div>')
1830
+ .append(
1831
+ dataFrame._html ? $(dataFrame.html)
1832
+ .removeAttr('id')
1833
+ .html(dataFrame._html) // Because of IE
1834
+ : dataFrame.html
1835
+ )
1836
+ .appendTo($frame);
1837
+ }
1838
+
1839
+ if (opts.captions && dataFrame.caption) {
1840
+ $('<div class="' + captionClass + '"></div>').append(dataFrame.caption).appendTo($frame);
1841
+ }
1842
+
1843
+ dataFrame.video && $frame
1844
+ .addClass(stageFrameVideoClass)
1845
+ .append($videoPlay.clone());
1846
+
1847
+ $stageFrame = $stageFrame.add($frame);
1848
+ } else if (type === 'navDot') {
1849
+ $navDotFrame = $navDotFrame.add($frame);
1850
+ } else if (type === 'navThumb') {
1851
+ frameData.$wrap = $frame.children(':first');
1852
+ $navThumbFrame = $navThumbFrame.add($frame);
1853
+ if (dataFrame.video) {
1854
+ $frame.append($videoPlay.clone());
1855
+ }
1856
+ }
1857
+ });
1858
+ }
1859
+
1860
+ function callFit ($img, measuresToFit, method) {
1861
+ return $img && $img.length && fit($img, measuresToFit, method);
1862
+ }
1863
+
1864
+ function stageFramePosition (indexes) {
1865
+ eachIndex(indexes, 'stage', function (i, index, dataFrame, $frame, key, frameData) {
1866
+ if (!$frame) return;
1867
+
1868
+ toDetach[STAGE_FRAME_KEY][normalizeIndex(index)] = $frame.css($.extend({left: o_fade ? 0 : getPosByIndex(index, measures.w, MARGIN, repositionIndex)}, o_fade && getDuration(0)));
1869
+
1870
+ if (isDetached($frame[0])) {
1871
+ $frame.appendTo($stageShaft);
1872
+ unloadVideo(dataFrame.$video);
1873
+ }
1874
+
1875
+ var method = dataFrame.fit || opts.fit;
1876
+
1877
+ callFit(frameData.$img, measures, method);
1878
+ callFit(frameData.$full, measures, method);
1879
+ });
1880
+ }
1881
+
1882
+ function thumbsDraw (pos, loadFLAG) {
1883
+ if (o_nav !== 'thumbs' || isNaN(pos)) return;
1884
+
1885
+ var leftLimit = -pos,
1886
+ rightLimit = -pos + measures.w;
1887
+
1888
+ $navThumbFrame.each(function () {
1889
+ var $this = $(this),
1890
+ thisData = $this.data(),
1891
+ eq = thisData.eq,
1892
+ specialMeasures = {h: o_thumbSide2},
1893
+ specialFit = 'cover';
1894
+
1895
+ specialMeasures.w = thisData.w;
1896
+
1897
+ if (thisData.l + thisData.w < leftLimit
1898
+ || thisData.l > rightLimit
1899
+ || callFit(thisData.$img, specialMeasures, specialFit)) return;
1900
+
1901
+ loadFLAG && loadImg([eq], 'navThumb', specialMeasures, specialFit);
1902
+ });
1903
+ }
1904
+
1905
+ function frameAppend ($frames, $shaft, type) {
1906
+ if (!frameAppend[type]) {
1907
+
1908
+ var thumbsFLAG = type === 'nav' && o_navThumbs,
1909
+ left = 0;
1910
+
1911
+ $shaft.append(
1912
+ $frames
1913
+ .filter(function () {
1914
+ var actual,
1915
+ $this = $(this),
1916
+ frameData = $this.data();
1917
+ for (var _i = 0, _l = data.length; _i < _l; _i++) {
1918
+ if (frameData.data === data[_i]) {
1919
+ actual = true;
1920
+ frameData.eq = _i;
1921
+ break;
1922
+ }
1923
+ }
1924
+ return actual || $this.remove() && false;
1925
+ })
1926
+ .sort(function (a, b) {
1927
+ return $(a).data().eq - $(b).data().eq;
1928
+ })
1929
+ .each(function () {
1930
+
1931
+ if (!thumbsFLAG) return;
1932
+
1933
+
1934
+
1935
+ var $this = $(this),
1936
+ frameData = $this.data(),
1937
+ thumbWidth = Math.round(o_thumbSide2 * frameData.data.thumbRatio) || o_thumbSide;
1938
+
1939
+ frameData.l = left;
1940
+ frameData.w = thumbWidth;
1941
+
1942
+ $this.css({width: thumbWidth});
1943
+
1944
+ left += thumbWidth + MARGIN;
1945
+ })
1946
+ );
1947
+
1948
+ frameAppend[type] = true;
1949
+ }
1950
+ }
1951
+
1952
+ function getDirection (x) {
1953
+ return x - stageLeft > measures.w / 3;
1954
+ }
1955
+
1956
+ function disableDirrection (i) {
1957
+ return !o_loop && (!(activeIndex + i) || !(activeIndex - size + i)) && !$videoPlaying;
1958
+ }
1959
+
1960
+ function arrsUpdate () {
1961
+ $arrs.each(function (i) {
1962
+ $(this).toggleClass(
1963
+ arrDisabledClass,
1964
+ disableDirrection(i)
1965
+ );
1966
+ });
1967
+ }
1968
+
1969
+ function getNavFrameBounds ($navFrame) {
1970
+ var navFrameData = $navFrame.data(),
1971
+ left,
1972
+ width;
1973
+
1974
+ if (o_navThumbs) {
1975
+ left = navFrameData.l;
1976
+ width = navFrameData.w;
1977
+ } else {
1978
+ left = $navFrame.position().left;
1979
+ width = $navFrame.width();
1980
+ }
1981
+
1982
+ return {
1983
+ c: left + width / 2,
1984
+ min: -left + MARGIN * 10,
1985
+ max: -left + measures.w - width - MARGIN * 10
1986
+ };
1987
+ }
1988
+
1989
+ function slideThumbBorder (time) {
1990
+ var navFrameData = that.activeFrame[navFrameKey].data();
1991
+ slide($thumbBorder, {
1992
+ time: time * .9,
1993
+ pos: navFrameData.l,
1994
+ width: navFrameData.w - MARGIN * 2
1995
+ });
1996
+ }
1997
+
1998
+ function slideNavShaft (options) {
1999
+ var $guessNavFrame = data[options.guessIndex][navFrameKey];
2000
+ if ($guessNavFrame) {
2001
+ var overflowFLAG = navShaftData.min !== navShaftData.max,
2002
+ activeNavFrameBounds = overflowFLAG && getNavFrameBounds(that.activeFrame[navFrameKey]),
2003
+ l = overflowFLAG && (options.keep && slideNavShaft.l ? slideNavShaft.l : minMaxLimit((options.coo || measures.w / 2) - getNavFrameBounds($guessNavFrame).c, activeNavFrameBounds.min, activeNavFrameBounds.max)),
2004
+ pos = overflowFLAG && minMaxLimit(l, navShaftData.min, navShaftData.max),
2005
+ time = options.time * .9;
2006
+
2007
+ slide($navShaft, {
2008
+ time: time,
2009
+ pos: pos || 0,
2010
+ onEnd: function () {
2011
+ thumbsDraw(pos, true);
2012
+ }
2013
+ });
2014
+
2015
+ if (time) thumbsDraw(pos);
2016
+ setShadow($nav, findShadowEdge(pos, navShaftData.min, navShaftData.max));
2017
+
2018
+ slideNavShaft.l = l;
2019
+ }
2020
+ }
2021
+
2022
+ function navUpdate () {
2023
+ deactivateFrames(navFrameKey);
2024
+ toDeactivate[navFrameKey].push(that.activeFrame[navFrameKey].addClass(activeClass));
2025
+ }
2026
+
2027
+ function deactivateFrames (key) {
2028
+ var _toDeactivate = toDeactivate[key];
2029
+
2030
+ while (_toDeactivate.length) {
2031
+ _toDeactivate.shift().removeClass(activeClass);
2032
+ }
2033
+ }
2034
+
2035
+
2036
+ function detachFrames (key) {
2037
+ var _toDetach = toDetach[key];
2038
+
2039
+ $.each(activeIndexes, function (i, index) {
2040
+ delete _toDetach[index];
2041
+ });
2042
+
2043
+ $.each(_toDetach, function (index, $frame) {
2044
+ delete _toDetach[index];
2045
+ $frame.detach();
2046
+ });
2047
+ }
2048
+
2049
+ function stageShaftReposition (skipOnEnd) {
2050
+
2051
+ repositionIndex = dirtyIndex = activeIndex;
2052
+
2053
+ var dataFrame = that.activeFrame,
2054
+ $frame = dataFrame[STAGE_FRAME_KEY];
2055
+
2056
+ if ($frame) {
2057
+ deactivateFrames(STAGE_FRAME_KEY);
2058
+ toDeactivate[STAGE_FRAME_KEY].push($frame.addClass(activeClass));
2059
+
2060
+ skipOnEnd || that.show.onEnd(true);
2061
+ stop($stageShaft, 0);
2062
+
2063
+ detachFrames(STAGE_FRAME_KEY);
2064
+ stageFramePosition(activeIndexes);
2065
+ setStageShaftMinmaxAndSnap();
2066
+ setNavShaftMinmax();
2067
+ }
2068
+ }
2069
+
2070
+ function extendMeasures (options, optsLeave) {
2071
+ options && $.extend(measures, {
2072
+ width: options.width || measures.width,
2073
+ height: options.height,
2074
+ minWidth: options.minWidth,
2075
+ maxWidth: options.maxWidth,
2076
+ minHeight: options.minHeight,
2077
+ maxHeight: options.maxHeight,
2078
+ ratio: (function (_ratio) {
2079
+ if (!_ratio) return;
2080
+ var ratio = Number(_ratio);
2081
+ if (!isNaN(ratio)) {
2082
+ return ratio;
2083
+ } else {
2084
+ ratio = _ratio.split('/');
2085
+ return Number(ratio[0] / ratio[1]) || undefined;
2086
+ }
2087
+ })(options.ratio)
2088
+ })
2089
+ && !optsLeave && $.extend(opts, {
2090
+ width: measures.width,
2091
+ height: measures.height,
2092
+ minWidth: measures.minWidth,
2093
+ maxWidth: measures.maxWidth,
2094
+ minHeight: measures.minHeight,
2095
+ maxHeight: measures.maxHeight,
2096
+ ratio: measures.ratio
2097
+ });
2098
+ }
2099
+
2100
+ function triggerEvent (event, extra) {
2101
+ $fotorama.trigger(_fotoramaClass + ':' + event, [that, extra]);
2102
+ }
2103
+
2104
+ function onTouchStart () {
2105
+ clearTimeout(onTouchEnd.t);
2106
+ touchedFLAG = 1;
2107
+
2108
+ if (opts.stopAutoplayOnTouch) {
2109
+ that.stopAutoplay();
2110
+ } else {
2111
+ pausedAutoplayFLAG = true;
2112
+ }
2113
+ }
2114
+
2115
+ function onTouchEnd () {
2116
+ onTouchEnd.t = setTimeout(function () {
2117
+ touchedFLAG = 0;
2118
+ }, TRANSITION_DURATION + TOUCH_TIMEOUT);
2119
+ }
2120
+
2121
+ function releaseAutoplay () {
2122
+ pausedAutoplayFLAG = !!($videoPlaying || stoppedAutoplayFLAG);
2123
+ }
2124
+
2125
+ function changeAutoplay () {
2126
+ clearTimeout(changeAutoplay.t);
2127
+ if (!opts.autoplay || pausedAutoplayFLAG) {
2128
+ if (that.autoplay) {
2129
+ that.autoplay = false;
2130
+ triggerEvent('stopautoplay');
2131
+ }
2132
+
2133
+ return;
2134
+ }
2135
+
2136
+ if (!that.autoplay) {
2137
+ that.autoplay = true;
2138
+ triggerEvent('startautoplay');
2139
+ }
2140
+
2141
+ var _activeIndex = activeIndex;
2142
+
2143
+ changeAutoplay.t = setTimeout(function () {
2144
+ var frameData = that.activeFrame[STAGE_FRAME_KEY].data();
2145
+ waitFor(function () {
2146
+ return frameData.state || _activeIndex !== activeIndex;
2147
+ }, function () {
2148
+ if (pausedAutoplayFLAG || _activeIndex !== activeIndex) return;
2149
+ that.show(o_loop ? '>' : normalizeIndex(activeIndex + 1));
2150
+ });
2151
+ }, opts.autoplay);
2152
+ }
2153
+
2154
+
2155
+ that.startAutoplay = function (interval) {
2156
+ if (that.autoplay) return this;
2157
+ pausedAutoplayFLAG = stoppedAutoplayFLAG = false;
2158
+ setAutoplayInterval(interval || opts.autoplay);
2159
+ changeAutoplay();
2160
+
2161
+ return this;
2162
+ };
2163
+
2164
+ that.stopAutoplay = function () {
2165
+ if (that.autoplay) {
2166
+ pausedAutoplayFLAG = stoppedAutoplayFLAG = true;
2167
+ changeAutoplay();
2168
+ }
2169
+ return this;
2170
+ };
2171
+
2172
+ that.show = function (options) {
2173
+ var index;
2174
+
2175
+ if (typeof options !== 'object') {
2176
+ index = options;
2177
+ options = {};
2178
+ } else {
2179
+ index = options.index;
2180
+ }
2181
+
2182
+ index = index === '>' ? dirtyIndex + 1 : index === '<' ? dirtyIndex - 1 : index === '<<' ? 0 : index === '>>' ? size - 1 : index;
2183
+ index = isNaN(index) ? getIndexFromHash(index, data, true) : index;
2184
+ index = typeof index === 'undefined' ? activeIndex || 0 : index;
2185
+
2186
+ that.activeIndex = activeIndex = edgeIndex(index);
2187
+ prevIndex = getPrevIndex(activeIndex);
2188
+ nextIndex = getNextIndex(activeIndex);
2189
+ activeIndexes = [activeIndex, prevIndex, nextIndex];
2190
+
2191
+ dirtyIndex = o_loop ? index : activeIndex;
2192
+
2193
+ var diffIndex = Math.abs(lastActiveIndex - dirtyIndex),
2194
+ time = getNumber(options.time, function () {
2195
+ return Math.min(o_transitionDuration * (1 + (diffIndex - 1) / 12), o_transitionDuration * 2);
2196
+ }),
2197
+ overPos = options.overPos;
2198
+
2199
+ if (options.slow) time *= 10;
2200
+
2201
+ that.activeFrame = activeFrame = data[activeIndex];
2202
+
2203
+ unloadVideo(false, activeFrame.i !== data[normalizeIndex(repositionIndex)].i);
2204
+
2205
+ frameDraw(activeIndexes, 'stage');
2206
+ stageFramePosition([dirtyIndex, getPrevIndex(dirtyIndex), getNextIndex(dirtyIndex)]);
2207
+
2208
+ triggerEvent('show', options.direct);
2209
+
2210
+ updateTouchTails('go', true);
2211
+
2212
+ var onEnd = that.show.onEnd = function (skipReposition) {
2213
+ if (onEnd.ok) return;
2214
+ onEnd.ok = true;
2215
+ updateFotoramaState();
2216
+ loadImg(activeIndexes, 'stage');
2217
+
2218
+ skipReposition || stageShaftReposition(true);
2219
+
2220
+ triggerEvent('showend', options.direct);
2221
+
2222
+ updateTouchTails('go', false);
2223
+
2224
+ stageCursor();
2225
+ releaseAutoplay();
2226
+ changeAutoplay();
2227
+ };
2228
+
2229
+ if (!o_fade) {
2230
+ slide($stageShaft, {
2231
+ pos: -getPosByIndex(dirtyIndex, measures.w, MARGIN, repositionIndex),
2232
+ overPos: overPos,
2233
+ time: time,
2234
+ onEnd: onEnd
2235
+ });
2236
+ } else {
2237
+ var $activeFrame = activeFrame[STAGE_FRAME_KEY],
2238
+ $prevActiveFrame = activeIndex !== lastActiveIndex ? data[lastActiveIndex][STAGE_FRAME_KEY] : null;
2239
+
2240
+ fade($activeFrame, $prevActiveFrame, $stageFrame, {
2241
+ time: time,
2242
+ method: opts.transition,
2243
+ onEnd: onEnd
2244
+ });
2245
+ }
2246
+
2247
+ arrsUpdate();
2248
+
2249
+ if (o_nav) {
2250
+ navUpdate();
2251
+
2252
+ var guessIndex = limitIndex(activeIndex + minMaxLimit(dirtyIndex - lastActiveIndex, -1, 1));
2253
+
2254
+ slideNavShaft({time: time, coo: guessIndex !== activeIndex && options.coo, guessIndex: typeof options.coo !== 'undefined' ? guessIndex : activeIndex});
2255
+
2256
+ if (o_navThumbs) slideThumbBorder(time);
2257
+ }
2258
+
2259
+ showedFLAG = typeof lastActiveIndex !== 'undefined' && lastActiveIndex !== activeIndex;
2260
+ lastActiveIndex = activeIndex;
2261
+ opts.hash && showedFLAG && !that.eq && setHash(activeFrame.id || activeIndex + 1);
2262
+
2263
+ return this;
2264
+ };
2265
+
2266
+ that.requestFullScreen = function () {
2267
+ if (o_allowFullScreen && !that.fullScreen) {
2268
+ scrollTop = $WINDOW.scrollTop();
2269
+ scrollLeft = $WINDOW.scrollLeft();
2270
+
2271
+ lockScroll(0, 0);
2272
+
2273
+ updateTouchTails('x', true);
2274
+
2275
+ measuresStash = $.extend({}, measures);
2276
+
2277
+ $fotorama
2278
+ .addClass(fullscreenClass)
2279
+ .appendTo($BODY.addClass(_fullscreenClass));
2280
+
2281
+ $HTML.addClass(_fullscreenClass);
2282
+
2283
+ unloadVideo($videoPlaying, true, true);
2284
+
2285
+ that.fullScreen = true;
2286
+
2287
+ if (o_nativeFullScreen) {
2288
+ fullScreenApi.request(fotorama);
2289
+ }
2290
+
2291
+ that.resize();
2292
+ loadImg(activeIndexes, 'stage');
2293
+
2294
+ triggerEvent('fullscreenenter');
2295
+ }
2296
+
2297
+ return this;
2298
+ };
2299
+
2300
+ function cancelFullScreen () {
2301
+ if (that.fullScreen) {
2302
+ that.fullScreen = false;
2303
+
2304
+ if (FULLSCREEN) {
2305
+ fullScreenApi.cancel(fotorama);
2306
+ }
2307
+
2308
+ $BODY.removeClass(_fullscreenClass);
2309
+ $HTML.removeClass(_fullscreenClass);
2310
+
2311
+ $fotorama
2312
+ .removeClass(fullscreenClass)
2313
+ .insertAfter($anchor);
2314
+
2315
+ measures = $.extend({}, measuresStash);
2316
+
2317
+ unloadVideo($videoPlaying, true, true);
2318
+
2319
+ updateTouchTails('x', false);
2320
+
2321
+ that.resize();
2322
+ loadImg(activeIndexes, 'stage');
2323
+
2324
+ lockScroll(scrollLeft, scrollTop);
2325
+
2326
+ triggerEvent('fullscreenexit');
2327
+ }
2328
+ }
2329
+
2330
+ that.cancelFullScreen = function () {
2331
+ if (o_nativeFullScreen && fullScreenApi.is()) {
2332
+ fullScreenApi.cancel(document);
2333
+ } else {
2334
+ cancelFullScreen();
2335
+ }
2336
+
2337
+ return this;
2338
+ };
2339
+
2340
+ if (document.addEventListener) {
2341
+ document.addEventListener(fullScreenApi.event, function () {
2342
+ if (!fullScreenApi.is() && !$videoPlaying) {
2343
+ cancelFullScreen();
2344
+ }
2345
+ });
2346
+ }
2347
+
2348
+ $DOCUMENT.on('keydown', function (e) {
2349
+ if ($videoPlaying && e.keyCode === 27) {
2350
+ e.preventDefault();
2351
+ unloadVideo($videoPlaying, true, true);
2352
+ } else if (that.fullScreen || (opts.keyboard && !index)) {
2353
+ if (e.keyCode === 27) {
2354
+ e.preventDefault();
2355
+ that.cancelFullScreen();
2356
+ } else if (e.keyCode === 39 || (e.keyCode === 40 && that.fullScreen)) {
2357
+ e.preventDefault();
2358
+ that.show({index: '>', slow: e.altKey, direct: true});
2359
+ } else if (e.keyCode === 37 || (e.keyCode === 38 && that.fullScreen)) {
2360
+ e.preventDefault();
2361
+ that.show({index: '<', slow: e.altKey, direct: true});
2362
+ }
2363
+ }
2364
+ });
2365
+
2366
+ if (!index) {
2367
+ $DOCUMENT.on('keydown', 'textarea, input, select', function (e) {
2368
+ if (!that.fullScreen) {
2369
+ e.stopPropagation();
2370
+ }
2371
+ });
2372
+ }
2373
+
2374
+ that.resize = function (options) {
2375
+ if (!data) return this;
2376
+
2377
+ extendMeasures(!that.fullScreen ? options : {width: '100%', maxWidth: null, minWidth: null, height: '100%', maxHeight: null, minHeight: null}, that.fullScreen);
2378
+
2379
+ var time = arguments[1] || 0,
2380
+ setFLAG = arguments[2],
2381
+ width = measures.width,
2382
+ height = measures.height,
2383
+ ratio = measures.ratio,
2384
+ windowHeight = $WINDOW.height() - (o_nav ? $nav.height() : 0);
2385
+
2386
+ if (measureIsValid(width)) {
2387
+ $wrap.css({width: width, minWidth: measures.minWidth, maxWidth: measures.maxWidth});
2388
+
2389
+ width = measures.w = $wrap.width();
2390
+ height = numberFromPercent(height) / 100 * windowHeight || numberFromMeasure(height);
2391
+
2392
+ height = height || (ratio && width / ratio);
2393
+
2394
+ if (height) {
2395
+ width = Math.round(width);
2396
+ height = measures.h = Math.round(minMaxLimit(height, numberFromPercent(measures.minHeight) / 100 * windowHeight || numberFromMeasure(measures.minHeight), numberFromPercent(measures.maxHeight) / 100 * windowHeight || numberFromMeasure(measures.maxHeight)));
2397
+
2398
+ stageShaftReposition();
2399
+
2400
+ $stage
2401
+ .addClass(stageOnlyActiveClass)
2402
+ .stop()
2403
+ .animate({width: width, height: height}, time, function () {
2404
+ $stage.removeClass(stageOnlyActiveClass);
2405
+ });
2406
+
2407
+ if (o_nav) {
2408
+ $nav
2409
+ .stop()
2410
+ .animate({width: width}, time);
2411
+
2412
+ slideNavShaft({guessIndex: activeIndex, time: time, keep: true});
2413
+ if (o_navThumbs && frameAppend.nav) slideThumbBorder(time);
2414
+ }
2415
+ measuresSetFLAG = setFLAG || true;
2416
+ ready();
2417
+ }
2418
+ }
2419
+
2420
+ stageLeft = $stage.offset().left;
2421
+
2422
+ return this;
2423
+ };
2424
+
2425
+ that.setOptions = function (options) {
2426
+ $.extend(opts, options);
2427
+ reset();
2428
+ return this;
2429
+ };
2430
+
2431
+ that.shuffle = function () {
2432
+ data && shuffle(data) && reset();
2433
+ return this;
2434
+ };
2435
+
2436
+
2437
+ function setShadow ($el, edge) {
2438
+ if (o_shadows) {
2439
+ $el.removeClass(shadowsLeftClass + ' ' + shadowsRightClass);
2440
+ edge && !$videoPlaying && $el.addClass(edge.replace(/^|\s/g, ' ' + shadowsClass + '--'));
2441
+ }
2442
+ }
2443
+
2444
+ that.destroy = function () {
2445
+ that.cancelFullScreen();
2446
+ that.stopAutoplay();
2447
+
2448
+ data = that.data = null;
2449
+
2450
+ appendElements();
2451
+
2452
+ activeIndexes = [];
2453
+ detachFrames(STAGE_FRAME_KEY);
2454
+
2455
+ return this;
2456
+ };
2457
+
2458
+ that.playVideo = function () {
2459
+ var dataFrame = that.activeFrame,
2460
+ video = dataFrame.video,
2461
+ _activeIndex = activeIndex;
2462
+
2463
+ if (typeof video === 'object' && dataFrame.videoReady) {
2464
+ o_nativeFullScreen && that.fullScreen && that.cancelFullScreen();
2465
+
2466
+ waitFor(function () {
2467
+ return !fullScreenApi.is() || _activeIndex !== activeIndex;
2468
+ }, function () {
2469
+ if (_activeIndex === activeIndex) {
2470
+ dataFrame.$video = dataFrame.$video || $($.Fotorama.jst.video(video));
2471
+ dataFrame.$video.appendTo(dataFrame[STAGE_FRAME_KEY]);
2472
+
2473
+ $wrap.addClass(wrapVideoClass);
2474
+ $videoPlaying = dataFrame.$video;
2475
+
2476
+ stageNoMove();
2477
+
2478
+ triggerEvent('loadvideo');
2479
+ }
2480
+ });
2481
+ }
2482
+
2483
+ return this;
2484
+ };
2485
+
2486
+ that.stopVideo = function () {
2487
+ unloadVideo($videoPlaying, true, true);
2488
+ return this;
2489
+ };
2490
+
2491
+
2492
+ function unloadVideo ($video, unloadActiveFLAG, releaseAutoplayFLAG) {
2493
+ if (unloadActiveFLAG) {
2494
+ $wrap.removeClass(wrapVideoClass);
2495
+ $videoPlaying = false;
2496
+
2497
+ stageNoMove();
2498
+ }
2499
+
2500
+ if ($video && $video !== $videoPlaying) {
2501
+ $video.remove();
2502
+ triggerEvent('unloadvideo');
2503
+ }
2504
+
2505
+ if (releaseAutoplayFLAG) {
2506
+ releaseAutoplay();
2507
+ changeAutoplay();
2508
+ }
2509
+ }
2510
+
2511
+ function toggleControlsClass (FLAG) {
2512
+ $wrap.toggleClass(wrapNoControlsClass, FLAG);
2513
+ }
2514
+
2515
+ function stageCursor (e) {
2516
+ if (stageShaftTouchTail.flow) return;
2517
+
2518
+ var x = e ? e.pageX : stageCursor.x,
2519
+ pointerFLAG = !disableDirrection(getDirection(x)) && opts.click;
2520
+
2521
+ if (stageCursor.p !== pointerFLAG
2522
+ && (o_fade || !opts.swipe)
2523
+ && $stage.toggleClass(pointerClass, pointerFLAG)) {
2524
+ stageCursor.p = pointerFLAG;
2525
+ stageCursor.x = x;
2526
+ }
2527
+ }
2528
+
2529
+ $stage.on('mousemove', stageCursor);
2530
+
2531
+ function onStageTap (e, toggleControlsFLAG) {
2532
+ var target = e.target,
2533
+ $target = $(target);
2534
+
2535
+ if ($target.hasClass(videoPlayClass)) {
2536
+ that.playVideo();
2537
+ } else if (target === fullscreenIcon) {
2538
+ that[(that.fullScreen ? 'cancel' : 'request') +'FullScreen']();
2539
+ } else if ($videoPlaying) {
2540
+ target === videoClose && unloadVideo($videoPlaying, true, true);
2541
+ } else {
2542
+ if (toggleControlsFLAG) {
2543
+ toggleControlsClass();
2544
+ } else if (opts.click) {
2545
+ that.show({index: e.shiftKey || !getDirection(e._x) ? '<' : '>', slow: e.altKey, direct: true});
2546
+ }
2547
+ }
2548
+ }
2549
+
2550
+ function updateTouchTails (key, value) {
2551
+ stageShaftTouchTail[key] = navShaftTouchTail[key] = value;
2552
+ }
2553
+
2554
+ stageShaftTouchTail = moveOnTouch($stageShaft, {
2555
+ onStart: onTouchStart,
2556
+ onMove: function (e, result) {
2557
+ setShadow($stage, result.edge);
2558
+ },
2559
+ onEnd: function (result) {
2560
+ setShadow($stage);
2561
+
2562
+ onTouchEnd();
2563
+
2564
+ var toggleControlsFLAG = (MS_POINTER && !hoverFLAG || result.touch) && opts.arrows;
2565
+
2566
+ if (result.moved || (toggleControlsFLAG && result.pos !== result.newPos)) {
2567
+ var index = getIndexByPos(result.newPos, measures.w, MARGIN, repositionIndex);
2568
+ that.show({
2569
+ index: index,
2570
+ time: o_fade ? o_transitionDuration : result.time,
2571
+ overPos: result.overPos,
2572
+ direct: true
2573
+ });
2574
+ } else if (!result.aborted) {
2575
+ onStageTap(result.startEvent, toggleControlsFLAG);
2576
+ }
2577
+ },
2578
+ getPos: function () {
2579
+ return - getPosByIndex(dirtyIndex, measures.w, MARGIN, repositionIndex);
2580
+ },
2581
+ timeLow: 1,
2582
+ timeHigh: 1,
2583
+ friction: 2,
2584
+ select: '.' + selectClass + ', .' + selectClass + ' *',
2585
+ $wrap: $stage
2586
+ });
2587
+
2588
+ navShaftTouchTail = moveOnTouch($navShaft, {
2589
+ onStart: onTouchStart,
2590
+ onMove: function (e, result) {
2591
+ setShadow($nav, result.edge);
2592
+ },
2593
+ onEnd: function (result) {
2594
+ onTouchEnd();
2595
+
2596
+ function onEnd () {
2597
+ slideNavShaft.l = result.newPos;
2598
+ releaseAutoplay();
2599
+ changeAutoplay();
2600
+ thumbsDraw(result.newPos, true);
2601
+ }
2602
+
2603
+ if (!result.moved) {
2604
+ var target = result.$target.closest('.' + navFrameClass, $navShaft)[0];
2605
+ target && onNavFrameClick.call(target, result.startEvent);
2606
+ } else if (result.pos !== result.newPos) {
2607
+ slide($navShaft, {
2608
+ time: result.time,
2609
+ pos: result.newPos,
2610
+ overPos: result.overPos,
2611
+ onEnd: onEnd
2612
+ });
2613
+ thumbsDraw(result.newPos);
2614
+ setShadow($nav, findShadowEdge(result.newPos, navShaftData.min, navShaftData.max));
2615
+ } else {
2616
+ onEnd();
2617
+ }
2618
+ },
2619
+ timeLow: .5,
2620
+ timeHigh: 2,
2621
+ friction: 5,
2622
+ $wrap: $nav
2623
+ });
2624
+
2625
+ $wrap.hover(
2626
+ function () {
2627
+ setTimeout(function () {
2628
+ if (touchedFLAG) return;
2629
+ hoverFLAG = true;
2630
+ toggleControlsClass(!hoverFLAG);
2631
+ }, 0);
2632
+ }, function () {
2633
+ if (!hoverFLAG) return;
2634
+ hoverFLAG = false;
2635
+ toggleControlsClass(!hoverFLAG);
2636
+ }
2637
+ );
2638
+
2639
+ function onNavFrameClick (e, time) {
2640
+ var index = $(this).data().eq;
2641
+ that.show({index: index, slow: e.altKey, direct: true, coo: e._x - $nav.offset().left, time: time});
2642
+ }
2643
+
2644
+ smartClick($arrs, function (e) {
2645
+ e.preventDefault();
2646
+ if ($videoPlaying) {
2647
+ unloadVideo($videoPlaying, true, true);
2648
+ } else {
2649
+ onTouchEnd();
2650
+ that.show({index: $arrs.index(this) ? '>' : '<', slow: e.altKey, direct: true});
2651
+ }
2652
+ }, {
2653
+ onStart: function () {
2654
+ onTouchStart();
2655
+ stageShaftTouchTail.control = true;
2656
+ },
2657
+ tail: stageShaftTouchTail
2658
+ });
2659
+
2660
+ function reset () {
2661
+ setData();
2662
+ setOptions();
2663
+
2664
+ if (!ready.ok) {
2665
+ // Only first time
2666
+ if (opts.hash && location.hash) {
2667
+ startIndex = getIndexFromHash(location.hash.replace(/^#/, ''), data, index === 0);
2668
+ }
2669
+ activeIndex = repositionIndex = dirtyIndex = lastActiveIndex = startIndex = edgeIndex(startIndex) || 0;
2670
+ }
2671
+
2672
+ if (size) {
2673
+ if ($videoPlaying) {
2674
+ unloadVideo($videoPlaying, true);
2675
+ }
2676
+
2677
+ activeIndexes = [];
2678
+ detachFrames(STAGE_FRAME_KEY);
2679
+
2680
+ that.show({index: activeIndex, time: 0});
2681
+ that.resize();
2682
+ } else {
2683
+ that.destroy();
2684
+ }
2685
+ }
2686
+
2687
+ $.each('load push pop shift unshift reverse sort splice'.split(' '), function (i, method) {
2688
+ that[method] = function () {
2689
+ data = data || [];
2690
+ if (method !== 'load') {
2691
+ Array.prototype[method].apply(data, arguments);
2692
+ } else if (arguments[0] && typeof arguments[0] === 'object' && arguments[0].length) {
2693
+ data = arguments[0];
2694
+ }
2695
+ reset();
2696
+ return that;
2697
+ }
2698
+ });
2699
+
2700
+ function ready () {
2701
+ if (!ready.ok) {
2702
+ ready.ok = true;
2703
+ triggerEvent('ready');
2704
+ }
2705
+ }
2706
+
2707
+
2708
+
2709
+ $WINDOW
2710
+ .on('resize', that.resize);
2711
+
2712
+ reset();
2713
+ };
2714
+
2715
+ $.fn.fotorama = function (opts) {
2716
+ return this.each(function () {
2717
+ var that = this,
2718
+ $fotorama = $(this),
2719
+ fotoramaData = $fotorama.data(),
2720
+ fotorama = fotoramaData.fotorama;
2721
+
2722
+ if (!fotorama) {
2723
+ waitFor(function () {
2724
+ return !isHidden(that);
2725
+ }, function () {
2726
+ fotoramaData.urtext = $fotorama.html();
2727
+ new $.Fotorama($fotorama,
2728
+ /* Priority for options:
2729
+ * 1. <div data-loop="true"></div>
2730
+ * 2. $('div').fotorama({loop: false})
2731
+ * 3. Defaults */
2732
+ $.extend(
2733
+ {},
2734
+ {
2735
+ // dimensions
2736
+ width: null, // 500 || '100%'
2737
+ minWidth: null,
2738
+ maxWidth: null, // '100%'
2739
+ height: null,
2740
+ minHeight: null,
2741
+ maxHeight: null,
2742
+ ratio: null, // '16/9' || 500/333 || 1.5
2743
+
2744
+ // navigation, thumbs
2745
+ nav: 'dots', // 'thumbs' || false
2746
+ navPosition: 'bottom', // 'top'
2747
+ thumbWidth: THUMB_SIZE,
2748
+ thumbHeight: THUMB_SIZE,
2749
+
2750
+ arrows: true,
2751
+ click: true,
2752
+ swipe: true,
2753
+
2754
+ allowFullScreen: false, // true || 'native'
2755
+
2756
+ fit: 'contain', // 'cover' || 'scale-down' || 'none'
2757
+
2758
+ transition: 'slide', // 'crossfade' || 'dissolve'
2759
+ transitionDuration: TRANSITION_DURATION,
2760
+
2761
+ captions: true,
2762
+
2763
+ hash: false,
2764
+
2765
+ autoplay: false,
2766
+ stopAutoplayOnTouch: true,
2767
+
2768
+ keyboard: false,
2769
+
2770
+ loop: false,
2771
+
2772
+ shuffle: false,
2773
+
2774
+ shadows: true
2775
+ },
2776
+ opts,
2777
+ fotoramaData
2778
+ )
2779
+ );
2780
+ });
2781
+ } else {
2782
+ fotorama.setOptions(opts);
2783
+ }
2784
+ });
2785
+ };
2786
+
2787
+ $.Fotorama.cache = {};
2788
+
2789
+ var _size = 0;
2790
+ $.Fotorama.size = 0;
2791
+
2792
+ $(function () {
2793
+ $('.' + _fotoramaClass + ':not([data-auto="false"])').fotorama();
2794
+ });
2795
+
2796
+ $ = $ || {};
2797
+ $.Fotorama = $.Fotorama || {};
2798
+ $.Fotorama.jst = $.Fotorama.jst || {};
2799
+
2800
+ $.Fotorama.jst.style = function(v) {
2801
+ var __t, __p = '', __e = _.escape;
2802
+ __p += '.fotorama' +
2803
+ ((__t = ( v.s )) == null ? '' : __t) +
2804
+ ' .fotorama__nav--thumbs .fotorama__nav__frame{\npadding:' +
2805
+ ((__t = ( v.m )) == null ? '' : __t) +
2806
+ 'px;\nheight:' +
2807
+ ((__t = ( v.h )) == null ? '' : __t) +
2808
+ 'px}\n.fotorama' +
2809
+ ((__t = ( v.s )) == null ? '' : __t) +
2810
+ ' .fotorama__thumb-border{\nheight:' +
2811
+ ((__t = ( v.h - v.m * (v.q ? 0 : 2) )) == null ? '' : __t) +
2812
+ 'px;\nborder-width:' +
2813
+ ((__t = ( v.m )) == null ? '' : __t) +
2814
+ 'px;\nmargin-top:' +
2815
+ ((__t = ( v.m )) == null ? '' : __t) +
2816
+ 'px}';
2817
+ return __p
2818
+ };
2819
+
2820
+ $.Fotorama.jst.video = function(v) {
2821
+ var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
2822
+ function print() { __p += __j.call(arguments, '') }
2823
+ __p += '<div class="fotorama__video"><iframe src="';
2824
+ print(v.type == 'youtube' ? 'http://youtube.com/embed/' + v.id +'?autoplay=1' : v.type == 'vimeo' ? 'http://player.vimeo.com/video/' + v.id + '?autoplay=1&amp;badge=0' : v.id) ;
2825
+ __p += '" frameborder="0" allowfullscreen></iframe></div>';
2826
+ return __p
2827
+ };
2828
+ })
2829
+ (window, document, jQuery);