upjs-rails 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +6 -3
  3. data/dist/up-bootstrap.css +5 -0
  4. data/dist/up-bootstrap.js +14 -0
  5. data/dist/up-bootstrap.min.css +1 -0
  6. data/dist/up-bootstrap.min.js +1 -0
  7. data/dist/up.css +22 -36
  8. data/dist/up.js +300 -137
  9. data/dist/up.min.css +1 -1
  10. data/dist/up.min.js +2 -2
  11. data/lib/assets/javascripts/up/browser.js.coffee +9 -35
  12. data/lib/assets/javascripts/up/bus.js.coffee +10 -10
  13. data/lib/assets/javascripts/up/modal.js.coffee +98 -40
  14. data/lib/assets/javascripts/up/motion.js.coffee +13 -13
  15. data/lib/assets/javascripts/up/navigation.js.coffee +28 -3
  16. data/lib/assets/javascripts/up/popup.js.coffee +14 -12
  17. data/lib/assets/javascripts/up/proxy.js.coffee +21 -24
  18. data/lib/assets/javascripts/up/util.js.coffee +72 -9
  19. data/lib/assets/javascripts/up/viewport.js.coffee +10 -8
  20. data/lib/assets/javascripts/up-bootstrap/modal-ext.js.coffee +16 -0
  21. data/lib/assets/javascripts/up-bootstrap.js.coffee +1 -0
  22. data/lib/assets/stylesheets/up/modal.css.sass +37 -24
  23. data/lib/assets/stylesheets/up/popup.css.sass +1 -6
  24. data/lib/assets/stylesheets/up-bootstrap/modal-ext.css.sass +9 -0
  25. data/lib/assets/stylesheets/up-bootstrap.css.sass +1 -0
  26. data/lib/assets/stylesheets/up.css.sass +3 -0
  27. data/lib/upjs/rails/version.rb +1 -1
  28. data/spec_app/Gemfile.lock +1 -1
  29. data/spec_app/spec/javascripts/up/modal_spec.js.coffee +26 -0
  30. data/spec_app/spec/javascripts/up/navigation_spec.js.coffee +6 -0
  31. data/spec_app/spec/javascripts/up/util_spec.js.coffee +24 -0
  32. metadata +11 -3
  33. data/lib/assets/stylesheets/up.css +0 -3
