upjs-rails 0.4.4 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/dist/up.min.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(){window.up={}}).call(this),function(){var t=[].slice;up.util=function(){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,C,x,T,S,E,A,P,D,U,F,j,z,M,O,q,H,I,N,W,G,L,X,J,R,V,B,_,K,Q,Z,Y,tn,nn,en,rn,on,un,an,sn,ln,cn,pn,fn,dn,mn,hn,vn,gn,yn,bn;return T=function(t,n){return n=n||{},n.url=t,o(n)},o=function(t){return t.selector&&(t.headers={"X-Up-Selector":t.selector}),$.ajax(t)},W=function(t,n){return(""===n||"80"===n)&&"http:"===t||"443"===n&&"https:"===t},tn=function(t,n){var e,r,o;return e=null,G(t)?(e=$("<a>").attr({href:t}).get(0),A(e.hostname)&&(e.href=e.href)):e=bn(t),r=e.protocol+"//"+e.hostname,W(e.protocol,e.port)||(r+=":"+e.port),o=e.pathname,"/"!==o[0]&&(o="/"+o),(null!=n?n.stripTrailingSlash:void 0)===!0&&(o=o.replace(/\/$/,"")),r+=o,(null!=n?n.hash:void 0)===!0&&(r+=e.hash),(null!=n?n.search:void 0)!==!1&&(r+=e.search),r},Y=function(t){return t?t.toUpperCase():"GET"},n=function(t){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v;for(p=t.split(/[ >]/),r=null,c=d=0,h=p.length;h>d;c=++d){for(i=p[c],u=i.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),f="div",o=[],l=null,m=0,v=u.length;v>m;m++)switch(a=u[m],a[0]){case".":o.push(a.substr(1));break;case"#":l=a.substr(1);break;default:f=a}s="<"+f,o.length&&(s+=' class="'+o.join(" ")+'"'),l&&(s+=' id="'+l+'"'),s+=">",n=$(s),e&&n.appendTo(e),0===c&&(r=n),e=n}return r},p=function(t,n){var e;return e=document.createElement(t),I(n)&&(e.innerHTML=n),e},h=function(){var n,e,o,u,i,a;if(n=1<=arguments.length?t.call(arguments,0):[],n=gn(n),o=n.shift(),o="[UP] "+o,u=(null!=(a=o.match(r))?a.length:void 0)||0,F(V(n))&&u<n.length&&(e=n.pop()),i=console.debug.apply(console,[o].concat(t.call(n))),e){console.groupCollapsed();try{i=e()}finally{console.groupEnd()}}return i},y=function(){var n,e,r;throw e=1<=arguments.length?t.call(arguments,0):[],e[0]="[UP] "+e[0],console.error.apply(console,e),r=hn(e),n=an($(".up-error"))||$('<div class="up-error"></div>').prependTo("body"),n.addClass("up-error"),n.text(r),r},r=/\%[odisf]/g,hn=function(t){var n,e,o;return o=t[0],n=0,e=30,o.replace(r,function(){var r,o;return n+=1,r=t[n],o=typeof r,"string"===o?(r=r.replace(/\s+/g," "),r.length>e&&(r=r.substr(0,e)+"\u2026"),'"'+r+'"'):"number"===o?r.toString():"("+o+")"})},d=function(t){var n,e,r,o,u,i,a;for(h("Creating selector from element %o",t),e=(n=t.attr("class"))?n.split(" "):[],r=t.attr("id"),u=t.prop("tagName").toLowerCase(),r&&(u+="#"+r),i=0,a=e.length;a>i;i++)o=e[i],u+="."+o;return u},f=function(t){var n,e,r,o,u,i,a,s,l,c,f,d;return l=function(t){return"<"+t+"(?: [^>]*)?>"},i=function(t){return"</"+t+">"},n="(?:.|\\n)*?",u=function(t){return"("+t+")"},d=new RegExp(l("head")+n+l("title")+u(n)+i("title")+n+i("body"),"i"),o=new RegExp(l("body")+u(n)+i("body"),"i"),(r=t.match(o))?(s=document.createElement("html"),e=p("body",r[1]),s.appendChild(e),(f=t.match(d))&&(a=p("head"),s.appendChild(a),c=p("title",f[1]),a.appendChild(c)),s):p("div",t)},w=$.extend,yn=$.trim,R=Object.keys||function(t){var n,e,r,o;for(e=[],r=0,o=t.length;o>r;r++)n=t[r],t.hasOwnProperty(n)&&e.push(n);return e},g=function(t,n){var e,r,o,u,i;for(i=[],e=o=0,u=t.length;u>o;e=++o)r=t[e],i.push(n(r,e));return i},q=function(t){return null===t},L=function(t){return void 0===t},D=function(t){return!L(t)},O=function(t){return L(t)||q(t)},j=function(t){return!O(t)},A=function(t){return O(t)||H(t)&&0===R(t).length||0===t.length},an=function(t,n){return null==n&&(n=I),n(t)?t:null},I=function(t){return!A(t)},F=function(t){return"function"==typeof t},G=function(t){return"string"==typeof t},z=function(t){return"object"==typeof t&&!!t},H=function(t){return z(t)||"function"==typeof t},U=function(t){return!(!t||1!==t.nodeType)},M=function(t){return t instanceof jQuery},N=function(t){return H(t)&&F(t.then)},P=function(t){return N(t)&&F(t.resolve)},S=function(t){return j(t)?t:void 0},E=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},gn=function(t){return Array.prototype.slice.call(t)},l=function(t){return E(t)?t.slice():w({},t)},bn=function(t){return M(t)?t.get(0):t},K=function(t,n){return w(l(t),n)},on=function(t,n){var e,r,o,u;if(o=t?l(t):{},n)for(r in n)e=n[r],u=o[r],j(u)?H(e)&&H(u)&&(o[r]=on(u,e)):o[r]=e;return o},rn=function(){var n,e,r,o,u,i;for(e=1<=arguments.length?t.call(arguments,0):[],r=null,u=0,i=e.length;i>u;u++)if(n=e[u],o=n,F(o)&&(o=o()),I(o)){r=o;break}return r},v=function(t,n){var e,r,o,u;for(r=null,o=0,u=t.length;u>o;o++)if(e=t[o],n(e)){r=e;break}return r},fn=function(t,n){var e;return e=[],g(t,function(t){return n(t)?e.push(t):void 0}),e},sn=function(){var n,e,r,o;return n=arguments[0],r=2<=arguments.length?t.call(arguments,1):[],o=function(){var t,o,u;for(u=[],t=0,o=r.length;o>t;t++)e=r[t],u.push(n.attr(e));return u}(),v(o,I)},Z=function(t){return setTimeout(t,0)},V=function(t){return t[t.length-1]},a=function(){var t;return t=document.documentElement,{width:t.clientWidth,height:t.clientHeight}},vn=function(t,n,e){var r,o;return o=t.css(R(n)),t.css(n),r=function(){return t.css(o)},e?(e(),r()):r},x=function(t){var n,e;return e=t.css(["transform","-webkit-transform"]),A(e)?(n=function(){return t.css(e)},t.css({transform:"translateZ(0)","-webkit-transform":"translateZ(0)"})):n=function(){},n},m=function(t,n,r){var o,u,i,a,s,l;return o=$(t),up.browser.canCssAnimation()?(r=on(r,{duration:300,delay:0,easing:"ease"}),u=$.Deferred(),a={"transition-property":R(n).join(", "),"transition-duration":r.duration+"ms","transition-delay":r.delay+"ms","transition-timing-function":r.easing},s=x(o),l=vn(o,a),o.css(n),u.then(s),u.then(l),o.data(e,u),u.then(function(){return o.removeData(e)}),i=setTimeout(function(){return u.resolve()},r.duration+r.delay),u.then(function(){return clearTimeout(i)}),u):(o.css(n),pn())},e="up-animation-promise",C=function(t){return $(t).each(function(){var t;return(t=$(this).data(e))?t.resolve():void 0})},_=function(t,n){var e,r,o;return r=(null!=n?n.relative:void 0)?t.position():t.offset(),e={left:r.left,top:r.top},(null!=n?n.inner:void 0)?(e.width=t.width(),e.height=t.height()):(e.width=t.outerWidth(),e.height=t.outerHeight()),(null!=n?n.full:void 0)&&(o=a(),e.right=o.width-(e.left+e.width),e.bottom=o.height-(e.top+e.height)),e},c=function(t,n){var e,r,o,u,i;for(u=t.get(0).attributes,i=[],r=0,o=u.length;o>r;r++)e=u[r],i.push(e.specified?n.attr(e.name,e.value):void 0);return i},un=function(t){var n,e;return e=_(t,{relative:!0,inner:!0}),n=t.clone(),n.find("script").remove(),n.css({right:"",bottom:"",position:"absolute"}),n.css(e),n.addClass("up-ghost"),n.insertBefore(t)},k=function(t,n){return t.find(n).addBack(n)},b=function(t){return 27===t.keyCode},s=function(t,n){return t.indexOf(n)>=0},i=function(t){return"true"===String(t)},u=function(t){return"false"===String(t)},B=function(t){return t.getResponseHeader("X-Up-Location")},Q=function(t){return t.getResponseHeader("X-Up-Method")},en=function(){var n,e,r,o,u,i;for(o=arguments[0],r=2<=arguments.length?t.call(arguments,1):[],n={},u=0,i=r.length;i>u;u++)e=r[u],o.hasOwnProperty(e)&&(n[e]=o[e]);return n},X=function(t){return!(t.metaKey||t.shiftKey||t.ctrlKey)},J=function(t){return 0===t.button&&X(t)},cn=function(){var t;return t=$.Deferred(),t.resolve(),t},pn=function(){return cn().promise()},nn=function(){return{is:function(){return!1},attr:function(){},find:function(){return[]}}},ln=function(){var n,e;return n=1<=arguments.length?t.call(arguments,0):[],e=$.when.apply($,n),e.resolve=function(){return g(n,function(t){return"function"==typeof t.resolve?t.resolve():void 0})},e},dn=function(t,n){var e,r,o;o=[];for(e in n)r=n[e],o.push(O(t.attr(e))?t.attr(e,r):void 0);return o},mn=function(t){var n,e,r,o,u,i,a,s;for(u={},n=function(t){return u[r(t)]},e=function(t){return v(t,n)},o=function(t){return u[r(t)]=!0},r=function(t){return"_"+t},a=0,s=t.length;s>a;a++)i=t[a],o(i);return{put:o,includes:n,includesAny:e}},{presentAttr:sn,createElement:p,normalizeUrl:tn,normalizeMethod:Y,createElementFromHtml:f,$createElementFromSelector:n,createSelectorFromElement:d,get:T,ajax:o,extend:w,copy:l,merge:K,options:on,option:rn,error:y,debug:h,each:g,detect:v,select:fn,last:V,isNull:q,isDefined:D,isUndefined:L,isGiven:j,isMissing:O,isPresent:I,isBlank:A,presence:an,isObject:H,isFunction:F,isString:G,isElement:U,isJQuery:M,isPromise:N,isDeferred:P,isHash:z,ifGiven:S,isUnmodifiedKeyEvent:X,isUnmodifiedMouseEvent:J,nullJquery:nn,unwrap:bn,nextFrame:Z,measure:_,temporaryCss:vn,cssAnimate:m,finishCssAnimate:C,forceCompositing:x,prependGhost:un,escapePressed:b,copyAttributes:c,findWithSelf:k,contains:s,isArray:E,toArray:gn,castsToTrue:i,castsToFalse:u,locationFromXhr:B,methodFromXhr:Q,clientSize:a,only:en,trim:yn,keys:R,resolvedPromise:pn,resolvedDeferred:cn,resolvableWhen:ln,setMissingAttrs:dn,stringSet:mn}}()}.call(this),function(){var t=[].slice;up.browser=function(){var n,e,r,o,u,i,a,s,l,c;return l=up.util,a=function(t,n){var e,r,o,u,i,a;return null==n&&(n={}),i=l.option(n.method,"get").toLowerCase(),"get"===i?location.href=t:$.rails?(a=n.target,o=$.rails.csrfToken(),r=$.rails.csrfParam(),e=$("<form method='post' action='"+t+"'></form>"),u="<input name='_method' value='"+i+"' type='hidden' />",l.isDefined(r)&&l.isDefined(o)&&(u+="<input name='"+r+"' value='"+o+"' type='hidden' />"),a&&e.attr("target",a),e.hide().append(u).appendTo("body"),e.submit()):error("Can't fake a "+i.toUpperCase()+" request without Rails UJS")},c=function(){return location.href},o=function(){var t,n,e,r,o,u,i,a;return window.console||(window.console={}),t=function(){},(n=window.console).log||(n.log=t),(e=window.console).info||(e.info=t),(r=window.console).error||(r.error=t),(o=window.console).debug||(o.debug=t),(u=window.console).group||(u.group=t),(i=window.console).groupCollapsed||(i.groupCollapsed=t),(a=window.console).groupEnd||(a.groupEnd=t)},s=function(n){var e,r;return e=void 0,r=!1,function(){var o;return o=1<=arguments.length?t.call(arguments,0):[],r?e:(r=!0,e=n.apply(null,o))}},r=s(function(){return l.isDefined(history.pushState)}),n=s(function(){return"transition"in document.documentElement.style}),e=s(function(){return"oninput"in document.createElement("input")}),u=function(){var t,n,e,r,o;return o=$.fn.jquery,r=o.split("."),n=parseInt(r[0]),e=parseInt(r[1]),t=n>=2||1===n&&e>=9,t||l.error("jQuery %o found, but Up.js requires 1.9+",o)},i=s(function(){return l.isDefined(document.addEventListener)}),{url:c,ensureConsoleExists:o,loadPage:a,canPushState:r,canCssAnimation:n,canInputEvent:e,isSupported:i,ensureRecentJquery:u}}()}.call(this),function(){var t=[].slice;up.bus=function(){var n,e,r,o,u,i,a,s;return s=up.util,n={},r={},e=function(t){return n[t]||(n[t]=[])},a=function(){var t,e,o;r={},o=[];for(e in n)t=n[e],o.push(r[e]=s.copy(t));return o},i=function(){return n=s.copy(r)},u=function(t,n){return e(t).push(n)},o=function(){var n,r,o;return o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],s.debug("Emitting event %o with args %o",o,n),r=e(o),s.each(r,function(t){return t.apply(null,n)})},u("framework:ready",a),u("framework:reset",i),{on:u,emit:o}}()}.call(this),function(){up.viewport=function(){var t,n,e,r,o,u,i;return i=up.util,n={duration:0,view:"body",easing:"swing"},e=function(t){return i.extend(n,t)},t="up-scroll-promise",u=function(e,o,u){var a,s,l,c,p;return a=$(e),u=i.options(u),l=i.option(u.duration,n.duration),c=i.option(u.easing,n.easing),r(a),l>0?(s=$.Deferred(),a.data(t,s),s.then(function(){return a.removeData(t),a.finish()}),p={scrollTop:o},a.animate(p,{duration:l,easing:c,complete:function(){return s.resolve()}}),s):(a.scrollTop(o),i.resolvedDeferred())},r=function(n){return $(n).each(function(){var n;return(n=$(this).data(t))?n.resolve():void 0})},o=function(t,e){var r,o,a,s,l,c,p,f,d,m,h;return e=i.options(e),m=i.option(e.view,n.view),f=i.option(e.padding,n.padding),r=$(t),o=$(m),h=o.height(),d=o.scrollTop(),c=d,p=d+h,l=r.position().top,a=c>l-f,s=l>p-f,a||s?(d=l-f,d=Math.max(d,0),d=Math.min(d,h-1),u(o,d,e)):i.resolvedDeferred()},{reveal:o,scroll:u,finishScrolling:r,defaults:e}}(),up.scroll=up.viewport.scroll,up.reveal=up.viewport.reveal}.call(this),function(){up.flow=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h;return h=up.util,f=function(t,n){var e;return e=$(t),h.isPresent(n)&&(n=h.normalizeUrl(n)),e.attr("up-source",n)},d=function(t){var n;return n=$(t).closest("[up-source]"),h.presence(n.attr("up-source"))||up.browser.url()},l=function(t,n,e){var r,u,i;return e=h.options(e),i=h.presence(t)?t:h.createSelectorFromElement($(t)),up.browser.canPushState()||h.castsToFalse(e.history)?(u={url:n,method:e.method,selector:i},r=up.proxy.ajax(u),r.done(function(t,r,a){var s,l;return(s=h.locationFromXhr(a))&&(h.debug("Location from server: %o",s),l={url:s,method:h.methodFromXhr(a),selector:i},up.proxy.alias(u,l),n=s),(h.isMissing(e.history)||h.castsToTrue(e.history))&&(e.history=n),(h.isMissing(e.source)||h.castsToTrue(e.source))&&(e.source=n),e.preload?void 0:o(i,t,e)}),r.fail(h.error),r):void(e.preload||up.browser.loadPage(n,h.only(e,"method")))},o=function(t,n,e){var o,s,l,c,p,f,d,v;for(e=h.options(e,{historyMethod:"push"}),h.castsToFalse(e.history)&&(e.history=null),h.castsToFalse(e.scroll)&&(e.scroll=null),e.source=h.option(e.source,e.history),l=i(n),e.title||(e.title=l.title()),d=u(t,e),v=[],p=0,f=d.length;f>p;p++)c=d[p],s=r(c.selector),o=l.find(c.selector),v.push(a(s,e).then(function(){return m(s,o,c.pseudoClass,c.transition,e)}));return v},r=function(t){return h.presence($(".up-popup "+t))||h.presence($(".up-modal "+t))||h.presence($(t))||h.error("Could not find selector %o in current body HTML",t)},i=function(t){var n;return n=h.createElementFromHtml(t),{title:function(){var t;return null!=(t=n.querySelector("title"))?t.textContent:void 0},find:function(e){var r;return(r=n.querySelector(e))?$(r):h.error("Could not find selector %o in response %o",e,t)}}},a=function(t,n){return up.motion.finish(t),p(t,n.scroll)},p=function(t,n){return n?up.reveal(t,{view:n}):h.resolvedDeferred()},e=function(n,e){return"function"==typeof e.insert&&e.insert(n),e.history&&(e.title&&(document.title=e.title),up.history[e.historyMethod](e.history)),f(n,e.source),t(n),up.ready(n)},m=function(t,r,o,u,i){var a,s;return u||(u="none"),o?(s="before"===o?"prepend":"append",a=r.children(),t[s](r.contents()),h.copyAttributes(r,t),e(a,i),up.animate(r,u)):n(t,{animation:function(){return r.insertBefore(t),e(r,i),t.is("body")&&"none"!==u&&h.error("Cannot apply transitions to body-elements (%o)",u),up.morph(t,r,u)}})},u=function(t,n){var e,r,o,u,i,a,s,l,c,p,f;for(s=n.transition||n.animation||"none",e=/\ *,\ */,r=t.split(e),h.isPresent(s)&&(l=s.split(e)),f=[],o=c=0,p=r.length;p>c;o=++c)u=r[o],i=u.match(/^(.+?)(?:\:(before|after))?$/),a=l[o]||h.last(l),f.push({selector:i[1],pseudoClass:i[2],transition:a});return f},t=function(t){var n,e;return e="[autofocus]:last",n=h.findWithSelf(t,e),n.length&&n.get(0)!==document.activeElement?n.focus():void 0},n=function(t,n){var e,r;return e=$(t),n=h.options(n,{animation:"none"}),e.addClass("up-destroying"),h.isPresent(n.url)&&up.history.push(n.url),h.isPresent(n.title)&&(document.title=n.title),up.bus.emit("fragment:destroy",e),r=h.presence(n.animation,h.isPromise)||up.motion.animate(e,n.animation),r.then(function(){return e.remove()})},s=function(t){var n;return n=d(t),l(t,n)},c=function(){return up.bus.emit("framework:reset")},up.bus.on("app:ready",function(){return f(document.body,up.browser.url())}),{replace:l,reload:s,destroy:n,implant:o,reset:c}}(),up.replace=up.flow.replace,up.reload=up.flow.reload,up.destroy=up.flow.destroy,up.reset=up.flow.reset}.call(this),function(){var t=[].slice;up.magic=function(){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g;return g=up.util,n="up-destroyable",e="up-destroyer",f=[],l=null,p=function(t,n,e){var r,o;if(up.browser.isSupported())return r=[t,n,function(t){return e.apply(this,[t,$(this),a(this)])}],f.push(r),(o=$(document)).on.apply(o,r)},u=[],s=null,o=function(){var n,e,r,o;return o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],up.browser.isSupported()?(e=n.pop(),r=g.options(n[0],{batch:!1}),u.push({selector:o,callback:e,batch:r.batch})):void 0},r=function(t,r,o){var u;return g.debug("Applying awakener %o on %o",t.selector,o),u=t.callback.apply(o,[r,a(r)]),g.isFunction(u)?(r.addClass(n),r.data(e,u)):void 0},i=function(t){var n,e,o,i,a;for(g.debug("Compiling fragment %o",t),a=[],o=0,i=u.length;i>o;o++)e=u[o],n=g.findWithSelf(t,e.selector),a.push(n.length?e.batch?r(e,n,n.get()):n.each(function(){return r(e,$(this),this)}):void 0);return a},c=function(t){return g.findWithSelf(t,"."+n).each(function(){var t,n;return t=$(this),(n=t.data(e))()})},a=function(t){var n,e;return n=$(t),e=n.attr("up-data"),g.isString(e)&&""!==g.trim(e)?JSON.parse(e):{}},v=function(){return l=g.copy(f),s=g.copy(u)},h=function(){var t,n,e,r;for(n=0,e=f.length;e>n;n++)t=f[n],g.contains(l,t)||(r=$(document)).off.apply(r,t);return f=g.copy(l),u=g.copy(s)},m=function(t){var n;return n=$(t),up.bus.emit("fragment:ready",n),n},d=function(t){return p("keydown","body",function(n){return g.escapePressed(n)?t(n):void 0})},up.bus.on("app:ready",function(){return m(document.body)}),up.bus.on("fragment:ready",i),up.bus.on("fragment:destroy",c),up.bus.on("framework:ready",v),up.bus.on("framework:reset",h),{awaken:o,on:p,ready:m,onEscape:d,data:a}}(),up.awaken=up.magic.awaken,up.on=up.magic.on,up.ready=up.magic.ready}.call(this),function(){up.history=function(){var t,n,e,r,o,u;return u=up.util,t=function(t){return u.normalizeUrl(t,{hash:!0})===u.normalizeUrl(up.browser.url(),{hash:!0})},o=function(e,r){return r=u.options(r,{force:!1}),r.force||!t(e)?n("replace",e):void 0},r=function(e){return t(e)?void 0:n("push",e)},n=function(t,n){return up.browser.canPushState()?(t+="State",window.history[t]({fromUp:!0},"",n)):u.error("This browser doesn't support history.pushState")},e=function(t){var n;return n=t.originalEvent.state,(null!=n?n.fromUp:void 0)?(u.debug("Restoring state %o (now on "+up.browser.url()+")",n),up.visit(up.browser.url(),{historyMethod:"replace"})):u.debug("Discarding unknown state %o",n)},up.browser.canPushState()&&setTimeout(function(){return $(window).on("popstate",e),o(up.browser.url(),{force:!0})},200),{push:r,replace:o}}()}.call(this),function(){up.motion=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w;return b=up.util,r={},i={},y={},a={},u={duration:300,delay:0,easing:"ease"},s=function(t){return b.extend(u,t)},n=function(t,e,r){var i;return i=$(t),c(i),r=b.options(r,u),b.isFunction(e)?o(e(i,r),e):b.isString(e)?n(i,l(e),r):b.isHash(e)?b.cssAnimate(i,e,r):b.error("Unknown animation type %o",e)},l=function(t){return r[t]||b.error("Unknown animation %o",e)},t="up-ghosting-promise",w=function(n,e,r){var o,u,i,a;return u=null,o=null,b.temporaryCss(e,{display:"none"},function(){return u=b.prependGhost(n).addClass("up-destroying")}),b.temporaryCss(n,{display:"none"},function(){return o=b.prependGhost(e)}),n.css({visibility:"hidden"}),i=b.temporaryCss(e,{display:"none"}),a=r(u,o),n.data(t,a),e.data(t,a),a.then(function(){return n.removeData(t),e.removeData(t),u.remove(),o.remove(),n.css({display:"none"}),i()}),a},c=function(t){return $(t).each(function(){var t;return t=$(this),b.finishCssAnimate(t),p(t)})},p=function(n){var e;return(e=n.data(t))?(b.debug("Canceling existing ghosting on %o",n),"function"==typeof e.resolve?e.resolve():void 0):void 0},o=function(t,n){return b.isDeferred(t)?t:b.error("Did not return a promise with .then and .resolve methods: %o",n)},f=function(t,e,i,a){var s,l,p,m,v;return up.browser.canCssAnimation()?(a=b.options(u),l=$(t),s=$(e),c(l),c(s),"none"===i?d():(v=b.presence(i,b.isFunction)||y[i])?w(l,s,function(t,n){return o(v(t,n,a),i)}):(p=r[i])?(l.hide(),n(s,p,a)):b.isString(i)&&i.indexOf("/")>=0?(m=i.split("/"),v=function(t,e,r){return h(n(t,m[0],r),n(e,m[1],r))},f(l,s,v,a)):b.error("Unknown transition %o",i)):b.resolvedDeferred()},g=function(t,n){return y[t]=n},e=function(t,n){return r[t]=n},v=function(){return i=b.copy(r),a=b.copy(y)},m=function(){return r=b.copy(i),y=b.copy(a)},h=b.resolvableWhen,d=b.resolvedDeferred,e("none",d),e("fade-in",function(t,e){return t.css({opacity:0}),n(t,{opacity:1},e)}),e("fade-out",function(t,e){return t.css({opacity:1}),n(t,{opacity:0},e)}),e("move-to-top",function(t,e){var r,o;return r=b.measure(t),o=r.top+r.height,t.css({"margin-top":"0px"}),n(t,{"margin-top":"-"+o+"px"},e)}),e("move-from-top",function(t,e){var r,o;return r=b.measure(t),o=r.top+r.height,t.css({"margin-top":"-"+o+"px"}),n(t,{"margin-top":"0px"},e)}),e("move-to-bottom",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().height-r.top,t.css({"margin-top":"0px"}),n(t,{"margin-top":o+"px"},e)}),e("move-from-bottom",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().height-r.top,t.css({"margin-top":o+"px"}),n(t,{"margin-top":"0px"},e)}),e("move-to-left",function(t,e){var r,o;return r=b.measure(t),o=r.left+r.width,t.css({"margin-left":"0px"}),n(t,{"margin-left":"-"+o+"px"},e)}),e("move-from-left",function(t,e){var r,o;return r=b.measure(t),o=r.left+r.width,t.css({"margin-left":"-"+o+"px"}),n(t,{"margin-left":"0px"},e)}),e("move-to-right",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().width-r.left,t.css({"margin-left":"0px"}),n(t,{"margin-left":o+"px"},e)}),e("move-from-right",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().width-r.left,t.css({"margin-left":o+"px"}),n(t,{"margin-left":"0px"},e)}),e("roll-down",function(t,e){var r,o;return r=t.height(),o=b.temporaryCss(t,{height:"0px",overflow:"hidden"}),n(t,{height:r+"px"},e).then(o)}),g("none",d),g("move-left",function(t,e,r){return h(n(t,"move-to-left",r),n(e,"move-from-right",r))}),g("move-right",function(t,e,r){return h(n(t,"move-to-right",r),n(e,"move-from-left",r))}),g("move-up",function(t,e,r){return h(n(t,"move-to-top",r),n(e,"move-from-bottom",r))}),g("move-down",function(t,e,r){return h(n(t,"move-to-bottom",r),n(e,"move-from-top",r))}),g("cross-fade",function(t,e,r){return h(n(t,"fade-out",r),n(e,"fade-in",r))}),up.bus.on("framework:ready",v),up.bus.on("framework:reset",m),{morph:f,animate:n,finish:c,transition:g,animation:e,defaults:s,none:d,when:h}}(),up.transition=up.motion.transition,up.animation=up.motion.animation,up.morph=up.motion.morph,up.animate=up.motion.animate}.call(this),function(){up.proxy=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,$,C,x,T;return l={preloadDelay:75,cacheSize:70,cacheExpiry:3e5},c=function(t){return T.extend(l,t)},o={},T=up.util,t=null,p=null,u=function(t){return v(t),[t.url,t.method,t.selector].join("|")},x=function(){var t,n,e;return t=T.keys(o),t.length>l.cacheSize&&(n=null,e=null,T.each(t,function(t){var r,u;return r=o[t],u=r.timestamp,!e||e>u?(n=t,e=u):void 0}),n)?delete o[n]:void 0},$=function(){return(new Date).valueOf()},v=function(t){return!T.isHash(t),t._requestNormalized||(t.method=T.normalizeMethod(t.method),t.url&&(t.url=T.normalizeUrl(t.url)),t.selector||(t.selector="body"),t._requestNormalized=!0),t},r=function(t,n){var e;return T.debug("Aliasing %o to %o",t,n),(e=d(t))?w(n,e):void 0},e=function(t){var n;return h(t)?(n=d(t))?C(n):(n=T.ajax(t),w(t,n)):(s(),n=T.ajax(t)),n},n=["GET","OPTIONS","HEAD"],h=function(t){return v(t),T.contains(n,t.method)},f=function(t){return h(t)||T.error("Won't preload non-GET request %o",t)},m=function(t){var n;return n=$()-t.timestamp,n<l.cacheExpiry},C=function(t){return t.timestamp=$()},d=function(t){var n,e;return n=u(t),(e=o[n])?m(e)?(T.debug("Cache hit for %o (%o)",t.url,t),e):(T.debug("Discarding stale cache entry for %o (%o)",t.url,t),void y(t)):void T.debug("Cache miss for %o (%o)",t.url,t)},w=function(t,n){var e;return x(),e=u(t),o[e]=n,C(n),n},y=function(t){var n;return n=u(t),delete o[n]},s=function(){return o={}},a=function(n){var e,r;return r=parseInt(T.presentAttr(n,"up-delay"))||l.preloadDelay,n.is(t)?void 0:(t=n,i(),e=function(){return g(n)},k(e,r))},k=function(t,n){return p=setTimeout(t,n)},i=function(){return clearTimeout(p),p=null},g=function(t,n){return n=T.options(),f(n),T.debug("Preloading %o",t),n.preload=!0,up.link.follow(t,n)},b=function(){return i(),o={}},up.bus.on("framework:reset",b),up.on("mouseover mousedown touchstart","[up-preload]",function(t,n){return up.link.childClicked(t,n)?void 0:a(up.link.resolve(n))}),{preload:g,ajax:e,get:d,set:w,alias:r,clear:s,defaults:c}}()}.call(this),function(){up.link=function(){var t,n,e,r,o,u;return o=up.util,u=function(t,n){return o.debug("Visiting "+t),up.replace("body",t,n)},e=function(t,n){var e,r,u;return e=$(t),n=o.options(n),u=o.option(e.attr("href"),e.attr("up-follow")),r=o.option(n.target,e.attr("up-target"),"body"),n.transition=o.option(n.transition,e.attr("up-transition"),e.attr("up-animation")),n.history=o.option(n.history,e.attr("up-history")),n.scroll=o.option(n.scroll,e.attr("up-scroll"),"body"),up.replace(r,u,n)},r=function(t){var n,e;return n=$(t),e=n.attr("up-follow"),n.is("a")||o.isPresent(e)&&!o.castsToTrue(e)?n:n.find("a:first")},up.on("click","a[up-target]",function(t,n){return t.preventDefault(),n.is("[up-instant]")?void 0:e(n)}),up.on("mousedown","a[up-target][up-instant]",function(n,e){return t(n,e)?(n.preventDefault(),up.follow(e)):void 0}),n=function(t,n){var e,r;return e=$(t.target),r=e.closest("a, [up-follow]"),r.length&&n.find(r).length},t=function(t,e){return o.isUnmodifiedMouseEvent(t)&&!n(t,e)},up.on("click","[up-follow]",function(t,o){return n(t,o)||(t.preventDefault(),o.is("[up-instant]"))?void 0:e(r(o))}),up.on("mousedown","[up-follow][up-instant]",function(n,e){return t(n,e)?(n.preventDefault(),up.follow(r(e))):void 0}),up.awaken("[up-dash]",function(t){var n,e;return e=t.attr("up-dash"),n={"up-preload":"true","up-instant":"true"},o.isBlank(e)||o.castsToTrue(e)?n["up-follow"]="":n["up-target"]=e,o.setMissingAttrs(t,n),t.removeAttr("up-dash")}),{visit:u,follow:e,resolve:r,childClicked:n}}(),up.visit=up.link.visit,up.follow=up.link.follow}.call(this),function(){up.form=function(){var observe,submit,u;return u=up.util,submit=function(t,n){var e,r,o,i,a,s,l,c,p,f;return e=$(t).closest("form"),n=u.options(n),l=u.option(n.target,e.attr("up-target"),"body"),r=u.option(n.failTarget,e.attr("up-fail-target"),function(){return u.createSelectorFromElement(e)}),i=u.option(n.history,e.attr("up-history"),!0),c=u.option(n.transition,e.attr("up-transition")),o=u.option(n.failTransition,e.attr("up-fail-transition")),a=u.option(n.method,e.attr("up-method"),e.attr("data-method"),e.attr("method"),"post").toUpperCase(),f=u.option(n.url,e.attr("action"),up.browser.url()),e.addClass("up-active"),up.browser.canPushState()||u.castsToFalse(i)?(s={url:f,type:a,data:e.serialize(),selector:l},p=function(t){var n;return f=i?u.castsToFalse(i)?!1:u.isString(i)?i:(n=u.locationFromXhr(t))?n:"GET"===s.type?s.url+"?"+s.data:void 0:void 0,u.option(f,!1)},u.ajax(s).always(function(){return e.removeClass("up-active")}).done(function(t,n,e){return up.flow.implant(l,t,{history:p(e),transition:c})}).fail(function(t){var n;return n=t.responseText,up.flow.implant(r,n,{transition:o})})):void e.get(0).submit()},observe=function(fieldOrSelector,options){var $field,callback,callbackPromise,callbackTimer,changeEvents,check,clearTimer,codeOnChange,delay,knownValue,nextCallback,runNextCallback;return $field=$(fieldOrSelector),options=u.options(options),delay=u.option($field.attr("up-delay"),options.delay,0),delay=parseInt(delay),knownValue=null,callback=null,callbackTimer=null,(codeOnChange=$field.attr("up-observe"))?callback=function(value,$field){return eval(codeOnChange)}:options.change?callback=options.change:u.error("up.observe: No change callback given"),callbackPromise=u.resolvedPromise(),nextCallback=null,runNextCallback=function(){var t;return nextCallback?(t=nextCallback(),nextCallback=null,t):void 0},check=function(){var t,n;return n=$field.val(),t=u.isNull(knownValue),knownValue===n||(knownValue=n,t)?void 0:(clearTimer(),nextCallback=function(){return callback.apply($field.get(0),[n,$field])},callbackTimer=setTimeout(function(){return callbackPromise.then(function(){var t;return t=runNextCallback(),callbackPromise=u.isPromise(t)?t:u.resolvedPromise()})},delay))},clearTimer=function(){return clearTimeout(callbackTimer)},changeEvents=up.browser.canInputEvent()?"input change":"input change keypress paste cut click propertychange",$field.on(changeEvents,check),check(),clearTimer},up.on("submit","form[up-target]",function(t,n){return t.preventDefault(),submit(n)}),up.awaken("[up-observe]",function(t){return observe(t)}),{submit:submit,observe:observe}}(),up.submit=up.form.submit,up.observe=up.form.observe}.call(this),function(){up.popup=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f;return p=up.util,e={openAnimation:"fade-in",closeAnimation:"fade-out",origin:"bottom-right"},o=function(t){return p.extend(e,t)},s=function(t,n,e){var r,o;return o=p.measure(t,{full:!0}),r=function(){switch(e){case"bottom-right":return{right:o.right,top:o.top+o.height};case"bottom-left":return{left:o.left,top:o.bottom+o.height};case"top-right":return{right:o.right,bottom:o.top};case"top-left":return{left:o.left,bottom:o.top};default:return p.error("Unknown origin %o",e)}}(),n.attr("up-origin",e),n.css(r),i(n)},i=function(t){var n,e,r,o,u,i,a;if(e=p.measure(t,{full:!0}),r=null,o=null,e.right<0&&(r=-e.right),e.bottom<0&&(o=-e.bottom),e.left<0&&(r=e.left),e.top<0&&(o=e.top),r&&((u=parseInt(t.css("left")))?t.css("left",u-r):(i=parseInt(t.css("right")))&&t.css("right",i+r)),o){if(a=parseInt(t.css("top")))return t.css("top",a-o);if(n=parseInt(t.css("bottom")))return t.css("bottom",n+o)}},l=function(){var t;return t=$(".up-popup"),t.attr("up-previous-url",up.browser.url()),t.attr("up-previous-title",document.title)},u=function(){var t;return t=$(".up-popup"),t.removeAttr("up-previous-url"),t.removeAttr("up-previous-title")},r=function(t,n,e){var r,o;return o=p.$createElementFromSelector(".up-popup"),e&&o.attr("up-sticky",""),r=p.$createElementFromSelector(n),r.appendTo(o),o.appendTo(document.body),l(),o.hide(),o},f=function(t,n,e,r){return n.show(),s(t,n,e),up.animate(n,r)},a=function(t,o){var u,i,a,s,l,c,d,m;return u=$(t),o=p.options(o),m=p.option(o.url,u.attr("href")),c=p.option(o.target,u.attr("up-popup"),"body"),l=p.option(o.origin,u.attr("up-origin"),e.origin),a=p.option(o.animation,u.attr("up-animation"),e.openAnimation),d=p.option(o.sticky,u.is("[up-sticky]")),s=up.browser.canPushState()?p.option(o.history,u.attr("up-history"),!1):!1,n(),i=r(u,c,d),up.replace(c,m,{history:s,insert:function(){return f(u,i,l,a)}})},c=function(){var t;return t=$(".up-popup"),t.is(".up-destroying")?void 0:t.find("[up-source]").attr("up-source")},n=function(t){var n;return n=$(".up-popup"),n.length?(t=p.options(t,{animation:e.closeAnimation,url:n.attr("up-previous-url"),title:n.attr("up-previous-title")}),up.destroy(n,t)):void 0},t=function(){return $(".up-popup").is("[up-sticky]")?void 0:n()},up.on("click","a[up-popup]",function(t,e){return t.preventDefault(),e.is(".up-current")?n():a(e)}),up.on("click","body",function(t){var e;return e=$(t.target),e.closest(".up-popup").length||e.closest("[up-popup]").length?void 0:n()}),up.bus.on("fragment:ready",function(n){return n.closest(".up-popup").length?void 0:(u(),t())}),up.magic.onEscape(function(){return n()}),up.on("click","[up-close]",function(t,e){return e.closest(".up-popup")?n():void 0}),up.bus.on("framework:reset",n),{open:a,close:n,source:c,defaults:o}}()}.call(this),function(){var t=[].slice;up.modal=function(){var n,e,r,o,u,i,a,s,l,c,p,f;return p=up.util,r={width:"auto",height:"auto",openAnimation:"fade-in",closeAnimation:"fade-out",closeLabel:"X",template:function(t){return'<div class="up-modal">\n <div class="up-modal-dialog">\n <div class="up-modal-close" up-close>'+t.closeLabel+'</div>\n <div class="up-modal-content"></div>\n </div>\n</div>'}},u=function(t){return p.extend(r,t)},c=function(){var t;return t=r.template,p.isFunction(t)?t(r):t},s=function(){var t;return t=$(".up-modal"),t.attr("up-previous-url",up.browser.url()),t.attr("up-previous-title",document.title)},i=function(){var t;return t=$(".up-modal"),t.removeAttr("up-previous-url"),t.removeAttr("up-previous-title")},o=function(t,n,e,r){var o,u,i,a;return i=$(c()),r&&i.attr("up-sticky",""),i.attr("up-previous-url",up.browser.url()),i.attr("up-previous-title",document.title),u=i.find(".up-modal-dialog"),p.isPresent(n)&&u.css("width",n),p.isPresent(e)&&u.css("height",e),o=u.find(".up-modal-content"),a=p.$createElementFromSelector(t),a.appendTo(o),i.appendTo(document.body),s(),i.hide(),i},f=function(t,n){return t.show(),up.animate(t,n)},a=function(){var n,u,i,a,s,l,c,d,m,h,v;return a=1<=arguments.length?t.call(arguments,0):[],!p.isObject(a[0])||p.isElement(a[0])||p.isJQuery(a[0])?(n=$(a[0]),c=a[1]):(n=p.nullJquery(),c=a[0]),c=p.options(c),h=p.option(c.url,n.attr("href"),n.attr("up-href")),d=p.option(c.target,n.attr("up-modal"),"body"),v=p.option(c.width,n.attr("up-width"),r.width),s=p.option(c.height,n.attr("up-height"),r.height),i=p.option(c.animation,n.attr("up-animation"),r.openAnimation),m=p.option(c.sticky,n.is("[up-sticky]")),l=up.browser.canPushState()?p.option(c.history,n.attr("up-history"),!0):!1,e(),u=o(d,v,s,m),up.replace(d,h,{history:l,insert:function(){return f(u,i)
2
- }})},l=function(){var t;return t=$(".up-modal"),t.is(".up-destroying")?void 0:t.find("[up-source]").attr("up-source")},e=function(t){var n;return n=$(".up-modal"),n.length?(t=p.options(t,{animation:r.closeAnimation,url:n.attr("up-previous-url"),title:n.attr("up-previous-title")}),up.destroy(n,t)):void 0},n=function(){return $(".up-modal").is("[up-sticky]")?void 0:(i(),e())},up.on("click","a[up-modal]",function(t,n){return t.preventDefault(),n.is(".up-current")?e():a(n)}),up.on("click","body",function(t){var n;return n=$(t.target),n.closest(".up-modal-dialog").length||n.closest("[up-modal]").length?void 0:e()}),up.bus.on("fragment:ready",function(t){return t.closest(".up-modal").length?void 0:n()}),up.magic.onEscape(function(){return e()}),up.on("click","[up-close]",function(t,n){return n.closest(".up-modal")?e():void 0}),up.bus.on("framework:reset",e),{open:a,close:e,source:l,defaults:u}}()}.call(this),function(){up.tooltip=function(){var t,n,e,r,o;return o=up.util,r=function(t,n,e){var r,u,i;return u=o.measure(t),i=o.measure(n),r=function(){switch(e){case"top":return{left:u.left+.5*(u.width-i.width),top:u.top-i.height};case"bottom":return{left:u.left+.5*(u.width-i.width),top:u.top+u.height};default:return o.error("Unknown origin %o",e)}}(),n.attr("up-origin",e),n.css(r)},n=function(t){return o.$createElementFromSelector(".up-tooltip").html(t).appendTo(document.body)},e=function(e,u){var i,a,s,l,c;return null==u&&(u={}),i=$(e),l=o.option(u.html,i.attr("up-tooltip"),i.attr("title")),c=o.option(u.origin,i.attr("up-origin"),"top"),s=o.option(u.animation,i.attr("up-animation"),"fade-in"),t(),a=n(l),r(i,a,c),up.animate(a,s,u)},t=function(t){var n;return n=$(".up-tooltip"),n.length?(t=o.options(t,{animation:"fade-out"}),up.destroy(n,t)):void 0},up.awaken("[up-tooltip]",function(n){return n.on("mouseover",function(){return e(n)}),n.on("mouseout",function(){return t()})}),up.on("click","body",function(){return t()}),up.bus.on("framework:reset",t),up.magic.onEscape(function(){return t()}),{open:e,close:t}}()}.call(this),function(){up.navigation=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d;return f=up.util,t="up-active",n="up-current",e=["a[href]","a[up-target]","[up-follow]","[up-modal]","[up-popup]","[up-href]"],o=e.join(", "),u=function(){var t,n,r;for(r=[],t=0,n=e.length;n>t;t++)p=e[t],r.push(p+"[up-instant]");return r}().join(", "),r="."+t,s=function(t){return f.isPresent(t)?f.normalizeUrl(t,{search:!1,stripTrailingSlash:!0}):void 0},c=function(t){var n,e,r,o,u,i,a;if(o=[],n=up.link.resolve(t))for(a=["href","up-follow","up-href"],u=0,i=a.length;i>u;u++)e=a[u],(r=f.presentAttr(n,e))&&(r=s(r),o.push(r));return o},a=function(){var t;return t=f.stringSet([s(up.browser.url()),s(up.modal.source()),s(up.popup.source())]),f.each($(o),function(e){var r,o;return r=$(e),o=c(r),t.includesAny(o)?r.addClass(n):r.removeClass(n)})},l=function(n){return d(),n=i(n),n.addClass(t)},i=function(t){return f.presence(t.parents(o))||t},d=function(){return $(r).removeClass(t)},up.on("click",o,function(t,n){return n.is("[up-instant]")?void 0:l(n)}),up.on("mousedown",u,function(t,n){return f.isUnmodifiedMouseEvent(t)?l(n):void 0}),up.bus.on("fragment:ready",function(){return d(),a()}),up.bus.on("fragment:destroy",function(t){return t.is(".up-modal, .up-popup")?a():void 0})}()}.call(this),function(){up.marker=function(){var t,n,e;return e=up.util,n=function(t){return""!==e.trim(t.html())},t=function(t){return e.findWithSelf(t,"[up-marker]").each(function(){var t;return t=$(this),n(t)?void 0:t.hide()})},up.bus.on("fragment:ready",t)}()}.call(this),function(){up.browser.ensureRecentJquery(),up.browser.isSupported()&&(up.browser.ensureConsoleExists(),up.bus.emit("framework:ready"),$(document).on("ready",function(){return up.bus.emit("app:ready")}))}.call(this);
1
+ (function(){window.up={}}).call(this),function(){var t=[].slice;up.util=function(){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,C,x,T,S,E,A,P,D,U,F,j,O,z,M,N,q,H,I,W,G,L,X,J,R,V,B,_,K,Q,Z,Y,tn,nn,en,rn,on,un,an,sn,ln,cn,pn,fn,dn,mn,hn,vn,gn,yn,bn;return T=function(t,n){return n=n||{},n.url=t,o(n)},o=function(t){return t.selector&&(t.headers={"X-Up-Selector":t.selector}),$.ajax(t)},W=function(t,n){return(""===n||"80"===n)&&"http:"===t||"443"===n&&"https:"===t},tn=function(t,n){var e,r,o;return e=null,G(t)?(e=$("<a>").attr({href:t}).get(0),A(e.hostname)&&(e.href=e.href)):e=bn(t),r=e.protocol+"//"+e.hostname,W(e.protocol,e.port)||(r+=":"+e.port),o=e.pathname,"/"!==o[0]&&(o="/"+o),(null!=n?n.stripTrailingSlash:void 0)===!0&&(o=o.replace(/\/$/,"")),r+=o,(null!=n?n.hash:void 0)===!0&&(r+=e.hash),(null!=n?n.search:void 0)!==!1&&(r+=e.search),r},Y=function(t){return t?t.toUpperCase():"GET"},n=function(t){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v;for(p=t.split(/[ >]/),r=null,c=d=0,h=p.length;h>d;c=++d){for(i=p[c],u=i.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),f="div",o=[],l=null,m=0,v=u.length;v>m;m++)switch(a=u[m],a[0]){case".":o.push(a.substr(1));break;case"#":l=a.substr(1);break;default:f=a}s="<"+f,o.length&&(s+=' class="'+o.join(" ")+'"'),l&&(s+=' id="'+l+'"'),s+=">",n=$(s),e&&n.appendTo(e),0===c&&(r=n),e=n}return r},p=function(t,n){var e;return e=document.createElement(t),H(n)&&(e.innerHTML=n),e},h=function(){var n,e,o,u,i,a;if(n=1<=arguments.length?t.call(arguments,0):[],n=gn(n),o=n.shift(),o="[UP] "+o,u=(null!=(a=o.match(r))?a.length:void 0)||0,F(V(n))&&u<n.length&&(e=n.pop()),i=console.debug.apply(console,[o].concat(t.call(n))),e){console.groupCollapsed();try{i=e()}finally{console.groupEnd()}}return i},y=function(){var n,e,r;throw e=1<=arguments.length?t.call(arguments,0):[],e[0]="[UP] "+e[0],console.error.apply(console,e),r=hn(e),n=an($(".up-error"))||$('<div class="up-error"></div>').prependTo("body"),n.addClass("up-error"),n.text(r),r},r=/\%[odisf]/g,hn=function(t){var n,e,o;return o=t[0],n=0,e=30,o.replace(r,function(){var r,o;return n+=1,r=t[n],o=typeof r,"string"===o?(r=r.replace(/\s+/g," "),r.length>e&&(r=r.substr(0,e)+"\u2026"),'"'+r+'"'):"number"===o?r.toString():"("+o+")"})},d=function(t){var n,e,r,o,u,i,a;for(h("Creating selector from element %o",t),e=(n=t.attr("class"))?n.split(" "):[],r=t.attr("id"),u=t.prop("tagName").toLowerCase(),r&&(u+="#"+r),i=0,a=e.length;a>i;i++)o=e[i],u+="."+o;return u},f=function(t){var n,e,r,o,u,i,a,s,l,c,f,d;return l=function(t){return"<"+t+"(?: [^>]*)?>"},i=function(t){return"</"+t+">"},n="(?:.|\\n)*?",u=function(t){return"("+t+")"},d=new RegExp(l("head")+n+l("title")+u(n)+i("title")+n+i("body"),"i"),o=new RegExp(l("body")+u(n)+i("body"),"i"),(r=t.match(o))?(s=document.createElement("html"),e=p("body",r[1]),s.appendChild(e),(f=t.match(d))&&(a=p("head"),s.appendChild(a),c=p("title",f[1]),a.appendChild(c)),s):p("div",t)},w=$.extend,yn=$.trim,R=Object.keys||function(t){var n,e,r,o;for(e=[],r=0,o=t.length;o>r;r++)n=t[r],t.hasOwnProperty(n)&&e.push(n);return e},g=function(t,n){var e,r,o,u,i;for(i=[],e=o=0,u=t.length;u>o;e=++o)r=t[e],i.push(n(r,e));return i},N=function(t){return null===t},L=function(t){return void 0===t},D=function(t){return!L(t)},M=function(t){return L(t)||N(t)},j=function(t){return!M(t)},A=function(t){return M(t)||q(t)&&0===R(t).length||0===t.length},an=function(t,n){return null==n&&(n=H),n(t)?t:null},H=function(t){return!A(t)},F=function(t){return"function"==typeof t},G=function(t){return"string"==typeof t},O=function(t){return"object"==typeof t&&!!t},q=function(t){return O(t)||"function"==typeof t},U=function(t){return!(!t||1!==t.nodeType)},z=function(t){return t instanceof jQuery},I=function(t){return q(t)&&F(t.then)},P=function(t){return I(t)&&F(t.resolve)},S=function(t){return j(t)?t:void 0},E=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},gn=function(t){return Array.prototype.slice.call(t)},l=function(t){return E(t)?t.slice():w({},t)},bn=function(t){return z(t)?t.get(0):t},K=function(t,n){return w(l(t),n)},on=function(t,n){var e,r,o,u;if(o=t?l(t):{},n)for(r in n)e=n[r],u=o[r],j(u)?q(e)&&q(u)&&(o[r]=on(u,e)):o[r]=e;return o},rn=function(){var n,e,r,o,u,i;for(e=1<=arguments.length?t.call(arguments,0):[],r=null,u=0,i=e.length;i>u;u++)if(n=e[u],o=n,F(o)&&(o=o()),H(o)){r=o;break}return r},v=function(t,n){var e,r,o,u;for(r=null,o=0,u=t.length;u>o;o++)if(e=t[o],n(e)){r=e;break}return r},fn=function(t,n){var e;return e=[],g(t,function(t){return n(t)?e.push(t):void 0}),e},sn=function(){var n,e,r,o;return n=arguments[0],r=2<=arguments.length?t.call(arguments,1):[],o=function(){var t,o,u;for(u=[],t=0,o=r.length;o>t;t++)e=r[t],u.push(n.attr(e));return u}(),v(o,H)},Z=function(t){return setTimeout(t,0)},V=function(t){return t[t.length-1]},a=function(){var t;return t=document.documentElement,{width:t.clientWidth,height:t.clientHeight}},vn=function(t,n,e){var r,o;return o=t.css(R(n)),t.css(n),r=function(){return t.css(o)},e?(e(),r()):r},x=function(t){var n,e;return e=t.css(["transform","-webkit-transform"]),A(e)?(n=function(){return t.css(e)},t.css({transform:"translateZ(0)","-webkit-transform":"translateZ(0)"})):n=function(){},n},m=function(t,n,r){var o,u,i,a,s,l;return o=$(t),up.browser.canCssAnimation()?(r=on(r,{duration:300,delay:0,easing:"ease"}),u=$.Deferred(),a={"transition-property":R(n).join(", "),"transition-duration":r.duration+"ms","transition-delay":r.delay+"ms","transition-timing-function":r.easing},s=x(o),l=vn(o,a),o.css(n),u.then(s),u.then(l),o.data(e,u),u.then(function(){return o.removeData(e)}),i=setTimeout(function(){return u.resolve()},r.duration+r.delay),u.then(function(){return clearTimeout(i)}),u):(o.css(n),pn())},e="up-animation-promise",C=function(t){return $(t).each(function(){var t;return(t=$(this).data(e))?t.resolve():void 0})},_=function(t,n){var e,r,o;return r=(null!=n?n.relative:void 0)?t.position():t.offset(),e={left:r.left,top:r.top},(null!=n?n.inner:void 0)?(e.width=t.width(),e.height=t.height()):(e.width=t.outerWidth(),e.height=t.outerHeight()),(null!=n?n.full:void 0)&&(o=a(),e.right=o.width-(e.left+e.width),e.bottom=o.height-(e.top+e.height)),e},c=function(t,n){var e,r,o,u,i;for(u=t.get(0).attributes,i=[],r=0,o=u.length;o>r;r++)e=u[r],i.push(e.specified?n.attr(e.name,e.value):void 0);return i},un=function(t){var n,e;return e=_(t,{relative:!0,inner:!0}),n=t.clone(),n.find("script").remove(),n.css({right:"",bottom:"",position:"absolute"}),n.css(e),n.addClass("up-ghost"),n.insertBefore(t)},k=function(t,n){return t.find(n).addBack(n)},b=function(t){return 27===t.keyCode},s=function(t,n){return t.indexOf(n)>=0},i=function(t){return"true"===String(t)},u=function(t){return"false"===String(t)},B=function(t){return t.getResponseHeader("X-Up-Location")},Q=function(t){return t.getResponseHeader("X-Up-Method")},en=function(){var n,e,r,o,u,i;for(o=arguments[0],r=2<=arguments.length?t.call(arguments,1):[],n={},u=0,i=r.length;i>u;u++)e=r[u],o.hasOwnProperty(e)&&(n[e]=o[e]);return n},X=function(t){return!(t.metaKey||t.shiftKey||t.ctrlKey)},J=function(t){return 0===t.button&&X(t)},cn=function(){var t;return t=$.Deferred(),t.resolve(),t},pn=function(){return cn().promise()},nn=function(){return{is:function(){return!1},attr:function(){},find:function(){return[]}}},ln=function(){var n,e;return n=1<=arguments.length?t.call(arguments,0):[],e=$.when.apply($,n),e.resolve=function(){return g(n,function(t){return"function"==typeof t.resolve?t.resolve():void 0})},e},dn=function(t,n){var e,r,o;o=[];for(e in n)r=n[e],o.push(M(t.attr(e))?t.attr(e,r):void 0);return o},mn=function(t){var n,e,r,o,u,i,a,s;for(u={},n=function(t){return u[r(t)]},e=function(t){return v(t,n)},o=function(t){return u[r(t)]=!0},r=function(t){return"_"+t},a=0,s=t.length;s>a;a++)i=t[a],o(i);return{put:o,includes:n,includesAny:e}},{presentAttr:sn,createElement:p,normalizeUrl:tn,normalizeMethod:Y,createElementFromHtml:f,$createElementFromSelector:n,createSelectorFromElement:d,get:T,ajax:o,extend:w,copy:l,merge:K,options:on,option:rn,error:y,debug:h,each:g,detect:v,select:fn,last:V,isNull:N,isDefined:D,isUndefined:L,isGiven:j,isMissing:M,isPresent:H,isBlank:A,presence:an,isObject:q,isFunction:F,isString:G,isElement:U,isJQuery:z,isPromise:I,isDeferred:P,isHash:O,ifGiven:S,isUnmodifiedKeyEvent:X,isUnmodifiedMouseEvent:J,nullJquery:nn,unwrap:bn,nextFrame:Z,measure:_,temporaryCss:vn,cssAnimate:m,finishCssAnimate:C,forceCompositing:x,prependGhost:un,escapePressed:b,copyAttributes:c,findWithSelf:k,contains:s,isArray:E,toArray:gn,castsToTrue:i,castsToFalse:u,locationFromXhr:B,methodFromXhr:Q,clientSize:a,only:en,trim:yn,keys:R,resolvedPromise:pn,resolvedDeferred:cn,resolvableWhen:ln,setMissingAttrs:dn,stringSet:mn}}()}.call(this),function(){var t=[].slice;up.browser=function(){var n,e,r,o,u,i,a,s,l,c;return l=up.util,a=function(t,n){var e,r,o,u,i,a;return null==n&&(n={}),i=l.option(n.method,"get").toLowerCase(),"get"===i?location.href=t:$.rails?(a=n.target,o=$.rails.csrfToken(),r=$.rails.csrfParam(),e=$("<form method='post' action='"+t+"'></form>"),u="<input name='_method' value='"+i+"' type='hidden' />",l.isDefined(r)&&l.isDefined(o)&&(u+="<input name='"+r+"' value='"+o+"' type='hidden' />"),a&&e.attr("target",a),e.hide().append(u).appendTo("body"),e.submit()):error("Can't fake a "+i.toUpperCase()+" request without Rails UJS")},c=function(){return location.href},o=function(){var t,n,e,r,o,u,i,a;return window.console||(window.console={}),t=function(){},(n=window.console).log||(n.log=t),(e=window.console).info||(e.info=t),(r=window.console).error||(r.error=t),(o=window.console).debug||(o.debug=t),(u=window.console).group||(u.group=t),(i=window.console).groupCollapsed||(i.groupCollapsed=t),(a=window.console).groupEnd||(a.groupEnd=t)},s=function(n){var e,r;return e=void 0,r=!1,function(){var o;return o=1<=arguments.length?t.call(arguments,0):[],r?e:(r=!0,e=n.apply(null,o))}},r=s(function(){return l.isDefined(history.pushState)}),n=s(function(){return"transition"in document.documentElement.style}),e=s(function(){return"oninput"in document.createElement("input")}),u=function(){var t,n,e,r,o;return o=$.fn.jquery,r=o.split("."),n=parseInt(r[0]),e=parseInt(r[1]),t=n>=2||1===n&&e>=9,t||l.error("jQuery %o found, but Up.js requires 1.9+",o)},i=s(function(){return l.isDefined(document.addEventListener)}),{url:c,ensureConsoleExists:o,loadPage:a,canPushState:r,canCssAnimation:n,canInputEvent:e,isSupported:i,ensureRecentJquery:u}}()}.call(this),function(){var t=[].slice;up.bus=function(){var n,e,r,o,u,i,a,s;return s=up.util,n={},r={},e=function(t){return n[t]||(n[t]=[])},a=function(){var t,e,o;r={},o=[];for(e in n)t=n[e],o.push(r[e]=s.copy(t));return o},i=function(){return n=s.copy(r)},u=function(t,n){return e(t).push(n)},o=function(){var n,r,o;return o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],s.debug("Emitting event %o with args %o",o,n),r=e(o),s.each(r,function(t){return t.apply(null,n)})},u("framework:ready",a),u("framework:reset",i),{on:u,emit:o}}()}.call(this),function(){up.viewport=function(){var t,n,e,r,o,u,i;return i=up.util,n={duration:0,view:"body",easing:"swing"},e=function(t){return i.extend(n,t)},t="up-scroll-promise",u=function(e,o,u){var a,s,l,c,p;return a=$(e),u=i.options(u),l=i.option(u.duration,n.duration),c=i.option(u.easing,n.easing),r(a),l>0?(s=$.Deferred(),a.data(t,s),s.then(function(){return a.removeData(t),a.finish()}),p={scrollTop:o},a.animate(p,{duration:l,easing:c,complete:function(){return s.resolve()}}),s):(a.scrollTop(o),i.resolvedDeferred())},r=function(n){return $(n).each(function(){var n;return(n=$(this).data(t))?n.resolve():void 0})},o=function(t,e){var r,o,a,s,l,c,p,f,d,m,h;return e=i.options(e),m=i.option(e.view,n.view),f=i.option(e.padding,n.padding),r=$(t),o=$(m),h=o.height(),d=o.scrollTop(),c=d,p=d+h,l=r.position().top,a=c>l-f,s=l>p-f,a||s?(d=l-f,d=Math.max(d,0),d=Math.min(d,h-1),u(o,d,e)):i.resolvedDeferred()},{reveal:o,scroll:u,finishScrolling:r,defaults:e}}(),up.scroll=up.viewport.scroll,up.reveal=up.viewport.reveal}.call(this),function(){up.flow=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h;return h=up.util,f=function(t,n){var e;return e=$(t),h.isPresent(n)&&(n=h.normalizeUrl(n)),e.attr("up-source",n)},d=function(t){var n;return n=$(t).closest("[up-source]"),h.presence(n.attr("up-source"))||up.browser.url()},l=function(t,n,e){var r,u,i;return e=h.options(e),i=h.presence(t)?t:h.createSelectorFromElement($(t)),up.browser.canPushState()||h.castsToFalse(e.history)?(u={url:n,method:e.method,selector:i},r=up.proxy.ajax(u),r.done(function(t,r,a){var s,l;return(s=h.locationFromXhr(a))&&(h.debug("Location from server: %o",s),l={url:s,method:h.methodFromXhr(a),selector:i},up.proxy.alias(u,l),n=s),(h.isMissing(e.history)||h.castsToTrue(e.history))&&(e.history=n),(h.isMissing(e.source)||h.castsToTrue(e.source))&&(e.source=n),e.preload?void 0:o(i,t,e)}),r.fail(h.error),r):void(e.preload||up.browser.loadPage(n,h.only(e,"method")))},o=function(t,n,e){var o,s,l,c,p,f,d,v;for(e=h.options(e,{historyMethod:"push"}),h.castsToFalse(e.history)&&(e.history=null),h.castsToFalse(e.scroll)&&(e.scroll=null),e.source=h.option(e.source,e.history),l=i(n),e.title||(e.title=l.title()),d=u(t,e),v=[],p=0,f=d.length;f>p;p++)c=d[p],s=r(c.selector),o=l.find(c.selector),v.push(a(s,e).then(function(){return m(s,o,c.pseudoClass,c.transition,e)}));return v},r=function(t){var n;return n=t+":not(.up-ghost, .up-destroying)",h.presence($(".up-popup "+n))||h.presence($(".up-modal "+n))||h.presence($(n))||h.error("Could not find selector %o in current body HTML",t)},i=function(t){var n;return n=h.createElementFromHtml(t),{title:function(){var t;return null!=(t=n.querySelector("title"))?t.textContent:void 0},find:function(e){var r;return(r=n.querySelector(e))?$(r):h.error("Could not find selector %o in response %o",e,t)}}},a=function(t,n){return up.motion.finish(t),p(t,n.scroll)},p=function(t,n){return n?up.reveal(t,{view:n}):h.resolvedDeferred()},e=function(n,e){return"function"==typeof e.insert&&e.insert(n),e.history&&(e.title&&(document.title=e.title),up.history[e.historyMethod](e.history)),f(n,e.source),t(n),up.ready(n)},m=function(t,r,o,u,i){var a,s;return u||(u="none"),o?(s="before"===o?"prepend":"append",a=r.children(),t[s](r.contents()),h.copyAttributes(r,t),e(a,i),up.animate(r,u,i)):n(t,{animation:function(){return r.insertBefore(t),e(r,i),t.is("body")&&"none"!==u&&h.error("Cannot apply transitions to body-elements (%o)",u),up.morph(t,r,u,i)}})},u=function(t,n){var e,r,o,u,i,a,s,l,c,p,f;for(s=n.transition||n.animation||"none",e=/\ *,\ */,r=t.split(e),h.isPresent(s)&&(l=s.split(e)),f=[],o=c=0,p=r.length;p>c;o=++c)u=r[o],i=u.match(/^(.+?)(?:\:(before|after))?$/),a=l[o]||h.last(l),f.push({selector:i[1],pseudoClass:i[2],transition:a});return f},t=function(t){var n,e;return e="[autofocus]:last",n=h.findWithSelf(t,e),n.length&&n.get(0)!==document.activeElement?n.focus():void 0},n=function(t,n){var e,r;return e=$(t),n=h.options(n,{animation:"none"}),e.addClass("up-destroying"),h.isPresent(n.url)&&up.history.push(n.url),h.isPresent(n.title)&&(document.title=n.title),up.bus.emit("fragment:destroy",e),r=h.presence(n.animation,h.isPromise)||up.motion.animate(e,n.animation),r.then(function(){return e.remove()})},s=function(t){var n;return n=d(t),l(t,n)},c=function(){return up.bus.emit("framework:reset")},up.bus.on("app:ready",function(){return f(document.body,up.browser.url())}),{replace:l,reload:s,destroy:n,implant:o,reset:c}}(),up.replace=up.flow.replace,up.reload=up.flow.reload,up.destroy=up.flow.destroy,up.reset=up.flow.reset}.call(this),function(){var t=[].slice;up.magic=function(){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g;return g=up.util,n="up-destroyable",e="up-destroyer",f=[],l=null,p=function(t,n,e){var r,o;if(up.browser.isSupported())return r=[t,n,function(t){return e.apply(this,[t,$(this),a(this)])}],f.push(r),(o=$(document)).on.apply(o,r)},u=[],s=null,o=function(){var n,e,r,o;return o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],up.browser.isSupported()?(e=n.pop(),r=g.options(n[0],{batch:!1}),u.push({selector:o,callback:e,batch:r.batch})):void 0},r=function(t,r,o){var u;return g.debug("Applying awakener %o on %o",t.selector,o),u=t.callback.apply(o,[r,a(r)]),g.isFunction(u)?(r.addClass(n),r.data(e,u)):void 0},i=function(t){var n,e,o,i,a;for(g.debug("Compiling fragment %o",t),a=[],o=0,i=u.length;i>o;o++)e=u[o],n=g.findWithSelf(t,e.selector),a.push(n.length?e.batch?r(e,n,n.get()):n.each(function(){return r(e,$(this),this)}):void 0);return a},c=function(t){return g.findWithSelf(t,"."+n).each(function(){var t,n;return t=$(this),(n=t.data(e))()})},a=function(t){var n,e;return n=$(t),e=n.attr("up-data"),g.isString(e)&&""!==g.trim(e)?JSON.parse(e):{}},v=function(){return l=g.copy(f),s=g.copy(u)},h=function(){var t,n,e,r;for(n=0,e=f.length;e>n;n++)t=f[n],g.contains(l,t)||(r=$(document)).off.apply(r,t);return f=g.copy(l),u=g.copy(s)},m=function(t){var n;return n=$(t),up.bus.emit("fragment:ready",n),n},d=function(t){return p("keydown","body",function(n){return g.escapePressed(n)?t(n):void 0})},up.bus.on("app:ready",function(){return m(document.body)}),up.bus.on("fragment:ready",i),up.bus.on("fragment:destroy",c),up.bus.on("framework:ready",v),up.bus.on("framework:reset",h),{awaken:o,on:p,ready:m,onEscape:d,data:a}}(),up.awaken=up.magic.awaken,up.on=up.magic.on,up.ready=up.magic.ready}.call(this),function(){up.history=function(){var t,n,e,r,o,u;return u=up.util,t=function(t){return u.normalizeUrl(t,{hash:!0})===u.normalizeUrl(up.browser.url(),{hash:!0})},o=function(e,r){return r=u.options(r,{force:!1}),r.force||!t(e)?n("replace",e):void 0},r=function(e){return t(e)?void 0:n("push",e)},n=function(t,n){return up.browser.canPushState()?(t+="State",window.history[t]({fromUp:!0},"",n)):u.error("This browser doesn't support history.pushState")},e=function(t){var n;return n=t.originalEvent.state,(null!=n?n.fromUp:void 0)?(u.debug("Restoring state %o (now on "+up.browser.url()+")",n),up.visit(up.browser.url(),{historyMethod:"replace"})):u.debug("Discarding unknown state %o",n)},up.browser.canPushState()&&setTimeout(function(){return $(window).on("popstate",e),o(up.browser.url(),{force:!0})},200),{push:r,replace:o}}()}.call(this),function(){up.motion=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k;return w=up.util,o={},a={},b={},s={},i={duration:300,delay:0,easing:"ease"},l=function(t){return w.extend(i,t)},n=function(t,r,o){var i;return i=$(t),p(i),o=e(o),w.isFunction(r)?u(r(i,o),r):w.isString(r)?n(i,c(r),o):w.isHash(r)?w.cssAnimate(i,r,o):w.error("Unknown animation type %o",r)},e=function(t,n){var e;return null==n&&(n=null),t=w.options(t),e={},e.easing=w.option(t.easing,null!=n?n.attr("up-easing"):void 0,i.easing),e.duration=Number(w.option(t.duration,null!=n?n.attr("up-duration"):void 0,i.duration)),e.delay=Number(w.option(t.delay,null!=n?n.attr("up-delay"):void 0,i.delay)),e},c=function(t){return o[t]||w.error("Unknown animation %o",r)},t="up-ghosting-promise",k=function(n,e,r){var o,u,i,a;return u=null,o=null,w.temporaryCss(e,{display:"none"},function(){return u=w.prependGhost(n).addClass("up-destroying")}),w.temporaryCss(n,{display:"none"},function(){return o=w.prependGhost(e)}),n.css({visibility:"hidden"}),a=w.temporaryCss(e,{display:"none"}),i=r(u,o),n.data(t,i),e.data(t,i),i.then(function(){return n.removeData(t),e.removeData(t),u.remove(),o.remove(),n.css({display:"none"}),a()}),i},p=function(t){return $(t).each(function(){var t;return t=$(this),w.finishCssAnimate(t),f(t)})},f=function(n){var e;return(e=n.data(t))?(w.debug("Canceling existing ghosting on %o",n),"function"==typeof e.resolve?e.resolve():void 0):void 0},u=function(t,n){return w.isDeferred(t)?t:w.error("Did not return a promise with .then and .resolve methods: %o",n)},d=function(t,r,i,a){var s,l,c,f,h;return up.browser.canCssAnimation()?(a=e(a),l=$(t),s=$(r),p(l),p(s),"none"===i?m():(h=w.presence(i,w.isFunction)||b[i])?k(l,s,function(t,n){return u(h(t,n,a),i)}):(c=o[i])?(l.hide(),n(s,c,a)):w.isString(i)&&i.indexOf("/")>=0?(f=i.split("/"),h=function(t,e,r){return v(n(t,f[0],r),n(e,f[1],r))},d(l,s,h,a)):w.error("Unknown transition %o",i)):w.resolvedDeferred()},y=function(t,n){return b[t]=n},r=function(t,n){return o[t]=n},g=function(){return a=w.copy(o),s=w.copy(b)},h=function(){return o=w.copy(a),b=w.copy(s)},v=w.resolvableWhen,m=w.resolvedDeferred,r("none",m),r("fade-in",function(t,e){return t.css({opacity:0}),n(t,{opacity:1},e)}),r("fade-out",function(t,e){return t.css({opacity:1}),n(t,{opacity:0},e)}),r("move-to-top",function(t,e){var r,o;return r=w.measure(t),o=r.top+r.height,t.css({"margin-top":"0px"}),n(t,{"margin-top":"-"+o+"px"},e)}),r("move-from-top",function(t,e){var r,o;return r=w.measure(t),o=r.top+r.height,t.css({"margin-top":"-"+o+"px"}),n(t,{"margin-top":"0px"},e)}),r("move-to-bottom",function(t,e){var r,o;return r=w.measure(t),o=w.clientSize().height-r.top,t.css({"margin-top":"0px"}),n(t,{"margin-top":o+"px"},e)}),r("move-from-bottom",function(t,e){var r,o;return r=w.measure(t),o=w.clientSize().height-r.top,t.css({"margin-top":o+"px"}),n(t,{"margin-top":"0px"},e)}),r("move-to-left",function(t,e){var r,o;return r=w.measure(t),o=r.left+r.width,t.css({"margin-left":"0px"}),n(t,{"margin-left":"-"+o+"px"},e)}),r("move-from-left",function(t,e){var r,o;return r=w.measure(t),o=r.left+r.width,t.css({"margin-left":"-"+o+"px"}),n(t,{"margin-left":"0px"},e)}),r("move-to-right",function(t,e){var r,o;return r=w.measure(t),o=w.clientSize().width-r.left,t.css({"margin-left":"0px"}),n(t,{"margin-left":o+"px"},e)}),r("move-from-right",function(t,e){var r,o;return r=w.measure(t),o=w.clientSize().width-r.left,t.css({"margin-left":o+"px"}),n(t,{"margin-left":"0px"},e)}),r("roll-down",function(t,e){var r,o;return r=t.height(),o=w.temporaryCss(t,{height:"0px",overflow:"hidden"}),n(t,{height:r+"px"},e).then(o)}),y("none",m),y("move-left",function(t,e,r){return v(n(t,"move-to-left",r),n(e,"move-from-right",r))}),y("move-right",function(t,e,r){return v(n(t,"move-to-right",r),n(e,"move-from-left",r))}),y("move-up",function(t,e,r){return v(n(t,"move-to-top",r),n(e,"move-from-bottom",r))}),y("move-down",function(t,e,r){return v(n(t,"move-to-bottom",r),n(e,"move-from-top",r))}),y("cross-fade",function(t,e,r){return v(n(t,"fade-out",r),n(e,"fade-in",r))}),up.bus.on("framework:ready",g),up.bus.on("framework:reset",h),{morph:d,animate:n,animateOptions:e,finish:p,transition:y,animation:r,defaults:l,none:m,when:v}}(),up.transition=up.motion.transition,up.animation=up.motion.animation,up.morph=up.motion.morph,up.animate=up.motion.animate}.call(this),function(){up.proxy=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,$,C,x,T;return l={preloadDelay:75,cacheSize:70,cacheExpiry:3e5},c=function(t){return T.extend(l,t)},o={},T=up.util,t=null,p=null,u=function(t){return v(t),[t.url,t.method,t.selector].join("|")},x=function(){var t,n,e;return t=T.keys(o),t.length>l.cacheSize&&(n=null,e=null,T.each(t,function(t){var r,u;return r=o[t],u=r.timestamp,!e||e>u?(n=t,e=u):void 0}),n)?delete o[n]:void 0},$=function(){return(new Date).valueOf()},v=function(t){return!T.isHash(t),t._requestNormalized||(t.method=T.normalizeMethod(t.method),t.url&&(t.url=T.normalizeUrl(t.url)),t.selector||(t.selector="body"),t._requestNormalized=!0),t},r=function(t,n){var e;return T.debug("Aliasing %o to %o",t,n),(e=d(t))?w(n,e):void 0},e=function(t){var n;return h(t)?(n=d(t))?C(n):(n=T.ajax(t),w(t,n)):(s(),n=T.ajax(t)),n},n=["GET","OPTIONS","HEAD"],h=function(t){return v(t),T.contains(n,t.method)},f=function(t){return h(t)||T.error("Won't preload non-GET request %o",t)},m=function(t){var n;return n=$()-t.timestamp,n<l.cacheExpiry},C=function(t){return t.timestamp=$()},d=function(t){var n,e;return n=u(t),(e=o[n])?m(e)?(T.debug("Cache hit for %o (%o)",t.url,t),e):(T.debug("Discarding stale cache entry for %o (%o)",t.url,t),void y(t)):void T.debug("Cache miss for %o (%o)",t.url,t)},w=function(t,n){var e;return x(),e=u(t),o[e]=n,C(n),n},y=function(t){var n;return n=u(t),delete o[n]},s=function(){return o={}},a=function(n){var e,r;return r=parseInt(T.presentAttr(n,"up-delay"))||l.preloadDelay,n.is(t)?void 0:(t=n,i(),e=function(){return g(n)},k(e,r))},k=function(t,n){return p=setTimeout(t,n)},i=function(){return clearTimeout(p),p=null},g=function(t,n){return n=T.options(),f(n),T.debug("Preloading %o",t),n.preload=!0,up.link.follow(t,n)},b=function(){return i(),o={}},up.bus.on("framework:reset",b),up.on("mouseover mousedown touchstart","[up-preload]",function(t,n){return up.link.childClicked(t,n)?void 0:a(up.link.resolve(n))}),{preload:g,ajax:e,get:d,set:w,alias:r,clear:s,defaults:c}}()}.call(this),function(){up.link=function(){var t,n,e,r,o,u;return o=up.util,u=function(t,n){return o.debug("Visiting "+t),up.replace("body",t,n)},e=function(t,n){var e,r,u;return e=$(t),n=o.options(n),u=o.option(e.attr("href"),e.attr("up-follow")),r=o.option(n.target,e.attr("up-target"),"body"),n.transition=o.option(n.transition,e.attr("up-transition"),e.attr("up-animation")),n.history=o.option(n.history,e.attr("up-history")),n.scroll=o.option(n.scroll,e.attr("up-scroll"),"body"),n=o.merge(n,up.motion.animateOptions(n,e)),up.replace(r,u,n)},r=function(t){var n,e;return n=$(t),e=n.attr("up-follow"),n.is("a")||o.isPresent(e)&&!o.castsToTrue(e)?n:n.find("a:first")},up.on("click","a[up-target]",function(t,n){return t.preventDefault(),n.is("[up-instant]")?void 0:e(n)}),up.on("mousedown","a[up-target][up-instant]",function(n,e){return t(n,e)?(n.preventDefault(),up.follow(e)):void 0}),n=function(t,n){var e,r;return e=$(t.target),r=e.closest("a, [up-follow]"),r.length&&n.find(r).length},t=function(t,e){return o.isUnmodifiedMouseEvent(t)&&!n(t,e)},up.on("click","[up-follow]",function(t,o){return n(t,o)||(t.preventDefault(),o.is("[up-instant]"))?void 0:e(r(o))}),up.on("mousedown","[up-follow][up-instant]",function(n,e){return t(n,e)?(n.preventDefault(),up.follow(r(e))):void 0}),up.awaken("[up-dash]",function(t){var n,e;return e=t.attr("up-dash"),n={"up-preload":"true","up-instant":"true"},o.isBlank(e)||o.castsToTrue(e)?n["up-follow"]="":n["up-target"]=e,o.setMissingAttrs(t,n),t.removeAttr("up-dash")}),{visit:u,follow:e,resolve:r,childClicked:n}}(),up.visit=up.link.visit,up.follow=up.link.follow}.call(this),function(){up.form=function(){var observe,submit,u;return u=up.util,submit=function(t,n){var e,r,o,i,a,s,l,c,p,f,d;return e=$(t).closest("form"),n=u.options(n),c=u.option(n.target,e.attr("up-target"),"body"),o=u.option(n.failTarget,e.attr("up-fail-target"),function(){return u.createSelectorFromElement(e)}),a=u.option(n.history,e.attr("up-history"),!0),p=u.option(n.transition,e.attr("up-transition")),i=u.option(n.failTransition,e.attr("up-fail-transition"),p),s=u.option(n.method,e.attr("up-method"),e.attr("data-method"),e.attr("method"),"post").toUpperCase(),r=up.motion.animateOptions(n,e),d=u.option(n.url,e.attr("action"),up.browser.url()),e.addClass("up-active"),up.browser.canPushState()||u.castsToFalse(a)?(l={url:d,type:s,data:e.serialize(),selector:c},f=function(t){var n;return d=a?u.castsToFalse(a)?!1:u.isString(a)?a:(n=u.locationFromXhr(t))?n:"GET"===l.type?l.url+"?"+l.data:void 0:void 0,u.option(d,!1)},u.ajax(l).always(function(){return e.removeClass("up-active")}).done(function(t,n,e){var o;return o=u.merge(r,{history:f(e),transition:p}),up.flow.implant(c,t,o)}).fail(function(t){var n,e;return e=t.responseText,n=u.merge(r,{transition:i}),up.flow.implant(o,e,n)})):void e.get(0).submit()},observe=function(fieldOrSelector,options){var $field,callback,callbackPromise,callbackTimer,changeEvents,check,clearTimer,codeOnChange,delay,knownValue,nextCallback,runNextCallback;return $field=$(fieldOrSelector),options=u.options(options),delay=u.option($field.attr("up-delay"),options.delay,0),delay=parseInt(delay),knownValue=null,callback=null,callbackTimer=null,(codeOnChange=$field.attr("up-observe"))?callback=function(value,$field){return eval(codeOnChange)}:options.change?callback=options.change:u.error("up.observe: No change callback given"),callbackPromise=u.resolvedPromise(),nextCallback=null,runNextCallback=function(){var t;return nextCallback?(t=nextCallback(),nextCallback=null,t):void 0},check=function(){var t,n;return n=$field.val(),t=u.isNull(knownValue),knownValue===n||(knownValue=n,t)?void 0:(clearTimer(),nextCallback=function(){return callback.apply($field.get(0),[n,$field])},callbackTimer=setTimeout(function(){return callbackPromise.then(function(){var t;return t=runNextCallback(),callbackPromise=u.isPromise(t)?t:u.resolvedPromise()})},delay))},clearTimer=function(){return clearTimeout(callbackTimer)},changeEvents=up.browser.canInputEvent()?"input change":"input change keypress paste cut click propertychange",$field.on(changeEvents,check),check(),clearTimer},up.on("submit","form[up-target]",function(t,n){return t.preventDefault(),submit(n)}),up.awaken("[up-observe]",function(t){return observe(t)}),{submit:submit,observe:observe}}(),up.submit=up.form.submit,up.observe=up.form.observe}.call(this),function(){up.popup=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f;return p=up.util,e={openAnimation:"fade-in",closeAnimation:"fade-out",origin:"bottom-right"},o=function(t){return p.extend(e,t)},s=function(t,n,e){var r,o;return o=p.measure(t,{full:!0}),r=function(){switch(e){case"bottom-right":return{right:o.right,top:o.top+o.height};case"bottom-left":return{left:o.left,top:o.bottom+o.height};case"top-right":return{right:o.right,bottom:o.top};case"top-left":return{left:o.left,bottom:o.top};default:return p.error("Unknown origin %o",e)}}(),n.attr("up-origin",e),n.css(r),i(n)},i=function(t){var n,e,r,o,u,i,a;if(e=p.measure(t,{full:!0}),r=null,o=null,e.right<0&&(r=-e.right),e.bottom<0&&(o=-e.bottom),e.left<0&&(r=e.left),e.top<0&&(o=e.top),r&&((u=parseInt(t.css("left")))?t.css("left",u-r):(i=parseInt(t.css("right")))&&t.css("right",i+r)),o){if(a=parseInt(t.css("top")))return t.css("top",a-o);if(n=parseInt(t.css("bottom")))return t.css("bottom",n+o)}},l=function(){var t;return t=$(".up-popup"),t.attr("up-previous-url",up.browser.url()),t.attr("up-previous-title",document.title)},u=function(){var t;return t=$(".up-popup"),t.removeAttr("up-previous-url"),t.removeAttr("up-previous-title")},r=function(t,n,e){var r,o;return o=p.$createElementFromSelector(".up-popup"),e&&o.attr("up-sticky",""),r=p.$createElementFromSelector(n),r.appendTo(o),o.appendTo(document.body),l(),o.hide(),o},f=function(t,n,e,r,o){return n.show(),s(t,n,e),up.animate(n,r,o)},a=function(t,o){var u,i,a,s,l,c,d,m,h;return u=$(t),o=p.options(o),h=p.option(o.url,u.attr("href")),d=p.option(o.target,u.attr("up-popup"),"body"),c=p.option(o.origin,u.attr("up-origin"),e.origin),s=p.option(o.animation,u.attr("up-animation"),e.openAnimation),m=p.option(o.sticky,u.is("[up-sticky]")),l=up.browser.canPushState()?p.option(o.history,u.attr("up-history"),!1):!1,a=up.motion.animateOptions(o,u),n(),i=r(u,d,m),up.replace(d,h,{history:l,insert:function(){return f(u,i,c,s,a)}})},c=function(){var t;return t=$(".up-popup"),t.is(".up-destroying")?void 0:t.find("[up-source]").attr("up-source")},n=function(t){var n;return n=$(".up-popup"),n.length?(t=p.options(t,{animation:e.closeAnimation,url:n.attr("up-previous-url"),title:n.attr("up-previous-title")}),up.destroy(n,t)):void 0},t=function(){return $(".up-popup").is("[up-sticky]")?void 0:n()},up.on("click","a[up-popup]",function(t,e){return t.preventDefault(),e.is(".up-current")?n():a(e)}),up.on("click","body",function(t){var e;return e=$(t.target),e.closest(".up-popup").length||e.closest("[up-popup]").length?void 0:n()}),up.bus.on("fragment:ready",function(n){return n.closest(".up-popup").length?void 0:(u(),t())}),up.magic.onEscape(function(){return n()}),up.on("click","[up-close]",function(t,e){return e.closest(".up-popup")?n():void 0}),up.bus.on("framework:reset",n),{open:a,close:n,source:c,defaults:o}}()}.call(this),function(){var t=[].slice;up.modal=function(){var n,e,r,o,u,i,a,s,l,c,p,f;return p=up.util,r={width:"auto",height:"auto",openAnimation:"fade-in",closeAnimation:"fade-out",closeLabel:"X",template:function(t){return'<div class="up-modal">\n <div class="up-modal-dialog">\n <div class="up-modal-close" up-close>'+t.closeLabel+'</div>\n <div class="up-modal-content"></div>\n </div>\n</div>'}},u=function(t){return p.extend(r,t)},c=function(){var t;return t=r.template,p.isFunction(t)?t(r):t},s=function(){var t;return t=$(".up-modal"),t.attr("up-previous-url",up.browser.url()),t.attr("up-previous-title",document.title)},i=function(){var t;return t=$(".up-modal"),t.removeAttr("up-previous-url"),t.removeAttr("up-previous-title")},o=function(t,n,e,r){var o,u,i,a;return i=$(c()),r&&i.attr("up-sticky",""),i.attr("up-previous-url",up.browser.url()),i.attr("up-previous-title",document.title),u=i.find(".up-modal-dialog"),p.isPresent(n)&&u.css("width",n),p.isPresent(e)&&u.css("height",e),o=u.find(".up-modal-content"),a=p.$createElementFromSelector(t),a.appendTo(o),i.appendTo(document.body),s(),i.hide(),i
2
+ },f=function(t,n,e){return t.show(),up.animate(t,n,e)},a=function(){var n,u,i,a,s,l,c,d,m,h,v,g;return s=1<=arguments.length?t.call(arguments,0):[],!p.isObject(s[0])||p.isElement(s[0])||p.isJQuery(s[0])?(n=$(s[0]),d=s[1]):(n=p.nullJquery(),d=s[0]),d=p.options(d),v=p.option(d.url,n.attr("href"),n.attr("up-href")),m=p.option(d.target,n.attr("up-modal"),"body"),g=p.option(d.width,n.attr("up-width"),r.width),l=p.option(d.height,n.attr("up-height"),r.height),a=p.option(d.animation,n.attr("up-animation"),r.openAnimation),h=p.option(d.sticky,n.is("[up-sticky]")),c=up.browser.canPushState()?p.option(d.history,n.attr("up-history"),!0):!1,i=up.motion.animateOptions(d,n),e(),u=o(m,g,l,h),up.replace(m,v,{history:c,insert:function(){return f(u,a,i)}})},l=function(){var t;return t=$(".up-modal"),t.is(".up-destroying")?void 0:t.find("[up-source]").attr("up-source")},e=function(t){var n;return n=$(".up-modal"),n.length?(t=p.options(t,{animation:r.closeAnimation,url:n.attr("up-previous-url"),title:n.attr("up-previous-title")}),up.destroy(n,t)):void 0},n=function(){return $(".up-modal").is("[up-sticky]")?void 0:(i(),e())},up.on("click","a[up-modal]",function(t,n){return t.preventDefault(),n.is(".up-current")?e():a(n)}),up.on("click","body",function(t){var n;return n=$(t.target),n.closest(".up-modal-dialog").length||n.closest("[up-modal]").length?void 0:e()}),up.bus.on("fragment:ready",function(t){return t.closest(".up-modal").length?void 0:n()}),up.magic.onEscape(function(){return e()}),up.on("click","[up-close]",function(t,n){return n.closest(".up-modal")?e():void 0}),up.bus.on("framework:reset",e),{open:a,close:e,source:l,defaults:u}}()}.call(this),function(){up.tooltip=function(){var t,n,e,r,o;return o=up.util,r=function(t,n,e){var r,u,i;return u=o.measure(t),i=o.measure(n),r=function(){switch(e){case"top":return{left:u.left+.5*(u.width-i.width),top:u.top-i.height};case"bottom":return{left:u.left+.5*(u.width-i.width),top:u.top+u.height};default:return o.error("Unknown origin %o",e)}}(),n.attr("up-origin",e),n.css(r)},n=function(t){return o.$createElementFromSelector(".up-tooltip").html(t).appendTo(document.body)},e=function(e,u){var i,a,s,l,c;return null==u&&(u={}),i=$(e),l=o.option(u.html,i.attr("up-tooltip"),i.attr("title")),c=o.option(u.origin,i.attr("up-origin"),"top"),s=o.option(u.animation,i.attr("up-animation"),"fade-in"),t(),a=n(l),r(i,a,c),up.animate(a,s,u)},t=function(t){var n;return n=$(".up-tooltip"),n.length?(t=o.options(t,{animation:"fade-out"}),up.destroy(n,t)):void 0},up.awaken("[up-tooltip]",function(n){return n.on("mouseover",function(){return e(n)}),n.on("mouseout",function(){return t()})}),up.on("click","body",function(){return t()}),up.bus.on("framework:reset",t),up.magic.onEscape(function(){return t()}),{open:e,close:t}}()}.call(this),function(){up.navigation=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d;return f=up.util,t="up-active",n="up-current",e=["a[href]","a[up-target]","[up-follow]","[up-modal]","[up-popup]","[up-href]"],o=e.join(", "),u=function(){var t,n,r;for(r=[],t=0,n=e.length;n>t;t++)p=e[t],r.push(p+"[up-instant]");return r}().join(", "),r="."+t,s=function(t){return f.isPresent(t)?f.normalizeUrl(t,{search:!1,stripTrailingSlash:!0}):void 0},c=function(t){var n,e,r,o,u,i,a;if(o=[],n=up.link.resolve(t))for(a=["href","up-follow","up-href"],u=0,i=a.length;i>u;u++)e=a[u],(r=f.presentAttr(n,e))&&(r=s(r),o.push(r));return o},a=function(){var t;return t=f.stringSet([s(up.browser.url()),s(up.modal.source()),s(up.popup.source())]),f.each($(o),function(e){var r,o;return r=$(e),o=c(r),t.includesAny(o)?r.addClass(n):r.removeClass(n)})},l=function(n){return d(),n=i(n),n.addClass(t)},i=function(t){return f.presence(t.parents(o))||t},d=function(){return $(r).removeClass(t)},up.on("click",o,function(t,n){return n.is("[up-instant]")?void 0:l(n)}),up.on("mousedown",u,function(t,n){return f.isUnmodifiedMouseEvent(t)?l(n):void 0}),up.bus.on("fragment:ready",function(){return d(),a()}),up.bus.on("fragment:destroy",function(t){return t.is(".up-modal, .up-popup")?a():void 0})}()}.call(this),function(){up.marker=function(){var t,n,e;return e=up.util,n=function(t){return""!==e.trim(t.html())},t=function(t){return e.findWithSelf(t,"[up-marker]").each(function(){var t;return t=$(this),n(t)?void 0:t.hide()})},up.bus.on("fragment:ready",t)}()}.call(this),function(){up.browser.ensureRecentJquery(),up.browser.isSupported()&&(up.browser.ensureConsoleExists(),up.bus.emit("framework:ready"),$(document).on("ready",function(){return up.bus.emit("app:ready")}))}.call(this);
@@ -134,9 +134,11 @@ up.flow = (->
134
134
  swapElements($old, $new, step.pseudoClass, step.transition, options)
135
135
 
136
136
  findOldFragment = (selector) ->
137
- u.presence($(".up-popup " + selector)) ||
138
- u.presence($(".up-modal " + selector)) ||
139
- u.presence($(selector)) ||
137
+ selectorWithExcludes = "#{selector}:not(.up-ghost, .up-destroying)"
138
+ # Prefer to replace fragments in an open popup or modal
139
+ u.presence($(".up-popup #{selectorWithExcludes}")) ||
140
+ u.presence($(".up-modal #{selectorWithExcludes}")) ||
141
+ u.presence($(selectorWithExcludes)) ||
140
142
  u.error('Could not find selector %o in current body HTML', selector)
141
143
 
142
144
  parseResponse = (html) ->
@@ -193,7 +195,7 @@ up.flow = (->
193
195
  elementsInserted($addedChildren, options)
194
196
  # Since we're adding content instead of replacing, we'll only
195
197
  # animate $new instead of morphing between $old and $new
196
- up.animate($new, transition)
198
+ up.animate($new, transition, options)
197
199
  else
198
200
  # Wrap the replacement as a destroy animation, so $old will
199
201
  # get marked as .up-destroying right away.
@@ -205,7 +207,7 @@ up.flow = (->
205
207
  elementsInserted($new, options)
206
208
  if $old.is('body') && transition != 'none'
207
209
  u.error('Cannot apply transitions to body-elements (%o)', transition)
208
- up.morph($old, $new, transition)
210
+ up.morph($old, $new, transition, options)
209
211
 
210
212
  parseImplantSteps = (selector, options) ->
211
213
  transitionString = options.transition || options.animation || 'none'
@@ -40,17 +40,37 @@ up.form = (->
40
40
  If the argument points to an element that is not a form,
41
41
  Up.js will search its ancestors for the closest form.
42
42
  @param {String} [options.url]
43
+ The URL where to submit the form.
44
+ Defaults to the form's `action` attribute, or to the current URL of the browser window.
43
45
  @param {String} [options.method]
46
+ The HTTP method used for the form submission.
47
+ Defaults to the form's `up-method`, `data-method` or `method` attribute, or to `'post'`
48
+ if none of these attributes are given.
44
49
  @param {String} [options.target]
50
+ The selector to update when the form submission succeeds.
51
+ Defaults to the form's `up-target` attribute, or to `'body'`.
45
52
  @param {String} [options.failTarget]
53
+ The selector to update when the form submission succeeds.
54
+ Defaults to the form's `up-fail-target` attribute, or to an auto-generated
55
+ selector that matches the form itself.
46
56
  @param {Boolean|String} [options.history=true]
47
57
  Successful form submissions will add a history entry and change the browser's
48
58
  location bar if the form either uses the `GET` method or the response redirected
49
59
  to another page (this requires the `upjs-rails` gem).
50
60
  If want to prevent history changes in any case, set this to `false`.
51
61
  If you pass a `String`, it is used as the URL for the browser history.
52
- @param {String} [options.transition]
53
- @param {String} [options.failTransition]
62
+ @param {String} [options.transition='none']
63
+ The transition to use when a successful form submission updates the `options.target` selector.
64
+ Defaults to the form's `up-transition` attribute, or to `'none'`.
65
+ @param {String} [options.failTransition='none']
66
+ The transition to use when a failed form submission updates the `options.failTarget` selector.
67
+ Defaults to the form's `up-fail-transition` attribute, or to `options.transition`, or to `'none'`.
68
+ @param {Number} [opts.duration]
69
+ The duration of the transition. See [`up.morph`](/up.motion#up.morph).
70
+ @param {Number} [opts.delay]
71
+ The delay before the transition starts. See [`up.morph`](/up.motion#up.morph).
72
+ @param {String} [opts.easing]
73
+ The timing function that controls the transition's acceleration. [`up.morph`](/up.motion#up.morph).
54
74
  @return {Promise}
55
75
  A promise for the AJAX response
56
76
  ###
@@ -63,8 +83,9 @@ up.form = (->
63
83
  failureSelector = u.option(options.failTarget, $form.attr('up-fail-target'), -> u.createSelectorFromElement($form))
64
84
  historyOption = u.option(options.history, $form.attr('up-history'), true)
65
85
  successTransition = u.option(options.transition, $form.attr('up-transition'))
66
- failureTransition = u.option(options.failTransition, $form.attr('up-fail-transition'))
86
+ failureTransition = u.option(options.failTransition, $form.attr('up-fail-transition'), successTransition)
67
87
  httpMethod = u.option(options.method, $form.attr('up-method'), $form.attr('data-method'), $form.attr('method'), 'post').toUpperCase()
88
+ animateOptions = up.motion.animateOptions(options, $form)
68
89
  url = u.option(options.url, $form.attr('action'), up.browser.url())
69
90
 
70
91
  $form.addClass('up-active')
@@ -96,15 +117,15 @@ up.form = (->
96
117
  .always ->
97
118
  $form.removeClass('up-active')
98
119
  .done (html, textStatus, xhr) ->
99
- up.flow.implant(successSelector, html,
120
+ successOptions = u.merge(animateOptions,
100
121
  history: successUrl(xhr),
101
122
  transition: successTransition
102
123
  )
124
+ up.flow.implant(successSelector, html, successOptions)
103
125
  .fail (xhr, textStatus, errorThrown) ->
104
126
  html = xhr.responseText
105
- up.flow.implant(failureSelector, html,
106
- transition: failureTransition
107
- )
127
+ failureOptions = u.merge(animateOptions, transition: failureTransition)
128
+ up.flow.implant(failureSelector, html, failureOptions)
108
129
 
109
130
  ###*
110
131
  Observes an input field and executes code when its value changes.
@@ -32,7 +32,16 @@ Your HTML could look like this:
32
32
  </article>
33
33
  ```
34
34
 
35
- Slow, full page loads. White flash during loading.
35
+ Using this document-oriented way of navigating between pages
36
+ is not a good fit for modern applications, for a multitude of reasons:
37
+
38
+ - State changes caused by AJAX updates get lost during the page transition.
39
+ - Unsaved form changes get lost during the page transition.
40
+ - The Javascript VM is reset during the page transition.
41
+ - If the page layout is composed from multiple srollable containers
42
+ (e.g. a pane view), the scroll positions get lost during the page transition.
43
+ - The user sees a "flash" as the browser loads and renders the new page,
44
+ even if large portions of the old and new page are the same (navigation, layout, etc.).
36
45
 
37
46
 
38
47
  Smoother flow by updating fragments
@@ -123,6 +132,12 @@ up.link = (->
123
132
  @param {Element|jQuery|String} [options.scroll]
124
133
  An element or selector that will be scrolled to the top in
125
134
  case the replaced element is not visible in the viewport.
135
+ @param {Number} [opts.duration]
136
+ The duration of the transition. See [`up.morph`](/up.motion#up.morph).
137
+ @param {Number} [opts.delay]
138
+ The delay before the transition starts. See [`up.morph`](/up.motion#up.morph).
139
+ @param {String} [opts.easing]
140
+ The timing function that controls the transition's acceleration. [`up.morph`](/up.motion#up.morph).
126
141
  ###
127
142
  follow = (link, options) ->
128
143
  $link = $(link)
@@ -133,7 +148,8 @@ up.link = (->
133
148
  options.transition = u.option(options.transition, $link.attr('up-transition'), $link.attr('up-animation'))
134
149
  options.history = u.option(options.history, $link.attr('up-history'))
135
150
  options.scroll = u.option(options.scroll, $link.attr('up-scroll'), 'body')
136
-
151
+ options = u.merge(options, up.motion.animateOptions(options, $link))
152
+
137
153
  up.replace(selector, url, options)
138
154
 
139
155
  resolve = (element) ->
@@ -148,7 +164,40 @@ up.link = (->
148
164
  Follows this link via AJAX and replaces a CSS selector in the current page
149
165
  with corresponding elements from a new page fetched from the server:
150
166
 
151
- <a href="/users" up-target=".main">User list</a>
167
+ <a href="/posts/5" up-target=".main">Read post</a>
168
+
169
+ \#\#\#\# Updating multiple fragments
170
+
171
+ You can update multiple fragments from a single request by separating
172
+ separators with a comma (like in CSS). E.g. if opening a post should
173
+ also update a bubble showing the number of unread posts, you might
174
+ do this:
175
+
176
+ <a href="/posts/5" up-target=".main, .unread-count">Read post</a>
177
+
178
+ \#\#\#\# Appending or prepending instead of replacing
179
+
180
+ By default Up.js will replace the given selector with the same
181
+ selector from a freshly fetched page. Instead of replacing you
182
+ can *append* the loaded content to the existing content by using the
183
+ `:after` pseudo selector. In the same fashion, you can use `:before`
184
+ to indicate that you would like the *prepend* the loaded content.
185
+
186
+ A practical example would be a paginated list of items. Below the list is
187
+ a button to load the next page. You can append to the existing list
188
+ by using `:after` in the `up-target` selector like this:
189
+
190
+ <ul class="tasks">
191
+ <li>Wash car</li>
192
+ <li>Purchase supplies</li>
193
+ <li>Fix tent</li>
194
+ </ul>
195
+
196
+ <a href="/page/2" class="next-page" up-target=".tasks:after, .next-page">
197
+ Load more tasks
198
+ </a>
199
+
200
+ \#\#\#\# Following on mousedown
152
201
 
153
202
  By also adding an `up-instant` attribute, the page will be fetched
154
203
  on `mousedown` instead of `click`, making the interaction even faster:
@@ -196,7 +245,9 @@ up.link = (->
196
245
  current `<body>` element with the response's `<body>` element
197
246
 
198
247
  <a href="/users" up-follow>User list</a>
199
-
248
+
249
+ \#\#\#\# Following on mousedown
250
+
200
251
  By also adding an `up-instant` attribute, the page will be fetched
201
252
  on `mousedown` instead of `click`, making the interaction even faster:
202
253
 
@@ -207,6 +258,8 @@ up.link = (->
207
258
  navigation actions this isn't needed. E.g. popular operation
208
259
  systems switch tabs on `mousedown`.
209
260
 
261
+ \#\#\#\# Enlarging the click area
262
+
210
263
  You can also apply `[up-follow]` to any element that contains a link
211
264
  in order to enlarge the link's click area:
212
265
 
@@ -216,7 +269,7 @@ up.link = (->
216
269
  </div>
217
270
 
218
271
  In the example above, clicking anywhere within `.notification` element
219
- would follow the `Close` link.
272
+ would follow the *Close* link.
220
273
 
221
274
  @method [up-follow]
222
275
  @ujs
@@ -92,9 +92,9 @@ up.modal = (->
92
92
  $modal.hide()
93
93
  $modal
94
94
 
95
- updated = ($modal, animation) ->
95
+ updated = ($modal, animation, animateOptions) ->
96
96
  $modal.show()
97
- up.animate($modal, animation)
97
+ up.animate($modal, animation, animateOptions)
98
98
 
99
99
  ###*
100
100
  Opens the given link's destination in a modal overlay:
@@ -113,11 +113,18 @@ up.modal = (->
113
113
  @param {String} [options.url]
114
114
  @param {Number} [options.width]
115
115
  @param {Number} [options.height]
116
- @param {String} [options.animation]
117
116
  @param {Boolean} [options.sticky=false]
118
117
  If set to `true`, the modal remains
119
118
  open even if the page changes in the background.
120
119
  @param {Object} [options.history=true]
120
+ @param {String} [options.animation]
121
+ The animation to use when opening the modal.
122
+ @param {Number} [opts.duration]
123
+ The duration of the animation. See [`up.animate`](/up.motion#up.animate).
124
+ @param {Number} [opts.delay]
125
+ The delay before the animation starts. See [`up.animate`](/up.motion#up.animate).
126
+ @param {String} [opts.easing]
127
+ The timing function that controls the animation's acceleration. [`up.animate`](/up.motion#up.animate).
121
128
  @return {Promise}
122
129
  A promise that will be resolved when the modal has finished loading.
123
130
  ###
@@ -137,13 +144,14 @@ up.modal = (->
137
144
  animation = u.option(options.animation, $link.attr('up-animation'), config.openAnimation)
138
145
  sticky = u.option(options.sticky, $link.is('[up-sticky]'))
139
146
  history = if up.browser.canPushState() then u.option(options.history, $link.attr('up-history'), true) else false
147
+ animateOptions = up.motion.animateOptions(options, $link)
140
148
 
141
149
  close()
142
150
  $modal = createHiddenModal(selector, width, height, sticky)
143
151
 
144
152
  up.replace(selector, url,
145
153
  history: history
146
- insert: -> updated($modal, animation)
154
+ insert: -> updated($modal, animation, animateOptions)
147
155
  )
148
156
 
149
157
  ###*