-
Notifications
You must be signed in to change notification settings - Fork 0
/
jmpress.min.js
12 lines (12 loc) · 30.6 KB
/
jmpress.min.js
1
2
3
4
5
6
7
8
9
10
11
12
/*!
* jmpress.js v0.4.5
* http://jmpressjs.github.com/jmpress.js
*
* A jQuery plugin to build a website on the infinite canvas.
*
* Copyright 2014 Kyle Robinson Young @shama & Tobias Koppers @sokra
* Licensed MIT
* http://www.opensource.org/licenses/mit-license.php
*
* Based on the foundation laid by Bartek Szopka @bartaz
*/!function(a,b,c,d){"use strict";function e(a){if(a){var b=1+a.substr(1).search(/[A-Z]/),c=a.substr(0,b).toLowerCase(),d=a.substr(b).toLowerCase();return"-"+c+"-"+d}}function f(a){return a?a+",":""}function g(a){return a.length>0?a:null}function h(e){function f(b,c){var d=l(b),e={oldStyle:a(b).attr("style")||""},f={data:d,stepData:e};m.call(this,"beforeInitStep",a(b),f),e.delegate=d.delegate,m.call(this,"initStep",a(b),f),a(b).data("stepData",e),a(b).attr("id")||a(b).attr("id","step-"+(c+1)),m.call(this,"applyStep",a(b),f)}function h(b){var c=a(b).data("stepData");a(b).attr("style",c.oldStyle),m.call(this,"unapplyStep",a(b),{stepData:c})}function i(b){m.call(this,"unapplyStep",a(b),{stepData:b.data("stepData")}),m.call(this,"applyStep",a(b),{stepData:b.data("stepData")})}function j(){L&&m.call(this,"setInactive",L,{stepData:a(L).data("stepData"),reason:"deinit"}),K.jmpressClass&&a(F).removeClass(K.jmpressClass),m.call(this,"beforeDeinit",a(this),{}),a(E.stepSelector,F).each(function(){h.call(F,this)}),G.attr("style",I.container),E.fullscreen&&a("html").attr("style",""),H.attr("style",I.area),a(J).children().each(function(){F.append(a(this))}),E.fullscreen?J.remove():(J.remove(),H.remove()),m.call(this,"afterDeinit",a(this),{}),a(F).data("jmpressmethods",!1)}function m(b,c,d){d.settings=E,d.current=K,d.container=G,d.parents=c?n(c):null,d.current=K,d.jmpress=this;var e={};return a.each(E[b],function(a,b){e.value=b.call(F,c,d)||e.value}),e.value}function n(b){return a(b).parentsUntil(F).not(F).filter(E.stepSelector)}function q(a){return r({step:L,substep:M},a)}function r(b,c){var e;if(a.isPlainObject(b)&&(e=b.substep,b=b.step),"string"==typeof b&&(b=F.find(b).first()),!b||!a(b).data("stepData"))return!1;s.call(this);var f=a(b).data("stepData"),h=!1;if(m.call(this,"beforeChange",b,{stepData:f,reason:c,cancel:function(){h=!0}}),h)return d;var i={},j=b;a(b).data("stepData").delegate&&(j=g(a(b).parentsUntil(F).filter(E.stepSelector).filter(f.delegate))||g(a(b).near(f.delegate))||g(a(b).near(f.delegate,!0))||g(a(f.delegate,F)),j?f=j.data("stepData"):j=b),N&&m.call(this,"setInactive",N,{stepData:a(N).data("stepData"),delegatedFrom:L,reason:c,target:i,nextStep:j,nextSubstep:e,nextStepData:f});var k={stepData:f,delegatedFrom:b,reason:c,target:i,substep:e,prevStep:N,prevSubstep:M,prevStepData:N&&a(N).data("stepData")};return m.call(this,"beforeActive",j,k),m.call(this,"setActive",j,k),K.jmpressClass&&a(F).removeClass(K.jmpressClass),a(F).addClass(K.jmpressClass="step-"+a(j).attr("id")),K.jmpressDelegatedClass&&a(F).removeClass(K.jmpressDelegatedClass),a(F).addClass(K.jmpressDelegatedClass="delegating-step-"+a(b).attr("id")),m.call(this,"applyTarget",j,a.extend({canvas:J,area:H,beforeActive:N},k)),L=b,M=k.substep,N=j,K.idleTimeout&&clearTimeout(K.idleTimeout),K.idleTimeout=setTimeout(function(){m.call(this,"idle",j,k)},Math.max(1,E.transitionDuration-100)),j}function s(){!function b(){function d(){(0!==a(G).scrollTop()||0!==a(G).scrollLeft())&&b()}if("BODY"===a(G)[0].tagName)try{c.scrollTo(0,0)}catch(e){}a(G).scrollTop(0),a(G).scrollLeft(0),setTimeout(d,1),setTimeout(d,10),setTimeout(d,100),setTimeout(d,200),setTimeout(d,400)}()}function t(a){return r.call(this,a,"jump")}function u(){return r.call(this,m.call(this,"selectNext",L,{stepData:a(L).data("stepData"),substep:M}),"next")}function v(){return r.call(this,m.call(this,"selectPrev",L,{stepData:a(L).data("stepData"),substep:M}),"prev")}function w(){return r.call(this,m.call(this,"selectHome",L,{stepData:a(L).data("stepData")}),"home")}function x(){return r.call(this,m.call(this,"selectEnd",L,{stepData:a(L).data("stepData")}),"end")}function y(b){return k(J,b||{}),a(J)}function z(){return N&&a(N)}function A(b,c,d){return p[b]?m.call(this,b,c,d):(a.error("callback "+b+" is not registered."),void 0)}function B(){var a=navigator.userAgent.toLowerCase();return-1===a.search(/(iphone)|(ipod)|(android)/)||-1!==a.search(/(chrome)/)}e=a.extend(!0,{},e||{});var C={},D=null;for(D in p)C[D]=a.isFunction(e[D])?[e[D]]:e[D],e[D]=[];var E=a.extend(!0,{},o,e);for(D in p)C[D]&&Array.prototype.push.apply(E[D],C[D]);var F=a(this),G=null,H=null,I={container:"",area:""},J=null,K=null,L=!1,M=null,N=!1;if(F.data("jmpressmethods",{select:r,reselect:q,scrollFix:s,goTo:t,next:u,prev:v,home:w,end:x,canvas:y,container:function(){return G},settings:function(){return E},active:z,current:function(){return K},fire:A,init:function(b){f.call(this,a(b),K.nextIdNumber++)},deinit:function(b){b?h.call(this,a(b)):j.call(this)},reapply:i}),B()===!1)return E.notSupportedClass&&F.addClass(E.notSupportedClass),void 0;E.notSupportedClass&&F.removeClass(E.notSupportedClass);var O=a(E.stepSelector,F);G=F,H=a("<div />"),J=a("<div />"),a(F).children().filter(O).each(function(){J.append(a(this))}),E.fullscreen&&(G=a("body"),a("html").css({overflow:"hidden"}),H=F),I.area=H.attr("style")||"",I.container=G.attr("style")||"",E.fullscreen?(G.css({height:"100%"}),F.append(J)):(G.css({position:"relative"}),H.append(J),F.append(H)),a(G).addClass(E.containerClass),a(H).addClass(E.areaClass),a(J).addClass(E.canvasClass),b.documentElement.style.height="100%",G.css({overflow:"hidden"});var P={position:"absolute",transitionDuration:"0s"};P=a.extend({},E.animation,P),k(H,P),k(H,{top:"50%",left:"50%",perspective:"1000px"}),k(J,P),K={},m.call(this,"beforeInit",null,{}),O.each(function(a){f.call(F,this,a)}),K.nextIdNumber=O.length,m.call(this,"afterInit",null,{}),r.call(this,m.call(this,"selectInitialStep","init",{})),E.initClass&&a(O).removeClass(E.initClass)}function i(){return o}function j(b,c){a.isFunction(c)?r[b]?a.error("function "+b+" is already registered."):r[b]=c:p[b]?a.error("callback "+b+" is already registered."):(p[b]=1,o[b]=[])}function k(b,c){var d,e,f={};for(d in c)c.hasOwnProperty(d)&&(e=n(d),null!==e&&(f[e]=c[d]));return a(b).css(f),b}function l(b){function c(a){a=a.split("-");for(var b=1;b<a.length;b++)a[b]=a[b].substr(0,1).toUpperCase()+a[b].substr(1);return a.join("")}if(a(b)[0].dataset)return a.extend({},a(b)[0].dataset);var d={},e=a(b)[0].attributes;return a.each(e,function(a,b){"data-"===b.nodeName.substr(0,5)&&(d[c(b.nodeName.substr(5))]=b.nodeValue)}),d}function m(){return!!a(this).data("jmpressmethods")}var n=function(){var a=b.createElement("dummy").style,c="Webkit Moz O ms Khtml".split(" "),e={};return function(b){if("undefined"==typeof e[b]){var f=b.charAt(0).toUpperCase()+b.substr(1),g=(b+" "+c.join(f+" ")+f).split(" ");e[b]=null;for(var h in g)if(a[g[h]]!==d){e[b]=g[h];break}}return e[b]}}(),o={stepSelector:".step",containerClass:"",canvasClass:"",areaClass:"",notSupportedClass:"not-supported",fullscreen:!0,animation:{transformOrigin:"top left",transitionProperty:f(e(n("transform")))+f(e(n("perspective")))+"opacity",transitionDuration:"1s",transitionDelay:"500ms",transitionTimingFunction:"ease-in-out",transformStyle:"preserve-3d"},transitionDuration:1500},p={beforeChange:1,beforeInitStep:1,initStep:1,beforeInit:1,afterInit:1,beforeDeinit:1,afterDeinit:1,applyStep:1,unapplyStep:1,setInactive:1,beforeActive:1,setActive:1,selectInitialStep:1,selectPrev:1,selectNext:1,selectHome:1,selectEnd:1,idle:1,applyTarget:1};for(var q in p)o[q]=[];var r={init:h,initialized:m,deinit:function(){},css:k,pfx:n,defaults:i,register:j,dataset:l};a.fn.jmpress=function(b){function c(){var c=a(this).data("jmpressmethods");if(c&&c[b])return c[b].apply(this,Array.prototype.slice.call(arguments,1));if(r[b])return r[b].apply(this,Array.prototype.slice.call(arguments,1));if(p[b]&&c){var d=c.settings(),e=Array.prototype.slice.call(arguments,1)[0];a.isFunction(e)&&(d[b]=d[b]||[],d[b].push(e))}else{if("object"==typeof b||!b)return h.apply(this,arguments);a.error("Method "+b+" does not exist on jQuery.jmpress")}return this}var d,e=arguments;return a(this).each(function(a,b){d=c.apply(b,e)}),d},a.extend({jmpress:function(b){if(r[b])return r[b].apply(this,Array.prototype.slice.call(arguments,1));if(p[b]){var c=Array.prototype.slice.call(arguments,1)[0];a.isFunction(c)?o[b].push(c):a.error("Second parameter should be a function: $.jmpress( callbackName, callbackFunction )")}else a.error("Method "+b+" does not exist on jQuery.jmpress")}})}(jQuery,document,window),function(a){"use strict";function b(b,c,d,e){var f;return b.each(function(b,g){return e&&(f=c(g,d,e))?!1:a(g).is(d)?(f=g,!1):!e&&(f=c(g,d,e))?!1:void 0}),f}function c(d,e,f){var g=a(d).children();return f&&(g=a(g.get().reverse())),b(g,c,e,f)}function d(d,e,f){return b(a(d)[f?"prevAll":"nextAll"](),c,e,f)}function e(b,c,e){var f,g=a(b).parents();return g=a(g.get()),a.each(g.get(),function(b,g){return e&&a(g).is(c)?(f=g,!1):(f=d(g,c,e),f?!1:void 0)}),f}a.fn.near=function(b,f){var g=[];return a(this).each(function(a,h){var i=(f?!1:c(h,b,f))||d(h,b,f)||e(h,b,f);i&&g.push(i)}),a(g)}}(jQuery,document,window),function(a,b,c,d){"use strict";function e(a){return Math.round(1e4*a)/1e4+""}var f={3:{transform:function(b,c){var d="translate(-50%,-50%)";a.each(c,function(a,b){var c,f=["X","Y","Z"];if("translate"===b[0])d+=" translate3d("+e(b[1]||0)+"px,"+e(b[2]||0)+"px,"+e(b[3]||0)+"px)";else if("rotate"===b[0]){var g=b[4]?[1,2,3]:[3,2,1];for(c=0;3>c;c++)d+=" rotate"+f[g[c]-1]+"("+e(b[g[c]]||0)+"deg)"}else if("scale"===b[0])for(c=0;3>c;c++)d+=" scale"+f[c]+"("+e(b[c+1]||1)+")"}),a.jmpress("css",b,a.extend({},{transform:d}))}},2:{transform:function(b,c){var d="translate(-50%,-50%)";a.each(c,function(a,b){var c=["X","Y"];if("translate"===b[0])d+=" translate("+e(b[1]||0)+"px,"+e(b[2]||0)+"px)";else if("rotate"===b[0])d+=" rotate("+e(b[3]||0)+"deg)";else if("scale"===b[0])for(var f=0;2>f;f++)d+=" scale"+c[f]+"("+e(b[f+1]||1)+")"}),a.jmpress("css",b,a.extend({},{transform:d}))}},1:{transform:function(b,c){var d={top:0,left:0};a.each(c,function(a,b){"translate"===b[0]&&(d.left=Math.round(b[1]||0)+"px",d.top=Math.round(b[2]||0)+"px")}),b.animate(d,1e3)}}},g=function(){return a.jmpress("pfx","perspective")?f[3]:a.jmpress("pfx","transform")?f[2]:f[1]}();a.jmpress("defaults").reasonableAnimation={},a.jmpress("initStep",function(b,c){var d=c.data,e=c.stepData,f=parseFloat;a.extend(e,{x:f(d.x)||0,y:f(d.y)||0,z:f(d.z)||0,r:f(d.r)||0,phi:f(d.phi)||0,rotate:f(d.rotate)||0,rotateX:f(d.rotateX)||0,rotateY:f(d.rotateY)||0,rotateZ:f(d.rotateZ)||0,revertRotate:!1,scale:f(d.scale)||1,scaleX:f(d.scaleX)||!1,scaleY:f(d.scaleY)||!1,scaleZ:f(d.scaleZ)||1})}),a.jmpress("afterInit",function(b,c){var d=c.settings.stepSelector,e=c.current;e.perspectiveScale=1,e.maxNestedDepth=0;for(var f=a(c.jmpress).find(d).children(d);f.length;)e.maxNestedDepth++,f=f.children(d)}),a.jmpress("applyStep",function(b,c){a.jmpress("css",a(b),{position:"absolute",transformStyle:"preserve-3d"}),c.parents.length>0&&a.jmpress("css",a(b),{top:"50%",left:"50%"});var d=c.stepData,e=[["translate",d.x||d.r*Math.sin(d.phi*Math.PI/180),d.y||-d.r*Math.cos(d.phi*Math.PI/180),d.z],["rotate",d.rotateX,d.rotateY,d.rotateZ||d.rotate,!0],["scale",d.scaleX||d.scale,d.scaleY||d.scale,d.scaleZ||d.scale]];g.transform(b,e)}),a.jmpress("setActive",function(b,c){var e=c.target,f=c.stepData,g=e.transform=[];e.perspectiveScale=1;for(var h=c.current.maxNestedDepth;h>(c.parents.length||0);h--)g.push(["scale"],["rotate"],["translate"]);g.push(["scale",1/(f.scaleX||f.scale),1/(f.scaleY||f.scale),1/f.scaleZ]),g.push(["rotate",-f.rotateX,-f.rotateY,-(f.rotateZ||f.rotate)]),g.push(["translate",-(f.x||f.r*Math.sin(f.phi*Math.PI/180)),-(f.y||-f.r*Math.cos(f.phi*Math.PI/180)),-f.z]),e.perspectiveScale*=f.scaleX||f.scale,a.each(c.parents,function(b,c){var d=a(c).data("stepData");g.push(["scale",1/(d.scaleX||d.scale),1/(d.scaleY||d.scale),1/d.scaleZ]),g.push(["rotate",-d.rotateX,-d.rotateY,-(d.rotateZ||d.rotate)]),g.push(["translate",-(d.x||d.r*Math.sin(d.phi*Math.PI/180)),-(d.y||-d.r*Math.cos(d.phi*Math.PI/180)),-d.z]),e.perspectiveScale*=d.scaleX||d.scale}),a.each(g,function(a,b){function e(e){c.current["rotate"+e+"-"+a]===d&&(c.current["rotate"+e+"-"+a]=b[e]||0);var f=c.current["rotate"+e+"-"+a],g=b[e]||0,h=f%360,i=g%360;0>h&&(h+=360),0>i&&(i+=360);var j=i-h;-180>j?j+=360:j>180&&(j-=360),c.current["rotate"+e+"-"+a]=b[e]=f+j}"rotate"===b[0]&&(e(1),e(2),e(3))})}),a.jmpress("applyTarget",function(b,c){var d,e=c.target,f=(c.stepData,c.settings),h=1.3*e.perspectiveScale<c.current.perspectiveScale,i=e.perspectiveScale>1.3*c.current.perspectiveScale,j=-1;a.each(e.transform,function(a,b){return b.length<=1||"rotate"===b[0]&&0===b[1]%360&&0===b[2]%360&&0===b[3]%360?void 0:"scale"!==b[0]?!1:(j=a,void 0)}),j!==c.current.oldLastScale&&(h=i=!1,c.current.oldLastScale=j);var k=[];if(-1!==j)for(;j>=0;)"scale"===e.transform[j][0]&&(k.push(e.transform[j]),e.transform[j]=["scale"]),j--;var l=f.animation;f.reasonableAnimation[c.reason]&&(l=a.extend({},l,f.reasonableAnimation[c.reason])),d={perspective:Math.round(1e3*e.perspectiveScale)+"px"},d=a.extend({},l,d),h||(d.transitionDelay="0s"),c.beforeActive||(d.transitionDuration="0s",d.transitionDelay="0s"),a.jmpress("css",c.area,d),g.transform(c.area,k),d=a.extend({},l),i||(d.transitionDelay="0s"),c.beforeActive||(d.transitionDuration="0s",d.transitionDelay="0s"),c.current.perspectiveScale=e.perspectiveScale,a.jmpress("css",c.canvas,d),g.transform(c.canvas,e.transform)})}(jQuery,document,window),function(a){"use strict";var b=a.jmpress,c="activeClass",d="nestedActiveClass",e=b("defaults");e[d]="nested-active",e[c]="active",b("setInactive",function(b,e){var f=e.settings,g=f[c],h=f[d];g&&a(b).removeClass(g),h&&a.each(e.parents,function(b,c){a(c).removeClass(h)})}),b("setActive",function(b,e){var f=e.settings,g=f[c],h=f[d];g&&a(b).addClass(g),h&&a.each(e.parents,function(b,c){a(c).addClass(h)})})}(jQuery,document,window),function(a){"use strict";function b(b,c){return a(this).find(c.settings.stepSelector).first()}function c(b,c,d,e){if(!c)return!1;var f=d.settings.stepSelector;c=a(c);do{var g=c.near(f,e);if((0===g.length||0===g.closest(b).length)&&(g=a(b).find(f)[e?"last":"first"]()),!g.length)return!1;c=g}while(c.data("stepData").exclude);return c}var d=a.jmpress;d("initStep",function(a,b){b.stepData.exclude=b.data.exclude&&-1===["false","no"].indexOf(b.data.exclude)}),d("selectInitialStep",b),d("selectHome",b),d("selectEnd",function(b,c){return a(this).find(c.settings.stepSelector).last()}),d("selectPrev",function(a,b){return c(this,a,b,!0)}),d("selectNext",function(a,b){return c(this,a,b)})}(jQuery,document,window),function(a){"use strict";a.jmpress("selectInitialStep",function(a,b){return b.settings.start})}(jQuery,document,window),function(a){"use strict";function b(b,c,d){for(var e=0;e<c.length-1;e++){var f=c[e],g=c[e+1];a(b).jmpress("initialized")?a(f,b).data("stepData")[d]=g:a(f,b).attr("data-"+d,g)}}function c(b,c,d,e){var f=c.stepData;if(f[d]){var g=a(b).near(f[d],e);if(g&&g.length)return g;if(g=a(f[d],this)[e?"last":"first"](),g&&g.length)return g}}var d=a.jmpress;d("register","route",function(a,c,d){"string"==typeof a&&(a=[a,a]),b(this,a,d?"prev":"next"),c||b(this,a.reverse(),d?"next":"prev")}),d("initStep",function(a,b){for(var c in{next:1,prev:1})b.stepData[c]=b.data[c]}),d("selectNext",function(a,b){return c.call(this,a,b,"next")}),d("selectPrev",function(a,b){return c.call(this,a,b,"prev",!0)})}(jQuery,document,window),function(a){"use strict";var b=a.jmpress,c="ajax:afterStepLoaded",d="ajax:loadStep";b("register",d),b("register",c),b("defaults").ajaxLoadedClass="loaded",b("initStep",function(b,c){c.stepData.src=a(b).attr("href")||c.data.src||!1,c.stepData.srcLoaded=!1}),b(d,function(b,d){var e=d.stepData,f=e&&e.src,g=d.settings;f&&(a(b).addClass(g.ajaxLoadedClass),e.srcLoaded=!0,a(b).load(f,function(e,f,g){a(d.jmpress).jmpress("fire",c,b,a.extend({},d,{response:e,status:f,xhr:g}))}))}),b("idle",function(b,c){if(b){var e=c.settings,f=a(this);c.stepData;var g=a(b).add(a(b).near(e.stepSelector)).add(a(b).near(e.stepSelector,!0)).add(f.jmpress("fire","selectPrev",b,{stepData:a(b).data("stepData")})).add(f.jmpress("fire","selectNext",b,{stepData:a(b).data("stepData")}));g.each(function(){var b=this,c=a(b).data("stepData");c.src&&!c.srcLoaded&&f.jmpress("fire",d,b,{stepData:a(b).data("stepData")})})}}),b("setActive",function(b){var c=a(b).data("stepData");c.src&&!c.srcLoaded&&a(this).jmpress("fire",d,b,{stepData:a(b).data("stepData")})})}(jQuery,document,window),function(a,b,c,d){"use strict";function e(){return""+Math.round(1e5*Math.random(),0)}function f(b){try{var e=a("#"+c.location.hash.replace(/^#\/?/,""));return e.length>0&&e.is(b.stepSelector)?e:d}catch(f){}}function g(a){var b="#/"+a;c.history&&c.history.pushState?c.location.hash!==b&&c.history.pushState({},"",b):c.location.hash!==b&&(c.location.hash=b)}var h=a.jmpress,i="a[href^=#]";h("defaults").hash={use:!0,update:!0,bindChange:!0},h("selectInitialStep",function(b,d){var h=d.settings,j=h.hash,k=d.current,l=a(this);return d.current.hashNamespace=".jmpress-"+e(),j.use?(j.bindChange&&(a(c).bind("hashchange"+k.hashNamespace,function(a){var b=f(h);l.jmpress("initialized")&&l.jmpress("scrollFix"),b&&b.length&&(b.attr("id")!==l.jmpress("active").attr("id")&&l.jmpress("select",b),g(b.attr("id"))),a.preventDefault()}),a(i).on("click"+k.hashNamespace,function(b){var c=a(this).attr("href");try{a(c).is(h.stepSelector)&&(l.jmpress("select",c),b.preventDefault(),b.stopPropagation())}catch(d){}})),f(h)):void 0}),h("afterDeinit",function(b,d){a(i).off(d.current.hashNamespace),a(c).unbind(d.current.hashNamespace)}),h("setActive",function(b,c){var d=c.settings,e=c.current;d.hash.use&&d.hash.update&&(clearTimeout(e.hashtimeout),e.hashtimeout=setTimeout(function(){g(a(c.delegatedFrom).attr("id"))},d.transitionDuration+200))})}(jQuery,document,window),function(a,b,c,d){"use strict";function e(){return""+Math.round(1e5*Math.random(),0)}function f(a){a.preventDefault(),a.stopPropagation()}var g=a.jmpress,h="next",i="prev";g("defaults").keyboard={use:!0,keys:{33:i,37:i,38:i,9:h+":"+i,32:h,34:h,39:h,40:h,36:"home",35:"end"},ignore:{INPUT:[32,37,38,39,40],TEXTAREA:[32,37,38,39,40],SELECT:[38,40]},tabSelector:"a[href]:visible, :input:visible"},g("afterInit",function(c,g){var h=g.settings,i=h.keyboard,j=i.ignore,k=g.current,l=a(this);h.fullscreen||l.attr("tabindex",0),k.keyboardNamespace=".jmpress-"+e(),a(h.fullscreen?b:l).bind("keypress"+k.keyboardNamespace,function(a){for(var b in j)if(a.target.nodeName===b&&-1!==j[b].indexOf(a.which))return;(a.which>=37&&a.which<=40||32===a.which)&&f(a)}),a(h.fullscreen?b:l).bind("keydown"+k.keyboardNamespace,function(b){var c=a(b.target);if((h.fullscreen||c.closest(l).length)&&i.use){for(var e in j)if(c[0].nodeName===e&&-1!==j[e].indexOf(b.which))return;var g,k=!1;if(9===b.which){if(c.closest(l.jmpress("active")).length?(g=c.near(i.tabSelector,b.shiftKey),a(g).closest(h.stepSelector).is(l.jmpress("active"))||(g=d)):b.shiftKey?k=!0:g=l.jmpress("active").find("a[href], :input").filter(":visible").first(),g&&g.length>0)return g.focus(),l.jmpress("scrollFix"),f(b),void 0;b.shiftKey&&(k=!0)}var m=i.keys[b.which];"string"==typeof m?(-1!==m.indexOf(":")&&(m=m.split(":"),m=b.shiftKey?m[1]:m[0]),l.jmpress(m),f(b)):a.isFunction(m)?m.call(l,b):m&&(l.jmpress.apply(l,m),f(b)),k&&(g=l.jmpress("active").find("a[href], :input").filter(":visible").last(),g.focus(),l.jmpress("scrollFix"))}})}),g("afterDeinit",function(c,d){a(b).unbind(d.current.keyboardNamespace)})}(jQuery,document,window),function(a,b,c,d){"use strict";function e(){return""+Math.round(1e5*Math.random(),0)}function f(a,b){return Math.max(Math.min(a,b),-b)}function g(b,c,d){var e=a(this).jmpress("current"),g=a(this).jmpress("settings"),h=a(this).jmpress("active").data("stepData"),i=a(this).jmpress("container");if(!(0===e.userZoom&&0>d)){var j=h.viewPortZoomable||g.viewPort.zoomable;if(!(e.userZoom===j&&d>0)){e.userZoom+=d;var k=a(i).innerWidth()/2,l=a(i).innerHeight()/2;b=b?b-k:b,c=c?c-l:c,e.userTranslateX=f(e.userTranslateX-d*b/e.zoomOriginWindowScale/j,k*e.userZoom*e.userZoom/j),e.userTranslateY=f(e.userTranslateY-d*c/e.zoomOriginWindowScale/j,l*e.userZoom*e.userZoom/j),a(this).jmpress("reselect","zoom")}}}var h=function(){var a=navigator.userAgent.toLowerCase(),b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return b[1]||""}(),i=a.jmpress("defaults");i.viewPort={width:!1,height:!1,maxScale:0,minScale:0,zoomable:0,zoomBindMove:!0,zoomBindWheel:!0};var j=i.keyboard.keys;j["mozilla"===h?107:187]="zoomIn",j["mozilla"===h?109:189]="zoomOut",i.reasonableAnimation.resize={transitionDuration:"0s",transitionDelay:"0ms"},i.reasonableAnimation.zoom={transitionDuration:"0s",transitionDelay:"0ms"},a.jmpress("initStep",function(a,b){for(var c in{viewPortHeight:1,viewPortWidth:1,viewPortMinScale:1,viewPortMaxScale:1,viewPortZoomable:1})b.stepData[c]=b.data[c]&&parseFloat(b.data[c])}),a.jmpress("afterInit",function(f,g){var h=this;g.current.viewPortNamespace=".jmpress-"+e(),a(c).bind("resize"+g.current.viewPortNamespace,function(){a(h).jmpress("reselect","resize")}),g.current.userZoom=0,g.current.userTranslateX=0,g.current.userTranslateY=0,g.settings.viewPort.zoomBindWheel&&a(g.settings.fullscreen?b:this).bind("mousewheel"+g.current.viewPortNamespace+" DOMMouseScroll"+g.current.viewPortNamespace,function(b,c){c=c||b.originalEvent.wheelDelta||-b.originalEvent.detail;var d=c/Math.abs(c);return 0>d?a(g.jmpress).jmpress("zoomOut",b.originalEvent.x,b.originalEvent.y):d>0&&a(g.jmpress).jmpress("zoomIn",b.originalEvent.x,b.originalEvent.y),!1}),g.settings.viewPort.zoomBindMove&&a(g.settings.fullscreen?b:this).bind("mousedown"+g.current.viewPortNamespace,function(a){g.current.userZoom&&(g.current.userTranslating={x:a.clientX,y:a.clientY},a.preventDefault(),a.stopImmediatePropagation())}).bind("mousemove"+g.current.viewPortNamespace,function(b){var c=g.current.userTranslating;c&&(a(h).jmpress("zoomTranslate",b.clientX-c.x,b.clientY-c.y),c.x=b.clientX,c.y=b.clientY,b.preventDefault(),b.stopImmediatePropagation())}).bind("mouseup"+g.current.viewPortNamespace,function(a){g.current.userTranslating&&(g.current.userTranslating=d,a.preventDefault(),a.stopImmediatePropagation())})}),a.jmpress("register","zoomIn",function(a,b){g.call(this,a||0,b||0,1)}),a.jmpress("register","zoomOut",function(a,b){g.call(this,a||0,b||0,-1)}),a.jmpress("register","zoomTranslate",function(b,c){var d=a(this).jmpress("current"),e=a(this).jmpress("settings"),g=a(this).jmpress("active").data("stepData"),h=a(this).jmpress("container"),i=g.viewPortZoomable||e.viewPort.zoomable,j=a(h).innerWidth(),k=a(h).innerHeight();d.userTranslateX=f(d.userTranslateX+b/d.zoomOriginWindowScale,j*d.userZoom*d.userZoom/i),d.userTranslateY=f(d.userTranslateY+c/d.zoomOriginWindowScale,k*d.userZoom*d.userZoom/i),a(this).jmpress("reselect","zoom")}),a.jmpress("afterDeinit",function(d,e){a(e.settings.fullscreen?b:this).unbind(e.current.viewPortNamespace),a(c).unbind(e.current.viewPortNamespace)}),a.jmpress("setActive",function(b,c){var d=c.settings.viewPort,e=c.stepData.viewPortHeight||d.height,f=c.stepData.viewPortWidth||d.width,g=c.stepData.viewPortMaxScale||d.maxScale,h=c.stepData.viewPortMinScale||d.minScale,i=e&&a(c.container).innerHeight()/e,j=f&&a(c.container).innerWidth()/f,k=(j||i)&&Math.min(j||i,i||j);if(k){k=k||1,g&&(k=Math.min(k,g)),h&&(k=Math.max(k,h));var l=c.stepData.viewPortZoomable||c.settings.viewPort.zoomable;if(l){var m=1/k-1/g;m/=l,k=1/(1/k-m*c.current.userZoom)}c.target.transform.reverse(),c.current.userTranslateX&&c.current.userTranslateY?c.target.transform.push(["translate",c.current.userTranslateX,c.current.userTranslateY,0]):c.target.transform.push(["translate"]),c.target.transform.push(["scale",k,k,1]),c.target.transform.reverse(),c.target.perspectiveScale/=k}c.current.zoomOriginWindowScale=k}),a.jmpress("setInactive",function(b,c){c.nextStep&&b&&a(c.nextStep).attr("id")===a(b).attr("id")||(c.current.userZoom=0,c.current.userTranslateX=0,c.current.userTranslateY=0)})}(jQuery,document,window),function(a){"use strict";function b(){return""+Math.round(1e5*Math.random(),0)}var c=a.jmpress;c("defaults").mouse={clickSelects:!0},c("afterInit",function(c,d){var e=d.settings,f=e.stepSelector,g=d.current,h=a(this);g.clickableStepsNamespace=".jmpress-"+b(),h.bind("click"+g.clickableStepsNamespace,function(b){if(e.mouse.clickSelects&&!g.userZoom){var c=a(b.target).closest(f);c.is(h.jmpress("active"))||c.length&&(h.jmpress("select",c[0],"click"),b.preventDefault(),b.stopPropagation())}})}),c("afterDeinit",function(b,c){a(this).unbind(c.current.clickableStepsNamespace)})}(jQuery,document,window),function(a,b){"use strict";function c(){return""+Math.round(1e5*Math.random(),0)}var d=a.jmpress;d("afterInit",function(d,e){var f=e.settings,g=e.current,h=e.jmpress;g.mobileNamespace=".jmpress-"+c();var i,j=[0,0];a(f.fullscreen?b:h).bind("touchstart"+g.mobileNamespace,function(a){i=a.originalEvent.touches[0],j=[i.pageX,i.pageY]}).bind("touchmove"+g.mobileNamespace,function(a){return i=a.originalEvent.touches[0],a.preventDefault(),!1}).bind("touchend"+g.mobileNamespace,function(b){var c=[i.pageX,i.pageY],d=[c[0]-j[0],c[1]-j[1]];return Math.max(Math.abs(d[0]),Math.abs(d[1]))>50?(d=Math.abs(d[0])>Math.abs(d[1])?d[0]:d[1],a(h).jmpress(d>0?"prev":"next"),b.preventDefault(),!1):void 0})}),d("afterDeinit",function(c,d){var e=d.settings,f=d.current,g=d.jmpress;a(e.fullscreen?b:g).unbind(f.mobileNamespace)})}(jQuery,document,window),function(a,b,c,d){"use strict";function e(b,c,f){for(var g in c){var h=g;f&&(h=f+h.substr(0,1).toUpperCase()+h.substr(1)),a.isPlainObject(c[g])?e(b,c[g],h):b[h]===d&&(b[h]=c[g])}}function f(b,c){a.isArray(c)?c.length<b.length?a.error("more nested steps than children in template"):b.each(function(b,d){d=a(d);var f=d.data(j)||{};e(f,c[b]),d.data(j,f)}):a.isFunction(c)&&b.each(function(d,f){f=a(f);var g=f.data(j)||{};e(g,c(d,f,b)),f.data(j,g)})}function g(a,b,c,d){if(c.children){var e=b.children(d.settings.stepSelector);f(e,c.children)}h(a,c)}function h(a,b){e(a,b)}var i=a.jmpress,j="_template_",k="_applied_template_",l={};i("beforeInitStep",function(b,c){b=a(b);var d=c.data,e=d.template,f=b.data(k),h=b.data(j);e&&a.each(e.split(" "),function(a,e){var f=l[e];g(d,b,f,c)}),f&&g(d,b,f,c),h&&(g(d,b,h,c),b.data(j,null),h.template&&a.each(h.template.split(" "),function(a,e){var f=l[e];g(d,b,f,c)}))}),i("beforeInit",function(b,c){var d=i("dataset",this),e=d.template,g=c.settings.stepSelector;if(e){var h=l[e];f(a(this).find(g).filter(function(){return!a(this).parent().is(g)}),h.children)}}),i("register","template",function(b,c){l[b]=l[b]?a.extend(!0,{},l[b],c):a.extend(!0,{},c)}),i("register","apply",function(b,c){if(c)if(a.isArray(c))f(a(b),c);else{var d;d="string"==typeof c?l[c]:a.extend(!0,{},c),a(b).each(function(b,c){c=a(c);var f=c.data(k)||{};e(f,d),c.data(k,f)})}else{var g=a(this).jmpress("settings").stepSelector;f(a(this).find(g).filter(function(){return!a(this).parent().is(g)}),b)}})}(jQuery,document,window),function(a){"use strict";a.jmpress("setActive",function(b,c){c.prevStep!==b&&a(b).triggerHandler("enterStep")}),a.jmpress("setInactive",function(b,c){c.nextStep!==b&&a(b).triggerHandler("leaveStep")})}(jQuery,document,window),function(a,b,c,d){"use strict";function e(b){for(var c=b.split(" "),d=c[0],e={willClass:"will-"+d,doClass:"do-"+d,hasClass:"has-"+d},f="",g=1;g<c.length;g++){var h=c[g];switch(f){case"":"after"===h?f="after":a.warn("unknown keyword in '"+b+"'. '"+h+"' unknown.");break;case"after":if(h.match(/^[1-9][0-9]*m?s?/)){var i=parseFloat(h);-1!==h.indexOf("ms")?i*=1:-1!==h.indexOf("s")?i*=1e3:-1!==h.indexOf("m")&&(i*=6e4),e.delay=i}else e.after=Array.prototype.slice.call(c,g).join(" "),g=c.length}}return e}function f(b,c,d,e){e=e||b.length-1,d=d||0;for(var f=d;e+1>f;f++)if(a(b[f].element).is(c))return f}function g(b,c,d){a.each(c._on,function(a,c){b.push({substep:c.substep,delay:c.delay+d}),g(b,c.substep,c.delay+d)})}a.jmpress("defaults").customAnimationDataAttribute="jmpress",a.jmpress("afterInit",function(a,b){b.current.animationTimeouts=[],b.current.animationCleanupWaiting=[]}),a.jmpress("applyStep",function(b,c){function h(a,b){return b.substep._after?(k=b.substep._after,!1):void 0}var i={},j=[];if(a(b).find("[data-"+c.settings.customAnimationDataAttribute+"]").each(function(d,e){a(e).closest(c.settings.stepSelector).is(b)&&j.push({element:e})}),0!==j.length){a.each(j,function(b,d){d.info=e(a(d.element).data(c.settings.customAnimationDataAttribute)),a(d.element).addClass(d.info.willClass),d._on=[],d._after=null});var k={_after:d,_on:[],info:{}};if(a.each(j,function(a,b){var c=b.info.after;if(c)if("step"===c)c=k;else if("prev"===c)c=j[a-1];else{var e=f(j,c,0,a-1);e===d&&(e=f(j,c)),c=e===d||e===a?j[a-1]:j[e]}else c=j[a-1];if(c){if(!b.info.delay){if(!c._after)return c._after=b,void 0;c=c._after}c._on.push({substep:b,delay:b.info.delay||0})}}),k._after===d&&0===k._on.length){var l=f(j,c.stepData.startSubstep)||0;k._after=j[l]}var m=[];do{var n=[{substep:k,delay:0}];g(n,k,0),m.push(n),k=null,a.each(n,h)}while(k);i.list=m,a(b).data("substepsData",i)}}),a.jmpress("unapplyStep",function(b){var c=a(b).data("substepsData");c&&a.each(c.list,function(b,c){a.each(c,function(b,c){c.substep.info.willClass&&a(c.substep.element).removeClass(c.substep.info.willClass),c.substep.info.hasClass&&a(c.substep.element).removeClass(c.substep.info.hasClass),c.substep.info.doClass&&a(c.substep.element).removeClass(c.substep.info.doClass)})})}),a.jmpress("setActive",function(b,c){var e=a(b).data("substepsData");if(e){c.substep===d&&(c.substep="prev"===c.reason?e.list.length-1:0);var f=c.substep;a.each(c.current.animationTimeouts,function(a,b){clearTimeout(b)}),c.current.animationTimeouts=[],a.each(e.list,function(b,d){var e=f>b,g=f>=b;a.each(d,function(b,d){function f(){a(d.substep.element).addClass(d.substep.info.doClass)}d.substep.info.hasClass&&a(d.substep.element)[(e?"add":"remove")+"Class"](d.substep.info.hasClass),g&&!e&&d.delay&&"prev"!==c.reason?d.substep.info.doClass&&(a(d.substep.element).removeClass(d.substep.info.doClass),c.current.animationTimeouts.push(setTimeout(f,d.delay))):d.substep.info.doClass&&a(d.substep.element)[(g?"add":"remove")+"Class"](d.substep.info.doClass)})})}}),a.jmpress("setInactive",function(b,c){function d(b){a.each(b.list,function(b,c){a.each(c,function(b,c){c.substep.info.hasClass&&a(c.substep.element).removeClass(c.substep.info.hasClass),c.substep.info.doClass&&a(c.substep.element).removeClass(c.substep.info.doClass)})})}if(c.nextStep!==b){a.each(c.current.animationCleanupWaiting,function(a,b){d(b)}),c.current.animationCleanupWaiting=[];var e=a(b).data("substepsData");e&&c.current.animationCleanupWaiting.push(e)}}),a.jmpress("selectNext",function(b,c){if(c.substep!==d){var e=a(b).data("substepsData");if(e)return c.substep<e.list.length-1?{step:b,substep:c.substep+1}:void 0}}),a.jmpress("selectPrev",function(b,c){if(c.substep!==d){var e=a(b).data("substepsData");if(e)return c.substep>0?{step:b,substep:c.substep-1}:void 0}})}(jQuery,document,window);