data/dist/up.min.css CHANGED
@@ -1 +1 @@
1
- [up-close]{cursor:pointer}.up-error{background-color:#e10;color:white;padding:5px;font-family:arial, helvetica, sans-serif;font-weight:bold;font-size:14px;line-height:18px;position:fixed;left:0;top:0;max-width:100%;box-sizing:border-box;z-index:99999999}[up-href][up-follow],[up-href][up-target]{cursor:pointer}.up-modal{position:fixed;top:0;left:0;bottom:0;right:0;z-index:10000;background-color:rgba(90,90,90,0.4)}.up-modal-dialog{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);-ms-transform:translate(-50%, -50%);-webkit-transform:translate(-50%, -50%);max-width:100%;max-height:100%;background-color:#fff;box-shadow:0 0 10px 1px rgba(0,0,0,0.3);box-sizing:border-box}.up-modal-close{position:absolute;right:0;top:0;width:36px;text-align:center;line-height:24px;height:24px;background-color:#999;color:#fff;font-weight:bold;text-transform:uppercase;cursor:pointer;transform:translateY(-100%);-ms-transform:translateY(-100%);-webkit-transform:translateY(-100%)}.up-modal-content{overflow-x:hidden;overflow-y:auto;width:100%;height:100%;padding:20px;box-sizing:border-box}.up-popup{z-index:10000;position:absolute;background-color:#fff;padding:15px;box-shadow:0 0 4px rgba(0,0,0,0.3)}.up-modal .up-popup{z-index:15000}.up-tooltip{z-index:30000;position:absolute;background-color:#666;color:white;padding:6px 9px;white-space:nowrap}.up-tooltip[up-position=top]{margin-top:-6px}.up-tooltip[up-position=top]:after{content:"";position:absolute;border-style:solid;border-width:8px 8px 0;border-color:#666 transparent;display:block;width:0;z-index:1;bottom:-8px;left:50%;margin-left:-8px}.up-tooltip[up-position=bottom]{margin-top:6px}.up-tooltip[up-position=bottom]:after{content:"";position:absolute;border-style:solid;border-width:0 8px 8px;border-color:#666 transparent;display:block;width:0;z-index:1;top:-8px;left:50%;margin-left:-8px}
1
+ [up-close]{cursor:pointer}.up-error{background-color:#e10;color:white;padding:5px;font-family:arial, helvetica, sans-serif;font-weight:bold;font-size:14px;line-height:18px;position:fixed;left:0;top:0;max-width:100%;box-sizing:border-box;z-index:99999999}[up-href][up-follow],[up-href][up-target]{cursor:pointer}.up-modal{position:fixed;top:0;left:0;bottom:0;right:0;z-index:10000;background-color:rgba(90,90,90,0.4);overflow-x:hidden;overflow-y:scroll;text-align:center}.up-modal-dialog{z-index:1000;position:relative;box-sizing:border-box;margin:30px 10px;max-width:100%;display:inline-block;text-align:left}.up-modal-content{z-index:2000;padding:20px;background-color:#fff;box-shadow:0 0 10px 1px rgba(0,0,0,0.3)}.up-modal-close{z-index:3000;position:absolute;right:0;top:0;width:36px;text-align:center;line-height:36px;height:36px;font-size:34px;color:#666;cursor:pointer}.up-popup{z-index:20000;position:absolute;background-color:#fff;padding:15px;box-shadow:0 0 4px rgba(0,0,0,0.3)}.up-tooltip{z-index:30000;position:absolute;background-color:#666;color:white;padding:6px 9px;white-space:nowrap}.up-tooltip[up-position=top]{margin-top:-6px}.up-tooltip[up-position=top]:after{content:"";position:absolute;border-style:solid;border-width:8px 8px 0;border-color:#666 transparent;display:block;width:0;z-index:1;bottom:-8px;left:50%;margin-left:-8px}.up-tooltip[up-position=bottom]{margin-top:6px}.up-tooltip[up-position=bottom]:after{content:"";position:absolute;border-style:solid;border-width:0 8px 8px;border-color:#666 transparent;display:block;width:0;z-index:1;top:-8px;left:50%;margin-left:-8px}
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,x,C,T,E,S,P,A,D,U,F,O,M,j,z,L,I,N,H,W,q,G,X,J,R,K,V,B,_,Q,Z,Y,tn,nn,en,rn,on,un,an,sn,ln,cn,pn,fn,dn,mn,hn,vn,gn,yn,bn,wn,kn,$n;return E=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)},q=function(t,n){return(""===n||"80"===n)&&"http:"===t||"443"===n&&"https:"===t},nn=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=kn(t),r=e.protocol+"//"+e.hostname,q(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},tn=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(h=t.split(/[ >]/),r=null,c=p=0,d=h.length;d>p;c=++p){for(i=h[c],u=i.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),v="div",o=[],l=null,f=0,m=u.length;m>f;f++)switch(a=u[f],a[0]){case".":o.push(a.substr(1));break;case"#":l=a.substr(1);break;default:v=a}s="<"+v,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},f=function(t,n){var e;return e=document.createElement(t),H(n)&&(e.innerHTML=n),e},v=function(){var n,e;return e=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],e="[UP] "+e,console.debug.apply(console,[e].concat(t.call(n)))},$n=function(){var n,e;return e=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],e="[UP] "+e,console.warn.apply(console,[e].concat(t.call(n)))},b=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=vn(e),n=sn($(".up-error"))||$('<div class="up-error"></div>').prependTo("body"),n.addClass("up-error"),n.text(r),new Error(r)},r=/\%[odisf]/g,vn=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+")"})},m=function(t){var n,e,r,o,u,i,a;for(v("Creating selector from element %o",t),e=(n=t.attr("class"))?n.split(" "):[],r=t.attr("id"),a=t.prop("tagName").toLowerCase(),r&&(a+="#"+r),o=0,i=e.length;i>o;o++)u=e[o],a+="."+u;return a},d=function(t){var n,e,r,o,u,i,a,s,l,c,p,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=f("body",r[1]),s.appendChild(e),(p=t.match(d))&&(a=f("head"),s.appendChild(a),c=f("title",p[1]),a.appendChild(c)),s):f("div",t)},k=$.extend,wn=$.trim,K=Object.keys||function(t){var n,e,r,o;for(o=[],n=0,r=t.length;r>n;n++)e=t[n],t.hasOwnProperty(e)&&o.push(e);return o},y=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},yn=function(t,n){var e,r,o,u;for(u=[],e=r=0,o=t-1;o>=0?o>=r:r>=o;e=o>=0?++r:--r)u.push(n(e));return u},I=function(t){return null===t},X=function(t){return void 0===t},U=function(t){return!X(t)},L=function(t){return X(t)||I(t)},M=function(t){return!L(t)},A=function(t){return L(t)||N(t)&&0===K(t).length||0===t.length},sn=function(t,n){return null==n&&(n=H),n(t)?t:null},H=function(t){return!A(t)},O=function(t){return"function"==typeof t},G=function(t){return"string"==typeof t},j=function(t){return"object"==typeof t&&!!t},N=function(t){return j(t)||"function"==typeof t},F=function(t){return!(!t||1!==t.nodeType)},z=function(t){return t instanceof jQuery},W=function(t){return N(t)&&O(t.then)},D=function(t){return W(t)&&O(t.resolve)},S=function(t){return M(t)?t:void 0},P=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},bn=function(t){return Array.prototype.slice.call(t)},c=function(t){return P(t)?t.slice():k({},t)},kn=function(t){return z(t)?t.get(0):t},Q=function(t,n){return k(c(t),n)},un=function(t,n){var e,r,o,u;if(o=t?c(t):{},n)for(r in n)e=n[r],u=o[r],M(u)?N(e)&&N(u)&&(o[r]=un(u,e)):o[r]=e;return o},on=function(){var n,e,r,o,u,i;for(e=1<=arguments.length?t.call(arguments,0):[],u=null,r=0,o=e.length;o>r;r++)if(n=e[r],i=n,O(i)&&(i=i()),M(i)){u=i;break}return u},g=function(t,n){var e,r,o,u;for(u=null,r=0,o=t.length;o>r;r++)if(e=t[r],n(e)){u=e;break}return u},s=function(t){return mn(t,M)},mn=function(t,n){var e;return e=[],y(t,function(t){return n(t)?e.push(t):void 0}),e},ln=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}(),g(o,H)},Y=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}},gn=function(t,n,e){var r,o;return o=t.css(K(n)),t.css(n),r=function(){return t.css(o)},e?(e(),r()):r},T=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},h=function(t,n,r){var o,u,i,a,s,l;return o=$(t),up.browser.canCssAnimation()?(r=un(r,{duration:300,delay:0,easing:"ease"}),u=$.Deferred(),a={"transition-property":K(n).join(", "),"transition-duration":r.duration+"ms","transition-delay":r.delay+"ms","transition-timing-function":r.easing},s=T(o),l=gn(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),dn())},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},p=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},an=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)},x=function(t,n){return t.find(n).addBack(n)},w=function(t){return 27===t.keyCode},l=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")},Z=function(t){return t.getResponseHeader("X-Up-Method")},rn=function(){var n,e,r,o,u,i;for(i=arguments[0],o=2<=arguments.length?t.call(arguments,1):[],n={},e=0,u=o.length;u>e;e++)r=o[e],i.hasOwnProperty(r)&&(n[r]=i[r]);return n},J=function(t){return!(t.metaKey||t.shiftKey||t.ctrlKey)},R=function(t){var n;return n=X(t.button)||0===t.button,n&&J(t)},fn=function(){var t;return t=$.Deferred(),t.resolve(),t},dn=function(){return fn().promise()},en=function(){return{is:function(){return!1},attr:function(){},find:function(){return[]}}},pn=function(){var n,e;return n=1<=arguments.length?t.call(arguments,0):[],e=$.when.apply($,n),e.resolve=function(){return y(n,function(t){return"function"==typeof t.resolve?t.resolve():void 0})},e},hn=function(t,n){var e,r,o;r=[];for(e in n)o=n[e],r.push(L(t.attr(e))?t.attr(e,o):void 0);return r},cn=function(t,n){var e;return e=t.indexOf(n),e>=0?(t.splice(e,1),n):void 0},{presentAttr:ln,createElement:f,normalizeUrl:nn,normalizeMethod:tn,createElementFromHtml:d,$createElementFromSelector:n,createSelectorFromElement:m,get:E,ajax:o,extend:k,copy:c,merge:Q,options:un,option:on,error:b,debug:v,warn:$n,each:y,times:yn,detect:g,select:mn,compact:s,last:V,isNull:I,isDefined:U,isUndefined:X,isGiven:M,isMissing:L,isPresent:H,isBlank:A,presence:sn,isObject:N,isFunction:O,isString:G,isElement:F,isJQuery:z,isPromise:W,isDeferred:D,isHash:j,ifGiven:S,isUnmodifiedKeyEvent:J,isUnmodifiedMouseEvent:R,nullJquery:en,unwrap:kn,nextFrame:Y,measure:_,temporaryCss:gn,cssAnimate:h,finishCssAnimate:C,forceCompositing:T,prependGhost:an,escapePressed:w,copyAttributes:p,findWithSelf:x,contains:l,isArray:P,toArray:bn,castsToTrue:i,castsToFalse:u,locationFromXhr:B,methodFromXhr:Z,clientSize:a,only:rn,trim:wn,keys:K,resolvedPromise:dn,resolvedDeferred:fn,resolvableWhen:pn,setMissingAttrs:hn,remove:cn}}()}.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,s;return window.console||(window.console={}),s=function(){},(t=window.console).log||(t.log=s),(n=window.console).info||(n.info=s),(e=window.console).error||(e.error=s),(r=window.console).debug||(r.debug=s),(o=window.console).warn||(o.warn=s),(u=window.console).group||(u.group=s),(i=window.console).groupCollapsed||(i.groupCollapsed=s),(a=window.console).groupEnd||(a.groupEnd=s)},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,l;return l=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]=l.copy(t));return o},i=function(){return n=l.copy(r)},u=function(t,n){var r,o,u,i;for(i=t.split(" "),o=0,u=i.length;u>o;o++)r=i[o],e(r).push(n);return function(){return s(t,n)}},s=function(t,n){var r,o,u,i,a;for(i=t.split(" "),a=[],o=0,u=i.length;u>o;o++)r=i[o],a.push(l.remove(e(r),n));return a},o=function(){var n,r,o;return o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],l.debug("Emitting event %o with args %o",o,n),r=e(o),l.each(r,function(t){return t.apply(null,n)})},u("framework:ready",a),u("framework:reset",i),{on:u,off:s,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,v,g,y;return y=up.util,h=function(t,n){var e;return e=$(t),y.isPresent(n)&&(n=y.normalizeUrl(n)),e.attr("up-source",n)},v=function(t){var n;return n=$(t).closest("[up-source]"),y.presence(n.attr("up-source"))||up.browser.url()},f=function(t,n,e){var r,o,u;return e=y.options(e),u=y.presence(t)?t:y.createSelectorFromElement($(t)),up.browser.canPushState()||y.castsToFalse(e.history)?(o={url:n,method:e.method,selector:u,cache:e.cache,preload:e.preload},r=up.proxy.ajax(o),r.done(function(t,r,a){var s,l;return(s=y.locationFromXhr(a))&&(y.debug("Location from server: %o",s),l={url:s,method:y.methodFromXhr(a),selector:u},up.proxy.alias(o,l),n=s),(y.isMissing(e.history)||y.castsToTrue(e.history))&&(e.history=n),(y.isMissing(e.source)||y.castsToTrue(e.source))&&(e.source=n),e.preload?void 0:i(u,t,e)}),r.fail(y.error),r):(e.preload||up.browser.loadPage(n,y.only(e,"method")),y.resolvedPromise())},i=function(t,n,e){var o,u,i,a,p,f,d,m;for(e=y.options(e,{historyMethod:"push"}),y.castsToFalse(e.history)&&(e.history=null),y.castsToFalse(e.scroll)&&(e.scroll=null),e.source=y.option(e.source,e.history),f=l(n),e.title||(e.title=f.title()),p=s(t,e),d=[],i=0,a=p.length;a>i;i++)m=p[i],u=r(m.selector),o=f.find(m.selector),d.push(c(u,e).then(function(){return g(u,o,m.pseudoClass,m.transition,e)}));return d},r=function(t){return o(".up-popup "+t)||o(".up-modal "+t)||o(t)||u(t)},u=function(t){var n;return n="Could not find selector %o in current body HTML","#"===n[0]&&(n+=" (avoid using IDs)"),y.error(n,t)},l=function(t){var n;return n=y.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):y.error("Could not find selector %o in response %o",e,t)}}},c=function(t,n){return up.motion.finish(t),m(t,n.scroll)},m=function(t,n){return n?up.reveal(t,{view:n}):y.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)),h(n,e.source),t(n),up.ready(n)},g=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()),y.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&&y.error("Cannot apply transitions to body-elements (%o)",u),up.morph(t,r,u,i)}})},s=function(t,n){var e,r,o,u,i,a,s,l,c,p,f;for(p=n.transition||n.animation||"none",e=/\ *,\ */,r=t.split(e),y.isPresent(p)&&(f=p.split(e)),a=[],o=u=0,i=r.length;i>u;o=++u)s=r[o],l=s.match(/^(.+?)(?:\:(before|after))?$/),c=f[o]||y.last(f),a.push({selector:l[1],pseudoClass:l[2],transition:c});return a},t=function(t){var n,e;return e="[autofocus]:last",n=y.findWithSelf(t,e),n.length&&n.get(0)!==document.activeElement?n.focus():void 0},a=function(t){var n;return n=".up-ghost, .up-destroying",0===t.closest(n).length},o=function(t){var n,e,r,o,u,i;for(o=$(t).get(),e=null,u=0,i=o.length;i>u;u++)if(r=o[u],n=$(r),a(n)){e=n;break}return e},n=function(t,n){var e,r,o;return e=$(t),n=y.options(n,{animation:"none"}),r=up.motion.animateOptions(n),e.addClass("up-destroying"),y.isPresent(n.url)&&up.history.push(n.url),y.isPresent(n.title)&&(document.title=n.title),up.bus.emit("fragment:destroy",e),o=y.presence(n.animation,y.isPromise)||up.motion.animate(e,n.animation,r),o.then(function(){return e.remove()})},p=function(t,n){var e;return n=y.options(n,{cache:!1}),e=n.url||v(t),f(t,e,n)},d=function(){return up.bus.emit("framework:reset")},up.bus.on("app:ready",function(){return h(document.body,up.browser.url())}),{replace:f,reload:p,destroy:n,implant:i,reset:d,first:o}}(),up.replace=up.flow.replace,up.reload=up.flow.reload,up.destroy=up.flow.destroy,up.reset=up.flow.reset,up.first=up.flow.first}.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)},i=[],s=null,u=function(){var n,e,r;return r=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],up.browser.isSupported()?(u=n.pop(),e=g.options(n[0],{batch:!1}),i.push({selector:r,callback:u,batch:e.batch})):void 0},r=function(t,r,o){var u;return g.debug("Applying compiler %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},o=function(t){var n,e,o,a;for(g.debug("Compiling fragment %o",t),a=[],e=0,o=i.length;o>e;e++)u=i[e],n=g.findWithSelf(t,u.selector),a.push(n.length?u.batch?r(u,n,n.get()):n.each(function(){return r(u,$(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(i)},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),i=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",o),up.bus.on("fragment:destroy",c),up.bus.on("framework:ready",v),up.bus.on("framework:reset",h),{compiler:u,on:p,ready:m,onEscape:d,data:a}}(),up.compiler=up.magic.compiler,up.on=up.magic.on,up.ready=up.magic.ready,up.awaken=function(){var n;return n=1<=arguments.length?t.call(arguments,0):[],up.util.warn("up.awaken has been renamed to up.compiler and will be removed in a future version"),up.compiler.apply(up,n)}}.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,x,C,T,E,S,P,A,D,U,F,O,M;return M=up.util,s=void 0,t=void 0,S=void 0,i=void 0,T=void 0,m=void 0,a=void 0,n={busyDelay:300,preloadDelay:75,cacheSize:70,cacheExpiry:3e5},p=function(){return clearTimeout(S),S=null},c=function(){return clearTimeout(i),i=null},A=function(){return s={},t=null,p(),c(),T=0,m=M.copy(n),a=!1},A(),h=function(t){return M.extend(m,t)},l=function(t){return C(t),[t.url,t.method,t.data,t.selector].join("|")},O=function(){var t,n,e;return t=M.keys(s),t.length>m.cacheSize&&(n=null,e=null,M.each(t,function(t){var r,o;return r=s[t],o=r.timestamp,!e||e>o?(n=t,e=o):void 0}),n)?delete s[n]:void 0},F=function(){return(new Date).valueOf()},C=function(t){return t._normalized||(t.method=M.normalizeMethod(t.method),t.url&&(t.url=M.normalizeUrl(t.url)),t.selector||(t.selector="body"),t._normalized=!0),t},o=function(t,n){var e;return M.debug("Aliasing %o to %o",t,n),(e=v(t))?D(n,e):void 0},r=function(t){var n,e,r,o,u;return n=M.castsToTrue(t.cache),e=M.castsToFalse(t.cache),u=M.only(t,"url","method","data","selector","_normalized"),r=!0,b(u)||n?(o=v(u))&&!e?r="pending"===o.state():(o=w(u),D(u,o)):(d(),o=w(u)),r&&!t.preload&&(x(),o.then(k)),o},e=["GET","OPTIONS","HEAD"],g=function(){return 0===T},u=function(){return T>0},x=function(){var t,n;return n=g(),T+=1,n?(t=function(){return u()?(up.bus.emit("proxy:busy"),a=!0):void 0},m.busyDelay>0?i=setTimeout(t,m.busyDelay):t()):void 0},k=function(){return T-=1,g()&&a?(up.bus.emit("proxy:idle"),a=!1):void 0},w=function(t){var n;return up.bus.emit("proxy:load",t),n=M.ajax(t),n.then(function(){return up.bus.emit("proxy:receive",t)}),n},b=function(t){return C(t),M.contains(e,t.method)},y=function(t){var n;return n=F()-t.timestamp,n<m.cacheExpiry},v=function(t){var n,e;return n=l(t),(e=s[n])?y(e)?(M.debug("Cache hit for %o (%o)",t.url,t),e):(M.debug("Discarding stale cache entry for %o (%o)",t.url,t),void P(t)):void M.debug("Cache miss for %o (%o)",t.url,t)},D=function(t,n){var e;return O(),e=l(t),n.timestamp=F(),s[e]=n,n},P=function(t){var n;return n=l(t),delete s[n]},d=function(){return s={}},f=function(n){var e,r;return r=parseInt(M.presentAttr(n,"up-delay"))||m.preloadDelay,n.is(t)?void 0:(t=n,p(),e=function(){return E(n)},U(e,r))},U=function(t,n){return S=setTimeout(t,n)},E=function(t,n){var e,r;return e=$(t),n=M.options(n),r=up.link.followMethod(e,n),b({method:r})?(M.debug("Preloading %o",e),n.preload=!0,up.link.follow(e,n)):(M.debug("Won't preload %o due to unsafe method %o",e,r),M.resolvedPromise())},up.bus.on("framework:reset",A),up.on("mouseover mousedown touchstart","[up-preload]",function(t,n){return up.link.childClicked(t,n)?void 0:f(n)}),{preload:E,ajax:r,get:v,set:D,alias:o,clear:d,remove:P,idle:g,busy:u,defaults:h}}()}.call(this),function(){up.link=function(){var childClicked,follow,followMethod,shouldProcessLinkEvent,u,visit;return u=up.util,visit=function(t,n){return u.debug("Visiting "+t),up.replace("body",t,n)},follow=function(t,n){var e,r,o;return e=$(t),n=u.options(n),o=u.option(e.attr("up-href"),e.attr("href")),r=u.option(n.target,e.attr("up-target"),"body"),n.transition=u.option(n.transition,e.attr("up-transition"),e.attr("up-animation")),n.history=u.option(n.history,e.attr("up-history")),n.scroll=u.option(n.scroll,e.attr("up-scroll"),"body"),n.cache=u.option(n.cache,e.attr("up-cache")),n.method=followMethod(e,n),n=u.merge(n,up.motion.animateOptions(n,e)),up.replace(r,o,n)},followMethod=function(t,n){return n=u.options(n),u.option(n.method,t.attr("up-method"),t.attr("data-method"),"get").toUpperCase()},up.on("click","a[up-target], [up-href][up-target]",function(t,n){return shouldProcessLinkEvent(t,n)?n.is("[up-instant]")?t.preventDefault():(t.preventDefault(),follow(n)):void 0}),up.on("mousedown","a[up-instant], [up-href][up-instant]",function(t,n){return shouldProcessLinkEvent(t,n)?(t.preventDefault(),follow(n)):void 0}),childClicked=function(t,n){var e,r;return e=$(t.target),r=e.closest("a, [up-href]"),r.length&&n.find(r).length},shouldProcessLinkEvent=function(t,n){return u.isUnmodifiedMouseEvent(t)&&!childClicked(t,n)},up.on("click","a[up-follow], [up-href][up-follow]",function(t,n){return shouldProcessLinkEvent(t,n)?n.is("[up-instant]")?t.preventDefault():(t.preventDefault(),follow(n)):void 0}),up.compiler("[up-expand]",function(t){var n,e,r,o,i,a,s,l;for(o=t.find("a, [up-href]").get(0),o||u.error("No link to expand within %o",t),l=/^up-/,a={},a["up-href"]=$(o).attr("href"),s=o.attributes,e=0,r=s.length;r>e;e++)n=s[e],i=n.name,i.match(l)&&(a[i]=n.value);return u.isGiven(a["up-target"])||(a["up-follow"]=""),u.setMissingAttrs(t,a),t.removeAttr("up-expand")}),up.compiler("[up-dash]",function(t){var n,e;return e=t.attr("up-dash"),n={"up-preload":"true","up-instant":"true"},u.isBlank(e)||u.castsToTrue(e)?n["up-follow"]="":n["up-target"]=e,u.setMissingAttrs(t,n),t.removeAttr("up-dash")}),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visit,follow:follow,childClicked:childClicked,followMethod:followMethod}}(),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,m;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),m=u.option(n.cache,e.attr("up-cache")),d=u.option(n.url,e.attr("action"),up.browser.url()),e.addClass("up-active"),up.browser.canPushState()||u.castsToFalse(a)?(l={url:d,method:s,data:e.serialize(),selector:c,cache:m},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)},up.proxy.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.compiler("[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,d,m;return d=up.util,u=void 0,e={openAnimation:"fade-in",closeAnimation:"fade-out",position:"bottom-right"},i=function(t){return d.extend(e,t)},p=function(t,n,e){var r,o;return o=d.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 d.error("Unknown position %o",e)}}(),n.attr("up-position",e),n.css(r),s(n)},s=function(t){var n,e,r,o,u,i,a;if(e=d.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)}},c=function(){var t;return t=$(".up-popup"),t.attr("up-previous-url",up.browser.url()),t.attr("up-previous-title",document.title)},a=function(){var t;return t=$(".up-popup"),t.removeAttr("up-previous-url"),t.removeAttr("up-previous-title")},o=function(t,n,e){var r,o;return o=d.$createElementFromSelector(".up-popup"),e&&o.attr("up-sticky",""),r=d.$createElementFromSelector(n),r.appendTo(o),o.appendTo(document.body),c(),o.hide(),o
2
- },m=function(t,n,e,r,o){return n.show(),p(t,n,e),up.animate(n,r,o)},l=function(t,r){var u,i,a,s,l,c,p,f,h;return u=$(t),r=d.options(r),h=d.option(r.url,u.attr("href")),p=d.option(r.target,u.attr("up-popup"),"body"),c=d.option(r.position,u.attr("up-position"),e.position),s=d.option(r.animation,u.attr("up-animation"),e.openAnimation),f=d.option(r.sticky,u.is("[up-sticky]")),l=up.browser.canPushState()?d.option(r.history,u.attr("up-history"),!1):!1,a=up.motion.animateOptions(r,u),n(),i=o(u,p,f),up.replace(p,h,{history:l,insert:function(){return m(u,i,c,s,a)}})},f=function(){return u},n=function(t){var n;return n=$(".up-popup"),n.length?(t=d.options(t,{animation:e.closeAnimation,url:n.attr("up-previous-url"),title:n.attr("up-previous-title")}),u=void 0,up.destroy(n,t)):void 0},t=function(){return $(".up-popup").is("[up-sticky]")?void 0:(a(),n())},r=function(t){var n;return n=$(t),n.closest(".up-popup").length>0},up.on("click","a[up-popup]",function(t,e){return t.preventDefault(),e.is(".up-current")?n():l(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){var e;return r(n)?(e=n.attr("up-source"))?u=e:void 0: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:l,close:n,source:f,defaults:i,contains:r}}()}.call(this),function(){var t=[].slice;up.modal=function(){var n,e,r,o,u,i,a,s,l,c,p,f,d,m;return d=up.util,i=void 0,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>'}},a=function(t){return d.extend(r,t)},f=function(){var t;return t=r.template,d.isFunction(t)?t(r):t},c=function(){var t;return t=$(".up-modal"),t.attr("up-previous-url",up.browser.url()),t.attr("up-previous-title",document.title)},s=function(){var t;return t=$(".up-modal"),t.removeAttr("up-previous-url"),t.removeAttr("up-previous-title")},u=function(t,n,e,r){var o,u,i,a;return i=$(f()),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"),d.isPresent(n)&&u.css("width",n),d.isPresent(e)&&u.css("height",e),o=u.find(".up-modal-content"),a=d.$createElementFromSelector(t),a.appendTo(o),i.appendTo(document.body),c(),i.hide(),i},m=function(t,n,e){return t.show(),up.animate(t,n,e)},l=function(){var n,o,i,a,s,l,c,p,f,h,v,g;return s=1<=arguments.length?t.call(arguments,0):[],!d.isObject(s[0])||d.isElement(s[0])||d.isJQuery(s[0])?(n=$(s[0]),p=s[1]):(n=d.nullJquery(),p=s[0]),p=d.options(p),v=d.option(p.url,n.attr("up-href"),n.attr("href")),f=d.option(p.target,n.attr("up-modal"),"body"),g=d.option(p.width,n.attr("up-width"),r.width),l=d.option(p.height,n.attr("up-height"),r.height),a=d.option(p.animation,n.attr("up-animation"),r.openAnimation),h=d.option(p.sticky,n.is("[up-sticky]")),c=up.browser.canPushState()?d.option(p.history,n.attr("up-history"),!0):!1,i=up.motion.animateOptions(p,n),e(),o=u(f,g,l,h),up.replace(f,v,{history:c,insert:function(){return m(o,a,i)}})},p=function(){return i},e=function(t){var n;return n=$(".up-modal"),n.length?(t=d.options(t,{animation:r.closeAnimation,url:n.attr("up-previous-url"),title:n.attr("up-previous-title")}),i=void 0,up.destroy(n,t)):void 0},n=function(){return $(".up-modal").is("[up-sticky]")?void 0:(s(),e())},o=function(t){var n;return n=$(t),n.closest(".up-modal").length>0},up.on("click","a[up-modal]",function(t,n){return t.preventDefault(),n.is(".up-current")?e():l(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){var e;if(o(t)){if(e=t.attr("up-source"))return i=e}else if(!up.popup.contains(t))return 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:l,close:e,source:p,defaults:a,contains:o}}()}.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 position %o",e)}}(),n.attr("up-position",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,p;return null==u&&(u={}),i=$(e),c=o.option(u.html,i.attr("up-tooltip"),i.attr("title")),p=o.option(u.position,i.attr("up-position"),"top"),l=o.option(u.animation,i.attr("up-animation"),"fade-in"),s=up.motion.animateOptions(u,i),t(),a=n(c),r(i,a,p),up.animate(a,l,s)},t=function(t){var n;return n=$(".up-tooltip"),n.length?(t=o.options(t,{animation:"fade-out"}),t=o.merge(t,up.motion.animateOptions(t)),up.destroy(n,t)):void 0},up.compiler("[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,m;return f=up.util,t="up-active",n="up-current",e=["a","[up-href]","[up-alias]"],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,l;for(i=[],u=["href","up-href"],r=0,o=u.length;o>r;r++)e=u[r],(a=f.presentAttr(t,e))&&i.push(a);return(n=f.presentAttr(t,"up-alias"))&&(l=n.split(" "),i=i.concat(l)),i.map(s)},m=function(t){var n,e,r,o;return t=f.compact(t),r=function(t){return"*"===t.substr(-1)?e(t.slice(0,-1)):n(t)},n=function(n){return f.contains(t,n)},e=function(n){return f.detect(t,function(t){return 0===t.indexOf(n)})},o=function(t){return f.detect(t,r)},{matchesAny:o}},a=function(){var t;return t=m([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.matchesAny(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 f.isUnmodifiedMouseEvent(t)&&!n.is("[up-instant]")?l(n):void 0}),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.slot=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-slot]").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,x,C,T,E,S,P,A,D,O,U,F,M,z,j,W,L,N,I,H,q,G,J,R,X,K,V,B,_,Q,Z,Y,tn,nn,en,rn,on,un,an,sn,ln,cn,pn,fn,dn,mn,hn,vn,gn,yn,bn,wn,kn,$n,xn,Cn,Tn,En,Sn;return Z=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))}},S=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)},G=function(t,n){return(""===n||"80"===n)&&"http:"===t||"443"===n&&"https:"===t},rn=function(t,n){var e,r,o;return e=null,J(t)?(e=$("<a>").attr({href:t}).get(0),D(e.hostname)&&(e.href=e.href)):e=En(t),r=e.protocol+"//"+e.hostname,G(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},en=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(h=t.split(/[ >]/),r=null,c=p=0,d=h.length;d>p;c=++p){for(i=h[c],u=i.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),v="div",o=[],l=null,f=0,m=u.length;m>f;f++)switch(a=u[f],a[0]){case".":o.push(a.substr(1));break;case"#":l=a.substr(1);break;default:v=a}s="<"+v,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},d=function(t,n){var e;return e=document.createElement(t),H(n)&&(e.innerHTML=n),e},g=function(){var n,e;return e=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],e="[UP] "+e,console.debug.apply(console,[e].concat(t.call(n)))},Sn=function(){var n,e;return e=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],e="[UP] "+e,console.warn.apply(console,[e].concat(t.call(n)))},w=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=wn(e),n=pn($(".up-error"))||$('<div class="up-error"></div>').prependTo("body"),n.addClass("up-error"),n.text(r),new Error(r)},r=/\%[odisf]/g,wn=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+")"})},h=function(t){var n,e,r,o,u,i,a;for(g("Creating selector from element %o",t),e=(n=t.attr("class"))?n.split(" "):[],r=t.attr("id"),a=t.prop("tagName").toLowerCase(),r&&(a+="#"+r),o=0,i=e.length;i>o;o++)u=e[o],a+="."+u;return a},m=function(t){var n,e,r,o,u,i,a,s,l,c,p,f;return l=function(t){return"<"+t+"(?: [^>]*)?>"},i=function(t){return"</"+t+">"},n="(?:.|\\n)*?",u=function(t){return"("+t+")"},f=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=d("body",r[1]),s.appendChild(e),(p=t.match(f))&&(a=d("head"),s.appendChild(a),c=d("title",p[1]),a.appendChild(c)),s):d("div",t)},x=$.extend,Cn=$.trim,V=Object.keys||function(t){var n,e,r,o;for(o=[],n=0,r=t.length;r>n;n++)e=t[n],t.hasOwnProperty(e)&&o.push(e);return o},b=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,n){var e,r,o,u;for(u=[],e=r=0,o=t-1;o>=0?o>=r:r>=o;e=o>=0?++r:--r)u.push(n(e));return u},N=function(t){return null===t},R=function(t){return void 0===t},U=function(t){return!R(t)},L=function(t){return R(t)||N(t)},z=function(t){return!L(t)},D=function(t){return L(t)||I(t)&&0===V(t).length||0===t.length},pn=function(t,n){return null==n&&(n=H),n(t)?t:null},H=function(t){return!D(t)},M=function(t){return"function"==typeof t},J=function(t){return"string"==typeof t},j=function(t){return"object"==typeof t&&!!t},I=function(t){return j(t)||"function"==typeof t},F=function(t){return!(!t||1!==t.nodeType)},W=function(t){return t instanceof jQuery},q=function(t){return I(t)&&M(t.then)},O=function(t){return q(t)&&M(t.resolve)},P=function(t){return z(t)?t:void 0},A=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},xn=function(t){return Array.prototype.slice.call(t)},p=function(t){return A(t)?t.slice():x({},t)},En=function(t){return W(t)?t.get(0):t},Y=function(t,n){return x(p(t),n)},ln=function(t,n){var e,r,o,u;if(o=t?p(t):{},n)for(r in n)e=n[r],u=o[r],z(u)?I(e)&&I(u)&&(o[r]=ln(u,e)):o[r]=e;return o},sn=function(){var n,e,r,o,u,i;for(e=1<=arguments.length?t.call(arguments,0):[],u=null,r=0,o=e.length;o>r;r++)if(n=e[r],i=n,M(i)&&(i=i()),z(i)){u=i;break}return u},y=function(t,n){var e,r,o,u;for(u=null,r=0,o=t.length;o>r;r++)if(e=t[r],n(e)){u=e;break}return u},s=function(t){return yn(t,z)},Tn=function(t){var n;return n={},yn(t,function(t){return n.hasOwnProperty(t)?!1:n[t]=!0})},yn=function(t,n){var e;return e=[],b(t,function(t){return n(t)?e.push(t):void 0}),e},fn=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}(),y(o,H)},nn=function(t){return setTimeout(t,0)},B=function(t){return t[t.length-1]},a=function(){var t;return t=document.documentElement,{width:t.clientWidth,height:t.clientHeight}},gn=Z(function(){var t,n,e;return t=$("<div>").css({position:"absolute",top:"0",left:"0",width:"50px",height:"50px",overflowY:"scroll"}),t.appendTo(document.body),n=t.get(0),e=n.offsetWidth-n.clientWidth,t.remove(),e}),un=function(t){var n;return n=void 0,function(){return null!=t&&(n=t()),t=void 0,n}},kn=function(t,n,e){var r,o;return o=t.css(V(n)),t.css(n),r=function(){return t.css(o)},e?(e(),r()):un(r)},E=function(t){var n,e;return e=t.css(["transform","-webkit-transform"]),D(e)?(n=function(){return t.css(e)},t.css({transform:"translateZ(0)","-webkit-transform":"translateZ(0)"})):n=function(){},n},v=function(t,n,r){var o,u,i,a,s,l;return o=$(t),up.browser.canCssAnimation()?(r=ln(r,{duration:300,delay:0,easing:"ease"}),u=$.Deferred(),a={"transition-property":V(n).join(", "),"transition-duration":r.duration+"ms","transition-delay":r.delay+"ms","transition-timing-function":r.easing},s=E(o),l=kn(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),vn())},e="up-animation-promise",T=function(t){return $(t).each(function(){var t;return(t=$(this).data(e))?t.resolve():void 0})},Q=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},f=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},cn=function(t){var n,e;return e=Q(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)},C=function(t,n){return t.find(n).addBack(n)},k=function(t){return 27===t.keyCode},c=function(t,n){return t.indexOf(n)>=0},i=function(t){return"true"===String(t)},u=function(t){return"false"===String(t)},_=function(t){return t.getResponseHeader("X-Up-Location")},tn=function(t){return t.getResponseHeader("X-Up-Method")},an=function(){var n,e,r,o,u,i;for(i=arguments[0],o=2<=arguments.length?t.call(arguments,1):[],n={},e=0,u=o.length;u>e;e++)r=o[e],i.hasOwnProperty(r)&&(n[r]=i[r]);return n},X=function(t){return!(t.metaKey||t.shiftKey||t.ctrlKey)},K=function(t){var n;return n=R(t.button)||0===t.button,n&&X(t)},hn=function(){var t;return t=$.Deferred(),t.resolve(),t},vn=function(){return hn().promise()},on=function(){return{is:function(){return!1},attr:function(){},find:function(){return[]}}},mn=function(){var n,e;return n=1<=arguments.length?t.call(arguments,0):[],e=$.when.apply($,n),e.resolve=function(){return b(n,function(t){return"function"==typeof t.resolve?t.resolve():void 0})},e},bn=function(t,n){var e,r,o;r=[];for(e in n)o=n[e],r.push(L(t.attr(e))?t.attr(e,o):void 0);return r},dn=function(t,n){var e;return e=t.indexOf(n),e>=0?(t.splice(e,1),n):void 0},l=function(t){var n,e;return null==t&&(t={}),e={reset:function(){var r,o,u,i;for(i=Object.getOwnPropertyNames(e),r=0,u=i.length;u>r;r++)o=i[r],c(n,o)||delete e[o];return e.update(p(t))},update:function(t){return x(e,t)}},n=Object.getOwnPropertyNames(e),e.reset(),e},{presentAttr:fn,createElement:d,normalizeUrl:rn,normalizeMethod:en,createElementFromHtml:m,$createElementFromSelector:n,createSelectorFromElement:h,get:S,ajax:o,extend:x,copy:p,merge:Y,options:ln,option:sn,error:w,debug:g,warn:Sn,each:b,times:$n,detect:y,select:yn,compact:s,uniq:Tn,last:B,isNull:N,isDefined:U,isUndefined:R,isGiven:z,isMissing:L,isPresent:H,isBlank:D,presence:pn,isObject:I,isFunction:M,isString:J,isElement:F,isJQuery:W,isPromise:q,isDeferred:O,isHash:j,ifGiven:P,isUnmodifiedKeyEvent:X,isUnmodifiedMouseEvent:K,nullJquery:on,unwrap:En,nextFrame:nn,measure:Q,temporaryCss:kn,cssAnimate:v,finishCssAnimate:T,forceCompositing:E,prependGhost:cn,escapePressed:k,copyAttributes:f,findWithSelf:C,contains:c,isArray:A,toArray:xn,castsToTrue:i,castsToFalse:u,locationFromXhr:_,methodFromXhr:tn,clientSize:a,only:an,trim:Cn,keys:V,resolvedPromise:vn,resolvedDeferred:hn,resolvableWhen:mn,setMissingAttrs:bn,remove:dn,memoize:Z,scrollbarWidth:gn,config:l}}()}.call(this),function(){up.browser=function(){var t,n,e,r,o,u,i,a,s;return a=up.util,i=function(t,n){var e,r,o,u,i,s;return null==n&&(n={}),i=a.option(n.method,"get").toLowerCase(),"get"===i?location.href=t:$.rails?(s=n.target,o=$.rails.csrfToken(),r=$.rails.csrfParam(),e=$("<form method='post' action='"+t+"'></form>"),u="<input name='_method' value='"+i+"' type='hidden' />",a.isDefined(r)&&a.isDefined(o)&&(u+="<input name='"+r+"' value='"+o+"' type='hidden' />"),s&&e.attr("target",s),e.hide().append(u).appendTo("body"),e.submit()):error("Can't fake a "+i.toUpperCase()+" request without Rails UJS")},s=function(){return location.href},r=function(){var t,n,e,r,o,u,i,a,s;return window.console||(window.console={}),s=function(){},(t=window.console).log||(t.log=s),(n=window.console).info||(n.info=s),(e=window.console).error||(e.error=s),(r=window.console).debug||(r.debug=s),(o=window.console).warn||(o.warn=s),(u=window.console).group||(u.group=s),(i=window.console).groupCollapsed||(i.groupCollapsed=s),(a=window.console).groupEnd||(a.groupEnd=s)},e=a.memoize(function(){return a.isDefined(history.pushState)}),t=a.memoize(function(){return"transition"in document.documentElement.style}),n=a.memoize(function(){return"oninput"in document.createElement("input")}),o=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||a.error("jQuery %o found, but Up.js requires 1.9+",o)},u=a.memoize(function(){return a.isDefined(document.addEventListener)}),{url:s,ensureConsoleExists:r,loadPage:i,canPushState:e,canCssAnimation:t,canInputEvent:n,isSupported:u,ensureRecentJquery:o}}()}.call(this),function(){var t=[].slice;up.bus=function(){var n,e,r,o,u,i,a,s,l;return l=up.util,n={},r={},i=function(){return n=l.copy(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]=l.copy(t));return o},u=function(t,n){var r,o,u,i;for(i=t.split(" "),o=0,u=i.length;u>o;o++)r=i[o],e(r).push(n);return function(){return s(t,n)}},s=function(t,n){var r,o,u,i,a;for(i=t.split(" "),a=[],o=0,u=i.length;u>o;o++)r=i[o],a.push(l.remove(e(r),n));return a},o=function(){var n,r,o;return o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],l.debug("Emitting event %o with args %o",o,n),r=e(o),l.each(r,function(t){return t.apply(null,n)})},u("framework:ready",a),u("framework:reset",i),{on:u,off:s,emit:o}}()}.call(this),function(){up.viewport=function(){var t,n,e,r,o,u,i;return i=up.util,n=i.config({duration:0,view:"body",easing:"swing"}),r=function(){return n.reset()},t="up-scroll-promise",u=function(r,o,u){var a,s,l,c,p;return a=$(r),u=i.options(u),l=i.option(u.duration,n.duration),c=i.option(u.easing,n.easing),e(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())},e=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()},up.bus.on("framework:reset",r),{reveal:o,scroll:u,finishScrolling:e,defaults:n.update}}(),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,v,g,y;return y=up.util,h=function(t,n){var e;return e=$(t),y.isPresent(n)&&(n=y.normalizeUrl(n)),e.attr("up-source",n)},v=function(t){var n;return n=$(t).closest("[up-source]"),y.presence(n.attr("up-source"))||up.browser.url()},f=function(t,n,e){var r,o,u;return e=y.options(e),u=y.presence(t)?t:y.createSelectorFromElement($(t)),up.browser.canPushState()||y.castsToFalse(e.history)?(o={url:n,method:e.method,selector:u,cache:e.cache,preload:e.preload},r=up.proxy.ajax(o),r.done(function(t,r,a){var s,l;return(s=y.locationFromXhr(a))&&(y.debug("Location from server: %o",s),l={url:s,method:y.methodFromXhr(a),selector:u},up.proxy.alias(o,l),n=s),(y.isMissing(e.history)||y.castsToTrue(e.history))&&(e.history=n),(y.isMissing(e.source)||y.castsToTrue(e.source))&&(e.source=n),e.preload?void 0:i(u,t,e)}),r.fail(y.error),r):(e.preload||up.browser.loadPage(n,y.only(e,"method")),y.resolvedPromise())},i=function(t,n,e){var o,u,i,a,p,f,d,m;for(e=y.options(e,{historyMethod:"push"}),y.castsToFalse(e.history)&&(e.history=null),y.castsToFalse(e.scroll)&&(e.scroll=null),e.source=y.option(e.source,e.history),f=l(n),e.title||(e.title=f.title()),p=s(t,e),d=[],i=0,a=p.length;a>i;i++)m=p[i],u=r(m.selector),o=f.find(m.selector),d.push(c(u,e).then(function(){return g(u,o,m.pseudoClass,m.transition,e)}));return d},r=function(t){return o(".up-popup "+t)||o(".up-modal "+t)||o(t)||u(t)},u=function(t){var n;return n="Could not find selector %o in current body HTML","#"===n[0]&&(n+=" (avoid using IDs)"),y.error(n,t)},l=function(t){var n;return n=y.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):y.error("Could not find selector %o in response %o",e,t)}}},c=function(t,n){return up.motion.finish(t),m(t,n.scroll)},m=function(t,n){return n?up.reveal(t,{view:n}):y.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)),h(n,e.source),t(n),up.ready(n)},g=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()),y.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&&y.error("Cannot apply transitions to body-elements (%o)",u),up.morph(t,r,u,i)}})},s=function(t,n){var e,r,o,u,i,a,s,l,c,p,f;for(p=n.transition||n.animation||"none",e=/\ *,\ */,r=t.split(e),y.isPresent(p)&&(f=p.split(e)),a=[],o=u=0,i=r.length;i>u;o=++u)s=r[o],l=s.match(/^(.+?)(?:\:(before|after))?$/),c=f[o]||y.last(f),a.push({selector:l[1],pseudoClass:l[2],transition:c});return a},t=function(t){var n,e;return e="[autofocus]:last",n=y.findWithSelf(t,e),n.length&&n.get(0)!==document.activeElement?n.focus():void 0},a=function(t){var n;return n=".up-ghost, .up-destroying",0===t.closest(n).length},o=function(t){var n,e,r,o,u,i;for(o=$(t).get(),e=null,u=0,i=o.length;i>u;u++)if(r=o[u],n=$(r),a(n)){e=n;break}return e},n=function(t,n){var e,r,o;return e=$(t),n=y.options(n,{animation:"none"}),r=up.motion.animateOptions(n),e.addClass("up-destroying"),y.isPresent(n.url)&&up.history.push(n.url),y.isPresent(n.title)&&(document.title=n.title),up.bus.emit("fragment:destroy",e),o=y.presence(n.animation,y.isPromise)||up.motion.animate(e,n.animation,r),o.then(function(){return e.remove()})},p=function(t,n){var e;return n=y.options(n,{cache:!1}),e=n.url||v(t),f(t,e,n)},d=function(){return up.bus.emit("framework:reset")},up.bus.on("app:ready",function(){return h(document.body,up.browser.url())}),{replace:f,reload:p,destroy:n,implant:i,reset:d,first:o}}(),up.replace=up.flow.replace,up.reload=up.flow.reload,up.destroy=up.flow.destroy,up.reset=up.flow.reset,up.first=up.flow.first}.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)},i=[],s=null,u=function(){var n,e,r;return r=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],up.browser.isSupported()?(u=n.pop(),e=g.options(n[0],{batch:!1}),i.push({selector:r,callback:u,batch:e.batch})):void 0},r=function(t,r,o){var u;return g.debug("Applying compiler %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},o=function(t){var n,e,o,a;for(g.debug("Compiling fragment %o",t),a=[],e=0,o=i.length;o>e;e++)u=i[e],n=g.findWithSelf(t,u.selector),a.push(n.length?u.batch?r(u,n,n.get()):n.each(function(){return r(u,$(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(i)},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),i=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",o),up.bus.on("fragment:destroy",c),up.bus.on("framework:ready",v),up.bus.on("framework:reset",h),{compiler:u,on:p,ready:m,onEscape:d,data:a}}(),up.compiler=up.magic.compiler,up.on=up.magic.on,up.ready=up.magic.ready,up.awaken=function(){var n;return n=1<=arguments.length?t.call(arguments,0):[],up.util.warn("up.awaken has been renamed to up.compiler and will be removed in a future version"),up.compiler.apply(up,n)}}.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,o={},a={},y={},s={},i=b.config({duration:300,delay:0,easing:"ease"}),m=function(){return o=b.copy(a),y=b.copy(s),i.reset()},n=function(t,r,o){var i;return i=$(t),c(i),o=e(o),b.isFunction(r)?u(r(i,o),r):b.isString(r)?n(i,l(r),o):b.isHash(r)?b.cssAnimate(i,r,o):b.error("Unknown animation type %o",r)},e=function(t,n){var e;return null==n&&(n=null),t=b.options(t),e={},e.easing=b.option(t.easing,null!=n?n.attr("up-easing"):void 0,i.easing),e.duration=Number(b.option(t.duration,null!=n?n.attr("up-duration"):void 0,i.duration)),e.delay=Number(b.option(t.delay,null!=n?n.attr("up-delay"):void 0,i.delay)),e},l=function(t){return o[t]||b.error("Unknown animation %o",r)},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"}),a=b.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},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},u=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,r,i,a){var s,l,p,m,v;return up.browser.canCssAnimation()?(a=e(a),l=$(t),s=$(r),c(l),c(s),"none"===i?d():(v=b.presence(i,b.isFunction)||y[i])?w(l,s,function(t,n){return u(v(t,n,a),i)}):(p=o[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},r=function(t,n){return o[t]=n},v=function(){return a=b.copy(o),s=b.copy(y)},h=b.resolvableWhen,d=b.resolvedDeferred,r("none",d),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=b.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=b.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=b.measure(t),o=b.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=b.measure(t),o=b.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=b.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=b.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=b.measure(t),o=b.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=b.measure(t),o=b.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=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,animateOptions:e,finish:c,transition:g,animation:r,defaults:i.update,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,x,C,T,E,S,P,A,D,O,U;return U=up.util,a=void 0,t=void 0,T=void 0,u=void 0,x=void 0,i=void 0,d=U.config({busyDelay:300,preloadDelay:75,cacheSize:70,cacheExpiry:3e5}),c=function(){return clearTimeout(T),T=null},l=function(){return clearTimeout(u),u=null},S=function(){return a={},t=null,c(),l(),x=0,d.reset(),i=!1},S(),s=function(t){return k(t),[t.url,t.method,t.data,t.selector].join("|")},O=function(){var t,n,e;return t=U.keys(a),t.length>d.cacheSize&&(n=null,e=null,U.each(t,function(t){var r,o;return r=a[t],o=r.timestamp,!e||e>o?(n=t,e=o):void 0}),n)?delete a[n]:void 0},D=function(){return(new Date).valueOf()},k=function(t){return t._normalized||(t.method=U.normalizeMethod(t.method),t.url&&(t.url=U.normalizeUrl(t.url)),t.selector||(t.selector="body"),t._normalized=!0),t},r=function(t,n){var e;return U.debug("Aliasing %o to %o",t,n),(e=m(t))?P(n,e):void 0},e=function(t){var n,e,r,o,u;return n=U.castsToTrue(t.cache),e=U.castsToFalse(t.cache),u=U.only(t,"url","method","data","selector","_normalized"),r=!0,g(u)||n?(o=m(u))&&!e?r="pending"===o.state():(o=y(u),P(u,o)):(f(),o=y(u)),r&&!t.preload&&(w(),o.then(b)),o},n=["GET","OPTIONS","HEAD"],h=function(){return 0===x},o=function(){return x>0},w=function(){var t,n;return n=h(),x+=1,n?(t=function(){return o()?(up.bus.emit("proxy:busy"),i=!0):void 0},d.busyDelay>0?u=setTimeout(t,d.busyDelay):t()):void 0},b=function(){return x-=1,h()&&i?(up.bus.emit("proxy:idle"),i=!1):void 0},y=function(t){var n;return up.bus.emit("proxy:load",t),n=U.ajax(t),n.then(function(){return up.bus.emit("proxy:receive",t)}),n},g=function(t){return k(t),U.contains(n,t.method)},v=function(t){var n;return n=D()-t.timestamp,n<d.cacheExpiry},m=function(t){var n,e;return n=s(t),(e=a[n])?v(e)?(U.debug("Cache hit for %o (%o)",t.url,t),e):(U.debug("Discarding stale cache entry for %o (%o)",t.url,t),void E(t)):void U.debug("Cache miss for %o (%o)",t.url,t)},P=function(t,n){var e;return O(),e=s(t),n.timestamp=D(),a[e]=n,n},E=function(t){var n;return n=s(t),delete a[n]},f=function(){return a={}},p=function(n){var e,r;return r=parseInt(U.presentAttr(n,"up-delay"))||d.preloadDelay,n.is(t)?void 0:(t=n,c(),e=function(){return C(n)},A(e,r))},A=function(t,n){return T=setTimeout(t,n)},C=function(t,n){var e,r;return e=$(t),n=U.options(n),r=up.link.followMethod(e,n),g({method:r})?(U.debug("Preloading %o",e),n.preload=!0,up.link.follow(e,n)):(U.debug("Won't preload %o due to unsafe method %o",e,r),U.resolvedPromise())},up.on("mouseover mousedown touchstart","[up-preload]",function(t,n){return up.link.childClicked(t,n)?void 0:p(n)}),up.bus.on("framework:reset",S),{preload:C,ajax:e,get:m,set:P,alias:r,clear:f,remove:E,idle:h,busy:o,defaults:d.update}}()}.call(this),function(){up.link=function(){var childClicked,follow,followMethod,shouldProcessLinkEvent,u,visit;return u=up.util,visit=function(t,n){return u.debug("Visiting "+t),up.replace("body",t,n)},follow=function(t,n){var e,r,o;return e=$(t),n=u.options(n),o=u.option(e.attr("up-href"),e.attr("href")),r=u.option(n.target,e.attr("up-target"),"body"),n.transition=u.option(n.transition,e.attr("up-transition"),e.attr("up-animation")),n.history=u.option(n.history,e.attr("up-history")),n.scroll=u.option(n.scroll,e.attr("up-scroll"),"body"),n.cache=u.option(n.cache,e.attr("up-cache")),n.method=followMethod(e,n),n=u.merge(n,up.motion.animateOptions(n,e)),up.replace(r,o,n)},followMethod=function(t,n){return n=u.options(n),u.option(n.method,t.attr("up-method"),t.attr("data-method"),"get").toUpperCase()},up.on("click","a[up-target], [up-href][up-target]",function(t,n){return shouldProcessLinkEvent(t,n)?n.is("[up-instant]")?t.preventDefault():(t.preventDefault(),follow(n)):void 0}),up.on("mousedown","a[up-instant], [up-href][up-instant]",function(t,n){return shouldProcessLinkEvent(t,n)?(t.preventDefault(),follow(n)):void 0}),childClicked=function(t,n){var e,r;return e=$(t.target),r=e.closest("a, [up-href]"),r.length&&n.find(r).length},shouldProcessLinkEvent=function(t,n){return u.isUnmodifiedMouseEvent(t)&&!childClicked(t,n)},up.on("click","a[up-follow], [up-href][up-follow]",function(t,n){return shouldProcessLinkEvent(t,n)?n.is("[up-instant]")?t.preventDefault():(t.preventDefault(),follow(n)):void 0}),up.compiler("[up-expand]",function(t){var n,e,r,o,i,a,s,l;for(o=t.find("a, [up-href]").get(0),o||u.error("No link to expand within %o",t),l=/^up-/,a={},a["up-href"]=$(o).attr("href"),s=o.attributes,e=0,r=s.length;r>e;e++)n=s[e],i=n.name,i.match(l)&&(a[i]=n.value);return u.isGiven(a["up-target"])||(a["up-follow"]=""),u.setMissingAttrs(t,a),t.removeAttr("up-expand")}),up.compiler("[up-dash]",function(t){var n,e;return e=t.attr("up-dash"),n={"up-preload":"true","up-instant":"true"},u.isBlank(e)||u.castsToTrue(e)?n["up-follow"]="":n["up-target"]=e,u.setMissingAttrs(t,n),t.removeAttr("up-dash")}),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visit,follow:follow,childClicked:childClicked,followMethod:followMethod}}(),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,m;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),m=u.option(n.cache,e.attr("up-cache")),d=u.option(n.url,e.attr("action"),up.browser.url()),e.addClass("up-active"),up.browser.canPushState()||u.castsToFalse(a)?(l={url:d,method:s,data:e.serialize(),selector:c,cache:m},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)},up.proxy.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.compiler("[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,d,m;return d=up.util,u=void 0,e=d.config({openAnimation:"fade-in",closeAnimation:"fade-out",position:"bottom-right"}),c=function(){return n(),e.reset()},p=function(t,n,e){var r,o;return o=d.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 d.error("Unknown position %o",e)}}(),n.attr("up-position",e),n.css(r),a(n)},a=function(t){var n,e,r,o,u,i,a;if(e=d.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);
2
+ 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)},i=function(){var t;return t=$(".up-popup"),t.removeAttr("up-previous-url"),t.removeAttr("up-previous-title")},o=function(t,n,e){var r,o;return o=d.$createElementFromSelector(".up-popup"),e&&o.attr("up-sticky",""),r=d.$createElementFromSelector(n),r.appendTo(o),o.appendTo(document.body),l(),o.hide(),o},m=function(t,n,e,r,o){return n.show(),p(t,n,e),up.animate(n,r,o)},s=function(t,r){var u,i,a,s,l,c,p,f,h;return u=$(t),r=d.options(r),h=d.option(r.url,u.attr("href")),p=d.option(r.target,u.attr("up-popup"),"body"),c=d.option(r.position,u.attr("up-position"),e.position),s=d.option(r.animation,u.attr("up-animation"),e.openAnimation),f=d.option(r.sticky,u.is("[up-sticky]")),l=up.browser.canPushState()?d.option(r.history,u.attr("up-history"),!1):!1,a=up.motion.animateOptions(r,u),n(),i=o(u,p,f),up.replace(p,h,{history:l,insert:function(){return m(u,i,c,s,a)}})},f=function(){return u},n=function(t){var n;return n=$(".up-popup"),n.length?(t=d.options(t,{animation:e.closeAnimation,url:n.attr("up-previous-url"),title:n.attr("up-previous-title")}),u=void 0,up.destroy(n,t)):d.resolvedPromise()},t=function(){return $(".up-popup").is("[up-sticky]")?void 0:(i(),n())},r=function(t){var n;return n=$(t),n.closest(".up-popup").length>0},up.on("click","a[up-popup]",function(t,e){return t.preventDefault(),e.is(".up-current")?n():s(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){var e;return r(n)?(e=n.attr("up-source"))?u=e:void 0: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",c),{open:s,close:n,source:f,defaults:e.update,contains:r}}()}.call(this),function(){var t=[].slice;up.modal=function(){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v;return m=up.util,r=m.config({maxWidth:void 0,minWidth:void 0,width:void 0,height:void 0,openAnimation:"fade-in",closeAnimation:"fade-out",closeLabel:"\xd7",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>'}}),i=void 0,c=function(){return e(),i=void 0,r.reset()},d=function(){var t;return t=r.template,m.isFunction(t)?t(r):t},l=function(){var t;return t=$(".up-modal"),t.attr("up-previous-url",up.browser.url()),t.attr("up-previous-title",document.title)},a=function(){var t;return t=$(".up-modal"),t.removeAttr("up-previous-url"),t.removeAttr("up-previous-title")},u=function(t){var n,e,r,o;return r=$(d()),t.sticky&&r.attr("up-sticky",""),r.attr("up-previous-url",up.browser.url()),r.attr("up-previous-title",document.title),e=r.find(".up-modal-dialog"),m.isPresent(t.width)&&e.css("width",t.width),m.isPresent(t.maxWidth)&&e.css("max-width",t.maxWidth),m.isPresent(t.height)&&e.css("height",t.height),n=r.find(".up-modal-content"),o=m.$createElementFromSelector(t.selector),o.appendTo(n),r.appendTo(document.body),l(),r.hide(),r},h=void 0,p=function(){var t,n,e;return e=m.scrollbarWidth(),t=parseInt($("body").css("padding-right")),n=e+t,h=m.temporaryCss($("body"),{"padding-right":n+"px","overflow-y":"hidden"})},v=function(t,n,e){var r;return up.bus.emit("modal:open"),p(),t.show(),r=up.animate(t,n,e),r.then(function(){return up.bus.emit("modal:opened")}),r},s=function(){var n,o,i,a,s,l,c,p,f,d,h,g,y;return s=1<=arguments.length?t.call(arguments,0):[],!m.isObject(s[0])||m.isElement(s[0])||m.isJQuery(s[0])?(n=$(s[0]),f=s[1]):(n=m.nullJquery(),f=s[0]),f=m.options(f),g=m.option(f.url,n.attr("up-href"),n.attr("href")),d=m.option(f.target,n.attr("up-modal"),"body"),y=m.option(f.width,n.attr("up-width"),r.width),p=m.option(f.maxWidth,n.attr("up-max-width"),r.maxWidth),l=m.option(f.height,n.attr("up-height"),r.height),a=m.option(f.animation,n.attr("up-animation"),r.openAnimation),h=m.option(f.sticky,n.is("[up-sticky]")),c=up.browser.canPushState()?m.option(f.history,n.attr("up-history"),!0):!1,i=up.motion.animateOptions(f,n),e(),o=u({selector:d,width:y,maxWidth:p,height:l,sticky:h}),up.replace(d,g,{history:c,insert:function(){return v(o,a,i)}})},f=function(){return i},e=function(t){var n,e;return n=$(".up-modal"),n.length?(t=m.options(t,{animation:r.closeAnimation,url:n.attr("up-previous-url"),title:n.attr("up-previous-title")}),i=void 0,up.bus.emit("modal:close"),e=up.destroy(n,t),e.then(function(){return h(),up.bus.emit("modal:closed")}),e):m.resolvedPromise()},n=function(){return $(".up-modal").is("[up-sticky]")?void 0:(a(),e())},o=function(t){var n;return n=$(t),n.closest(".up-modal").length>0},up.on("click","a[up-modal]",function(t,n){return t.preventDefault(),n.is(".up-current")?e():s(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){var e;if(o(t)){if(e=t.attr("up-source"))return i=e}else if(!up.popup.contains(t))return 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",c),{open:s,close:e,source:f,defaults:r.update,contains:o}}()}.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 position %o",e)}}(),n.attr("up-position",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,p;return null==u&&(u={}),i=$(e),c=o.option(u.html,i.attr("up-tooltip"),i.attr("title")),p=o.option(u.position,i.attr("up-position"),"top"),l=o.option(u.animation,i.attr("up-animation"),"fade-in"),s=up.motion.animateOptions(u,i),t(),a=n(c),r(i,a,p),up.animate(a,l,s)},t=function(t){var n;return n=$(".up-tooltip"),n.length?(t=o.options(t,{animation:"fade-out"}),t=o.merge(t,up.motion.animateOptions(t)),up.destroy(n,t)):void 0},up.compiler("[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,m,h,v;return m=up.util,u=m.config({currentClass:"up-current"}),c=function(){return u.reset()},i=function(){var t;return t=u.currentClass,m.contains(t,"up-current")||(t+=" up-current"),t},t="up-active",n=["a","[up-href]","[up-alias]"],r=n.join(", "),o=function(){var t,e,r;for(r=[],t=0,e=n.length;e>t;t++)d=n[t],r.push(d+"[up-instant]");return r}().join(", "),e="."+t,l=function(t){return m.isPresent(t)?m.normalizeUrl(t,{search:!1,stripTrailingSlash:!0}):void 0},f=function(t){var n,e,r,o,u,i,a,s;for(i=[],u=["href","up-href"],r=0,o=u.length;o>r;r++)e=u[r],(a=m.presentAttr(t,e))&&i.push(a);return(n=m.presentAttr(t,"up-alias"))&&(s=n.split(" "),i=i.concat(s)),i.map(l)},v=function(t){var n,e,r,o;return t=m.compact(t),r=function(t){return"*"===t.substr(-1)?e(t.slice(0,-1)):n(t)},n=function(n){return m.contains(t,n)},e=function(n){return m.detect(t,function(t){return 0===t.indexOf(n)})},o=function(t){return m.detect(t,r)},{matchesAny:o}},s=function(){var t,n;return t=v([l(up.browser.url()),l(up.modal.source()),l(up.popup.source())]),n=i(),m.each($(r),function(e){var r,o;return r=$(e),o=f(r),t.matchesAny(o)?r.addClass(n):r.removeClass(n)})},p=function(n){return h(),n=a(n),n.addClass(t)},a=function(t){return m.presence(t.parents(r))||t},h=function(){return $(e).removeClass(t)},up.on("click",r,function(t,n){return m.isUnmodifiedMouseEvent(t)&&!n.is("[up-instant]")?p(n):void 0}),up.on("mousedown",o,function(t,n){return m.isUnmodifiedMouseEvent(t)?p(n):void 0}),up.bus.on("fragment:ready",function(){return h(),s()}),up.bus.on("fragment:destroy",function(t){return t.is(".up-modal, .up-popup")?s():void 0}),up.bus.on("framework:reset",c),{defaults:u.update}}()}.call(this),function(){up.slot=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-slot]").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);
@@ -2,7 +2,8 @@
2
2
  Browser interface
3
3
  =================
4
4
 
5
- Some browser-interfacing methods and switches that we can't currently get rid off.
5
+ Some browser-interfacing methods and switches that
6
+ we can't currently get rid off.
6
7
 
7
8
  @protected
8
9
  @class up.browser
@@ -10,24 +11,7 @@ Some browser-interfacing methods and switches that we can't currently get rid of
10
11
  up.browser = (->
11
12
 
12
13
  u = up.util
13
-
14
- # safari = false
15
- #
16
- # detect = ->
17
- # agent = navigator.userAgent
18
- # agentHas = (substring) -> agent.indexOf(substring) >= 1
19
- # safari = agentHas('Safari') && !agentHas('Chrome')
20
- #
21
- # transitionEndEvent = ->
22
- # if safari
23
- # 'webkitTransitionEnd'
24
- # else
25
- # 'transitionend'
26
- #
27
- # detect()
28
- #
29
- # transitionEndEvent: transitionEndEvent
30
-
14
+
31
15
  loadPage = (url, options = {}) ->
32
16
  method = u.option(options.method, 'get').toLowerCase()
33
17
  if method == 'get'
@@ -61,24 +45,14 @@ up.browser = (->
61
45
  window.console.group ||= noop
62
46
  window.console.groupCollapsed ||= noop
63
47
  window.console.groupEnd ||= noop
64
-
65
- memoize = (func) ->
66
- cache = undefined
67
- cached = false
68
- (args...) ->
69
- if cached
70
- cache
71
- else
72
- cached = true
73
- cache = func(args...)
74
-
75
- canPushState = memoize ->
48
+
49
+ canPushState = u.memoize ->
76
50
  u.isDefined(history.pushState)
77
51
 
78
- canCssAnimation = memoize ->
52
+ canCssAnimation = u.memoize ->
79
53
  'transition' of document.documentElement.style
80
54
 
81
- canInputEvent = memoize ->
55
+ canInputEvent = u.memoize ->
82
56
  'oninput' of document.createElement('input')
83
57
 
84
58
  ensureRecentJquery = ->
@@ -89,11 +63,11 @@ up.browser = (->
89
63
  compatible = major >= 2 || (major == 1 && minor >= 9)
90
64
  compatible or u.error("jQuery %o found, but Up.js requires 1.9+", version)
91
65
 
92
- isSupported = memoize ->
66
+ isSupported = u.memoize ->
93
67
  # This is the most concise way to exclude IE8 and lower
94
68
  # while keeping all relevant desktop and mobile browsers.
95
69
  u.isDefined(document.addEventListener)
96
-
70
+
97
71
  url: url
98
72
  ensureConsoleExists: ensureConsoleExists
99
73
  loadPage: loadPage
@@ -49,6 +49,16 @@ up.bus = (->
49
49
  callbacksByEvent = {}
50
50
  defaultCallbacksByEvent = {}
51
51
 
52
+ ###*
53
+ Resets the list of registered event listeners to the
54
+ moment when the framework was booted.
55
+
56
+ @private
57
+ @method up.bus.reset
58
+ ###
59
+ reset = ->
60
+ callbacksByEvent = u.copy(defaultCallbacksByEvent)
61
+
52
62
  callbacksFor = (event) ->
53
63
  callbacksByEvent[event] ||= []
54
64
 
@@ -63,16 +73,6 @@ up.bus = (->
63
73
  defaultCallbacksByEvent = {}
64
74
  for event, callbacks of callbacksByEvent
65
75
  defaultCallbacksByEvent[event] = u.copy(callbacks)
66
-
67
- ###*
68
- Resets the list of registered event listeners to the
69
- moment when the framework was booted.
70
-
71
- @private
72
- @method up.bus.reset
73
- ###
74
- reset = ->
75
- callbacksByEvent = u.copy(defaultCallbacksByEvent)
76
76
 
77
77
  ###*
78
78
  Registers an event handler to be called when the given
@@ -13,38 +13,29 @@ up.modal = (->
13
13
 
14
14
  u = up.util
15
15
 
16
- currentSource = undefined
17
-
18
- config =
19
- width: 'auto'
20
- height: 'auto'
21
- openAnimation: 'fade-in'
22
- closeAnimation: 'fade-out'
23
- closeLabel: 'X'
24
- template: (config) ->
25
- """
26
- <div class="up-modal">
27
- <div class="up-modal-dialog">
28
- <div class="up-modal-close" up-close>#{config.closeLabel}</div>
29
- <div class="up-modal-content"></div>
30
- </div>
31
- </div>
32
- """
33
-
34
16
  ###*
35
17
  Sets default options for future modals.
36
18
 
37
19
  @method up.modal.defaults
38
- @param {Number} [options.width='auto']
39
- The width of the dialog in pixels.
40
- Defaults to `'auto'`, meaning that the dialog will grow to fit its contents.
20
+ @param {Number} [options.width]
21
+ The width of the dialog as a CSS value like `'400px'` or `50%`.
22
+
23
+ Defaults to `undefined`, meaning that the dialog will grow to fit its contents
24
+ until it reaches `options.maxWidth`. Leaving this as `undefined` will
25
+ also allow you to control the width using CSS.
26
+ @param {Number} [options.maxWidth]
27
+ The width of the dialog as a CSS value like `'400px'` or `50%`.
28
+ You can set this to `undefined` to make the dialog fit its contents.
29
+ Be aware however, that e.g. Bootstrap stretches input elements
30
+ to `width: 100%`, meaning the dialog will also stretch to the full
31
+ width of the screen.
41
32
  @param {Number} [options.height='auto']
42
33
  The height of the dialog in pixels.
43
- Defaults to `'auto'`, meaning that the dialog will grow to fit its contents.
34
+ Defaults to `undefined`, meaning that the dialog will grow to fit its contents.
44
35
  @param {String|Function(config)} [options.template]
45
36
  A string containing the HTML structure of the modal.
46
37
  You can supply an alternative template string, but make sure that it
47
- contains tags with the classes `up-modal`, `up-modal-dialog` and `up-modal-content`.
38
+ defines tag with the classes `up-modal`, `up-modal-dialog` and `up-modal-content`.
48
39
 
49
40
  You can also supply a function that returns a HTML string.
50
41
  The function will be called with the modal options (merged from these defaults
@@ -58,9 +49,31 @@ up.modal = (->
58
49
  The animation used to close the modal. The animation will be applied
59
50
  to both the dialog box and the overlay dimming the page.
60
51
  ###
61
- defaults = (options) ->
62
- u.extend(config, options)
63
-
52
+ config = u.config
53
+ maxWidth: undefined
54
+ minWidth: undefined
55
+ width: undefined
56
+ height: undefined
57
+ openAnimation: 'fade-in'
58
+ closeAnimation: 'fade-out'
59
+ closeLabel: '×'
60
+ template: (config) ->
61
+ """
62
+ <div class="up-modal">
63
+ <div class="up-modal-dialog">
64
+ <div class="up-modal-close" up-close>#{config.closeLabel}</div>
65
+ <div class="up-modal-content"></div>
66
+ </div>
67
+ </div>
68
+ """
69
+
70
+ currentSource = undefined
71
+
72
+ reset = ->
73
+ close()
74
+ currentSource = undefined
75
+ config.reset()
76
+
64
77
  templateHtml = ->
65
78
  template = config.template
66
79
  if u.isFunction(template)
@@ -78,25 +91,44 @@ up.modal = (->
78
91
  $popup.removeAttr('up-previous-url')
79
92
  $popup.removeAttr('up-previous-title')
80
93
 
81
- createHiddenModal = (selector, width, height, sticky) ->
94
+ createHiddenModal = (options) ->
82
95
  $modal = $(templateHtml())
83
- $modal.attr('up-sticky', '') if sticky
96
+ $modal.attr('up-sticky', '') if options.sticky
84
97
  $modal.attr('up-previous-url', up.browser.url())
85
98
  $modal.attr('up-previous-title', document.title)
86
99
  $dialog = $modal.find('.up-modal-dialog')
87
- $dialog.css('width', width) if u.isPresent(width)
88
- $dialog.css('height', height) if u.isPresent(height)
89
- $content = $dialog.find('.up-modal-content')
90
- $placeholder = u.$createElementFromSelector(selector)
100
+ $dialog.css('width', options.width) if u.isPresent(options.width)
101
+ $dialog.css('max-width', options.maxWidth) if u.isPresent(options.maxWidth)
102
+ $dialog.css('height', options.height) if u.isPresent(options.height)
103
+ $content = $modal.find('.up-modal-content')
104
+ $placeholder = u.$createElementFromSelector(options.selector)
91
105
  $placeholder.appendTo($content)
92
106
  $modal.appendTo(document.body)
93
107
  rememberHistory()
94
108
  $modal.hide()
95
109
  $modal
96
110
 
111
+ unshiftBody = undefined
112
+
113
+ # Gives `<body>` a right padding in the width of a scrollbar.
114
+ # This is to prevent the body from jumping when we add the
115
+ # overlay, which has its own scroll bar.
116
+ shiftBody = ->
117
+ scrollbarWidth = u.scrollbarWidth()
118
+ bodyRightPadding = parseInt($('body').css('padding-right'))
119
+ bodyRightShift = scrollbarWidth + bodyRightPadding
120
+ unshiftBody = u.temporaryCss($('body'),
121
+ 'padding-right': "#{bodyRightShift}px",
122
+ 'overflow-y': 'hidden'
123
+ )
124
+
97
125
  updated = ($modal, animation, animateOptions) ->
126
+ up.bus.emit('modal:open')
127
+ shiftBody()
98
128
  $modal.show()
99
- up.animate($modal, animation, animateOptions)
129
+ promise = up.animate($modal, animation, animateOptions)
130
+ promise.then -> up.bus.emit('modal:opened')
131
+ promise
100
132
 
101
133
  ###*
102
134
  Opens the given link's destination in a modal overlay:
@@ -112,7 +144,14 @@ up.modal = (->
112
144
 
113
145
  This will request `/foo`, extract the `.list` selector from the response
114
146
  and open the selected container in a modal dialog.
115
-
147
+
148
+ \#\#\#\# Events
149
+
150
+ - Emits an [event](/up.bus) `modal:open` when the modal
151
+ is starting to open.
152
+ - Emits an [event](/up.bus) `modal:opened` when the opening
153
+ animation has finished and the modal contents are fully visible.
154
+
116
155
  @method up.modal.open
117
156
  @param {Element|jQuery|String} [elementOrSelector]
118
157
  The link to follow.
@@ -156,6 +195,7 @@ up.modal = (->
156
195
  url = u.option(options.url, $link.attr('up-href'), $link.attr('href'))
157
196
  selector = u.option(options.target, $link.attr('up-modal'), 'body')
158
197
  width = u.option(options.width, $link.attr('up-width'), config.width)
198
+ maxWidth = u.option(options.maxWidth, $link.attr('up-max-width'), config.maxWidth)
159
199
  height = u.option(options.height, $link.attr('up-height'), config.height)
160
200
  animation = u.option(options.animation, $link.attr('up-animation'), config.openAnimation)
161
201
  sticky = u.option(options.sticky, $link.is('[up-sticky]'))
@@ -163,7 +203,12 @@ up.modal = (->
163
203
  animateOptions = up.motion.animateOptions(options, $link)
164
204
 
165
205
  close()
166
- $modal = createHiddenModal(selector, width, height, sticky)
206
+ $modal = createHiddenModal
207
+ selector: selector
208
+ width: width
209
+ maxWidth: maxWidth
210
+ height: height
211
+ sticky: sticky
167
212
 
168
213
  up.replace(selector, url,
169
214
  history: history
@@ -184,6 +229,13 @@ up.modal = (->
184
229
  ###*
185
230
  Closes a currently opened modal overlay.
186
231
  Does nothing if no modal is currently open.
232
+
233
+ \#\#\#\# Events
234
+
235
+ - Emits an [event](/up.bus) `modal:close` when the modal
236
+ is starting to close.
237
+ - Emits an [event](/up.bus) `modal:closed` when the closing
238
+ animation has finished and the modal has been removed from the DOM.
187
239
 
188
240
  @method up.modal.close
189
241
  @param {Object} options
@@ -198,7 +250,14 @@ up.modal = (->
198
250
  title: $modal.attr('up-previous-title')
199
251
  )
200
252
  currentSource = undefined
201
- up.destroy($modal, options)
253
+ up.bus.emit('modal:close')
254
+ promise = up.destroy($modal, options)
255
+ promise.then ->
256
+ unshiftBody()
257
+ up.bus.emit('modal:closed')
258
+ promise
259
+ else
260
+ u.resolvedPromise()
202
261
 
203
262
  autoclose = ->
204
263
  unless $('.up-modal').is('[up-sticky]')
@@ -320,14 +379,13 @@ up.modal = (->
320
379
  close()
321
380
  )
322
381
 
323
- # The framework is reset between tests, so also close
324
- # a currently open modal dialog.
325
- up.bus.on 'framework:reset', close
382
+ # The framework is reset between tests
383
+ up.bus.on 'framework:reset', reset
326
384
 
327
385
  open: open
328
386
  close: close
329
387
  source: source
330
- defaults: defaults
388
+ defaults: config.update
331
389
  contains: contains
332
390
 
333
391
  )()
@@ -34,20 +34,24 @@ up.motion = (->
34
34
  transitions = {}
35
35
  defaultTransitions = {}
36
36
 
37
- config =
38
- duration: 300
39
- delay: 0
40
- easing: 'ease'
41
-
42
37
  ###*
38
+ Sets default options for animations and transitions.
39
+
43
40
  @method up.motion.defaults
44
41
  @param {Number} [options.duration=300]
45
42
  @param {Number} [options.delay=0]
46
43
  @param {String} [options.easing='ease']
47
44
  ###
48
- defaults = (options) ->
49
- u.extend(config, options)
50
-
45
+ config = u.config
46
+ duration: 300
47
+ delay: 0
48
+ easing: 'ease'
49
+
50
+ reset = ->
51
+ animations = u.copy(defaultAnimations)
52
+ transitions = u.copy(defaultTransitions)
53
+ config.reset()
54
+
51
55
  ###*
52
56
  Applies the given animation to the given element:
53
57
 
@@ -348,10 +352,6 @@ up.motion = (->
348
352
  defaultAnimations = u.copy(animations)
349
353
  defaultTransitions = u.copy(transitions)
350
354
 
351
- reset = ->
352
- animations = u.copy(defaultAnimations)
353
- transitions = u.copy(defaultTransitions)
354
-
355
355
  ###*
356
356
  Returns a new promise that resolves once all promises in arguments resolve.
357
357
 
@@ -497,7 +497,7 @@ up.motion = (->
497
497
  finish: finish
498
498
  transition: transition
499
499
  animation: animation
500
- defaults: defaults
500
+ defaults: config.update
501
501
  none: none
502
502
  when: resolvableWhen
503
503