upjs-rails 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
data/dist/up.min.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(){window.up={}}).call(this),function(){var t=[].slice;up.util=function(){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,C,x,T,S,E,A,P,D,U,F,j,z,M,O,H,I,N,q,W,G,L,X,R,V,B,J,_,K,Q,Z,Y,tn,nn,en,rn,on,un,an,sn,ln,cn,pn,fn,dn,mn,hn,vn,gn;return T=function(t,n){return n=n||{},n.url=t,o(n)},o=function(t){return t.selector&&(t.headers={"X-Up-Selector":t.selector}),$.ajax(t)},q=function(t,n){return(""===n||"80"===n)&&"http:"===t||"443"===n&&"https:"===t},Y=function(t,n){var e,r,o;return e=W(t)?$("<a>").attr({href:t}).get(0):gn(t),r=e.protocol+"//"+e.hostname,q(e.protocol,e.port)||(r+=":"+e.port),o=e.pathname,(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},Z=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},p=function(t,n){var e;return e=document.createElement(t),I(n)&&(e.innerHTML=n),e},h=function(){var n,e,o,u,i,a;if(n=1<=arguments.length?t.call(arguments,0):[],n=hn(n),o=n.shift(),o="[UP] "+o,u=(null!=(i=o.match(r))?i.length:void 0)||0,U(V(n))&&u<n.length&&(e=n.pop()),a=console.debug.apply(console,[o].concat(t.call(n))),e){console.groupCollapsed();try{a=e()}finally{console.groupEnd()}}return a},y=function(){var n,e,r;throw e=1<=arguments.length?t.call(arguments,0):[],e[0]="[UP] "+e[0],console.error.apply(console,e),r=dn(e),n=on($(".up-error"))||$('<div class="up-error"></div>').prependTo("body"),n.addClass("up-error"),n.text(r),r},r=/\%[odisf]/g,dn=function(t){var n,e,o;return o=t[0],n=0,e=30,o.replace(r,function(){var r,o;return n+=1,r=t[n],o=typeof r,"string"===o?(r=r.replace(/\s+/g," "),r.length>e&&(r=r.substr(0,e)+"\u2026"),'"'+r+'"'):"number"===o?r.toString():"("+o+")"})},d=function(t){var n,e,r,o,u,i,a;for(h("Creating selector from element %o",t),e=(n=t.attr("class"))?n.split(" "):[],r=t.attr("id"),a=t.prop("tagName").toLowerCase(),r&&(a+="#"+r),o=0,i=e.length;i>o;o++)u=e[o],a+="."+u;return a},f=function(t){var n,e,r,o,u,i,a,s,l,c,f,d;return l=function(t){return"<"+t+"(?: [^>]*)?>"},i=function(t){return"</"+t+">"},n="(?:.|\\n)*?",u=function(t){return"("+t+")"},d=new RegExp(l("head")+n+l("title")+u(n)+i("title")+n+i("body"),"i"),o=new RegExp(l("body")+u(n)+i("body"),"i"),(r=t.match(o))?(s=document.createElement("html"),e=p("body",r[1]),s.appendChild(e),(f=t.match(d))&&(a=p("head"),s.appendChild(a),c=p("title",f[1]),a.appendChild(c)),s):p("div",t)},w=$.extend,vn=$.trim,R=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},g=function(t,n){var e,r,o,u,i;for(i=[],e=o=0,u=t.length;u>o;e=++o)r=t[e],i.push(n(r,e));return i},O=function(t){return null===t},G=function(t){return void 0===t},D=function(t){return!G(t)},M=function(t){return G(t)||O(t)},F=function(t){return!M(t)},A=function(t){return M(t)||H(t)&&0===R(t).length||0===t.length},on=function(t,n){return null==n&&(n=I),n(t)?t:null},I=function(t){return!A(t)},U=function(t){return"function"==typeof t},W=function(t){return"string"==typeof t},j=function(t){return"object"==typeof t&&!!t},H=function(t){return j(t)||"function"==typeof t},z=function(t){return t instanceof jQuery},N=function(t){return H(t)&&U(t.then)},P=function(t){return N(t)&&U(t.resolve)},S=function(t){return F(t)?t:void 0},E=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},hn=function(t){return Array.prototype.slice.call(t)},l=function(t){return E(t)?t.slice():w({},t)},gn=function(t){return z(t)?t.get(0):t},_=function(t,n){return w(l(t),n)},en=function(t,n){var e,r,o,u;if(o=t?l(t):{},n)for(r in n)e=n[r],u=o[r],F(u)?H(e)&&H(u)&&(o[r]=en(u,e)):o[r]=e;return o},nn=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,U(i)&&(i=i()),I(i)){u=i;break}return u},v=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},cn=function(t,n){var e;return e=[],g(t,function(t){return n(t)?e.push(t):void 0}),e},un=function(){var n,e,r,o;return n=arguments[0],r=2<=arguments.length?t.call(arguments,1):[],o=function(){var t,o,u;for(u=[],t=0,o=r.length;o>t;t++)e=r[t],u.push(n.attr(e));return u}(),v(o,I)},Q=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}},mn=function(t,n,e){var r,o;return o=t.css(R(n)),t.css(n),r=function(){return t.css(o)},e?(e(),r()):r},x=function(t){var n,e;return e=t.css(["transform","-webkit-transform"]),A(e)?(n=function(){return t.css(e)},t.css({transform:"translateZ(0)","-webkit-transform":"translateZ(0)"})):n=function(){},n},m=function(t,n,r){var o,u,i,a,s,l;return o=$(t),up.browser.canCssAnimation()?(r=en(r,{duration:300,delay:0,easing:"ease"}),u=$.Deferred(),a={"transition-property":R(n).join(", "),"transition-duration":r.duration+"ms","transition-delay":r.delay+"ms","transition-timing-function":r.easing},s=x(o),l=mn(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),ln())},e="up-animation-promise",C=function(t){return $(t).each(function(){var t;return(t=$(this).data(e))?t.resolve():void 0})},J=function(t,n){var e,r,o;return r=(null!=n?n.relative:void 0)?t.position():t.offset(),e={left:r.left,top:r.top},(null!=n?n.inner:void 0)?(e.width=t.width(),e.height=t.height()):(e.width=t.outerWidth(),e.height=t.outerHeight()),(null!=n?n.full:void 0)&&(o=a(),e.right=o.width-(e.left+e.width),e.bottom=o.height-(e.top+e.height)),e},c=function(t,n){var e,r,o,u,i;for(u=t.get(0).attributes,i=[],r=0,o=u.length;o>r;r++)e=u[r],i.push(e.specified?n.attr(e.name,e.value):void 0);return i},rn=function(t){var n,e;return e=J(t,{relative:!0,inner:!0}),n=t.clone(),n.find("script").remove(),n.css({right:"",bottom:"",position:"absolute"}),n.css(e),n.addClass("up-ghost"),n.insertBefore(t)},k=function(t,n){return t.find(n).addBack(n)},b=function(t){return 27===t.keyCode},s=function(t,n){return t.indexOf(n)>=0},i=function(t){return"true"===String(t)},u=function(t){return"false"===String(t)},B=function(t){return t.getResponseHeader("X-Up-Location")},K=function(t){return t.getResponseHeader("X-Up-Method")},tn=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},L=function(t){return!(t.metaKey||t.shiftKey||t.ctrlKey)},X=function(t){return 0===t.button&&L(t)},sn=function(){var t;return t=$.Deferred(),t.resolve(),t},ln=function(){return sn().promise()},an=function(){var n,e;return n=1<=arguments.length?t.call(arguments,0):[],e=$.when.apply($,n),e.resolve=function(){return g(n,function(t){return"function"==typeof t.resolve?t.resolve():void 0})},e},pn=function(t,n){var e,r,o;r=[];for(e in n)o=n[e],r.push(M(t.attr(e))?t.attr(e,o):void 0);return r},fn=function(t){var n,e,r,o,u,i,a,s;for(a={},n=function(t){return a[o(t)]},e=function(t){return v(t,n)},i=function(t){return a[o(t)]=!0},o=function(t){return"_"+t},r=0,u=t.length;u>r;r++)s=t[r],i(s);return{put:i,includes:n,includesAny:e}},{presentAttr:un,createElement:p,normalizeUrl:Y,normalizeMethod:Z,createElementFromHtml:f,$createElementFromSelector:n,createSelectorFromElement:d,get:T,ajax:o,extend:w,copy:l,merge:_,options:en,option:nn,error:y,debug:h,each:g,detect:v,select:cn,last:V,isNull:O,isDefined:D,isUndefined:G,isGiven:F,isMissing:M,isPresent:I,isBlank:A,presence:on,isObject:H,isFunction:U,isString:W,isJQuery:z,isPromise:N,isDeferred:P,isHash:j,ifGiven:S,isUnmodifiedKeyEvent:L,isUnmodifiedMouseEvent:X,unwrap:gn,nextFrame:Q,measure:J,temporaryCss:mn,cssAnimate:m,finishCssAnimate:C,forceCompositing:x,prependGhost:rn,escapePressed:b,copyAttributes:c,findWithSelf:k,contains:s,isArray:E,toArray:hn,castsToTrue:i,castsToFalse:u,locationFromXhr:B,methodFromXhr:K,clientSize:a,only:tn,trim:vn,keys:R,resolvedPromise:ln,resolvedDeferred:sn,resolvableWhen:an,setMissingAttrs:pn,stringSet:fn}}()}.call(this),function(){var t=[].slice;up.browser=function(){var n,e,r,o,u,i,a,s,l,c;return l=up.util,a=function(t,n){var e,r,o,u,i,a;return null==n&&(n={}),i=l.option(n.method,"get").toLowerCase(),"get"===i?location.href=t:$.rails?(a=n.target,o=$.rails.csrfToken(),r=$.rails.csrfParam(),e=$("<form method='post' action='"+t+"'></form>"),u="<input name='_method' value='"+i+"' type='hidden' />",l.isDefined(r)&&l.isDefined(o)&&(u+="<input name='"+r+"' value='"+o+"' type='hidden' />"),a&&e.attr("target",a),e.hide().append(u).appendTo("body"),e.submit()):error("Can't fake a "+i.toUpperCase()+" request without Rails UJS")},c=function(){return location.href},o=function(){var t,n,e,r,o,u,i,a;return window.console||(window.console={}),a=function(){},(t=window.console).log||(t.log=a),(n=window.console).info||(n.info=a),(e=window.console).error||(e.error=a),(r=window.console).debug||(r.debug=a),(o=window.console).group||(o.group=a),(u=window.console).groupCollapsed||(u.groupCollapsed=a),(i=window.console).groupEnd||(i.groupEnd=a)},s=function(n){var e,r;return e=void 0,r=!1,function(){var o;return o=1<=arguments.length?t.call(arguments,0):[],r?e:(r=!0,e=n.apply(null,o))}},r=s(function(){return l.isDefined(history.pushState)}),n=s(function(){return"transition"in document.documentElement.style}),e=s(function(){return"oninput"in document.createElement("input")}),u=function(){var t,n,e,r,o;return o=$.fn.jquery,r=o.split("."),n=parseInt(r[0]),e=parseInt(r[1]),t=n>=2||1===n&&e>=9,t||l.error("jQuery %o found, but Up.js requires 1.9+",o)},i=s(function(){return l.isDefined(document.addEventListener)}),{url:c,ensureConsoleExists:o,loadPage:a,canPushState:r,canCssAnimation:n,canInputEvent:e,isSupported:i,ensureRecentJquery:u}}()}.call(this),function(){var t=[].slice;up.bus=function(){var n,e,r,o,u,i,a,s;return s=up.util,n={},r={},e=function(t){return n[t]||(n[t]=[])},a=function(){var t,e,o;r={},o=[];for(e in n)t=n[e],o.push(r[e]=s.copy(t));return o},i=function(){return n=s.copy(r)},u=function(t,n){return e(t).push(n)},o=function(){var n,r,o;return o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],s.debug("Emitting event %o with args %o",o,n),r=e(o),s.each(r,function(t){return t.apply(null,n)})},u("framework:ready",a),u("framework:reset",i),{on:u,emit:o}}()}.call(this),function(){up.viewport=function(){var t,n,e,r,o,u,i;return i=up.util,n={duration:0,view:"body",easing:"swing"},e=function(t){return i.extend(n,t)},t="up-scroll-promise",u=function(e,o,u){var a,s,l,c,p;return a=$(e),u=i.options(u),l=i.option(u.duration,n.duration),c=i.option(u.easing,n.easing),r(a),l>0?(s=$.Deferred(),a.data(t,s),s.then(function(){return a.removeData(t),a.finish()}),p={scrollTop:o},a.animate(p,{duration:l,easing:c,complete:function(){return s.resolve()}}),s):(a.scrollTop(o),i.resolvedDeferred())},r=function(n){return $(n).each(function(){var n;return(n=$(this).data(t))?n.resolve():void 0})},o=function(t,e){var r,o,a,s,l,c,p,f,d,m,h;return e=i.options(e),m=i.option(e.view,n.view),f=i.option(e.padding,n.padding),r=$(t),o=$(m),h=o.height(),d=o.scrollTop(),c=d,p=d+h,l=r.position().top,a=c>l-f,s=l>p-f,a||s?(d=l-f,d=Math.max(d,0),d=Math.min(d,h-1),u(o,d,e)):i.resolvedDeferred()},{reveal:o,scroll:u,finishScrolling:r,defaults:e}}(),up.scroll=up.viewport.scroll,up.reveal=up.viewport.reveal}.call(this),function(){up.flow=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h;return h=up.util,f=function(t,n){var e;return e=$(t),h.isPresent(n)&&(n=h.normalizeUrl(n)),e.attr("up-source",n)},d=function(t){var n;return n=$(t).closest("[up-source]"),h.presence(n.attr("up-source"))||up.browser.url()},l=function(t,n,e){var r,u,i;return e=h.options(e),i=h.presence(t)?t:h.createSelectorFromElement($(t)),up.browser.canPushState()||h.castsToFalse(e.history)?(u={url:n,method:e.method,selector:i},r=up.proxy.ajax(u),r.done(function(t,r,a){var s,l;return(s=h.locationFromXhr(a))&&(h.debug("Location from server: %o",s),l={url:s,method:h.methodFromXhr(a),selector:i},up.proxy.alias(u,l),n=s),(h.isMissing(e.history)||h.castsToTrue(e.history))&&(e.history=n),(h.isMissing(e.source)||h.castsToTrue(e.source))&&(e.source=n),e.preload?void 0:o(i,t,e)}),r.fail(h.error),r):void(e.preload||up.browser.loadPage(n,h.only(e,"method")))},o=function(t,n,e){var o,s,l,c,p,f,d,v;for(e=h.options(e,{historyMethod:"push"}),h.castsToFalse(e.history)&&(e.history=null),h.castsToFalse(e.scroll)&&(e.scroll=null),e.source=h.option(e.source,e.history),f=i(n),e.title||(e.title=f.title()),p=u(t,e),d=[],l=0,c=p.length;c>l;l++)v=p[l],s=r(v.selector),o=f.find(v.selector),d.push(a(s,e).then(function(){return m(s,o,v.pseudoClass,v.transition,e)}));return d},r=function(t){return h.presence($(".up-popup "+t))||h.presence($(".up-modal "+t))||h.presence($(t))||h.error("Could not find selector %o in current body HTML",t)},i=function(t){var n;return n=h.createElementFromHtml(t),{title:function(){var t;return null!=(t=n.querySelector("title"))?t.textContent:void 0},find:function(e){var r;return(r=n.querySelector(e))?$(r):h.error("Could not find selector %o in response %o",e,t)}}},a=function(t,n){return up.motion.finish(t),p(t,n.scroll)},p=function(t,n){return n?up.reveal(t,{view:n}):h.resolvedDeferred()},e=function(n,e){return"function"==typeof e.insert&&e.insert(n),e.history&&(e.title&&(document.title=e.title),up.history[e.historyMethod](e.history)),f(n,e.source),t(n),up.ready(n)},m=function(t,r,o,u,i){var a,s;return u||(u="none"),o?(s="before"===o?"prepend":"append",a=r.children(),t[s](r.contents()),h.copyAttributes(r,t),e(a,i),up.animate(r,u)):n(t,{animation:function(){return r.insertBefore(t),e(r,i),t.is("body")&&"none"!==u&&h.error("Cannot apply transitions to body-elements (%o)",u),up.morph(t,r,u)}})},u=function(t,n){var e,r,o,u,i,a,s,l,c,p,f;for(p=n.transition||n.animation||"none",e=/\ *,\ */,r=t.split(e),h.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]||h.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=h.findWithSelf(t,e),n.length&&n.get(0)!==document.activeElement?n.focus():void 0},n=function(t,n){var e,r;return e=$(t),n=h.options(n,{animation:"none"}),e.addClass("up-destroying"),h.isPresent(n.url)&&up.history.push(n.url),h.isPresent(n.title)&&(document.title=n.title),up.bus.emit("fragment:destroy",e),r=h.presence(n.animation,h.isPromise)||up.motion.animate(e,n.animation),r.then(function(){return e.remove()})},s=function(t){var n;return n=d(t),l(t,n)},c=function(){return up.bus.emit("framework:reset")},up.bus.on("app:ready",function(){return f(document.body,up.browser.url())}),{replace:l,reload:s,destroy:n,implant:o,reset:c}}(),up.replace=up.flow.replace,up.reload=up.flow.reload,up.destroy=up.flow.destroy,up.reset=up.flow.reset}.call(this),function(){var t=[].slice;up.magic=function(){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g;return g=up.util,n="up-destroyable",e="up-destroyer",f=[],l=null,p=function(t,n,e){var r,o;if(up.browser.isSupported())return r=[t,n,function(t){return e.apply(this,[t,$(this),a(this)])}],f.push(r),(o=$(document)).on.apply(o,r)},u=[],s=null,o=function(){var n,e,r,o;return o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],up.browser.isSupported()?(e=n.pop(),r=g.options(n[0],{batch:!1}),u.push({selector:o,callback:e,batch:r.batch})):void 0},r=function(t,r,o){var u;return g.debug("Applying awakener %o on %o",t.selector,o),u=t.callback.apply(o,[r,a(r)]),g.isFunction(u)?(r.addClass(n),r.data(e,u)):void 0},i=function(t){var n,e,o,i,a;for(g.debug("Compiling fragment %o",t),a=[],o=0,i=u.length;i>o;o++)e=u[o],n=g.findWithSelf(t,e.selector),a.push(n.length?e.batch?r(e,n,n.get()):n.each(function(){return r(e,$(this),this)}):void 0);return a},c=function(t){return g.findWithSelf(t,"."+n).each(function(){var t,n;return t=$(this),(n=t.data(e))()})},a=function(t){var n,e;return n=$(t),e=n.attr("up-data"),g.isString(e)&&""!==g.trim(e)?JSON.parse(e):{}},v=function(){return l=g.copy(f),s=g.copy(u)},h=function(){var t,n,e,r;for(n=0,e=f.length;e>n;n++)t=f[n],g.contains(l,t)||(r=$(document)).off.apply(r,t);return f=g.copy(l),u=g.copy(s)},m=function(t){var n;return n=$(t),up.bus.emit("fragment:ready",n),n},d=function(t){return p("keydown","body",function(n){return g.escapePressed(n)?t(n):void 0})},up.bus.on("app:ready",function(){return m(document.body)}),up.bus.on("fragment:ready",i),up.bus.on("fragment:destroy",c),up.bus.on("framework:ready",v),up.bus.on("framework:reset",h),{awaken:o,on:p,ready:m,onEscape:d,data:a}}(),up.awaken=up.magic.awaken,up.on=up.magic.on,up.ready=up.magic.ready}.call(this),function(){up.history=function(){var t,n,e,r,o,u;return u=up.util,t=function(t){return u.normalizeUrl(t,{hash:!0})===u.normalizeUrl(up.browser.url(),{hash:!0})},o=function(e,r){return r=u.options(r,{force:!1}),r.force||!t(e)?n("replace",e):void 0},r=function(e){return t(e)?void 0:n("push",e)},n=function(t,n){return up.browser.canPushState()?(t+="State",window.history[t]({fromUp:!0},"",n)):u.error("This browser doesn't support history.pushState")},e=function(t){var n;return n=t.originalEvent.state,(null!=n?n.fromUp:void 0)?(u.debug("Restoring state %o (now on "+up.browser.url()+")",n),up.visit(up.browser.url(),{historyMethod:"replace"})):u.debug("Discarding unknown state %o",n)},up.browser.canPushState()&&setTimeout(function(){return $(window).on("popstate",e),o(up.browser.url(),{force:!0})},200),{push:r,replace:o}}()}.call(this),function(){up.motion=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w;return b=up.util,r={},i={},y={},a={},u={duration:300,delay:0,easing:"ease"},s=function(t){return b.extend(u,t)},n=function(t,e,r){var i;return i=$(t),c(i),r=b.options(r,u),b.isFunction(e)?o(e(i,r),e):b.isString(e)?n(i,l(e),r):b.isHash(e)?b.cssAnimate(i,e,r):b.error("Unknown animation type %o",e)},l=function(t){return r[t]||b.error("Unknown animation %o",e)},t="up-ghosting-promise",w=function(n,e,r){var o,u,i,a;return u=null,o=null,b.temporaryCss(e,{display:"none"},function(){return u=b.prependGhost(n).addClass("up-destroying")}),b.temporaryCss(n,{display:"none"},function(){return o=b.prependGhost(e)}),n.css({visibility:"hidden"}),i=b.temporaryCss(e,{display:"none"}),a=r(u,o),n.data(t,a),e.data(t,a),a.then(function(){return n.removeData(t),e.removeData(t),u.remove(),o.remove(),n.css({display:"none"}),i()}),a},c=function(t){return $(t).each(function(){var t;return t=$(this),b.finishCssAnimate(t),p(t)})},p=function(n){var e;return(e=n.data(t))?(b.debug("Canceling existing ghosting on %o",n),"function"==typeof e.resolve?e.resolve():void 0):void 0},o=function(t,n){return b.isDeferred(t)?t:b.error("Did not return a promise with .then and .resolve methods: %o",n)},f=function(t,e,i,a){var s,l,p,m,v;return up.browser.canCssAnimation()?(a=b.options(u),l=$(t),s=$(e),c(l),c(s),"none"===i?d():(v=b.presence(i,b.isFunction)||y[i])?w(l,s,function(t,n){return o(v(t,n,a),i)}):(p=r[i])?(l.hide(),n(s,p,a)):b.isString(i)&&i.indexOf("/")>=0?(m=i.split("/"),v=function(t,e,r){return h(n(t,m[0],r),n(e,m[1],r))},f(l,s,v,a)):b.error("Unknown transition %o",i)):b.resolvedDeferred()},g=function(t,n){return y[t]=n},e=function(t,n){return r[t]=n},v=function(){return i=b.copy(r),a=b.copy(y)},m=function(){return r=b.copy(i),y=b.copy(a)},h=b.resolvableWhen,d=b.resolvedDeferred,e("none",d),e("fade-in",function(t,e){return t.css({opacity:0}),n(t,{opacity:1},e)}),e("fade-out",function(t,e){return t.css({opacity:1}),n(t,{opacity:0},e)}),e("move-to-top",function(t,e){var r,o;return r=b.measure(t),o=r.top+r.height,t.css({"margin-top":"0px"}),n(t,{"margin-top":"-"+o+"px"},e)}),e("move-from-top",function(t,e){var r,o;return r=b.measure(t),o=r.top+r.height,t.css({"margin-top":"-"+o+"px"}),n(t,{"margin-top":"0px"},e)}),e("move-to-bottom",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().height-r.top,t.css({"margin-top":"0px"}),n(t,{"margin-top":o+"px"},e)}),e("move-from-bottom",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().height-r.top,t.css({"margin-top":o+"px"}),n(t,{"margin-top":"0px"},e)}),e("move-to-left",function(t,e){var r,o;return r=b.measure(t),o=r.left+r.width,t.css({"margin-left":"0px"}),n(t,{"margin-left":"-"+o+"px"},e)}),e("move-from-left",function(t,e){var r,o;return r=b.measure(t),o=r.left+r.width,t.css({"margin-left":"-"+o+"px"}),n(t,{"margin-left":"0px"},e)}),e("move-to-right",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().width-r.left,t.css({"margin-left":"0px"}),n(t,{"margin-left":o+"px"},e)}),e("move-from-right",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().width-r.left,t.css({"margin-left":o+"px"}),n(t,{"margin-left":"0px"},e)}),e("roll-down",function(t,e){var r,o;return r=t.height(),o=b.temporaryCss(t,{height:"0px",overflow:"hidden"}),n(t,{height:r+"px"},e).then(o)}),g("none",d),g("move-left",function(t,e,r){return h(n(t,"move-to-left",r),n(e,"move-from-right",r))}),g("move-right",function(t,e,r){return h(n(t,"move-to-right",r),n(e,"move-from-left",r))}),g("move-up",function(t,e,r){return h(n(t,"move-to-top",r),n(e,"move-from-bottom",r))}),g("move-down",function(t,e,r){return h(n(t,"move-to-bottom",r),n(e,"move-from-top",r))}),g("cross-fade",function(t,e,r){return h(n(t,"fade-out",r),n(e,"fade-in",r))}),up.bus.on("framework:ready",v),up.bus.on("framework:reset",m),{morph:f,animate:n,finish:c,transition:g,animation:e,defaults:s,none:d,when:h}}(),up.transition=up.motion.transition,up.animation=up.motion.animation,up.morph=up.motion.morph,up.animate=up.motion.animate}.call(this),function(){up.proxy=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,$,C,x,T;return l={preloadDelay:75,cacheSize:70,cacheExpiry:3e5},c=function(t){return T.extend(l,t)},o={},T=up.util,t=null,p=null,u=function(t){return v(t),[t.url,t.method,t.selector].join("|")},x=function(){var t,n,e;return t=T.keys(o),t.length>l.cacheSize&&(n=null,e=null,T.each(t,function(t){var r,u;return r=o[t],u=r.timestamp,!e||e>u?(n=t,e=u):void 0}),n)?delete o[n]:void 0},$=function(){return(new Date).valueOf()},v=function(t){return!T.isHash(t),t._requestNormalized||(t.method=T.normalizeMethod(t.method),t.url&&(t.url=T.normalizeUrl(t.url)),t.selector||(t.selector="body"),t._requestNormalized=!0),t},r=function(t,n){var e;return T.debug("Aliasing %o to %o",t,n),(e=d(t))?w(n,e):void 0},e=function(t){var n;return h(t)?(n=d(t))?C(n):(n=T.ajax(t),w(t,n)):(s(),n=T.ajax(t)),n},n=["GET","OPTIONS","HEAD"],h=function(t){return v(t),T.contains(n,t.method)},f=function(t){return h(t)||T.error("Won't preload non-GET request %o",t)},m=function(t){var n;return n=$()-t.timestamp,n<l.cacheExpiry},C=function(t){return t.timestamp=$()},d=function(t){var n,e;return n=u(t),(e=o[n])?m(e)?(T.debug("Cache hit for %o (%o)",t.url,t),e):(T.debug("Discarding stale cache entry for %o (%o)",t.url,t),void y(t)):void T.debug("Cache miss for %o (%o)",t.url,t)},w=function(t,n){var e;return x(),e=u(t),o[e]=n,C(n),n},y=function(t){var n;return n=u(t),delete o[n]},s=function(){return o={}},a=function(n){var e,r;return r=parseInt(T.presentAttr(n,"up-delay"))||l.preloadDelay,n.is(t)?void 0:(t=n,i(),e=function(){return g(n)},k(e,r))},k=function(t,n){return p=setTimeout(t,n)},i=function(){return clearTimeout(p),p=null},g=function(t,n){return n=T.options(),f(n),T.debug("Preloading %o",t),n.preload=!0,up.link.follow(t,n)},b=function(){return i(),o={}},up.bus.on("framework:reset",b),up.on("mouseover mousedown touchstart","[up-preload]",function(t,n){return up.link.childClicked(t,n)?void 0:a(up.link.resolve(n))}),{preload:g,ajax:e,get:d,set:w,alias:r,clear:s,defaults:c}}()}.call(this),function(){up.link=function(){var t,n,e,r,o,u;return o=up.util,u=function(t,n){return o.debug("Visiting "+t),up.replace("body",t,n)},e=function(t,n){var e,r,u;return e=$(t),n=o.options(n),u=o.option(e.attr("href"),e.attr("up-follow")),r=o.option(n.target,e.attr("up-target"),"body"),n.transition=o.option(n.transition,e.attr("up-transition"),e.attr("up-animation")),n.history=o.option(n.history,e.attr("up-history")),n.scroll=o.option(n.history,e.attr("up-scroll"),"body"),up.replace(r,u,n)},r=function(t){var n,e;return n=$(t),e=n.attr("up-follow"),n.is("a")||o.isPresent(e)&&!o.castsToTrue(e)?n:n.find("a:first")},up.on("click","a[up-target]",function(t,n){return t.preventDefault(),n.is("[up-instant]")?void 0:e(n)}),up.on("mousedown","a[up-target][up-instant]",function(n,e){return t(n,e)?(n.preventDefault(),up.follow(e)):void 0}),n=function(t,n){var e,r;return e=$(t.target),r=e.closest("a, [up-follow]"),r.length&&n.find(r).length},t=function(t,e){return o.isUnmodifiedMouseEvent(t)&&!n(t,e)},up.on("click","[up-follow]",function(t,o){return n(t,o)||(t.preventDefault(),o.is("[up-instant]"))?void 0:e(r(o))}),up.on("mousedown","[up-follow][up-instant]",function(n,e){return t(n,e)?(n.preventDefault(),up.follow(r(e))):void 0}),up.awaken("[up-dash]",function(t){var n,e;return e=t.attr("up-dash"),n={"up-preload":"true","up-instant":"true"},o.isBlank(e)||o.castsToTrue(e)?n["up-follow"]="":n["up-target"]=e,o.setMissingAttrs(t,n),t.removeAttr("up-dash")}),{visit:u,follow:e,resolve:r,childClicked:n}}(),up.visit=up.link.visit,up.follow=up.link.follow}.call(this),function(){up.form=function(){var observe,submit,u;return u=up.util,submit=function(t,n){var e,r,o,i,a,s,l,c,p,f;return e=$(t).closest("form"),n=u.options(n),l=u.option(n.target,e.attr("up-target"),"body"),r=u.option(n.failTarget,e.attr("up-fail-target"),function(){return u.createSelectorFromElement(e)}),i=u.option(n.history,e.attr("up-history"),!0),c=u.option(n.transition,e.attr("up-transition")),o=u.option(n.failTransition,e.attr("up-fail-transition")),a=u.option(n.method,e.attr("up-method"),e.attr("data-method"),e.attr("method"),"post").toUpperCase(),f=u.option(n.url,e.attr("action"),up.browser.url()),e.addClass("up-active"),up.browser.canPushState()||u.castsToFalse(i)?(s={url:f,type:a,data:e.serialize(),selector:l},p=function(t){var n;return f=i?u.castsToFalse(i)?!1:u.isString(i)?i:(n=u.locationFromXhr(t))?n:"GET"===s.type?s.url+"?"+s.data:void 0:void 0,u.option(f,!1)},u.ajax(s).always(function(){return e.removeClass("up-active")}).done(function(t,n,e){return up.flow.implant(l,t,{history:p(e),transition:c})}).fail(function(t){var n;return n=t.responseText,up.flow.implant(r,n,{transition:o})})):void e.get(0).submit()},observe=function(fieldOrSelector,options){var $field,callback,callbackPromise,callbackTimer,changeEvents,check,clearTimer,codeOnChange,delay,knownValue,nextCallback,runNextCallback;return $field=$(fieldOrSelector),options=u.options(options),delay=u.option($field.attr("up-delay"),options.delay,0),delay=parseInt(delay),knownValue=null,callback=null,callbackTimer=null,(codeOnChange=$field.attr("up-observe"))?callback=function(value,$field){return eval(codeOnChange)}:options.change?callback=options.change:u.error("up.observe: No change callback given"),callbackPromise=u.resolvedPromise(),nextCallback=null,runNextCallback=function(){var t;return nextCallback?(t=nextCallback(),nextCallback=null,t):void 0},check=function(){var t,n;return n=$field.val(),t=u.isNull(knownValue),knownValue===n||(knownValue=n,t)?void 0:(clearTimer(),nextCallback=function(){return callback.apply($field.get(0),[n,$field])},callbackTimer=setTimeout(function(){return callbackPromise.then(function(){var t;return t=runNextCallback(),callbackPromise=u.isPromise(t)?t:u.resolvedPromise()})},delay))},clearTimer=function(){return clearTimeout(callbackTimer)},changeEvents=up.browser.canInputEvent()?"input change":"input change keypress paste cut click propertychange",$field.on(changeEvents,check),check(),clearTimer},up.on("submit","form[up-target]",function(t,n){return t.preventDefault(),submit(n)}),up.awaken("[up-observe]",function(t){return observe(t)}),{submit:submit,observe:observe}}(),up.submit=up.form.submit,up.observe=up.form.observe}.call(this),function(){up.popup=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f;return p=up.util,e={openAnimation:"fade-in",closeAnimation:"fade-out",origin:"bottom-right"},o=function(t){return p.extend(e,t)},s=function(t,n,e){var r,o;return o=p.measure(t,{full:!0}),r=function(){switch(e){case"bottom-right":return{right:o.right,top:o.top+o.height};case"bottom-left":return{left:o.left,top:o.bottom+o.height};case"top-right":return{right:o.right,bottom:o.top};case"top-left":return{left:o.left,bottom:o.top};default:return p.error("Unknown origin %o",e)}}(),n.attr("up-origin",e),n.css(r),i(n)},i=function(t){var n,e,r,o,u,i,a;if(e=p.measure(t,{full:!0}),r=null,o=null,e.right<0&&(r=-e.right),e.bottom<0&&(o=-e.bottom),e.left<0&&(r=e.left),e.top<0&&(o=e.top),r&&((u=parseInt(t.css("left")))?t.css("left",u-r):(i=parseInt(t.css("right")))&&t.css("right",i+r)),o){if(a=parseInt(t.css("top")))return t.css("top",a-o);if(n=parseInt(t.css("bottom")))return t.css("bottom",n+o)}},l=function(){var t;return t=$(".up-popup"),t.attr("up-previous-url",up.browser.url()),t.attr("up-previous-title",document.title)},u=function(){var t;return t=$(".up-popup"),t.removeAttr("up-previous-url"),t.removeAttr("up-previous-title")},r=function(t,n,e){var r,o;return o=p.$createElementFromSelector(".up-popup"),e&&o.attr("up-sticky",""),r=p.$createElementFromSelector(n),r.appendTo(o),o.appendTo(document.body),l(),o.hide(),o},f=function(t,n,e,r){return n.show(),s(t,n,e),up.animate(n,r)},a=function(t,o){var u,i,a,s,l,c,d,m;return u=$(t),o=p.options(o),m=p.option(u.attr("href")),c=p.option(o.target,u.attr("up-popup"),"body"),l=p.option(o.origin,u.attr("up-origin"),e.origin),a=p.option(o.animation,u.attr("up-animation"),e.openAnimation),d=p.option(o.sticky,u.is("[up-sticky]")),s=up.browser.canPushState()?p.option(o.history,u.attr("up-history"),!1):!1,n(),i=r(u,c,d),up.replace(c,m,{history:s,insert:function(){return f(u,i,l,a)}})},c=function(){var t;return t=$(".up-popup"),t.is(".up-destroying")?void 0:t.find("[up-source]").attr("up-source")},n=function(t){var n;return n=$(".up-popup"),n.length?(t=p.options(t,{animation:e.closeAnimation,url:n.attr("up-previous-url"),title:n.attr("up-previous-title")}),up.destroy(n,t)):void 0},t=function(){return $(".up-popup").is("[up-sticky]")?void 0:n()},up.on("click","a[up-popup]",function(t,e){return t.preventDefault(),e.is(".up-current")?n():a(e)}),up.on("click","body",function(t){var e;return e=$(t.target),e.closest(".up-popup").length||e.closest("[up-popup]").length?void 0:n()}),up.bus.on("fragment:ready",function(n){return n.closest(".up-popup").length?void 0:(u(),t())}),up.magic.onEscape(function(){return n()}),up.on("click","[up-close]",function(t,e){return e.closest(".up-popup")?n():void 0}),up.bus.on("framework:reset",n),{open:a,close:n,source:c,defaults:o}}()}.call(this),function(){up.modal=function(){var t,n,e,r,o,u,i,a,s,l,c,p;return c=up.util,e={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>'}},o=function(t){return c.extend(e,t)},l=function(){var t;return t=e.template,c.isFunction(t)?t(e):t},a=function(){var t;return t=$(".up-modal"),t.attr("up-previous-url",up.browser.url()),t.attr("up-previous-title",document.title)},u=function(){var t;return t=$(".up-modal"),t.removeAttr("up-previous-url"),t.removeAttr("up-previous-title")},r=function(t,n,e,r){var o,u,i,s;return i=$(l()),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"),c.isPresent(n)&&u.css("width",n),c.isPresent(e)&&u.css("height",e),o=u.find(".up-modal-content"),s=c.$createElementFromSelector(t),s.appendTo(o),i.appendTo(document.body),a(),i.hide(),i},p=function(t,n){return t.show(),up.animate(t,n)},i=function(t,o){var u,i,a,s,l,f,d,m,h;return u=$(t),o=c.options(o),m=c.option(u.attr("href")),f=c.option(o.target,u.attr("up-modal"),"body"),h=c.option(o.width,u.attr("up-width"),e.width),s=c.option(o.height,u.attr("up-height"),e.height),a=c.option(o.animation,u.attr("up-animation"),e.openAnimation),d=c.option(o.sticky,u.is("[up-sticky]")),l=up.browser.canPushState()?c.option(o.history,u.attr("up-history"),!0):!1,n(),i=r(f,h,s,d),up.replace(f,m,{history:l,insert:function(){return p(i,a)}})},s=function(){var t;return t=$(".up-modal"),t.is(".up-destroying")?void 0:t.find("[up-source]").attr("up-source")
2
- },n=function(t){var n;return n=$(".up-modal"),n.length?(t=c.options(t,{animation:e.closeAnimation,url:n.attr("up-previous-url"),title:n.attr("up-previous-title")}),up.destroy(n,t)):void 0},t=function(){return $(".up-modal").is("[up-sticky]")?void 0:(u(),n())},up.on("click","a[up-modal]",function(t,e){return t.preventDefault(),e.is(".up-current")?n():i(e)}),up.on("click","body",function(t){var e;return e=$(t.target),e.closest(".up-modal-dialog").length||e.closest("[up-modal]").length?void 0:n()}),up.bus.on("fragment:ready",function(n){return n.closest(".up-modal").length?void 0:t()}),up.magic.onEscape(function(){return n()}),up.on("click","[up-close]",function(t,e){return e.closest(".up-modal")?n():void 0}),up.bus.on("framework:reset",n),{open:i,close:n,source:s,defaults: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 origin %o",e)}}(),n.attr("up-origin",e),n.css(r)},n=function(t){return o.$createElementFromSelector(".up-tooltip").html(t).appendTo(document.body)},e=function(e,u){var i,a,s,l,c;return null==u&&(u={}),i=$(e),l=o.option(u.html,i.attr("up-tooltip"),i.attr("title")),c=o.option(u.origin,i.attr("up-origin"),"top"),s=o.option(u.animation,i.attr("up-animation"),"fade-in"),t(),a=n(l),r(i,a,c),up.animate(a,s,u)},t=function(t){var n;return n=$(".up-tooltip"),n.length?(t=o.options(t,{animation:"fade-out"}),up.destroy(n,t)):void 0},up.awaken("[up-tooltip]",function(n){return n.on("mouseover",function(){return e(n)}),n.on("mouseout",function(){return t()})}),up.on("click","body",function(){return t()}),up.bus.on("framework:reset",t),up.magic.onEscape(function(){return t()}),{open:e,close:t}}()}.call(this),function(){up.navigation=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d;return f=up.util,t="up-active",n="up-current",e=["a[href]","a[up-target]","[up-follow]","[up-modal]","[up-popup]","[up-href]"],o=e.join(", "),u=function(){var t,n,r;for(r=[],t=0,n=e.length;n>t;t++)p=e[t],r.push(p+"[up-instant]");return r}().join(", "),r="."+t,s=function(t){return f.isPresent(t)?f.normalizeUrl(t,{search:!1,stripTrailingSlash:!0}):void 0},c=function(t){var n,e,r,o,u,i,a;if(a=[],n=up.link.resolve(t))for(u=["href","up-follow","up-href"],r=0,o=u.length;o>r;r++)e=u[r],(i=f.presentAttr(n,e))&&(i=s(i),a.push(i));return a},a=function(){var t;return t=f.stringSet([s(up.browser.url()),s(up.modal.source()),s(up.popup.source())]),f.each($(o),function(e){var r,o;return r=$(e),o=c(r),t.includesAny(o)?r.addClass(n):r.removeClass(n)})},l=function(n){return d(),n=i(n),n.addClass(t)},i=function(t){return f.presence(t.parents(o))||t},d=function(){return $(r).removeClass(t)},up.on("click",o,function(t,n){return n.is("[up-instant]")?void 0:l(n)}),up.on("mousedown",u,function(t,n){return f.isUnmodifiedMouseEvent(t)?l(n):void 0}),up.bus.on("fragment:ready",function(){return d(),a()}),up.bus.on("fragment:destroy",function(t){return t.is(".up-modal, .up-popup")?a():void 0})}()}.call(this),function(){up.marker=function(){var t,n,e;return e=up.util,n=function(t){return""!==e.trim(t.html())},t=function(t){return e.findWithSelf(t,"[up-marker]").each(function(){var t;return t=$(this),n(t)?void 0:t.hide()})},up.bus.on("fragment:ready",t)}()}.call(this),function(){up.browser.ensureRecentJquery(),up.browser.isSupported()&&(up.browser.ensureConsoleExists(),up.bus.emit("framework:ready"),$(document).on("ready",function(){return up.bus.emit("app:ready")}))}.call(this);
1
+ (function(){window.up={}}).call(this),function(){var t=[].slice;up.util=function(){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,C,x,T,S,E,A,P,D,U,F,j,z,M,O,q,H,I,N,W,G,L,X,J,R,V,B,_,K,Q,Z,Y,tn,nn,en,rn,on,un,an,sn,ln,cn,pn,fn,dn,mn,hn,vn,gn,yn,bn;return T=function(t,n){return n=n||{},n.url=t,o(n)},o=function(t){return t.selector&&(t.headers={"X-Up-Selector":t.selector}),$.ajax(t)},W=function(t,n){return(""===n||"80"===n)&&"http:"===t||"443"===n&&"https:"===t},tn=function(t,n){var e,r,o;return e=null,G(t)?(e=$("<a>").attr({href:t}).get(0),A(e.hostname)&&(e.href=e.href)):e=bn(t),r=e.protocol+"//"+e.hostname,W(e.protocol,e.port)||(r+=":"+e.port),o=e.pathname,"/"!==o[0]&&(o="/"+o),(null!=n?n.stripTrailingSlash:void 0)===!0&&(o=o.replace(/\/$/,"")),r+=o,(null!=n?n.hash:void 0)===!0&&(r+=e.hash),(null!=n?n.search:void 0)!==!1&&(r+=e.search),r},Y=function(t){return t?t.toUpperCase():"GET"},n=function(t){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v;for(p=t.split(/[ >]/),r=null,c=d=0,h=p.length;h>d;c=++d){for(i=p[c],u=i.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),f="div",o=[],l=null,m=0,v=u.length;v>m;m++)switch(a=u[m],a[0]){case".":o.push(a.substr(1));break;case"#":l=a.substr(1);break;default:f=a}s="<"+f,o.length&&(s+=' class="'+o.join(" ")+'"'),l&&(s+=' id="'+l+'"'),s+=">",n=$(s),e&&n.appendTo(e),0===c&&(r=n),e=n}return r},p=function(t,n){var e;return e=document.createElement(t),I(n)&&(e.innerHTML=n),e},h=function(){var n,e,o,u,i,a;if(n=1<=arguments.length?t.call(arguments,0):[],n=gn(n),o=n.shift(),o="[UP] "+o,u=(null!=(a=o.match(r))?a.length:void 0)||0,F(V(n))&&u<n.length&&(e=n.pop()),i=console.debug.apply(console,[o].concat(t.call(n))),e){console.groupCollapsed();try{i=e()}finally{console.groupEnd()}}return i},y=function(){var n,e,r;throw e=1<=arguments.length?t.call(arguments,0):[],e[0]="[UP] "+e[0],console.error.apply(console,e),r=hn(e),n=an($(".up-error"))||$('<div class="up-error"></div>').prependTo("body"),n.addClass("up-error"),n.text(r),r},r=/\%[odisf]/g,hn=function(t){var n,e,o;return o=t[0],n=0,e=30,o.replace(r,function(){var r,o;return n+=1,r=t[n],o=typeof r,"string"===o?(r=r.replace(/\s+/g," "),r.length>e&&(r=r.substr(0,e)+"\u2026"),'"'+r+'"'):"number"===o?r.toString():"("+o+")"})},d=function(t){var n,e,r,o,u,i,a;for(h("Creating selector from element %o",t),e=(n=t.attr("class"))?n.split(" "):[],r=t.attr("id"),u=t.prop("tagName").toLowerCase(),r&&(u+="#"+r),i=0,a=e.length;a>i;i++)o=e[i],u+="."+o;return u},f=function(t){var n,e,r,o,u,i,a,s,l,c,f,d;return l=function(t){return"<"+t+"(?: [^>]*)?>"},i=function(t){return"</"+t+">"},n="(?:.|\\n)*?",u=function(t){return"("+t+")"},d=new RegExp(l("head")+n+l("title")+u(n)+i("title")+n+i("body"),"i"),o=new RegExp(l("body")+u(n)+i("body"),"i"),(r=t.match(o))?(s=document.createElement("html"),e=p("body",r[1]),s.appendChild(e),(f=t.match(d))&&(a=p("head"),s.appendChild(a),c=p("title",f[1]),a.appendChild(c)),s):p("div",t)},w=$.extend,yn=$.trim,R=Object.keys||function(t){var n,e,r,o;for(e=[],r=0,o=t.length;o>r;r++)n=t[r],t.hasOwnProperty(n)&&e.push(n);return e},g=function(t,n){var e,r,o,u,i;for(i=[],e=o=0,u=t.length;u>o;e=++o)r=t[e],i.push(n(r,e));return i},q=function(t){return null===t},L=function(t){return void 0===t},D=function(t){return!L(t)},O=function(t){return L(t)||q(t)},j=function(t){return!O(t)},A=function(t){return O(t)||H(t)&&0===R(t).length||0===t.length},an=function(t,n){return null==n&&(n=I),n(t)?t:null},I=function(t){return!A(t)},F=function(t){return"function"==typeof t},G=function(t){return"string"==typeof t},z=function(t){return"object"==typeof t&&!!t},H=function(t){return z(t)||"function"==typeof t},U=function(t){return!(!t||1!==t.nodeType)},M=function(t){return t instanceof jQuery},N=function(t){return H(t)&&F(t.then)},P=function(t){return N(t)&&F(t.resolve)},S=function(t){return j(t)?t:void 0},E=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},gn=function(t){return Array.prototype.slice.call(t)},l=function(t){return E(t)?t.slice():w({},t)},bn=function(t){return M(t)?t.get(0):t},K=function(t,n){return w(l(t),n)},on=function(t,n){var e,r,o,u;if(o=t?l(t):{},n)for(r in n)e=n[r],u=o[r],j(u)?H(e)&&H(u)&&(o[r]=on(u,e)):o[r]=e;return o},rn=function(){var n,e,r,o,u,i;for(e=1<=arguments.length?t.call(arguments,0):[],r=null,u=0,i=e.length;i>u;u++)if(n=e[u],o=n,F(o)&&(o=o()),I(o)){r=o;break}return r},v=function(t,n){var e,r,o,u;for(r=null,o=0,u=t.length;u>o;o++)if(e=t[o],n(e)){r=e;break}return r},fn=function(t,n){var e;return e=[],g(t,function(t){return n(t)?e.push(t):void 0}),e},sn=function(){var n,e,r,o;return n=arguments[0],r=2<=arguments.length?t.call(arguments,1):[],o=function(){var t,o,u;for(u=[],t=0,o=r.length;o>t;t++)e=r[t],u.push(n.attr(e));return u}(),v(o,I)},Z=function(t){return setTimeout(t,0)},V=function(t){return t[t.length-1]},a=function(){var t;return t=document.documentElement,{width:t.clientWidth,height:t.clientHeight}},vn=function(t,n,e){var r,o;return o=t.css(R(n)),t.css(n),r=function(){return t.css(o)},e?(e(),r()):r},x=function(t){var n,e;return e=t.css(["transform","-webkit-transform"]),A(e)?(n=function(){return t.css(e)},t.css({transform:"translateZ(0)","-webkit-transform":"translateZ(0)"})):n=function(){},n},m=function(t,n,r){var o,u,i,a,s,l;return o=$(t),up.browser.canCssAnimation()?(r=on(r,{duration:300,delay:0,easing:"ease"}),u=$.Deferred(),a={"transition-property":R(n).join(", "),"transition-duration":r.duration+"ms","transition-delay":r.delay+"ms","transition-timing-function":r.easing},s=x(o),l=vn(o,a),o.css(n),u.then(s),u.then(l),o.data(e,u),u.then(function(){return o.removeData(e)}),i=setTimeout(function(){return u.resolve()},r.duration+r.delay),u.then(function(){return clearTimeout(i)}),u):(o.css(n),pn())},e="up-animation-promise",C=function(t){return $(t).each(function(){var t;return(t=$(this).data(e))?t.resolve():void 0})},_=function(t,n){var e,r,o;return r=(null!=n?n.relative:void 0)?t.position():t.offset(),e={left:r.left,top:r.top},(null!=n?n.inner:void 0)?(e.width=t.width(),e.height=t.height()):(e.width=t.outerWidth(),e.height=t.outerHeight()),(null!=n?n.full:void 0)&&(o=a(),e.right=o.width-(e.left+e.width),e.bottom=o.height-(e.top+e.height)),e},c=function(t,n){var e,r,o,u,i;for(u=t.get(0).attributes,i=[],r=0,o=u.length;o>r;r++)e=u[r],i.push(e.specified?n.attr(e.name,e.value):void 0);return i},un=function(t){var n,e;return e=_(t,{relative:!0,inner:!0}),n=t.clone(),n.find("script").remove(),n.css({right:"",bottom:"",position:"absolute"}),n.css(e),n.addClass("up-ghost"),n.insertBefore(t)},k=function(t,n){return t.find(n).addBack(n)},b=function(t){return 27===t.keyCode},s=function(t,n){return t.indexOf(n)>=0},i=function(t){return"true"===String(t)},u=function(t){return"false"===String(t)},B=function(t){return t.getResponseHeader("X-Up-Location")},Q=function(t){return t.getResponseHeader("X-Up-Method")},en=function(){var n,e,r,o,u,i;for(o=arguments[0],r=2<=arguments.length?t.call(arguments,1):[],n={},u=0,i=r.length;i>u;u++)e=r[u],o.hasOwnProperty(e)&&(n[e]=o[e]);return n},X=function(t){return!(t.metaKey||t.shiftKey||t.ctrlKey)},J=function(t){return 0===t.button&&X(t)},cn=function(){var t;return t=$.Deferred(),t.resolve(),t},pn=function(){return cn().promise()},nn=function(){return{is:function(){return!1},attr:function(){},find:function(){return[]}}},ln=function(){var n,e;return n=1<=arguments.length?t.call(arguments,0):[],e=$.when.apply($,n),e.resolve=function(){return g(n,function(t){return"function"==typeof t.resolve?t.resolve():void 0})},e},dn=function(t,n){var e,r,o;o=[];for(e in n)r=n[e],o.push(O(t.attr(e))?t.attr(e,r):void 0);return o},mn=function(t){var n,e,r,o,u,i,a,s;for(u={},n=function(t){return u[r(t)]},e=function(t){return v(t,n)},o=function(t){return u[r(t)]=!0},r=function(t){return"_"+t},a=0,s=t.length;s>a;a++)i=t[a],o(i);return{put:o,includes:n,includesAny:e}},{presentAttr:sn,createElement:p,normalizeUrl:tn,normalizeMethod:Y,createElementFromHtml:f,$createElementFromSelector:n,createSelectorFromElement:d,get:T,ajax:o,extend:w,copy:l,merge:K,options:on,option:rn,error:y,debug:h,each:g,detect:v,select:fn,last:V,isNull:q,isDefined:D,isUndefined:L,isGiven:j,isMissing:O,isPresent:I,isBlank:A,presence:an,isObject:H,isFunction:F,isString:G,isElement:U,isJQuery:M,isPromise:N,isDeferred:P,isHash:z,ifGiven:S,isUnmodifiedKeyEvent:X,isUnmodifiedMouseEvent:J,nullJquery:nn,unwrap:bn,nextFrame:Z,measure:_,temporaryCss:vn,cssAnimate:m,finishCssAnimate:C,forceCompositing:x,prependGhost:un,escapePressed:b,copyAttributes:c,findWithSelf:k,contains:s,isArray:E,toArray:gn,castsToTrue:i,castsToFalse:u,locationFromXhr:B,methodFromXhr:Q,clientSize:a,only:en,trim:yn,keys:R,resolvedPromise:pn,resolvedDeferred:cn,resolvableWhen:ln,setMissingAttrs:dn,stringSet:mn}}()}.call(this),function(){var t=[].slice;up.browser=function(){var n,e,r,o,u,i,a,s,l,c;return l=up.util,a=function(t,n){var e,r,o,u,i,a;return null==n&&(n={}),i=l.option(n.method,"get").toLowerCase(),"get"===i?location.href=t:$.rails?(a=n.target,o=$.rails.csrfToken(),r=$.rails.csrfParam(),e=$("<form method='post' action='"+t+"'></form>"),u="<input name='_method' value='"+i+"' type='hidden' />",l.isDefined(r)&&l.isDefined(o)&&(u+="<input name='"+r+"' value='"+o+"' type='hidden' />"),a&&e.attr("target",a),e.hide().append(u).appendTo("body"),e.submit()):error("Can't fake a "+i.toUpperCase()+" request without Rails UJS")},c=function(){return location.href},o=function(){var t,n,e,r,o,u,i,a;return window.console||(window.console={}),t=function(){},(n=window.console).log||(n.log=t),(e=window.console).info||(e.info=t),(r=window.console).error||(r.error=t),(o=window.console).debug||(o.debug=t),(u=window.console).group||(u.group=t),(i=window.console).groupCollapsed||(i.groupCollapsed=t),(a=window.console).groupEnd||(a.groupEnd=t)},s=function(n){var e,r;return e=void 0,r=!1,function(){var o;return o=1<=arguments.length?t.call(arguments,0):[],r?e:(r=!0,e=n.apply(null,o))}},r=s(function(){return l.isDefined(history.pushState)}),n=s(function(){return"transition"in document.documentElement.style}),e=s(function(){return"oninput"in document.createElement("input")}),u=function(){var t,n,e,r,o;return o=$.fn.jquery,r=o.split("."),n=parseInt(r[0]),e=parseInt(r[1]),t=n>=2||1===n&&e>=9,t||l.error("jQuery %o found, but Up.js requires 1.9+",o)},i=s(function(){return l.isDefined(document.addEventListener)}),{url:c,ensureConsoleExists:o,loadPage:a,canPushState:r,canCssAnimation:n,canInputEvent:e,isSupported:i,ensureRecentJquery:u}}()}.call(this),function(){var t=[].slice;up.bus=function(){var n,e,r,o,u,i,a,s;return s=up.util,n={},r={},e=function(t){return n[t]||(n[t]=[])},a=function(){var t,e,o;r={},o=[];for(e in n)t=n[e],o.push(r[e]=s.copy(t));return o},i=function(){return n=s.copy(r)},u=function(t,n){return e(t).push(n)},o=function(){var n,r,o;return o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],s.debug("Emitting event %o with args %o",o,n),r=e(o),s.each(r,function(t){return t.apply(null,n)})},u("framework:ready",a),u("framework:reset",i),{on:u,emit:o}}()}.call(this),function(){up.viewport=function(){var t,n,e,r,o,u,i;return i=up.util,n={duration:0,view:"body",easing:"swing"},e=function(t){return i.extend(n,t)},t="up-scroll-promise",u=function(e,o,u){var a,s,l,c,p;return a=$(e),u=i.options(u),l=i.option(u.duration,n.duration),c=i.option(u.easing,n.easing),r(a),l>0?(s=$.Deferred(),a.data(t,s),s.then(function(){return a.removeData(t),a.finish()}),p={scrollTop:o},a.animate(p,{duration:l,easing:c,complete:function(){return s.resolve()}}),s):(a.scrollTop(o),i.resolvedDeferred())},r=function(n){return $(n).each(function(){var n;return(n=$(this).data(t))?n.resolve():void 0})},o=function(t,e){var r,o,a,s,l,c,p,f,d,m,h;return e=i.options(e),m=i.option(e.view,n.view),f=i.option(e.padding,n.padding),r=$(t),o=$(m),h=o.height(),d=o.scrollTop(),c=d,p=d+h,l=r.position().top,a=c>l-f,s=l>p-f,a||s?(d=l-f,d=Math.max(d,0),d=Math.min(d,h-1),u(o,d,e)):i.resolvedDeferred()},{reveal:o,scroll:u,finishScrolling:r,defaults:e}}(),up.scroll=up.viewport.scroll,up.reveal=up.viewport.reveal}.call(this),function(){up.flow=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h;return h=up.util,f=function(t,n){var e;return e=$(t),h.isPresent(n)&&(n=h.normalizeUrl(n)),e.attr("up-source",n)},d=function(t){var n;return n=$(t).closest("[up-source]"),h.presence(n.attr("up-source"))||up.browser.url()},l=function(t,n,e){var r,u,i;return e=h.options(e),i=h.presence(t)?t:h.createSelectorFromElement($(t)),up.browser.canPushState()||h.castsToFalse(e.history)?(u={url:n,method:e.method,selector:i},r=up.proxy.ajax(u),r.done(function(t,r,a){var s,l;return(s=h.locationFromXhr(a))&&(h.debug("Location from server: %o",s),l={url:s,method:h.methodFromXhr(a),selector:i},up.proxy.alias(u,l),n=s),(h.isMissing(e.history)||h.castsToTrue(e.history))&&(e.history=n),(h.isMissing(e.source)||h.castsToTrue(e.source))&&(e.source=n),e.preload?void 0:o(i,t,e)}),r.fail(h.error),r):void(e.preload||up.browser.loadPage(n,h.only(e,"method")))},o=function(t,n,e){var o,s,l,c,p,f,d,v;for(e=h.options(e,{historyMethod:"push"}),h.castsToFalse(e.history)&&(e.history=null),h.castsToFalse(e.scroll)&&(e.scroll=null),e.source=h.option(e.source,e.history),l=i(n),e.title||(e.title=l.title()),d=u(t,e),v=[],p=0,f=d.length;f>p;p++)c=d[p],s=r(c.selector),o=l.find(c.selector),v.push(a(s,e).then(function(){return m(s,o,c.pseudoClass,c.transition,e)}));return v},r=function(t){return h.presence($(".up-popup "+t))||h.presence($(".up-modal "+t))||h.presence($(t))||h.error("Could not find selector %o in current body HTML",t)},i=function(t){var n;return n=h.createElementFromHtml(t),{title:function(){var t;return null!=(t=n.querySelector("title"))?t.textContent:void 0},find:function(e){var r;return(r=n.querySelector(e))?$(r):h.error("Could not find selector %o in response %o",e,t)}}},a=function(t,n){return up.motion.finish(t),p(t,n.scroll)},p=function(t,n){return n?up.reveal(t,{view:n}):h.resolvedDeferred()},e=function(n,e){return"function"==typeof e.insert&&e.insert(n),e.history&&(e.title&&(document.title=e.title),up.history[e.historyMethod](e.history)),f(n,e.source),t(n),up.ready(n)},m=function(t,r,o,u,i){var a,s;return u||(u="none"),o?(s="before"===o?"prepend":"append",a=r.children(),t[s](r.contents()),h.copyAttributes(r,t),e(a,i),up.animate(r,u)):n(t,{animation:function(){return r.insertBefore(t),e(r,i),t.is("body")&&"none"!==u&&h.error("Cannot apply transitions to body-elements (%o)",u),up.morph(t,r,u)}})},u=function(t,n){var e,r,o,u,i,a,s,l,c,p,f;for(s=n.transition||n.animation||"none",e=/\ *,\ */,r=t.split(e),h.isPresent(s)&&(l=s.split(e)),f=[],o=c=0,p=r.length;p>c;o=++c)u=r[o],i=u.match(/^(.+?)(?:\:(before|after))?$/),a=l[o]||h.last(l),f.push({selector:i[1],pseudoClass:i[2],transition:a});return f},t=function(t){var n,e;return e="[autofocus]:last",n=h.findWithSelf(t,e),n.length&&n.get(0)!==document.activeElement?n.focus():void 0},n=function(t,n){var e,r;return e=$(t),n=h.options(n,{animation:"none"}),e.addClass("up-destroying"),h.isPresent(n.url)&&up.history.push(n.url),h.isPresent(n.title)&&(document.title=n.title),up.bus.emit("fragment:destroy",e),r=h.presence(n.animation,h.isPromise)||up.motion.animate(e,n.animation),r.then(function(){return e.remove()})},s=function(t){var n;return n=d(t),l(t,n)},c=function(){return up.bus.emit("framework:reset")},up.bus.on("app:ready",function(){return f(document.body,up.browser.url())}),{replace:l,reload:s,destroy:n,implant:o,reset:c}}(),up.replace=up.flow.replace,up.reload=up.flow.reload,up.destroy=up.flow.destroy,up.reset=up.flow.reset}.call(this),function(){var t=[].slice;up.magic=function(){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g;return g=up.util,n="up-destroyable",e="up-destroyer",f=[],l=null,p=function(t,n,e){var r,o;if(up.browser.isSupported())return r=[t,n,function(t){return e.apply(this,[t,$(this),a(this)])}],f.push(r),(o=$(document)).on.apply(o,r)},u=[],s=null,o=function(){var n,e,r,o;return o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],up.browser.isSupported()?(e=n.pop(),r=g.options(n[0],{batch:!1}),u.push({selector:o,callback:e,batch:r.batch})):void 0},r=function(t,r,o){var u;return g.debug("Applying awakener %o on %o",t.selector,o),u=t.callback.apply(o,[r,a(r)]),g.isFunction(u)?(r.addClass(n),r.data(e,u)):void 0},i=function(t){var n,e,o,i,a;for(g.debug("Compiling fragment %o",t),a=[],o=0,i=u.length;i>o;o++)e=u[o],n=g.findWithSelf(t,e.selector),a.push(n.length?e.batch?r(e,n,n.get()):n.each(function(){return r(e,$(this),this)}):void 0);return a},c=function(t){return g.findWithSelf(t,"."+n).each(function(){var t,n;return t=$(this),(n=t.data(e))()})},a=function(t){var n,e;return n=$(t),e=n.attr("up-data"),g.isString(e)&&""!==g.trim(e)?JSON.parse(e):{}},v=function(){return l=g.copy(f),s=g.copy(u)},h=function(){var t,n,e,r;for(n=0,e=f.length;e>n;n++)t=f[n],g.contains(l,t)||(r=$(document)).off.apply(r,t);return f=g.copy(l),u=g.copy(s)},m=function(t){var n;return n=$(t),up.bus.emit("fragment:ready",n),n},d=function(t){return p("keydown","body",function(n){return g.escapePressed(n)?t(n):void 0})},up.bus.on("app:ready",function(){return m(document.body)}),up.bus.on("fragment:ready",i),up.bus.on("fragment:destroy",c),up.bus.on("framework:ready",v),up.bus.on("framework:reset",h),{awaken:o,on:p,ready:m,onEscape:d,data:a}}(),up.awaken=up.magic.awaken,up.on=up.magic.on,up.ready=up.magic.ready}.call(this),function(){up.history=function(){var t,n,e,r,o,u;return u=up.util,t=function(t){return u.normalizeUrl(t,{hash:!0})===u.normalizeUrl(up.browser.url(),{hash:!0})},o=function(e,r){return r=u.options(r,{force:!1}),r.force||!t(e)?n("replace",e):void 0},r=function(e){return t(e)?void 0:n("push",e)},n=function(t,n){return up.browser.canPushState()?(t+="State",window.history[t]({fromUp:!0},"",n)):u.error("This browser doesn't support history.pushState")},e=function(t){var n;return n=t.originalEvent.state,(null!=n?n.fromUp:void 0)?(u.debug("Restoring state %o (now on "+up.browser.url()+")",n),up.visit(up.browser.url(),{historyMethod:"replace"})):u.debug("Discarding unknown state %o",n)},up.browser.canPushState()&&setTimeout(function(){return $(window).on("popstate",e),o(up.browser.url(),{force:!0})},200),{push:r,replace:o}}()}.call(this),function(){up.motion=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w;return b=up.util,r={},i={},y={},a={},u={duration:300,delay:0,easing:"ease"},s=function(t){return b.extend(u,t)},n=function(t,e,r){var i;return i=$(t),c(i),r=b.options(r,u),b.isFunction(e)?o(e(i,r),e):b.isString(e)?n(i,l(e),r):b.isHash(e)?b.cssAnimate(i,e,r):b.error("Unknown animation type %o",e)},l=function(t){return r[t]||b.error("Unknown animation %o",e)},t="up-ghosting-promise",w=function(n,e,r){var o,u,i,a;return u=null,o=null,b.temporaryCss(e,{display:"none"},function(){return u=b.prependGhost(n).addClass("up-destroying")}),b.temporaryCss(n,{display:"none"},function(){return o=b.prependGhost(e)}),n.css({visibility:"hidden"}),i=b.temporaryCss(e,{display:"none"}),a=r(u,o),n.data(t,a),e.data(t,a),a.then(function(){return n.removeData(t),e.removeData(t),u.remove(),o.remove(),n.css({display:"none"}),i()}),a},c=function(t){return $(t).each(function(){var t;return t=$(this),b.finishCssAnimate(t),p(t)})},p=function(n){var e;return(e=n.data(t))?(b.debug("Canceling existing ghosting on %o",n),"function"==typeof e.resolve?e.resolve():void 0):void 0},o=function(t,n){return b.isDeferred(t)?t:b.error("Did not return a promise with .then and .resolve methods: %o",n)},f=function(t,e,i,a){var s,l,p,m,v;return up.browser.canCssAnimation()?(a=b.options(u),l=$(t),s=$(e),c(l),c(s),"none"===i?d():(v=b.presence(i,b.isFunction)||y[i])?w(l,s,function(t,n){return o(v(t,n,a),i)}):(p=r[i])?(l.hide(),n(s,p,a)):b.isString(i)&&i.indexOf("/")>=0?(m=i.split("/"),v=function(t,e,r){return h(n(t,m[0],r),n(e,m[1],r))},f(l,s,v,a)):b.error("Unknown transition %o",i)):b.resolvedDeferred()},g=function(t,n){return y[t]=n},e=function(t,n){return r[t]=n},v=function(){return i=b.copy(r),a=b.copy(y)},m=function(){return r=b.copy(i),y=b.copy(a)},h=b.resolvableWhen,d=b.resolvedDeferred,e("none",d),e("fade-in",function(t,e){return t.css({opacity:0}),n(t,{opacity:1},e)}),e("fade-out",function(t,e){return t.css({opacity:1}),n(t,{opacity:0},e)}),e("move-to-top",function(t,e){var r,o;return r=b.measure(t),o=r.top+r.height,t.css({"margin-top":"0px"}),n(t,{"margin-top":"-"+o+"px"},e)}),e("move-from-top",function(t,e){var r,o;return r=b.measure(t),o=r.top+r.height,t.css({"margin-top":"-"+o+"px"}),n(t,{"margin-top":"0px"},e)}),e("move-to-bottom",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().height-r.top,t.css({"margin-top":"0px"}),n(t,{"margin-top":o+"px"},e)}),e("move-from-bottom",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().height-r.top,t.css({"margin-top":o+"px"}),n(t,{"margin-top":"0px"},e)}),e("move-to-left",function(t,e){var r,o;return r=b.measure(t),o=r.left+r.width,t.css({"margin-left":"0px"}),n(t,{"margin-left":"-"+o+"px"},e)}),e("move-from-left",function(t,e){var r,o;return r=b.measure(t),o=r.left+r.width,t.css({"margin-left":"-"+o+"px"}),n(t,{"margin-left":"0px"},e)}),e("move-to-right",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().width-r.left,t.css({"margin-left":"0px"}),n(t,{"margin-left":o+"px"},e)}),e("move-from-right",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().width-r.left,t.css({"margin-left":o+"px"}),n(t,{"margin-left":"0px"},e)}),e("roll-down",function(t,e){var r,o;return r=t.height(),o=b.temporaryCss(t,{height:"0px",overflow:"hidden"}),n(t,{height:r+"px"},e).then(o)}),g("none",d),g("move-left",function(t,e,r){return h(n(t,"move-to-left",r),n(e,"move-from-right",r))}),g("move-right",function(t,e,r){return h(n(t,"move-to-right",r),n(e,"move-from-left",r))}),g("move-up",function(t,e,r){return h(n(t,"move-to-top",r),n(e,"move-from-bottom",r))}),g("move-down",function(t,e,r){return h(n(t,"move-to-bottom",r),n(e,"move-from-top",r))}),g("cross-fade",function(t,e,r){return h(n(t,"fade-out",r),n(e,"fade-in",r))}),up.bus.on("framework:ready",v),up.bus.on("framework:reset",m),{morph:f,animate:n,finish:c,transition:g,animation:e,defaults:s,none:d,when:h}}(),up.transition=up.motion.transition,up.animation=up.motion.animation,up.morph=up.motion.morph,up.animate=up.motion.animate}.call(this),function(){up.proxy=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,$,C,x,T;return l={preloadDelay:75,cacheSize:70,cacheExpiry:3e5},c=function(t){return T.extend(l,t)},o={},T=up.util,t=null,p=null,u=function(t){return v(t),[t.url,t.method,t.selector].join("|")},x=function(){var t,n,e;return t=T.keys(o),t.length>l.cacheSize&&(n=null,e=null,T.each(t,function(t){var r,u;return r=o[t],u=r.timestamp,!e||e>u?(n=t,e=u):void 0}),n)?delete o[n]:void 0},$=function(){return(new Date).valueOf()},v=function(t){return!T.isHash(t),t._requestNormalized||(t.method=T.normalizeMethod(t.method),t.url&&(t.url=T.normalizeUrl(t.url)),t.selector||(t.selector="body"),t._requestNormalized=!0),t},r=function(t,n){var e;return T.debug("Aliasing %o to %o",t,n),(e=d(t))?w(n,e):void 0},e=function(t){var n;return h(t)?(n=d(t))?C(n):(n=T.ajax(t),w(t,n)):(s(),n=T.ajax(t)),n},n=["GET","OPTIONS","HEAD"],h=function(t){return v(t),T.contains(n,t.method)},f=function(t){return h(t)||T.error("Won't preload non-GET request %o",t)},m=function(t){var n;return n=$()-t.timestamp,n<l.cacheExpiry},C=function(t){return t.timestamp=$()},d=function(t){var n,e;return n=u(t),(e=o[n])?m(e)?(T.debug("Cache hit for %o (%o)",t.url,t),e):(T.debug("Discarding stale cache entry for %o (%o)",t.url,t),void y(t)):void T.debug("Cache miss for %o (%o)",t.url,t)},w=function(t,n){var e;return x(),e=u(t),o[e]=n,C(n),n},y=function(t){var n;return n=u(t),delete o[n]},s=function(){return o={}},a=function(n){var e,r;return r=parseInt(T.presentAttr(n,"up-delay"))||l.preloadDelay,n.is(t)?void 0:(t=n,i(),e=function(){return g(n)},k(e,r))},k=function(t,n){return p=setTimeout(t,n)},i=function(){return clearTimeout(p),p=null},g=function(t,n){return n=T.options(),f(n),T.debug("Preloading %o",t),n.preload=!0,up.link.follow(t,n)},b=function(){return i(),o={}},up.bus.on("framework:reset",b),up.on("mouseover mousedown touchstart","[up-preload]",function(t,n){return up.link.childClicked(t,n)?void 0:a(up.link.resolve(n))}),{preload:g,ajax:e,get:d,set:w,alias:r,clear:s,defaults:c}}()}.call(this),function(){up.link=function(){var t,n,e,r,o,u;return o=up.util,u=function(t,n){return o.debug("Visiting "+t),up.replace("body",t,n)},e=function(t,n){var e,r,u;return e=$(t),n=o.options(n),u=o.option(e.attr("href"),e.attr("up-follow")),r=o.option(n.target,e.attr("up-target"),"body"),n.transition=o.option(n.transition,e.attr("up-transition"),e.attr("up-animation")),n.history=o.option(n.history,e.attr("up-history")),n.scroll=o.option(n.scroll,e.attr("up-scroll"),"body"),up.replace(r,u,n)},r=function(t){var n,e;return n=$(t),e=n.attr("up-follow"),n.is("a")||o.isPresent(e)&&!o.castsToTrue(e)?n:n.find("a:first")},up.on("click","a[up-target]",function(t,n){return t.preventDefault(),n.is("[up-instant]")?void 0:e(n)}),up.on("mousedown","a[up-target][up-instant]",function(n,e){return t(n,e)?(n.preventDefault(),up.follow(e)):void 0}),n=function(t,n){var e,r;return e=$(t.target),r=e.closest("a, [up-follow]"),r.length&&n.find(r).length},t=function(t,e){return o.isUnmodifiedMouseEvent(t)&&!n(t,e)},up.on("click","[up-follow]",function(t,o){return n(t,o)||(t.preventDefault(),o.is("[up-instant]"))?void 0:e(r(o))}),up.on("mousedown","[up-follow][up-instant]",function(n,e){return t(n,e)?(n.preventDefault(),up.follow(r(e))):void 0}),up.awaken("[up-dash]",function(t){var n,e;return e=t.attr("up-dash"),n={"up-preload":"true","up-instant":"true"},o.isBlank(e)||o.castsToTrue(e)?n["up-follow"]="":n["up-target"]=e,o.setMissingAttrs(t,n),t.removeAttr("up-dash")}),{visit:u,follow:e,resolve:r,childClicked:n}}(),up.visit=up.link.visit,up.follow=up.link.follow}.call(this),function(){up.form=function(){var observe,submit,u;return u=up.util,submit=function(t,n){var e,r,o,i,a,s,l,c,p,f;return e=$(t).closest("form"),n=u.options(n),l=u.option(n.target,e.attr("up-target"),"body"),r=u.option(n.failTarget,e.attr("up-fail-target"),function(){return u.createSelectorFromElement(e)}),i=u.option(n.history,e.attr("up-history"),!0),c=u.option(n.transition,e.attr("up-transition")),o=u.option(n.failTransition,e.attr("up-fail-transition")),a=u.option(n.method,e.attr("up-method"),e.attr("data-method"),e.attr("method"),"post").toUpperCase(),f=u.option(n.url,e.attr("action"),up.browser.url()),e.addClass("up-active"),up.browser.canPushState()||u.castsToFalse(i)?(s={url:f,type:a,data:e.serialize(),selector:l},p=function(t){var n;return f=i?u.castsToFalse(i)?!1:u.isString(i)?i:(n=u.locationFromXhr(t))?n:"GET"===s.type?s.url+"?"+s.data:void 0:void 0,u.option(f,!1)},u.ajax(s).always(function(){return e.removeClass("up-active")}).done(function(t,n,e){return up.flow.implant(l,t,{history:p(e),transition:c})}).fail(function(t){var n;return n=t.responseText,up.flow.implant(r,n,{transition:o})})):void e.get(0).submit()},observe=function(fieldOrSelector,options){var $field,callback,callbackPromise,callbackTimer,changeEvents,check,clearTimer,codeOnChange,delay,knownValue,nextCallback,runNextCallback;return $field=$(fieldOrSelector),options=u.options(options),delay=u.option($field.attr("up-delay"),options.delay,0),delay=parseInt(delay),knownValue=null,callback=null,callbackTimer=null,(codeOnChange=$field.attr("up-observe"))?callback=function(value,$field){return eval(codeOnChange)}:options.change?callback=options.change:u.error("up.observe: No change callback given"),callbackPromise=u.resolvedPromise(),nextCallback=null,runNextCallback=function(){var t;return nextCallback?(t=nextCallback(),nextCallback=null,t):void 0},check=function(){var t,n;return n=$field.val(),t=u.isNull(knownValue),knownValue===n||(knownValue=n,t)?void 0:(clearTimer(),nextCallback=function(){return callback.apply($field.get(0),[n,$field])},callbackTimer=setTimeout(function(){return callbackPromise.then(function(){var t;return t=runNextCallback(),callbackPromise=u.isPromise(t)?t:u.resolvedPromise()})},delay))},clearTimer=function(){return clearTimeout(callbackTimer)},changeEvents=up.browser.canInputEvent()?"input change":"input change keypress paste cut click propertychange",$field.on(changeEvents,check),check(),clearTimer},up.on("submit","form[up-target]",function(t,n){return t.preventDefault(),submit(n)}),up.awaken("[up-observe]",function(t){return observe(t)}),{submit:submit,observe:observe}}(),up.submit=up.form.submit,up.observe=up.form.observe}.call(this),function(){up.popup=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f;return p=up.util,e={openAnimation:"fade-in",closeAnimation:"fade-out",origin:"bottom-right"},o=function(t){return p.extend(e,t)},s=function(t,n,e){var r,o;return o=p.measure(t,{full:!0}),r=function(){switch(e){case"bottom-right":return{right:o.right,top:o.top+o.height};case"bottom-left":return{left:o.left,top:o.bottom+o.height};case"top-right":return{right:o.right,bottom:o.top};case"top-left":return{left:o.left,bottom:o.top};default:return p.error("Unknown origin %o",e)}}(),n.attr("up-origin",e),n.css(r),i(n)},i=function(t){var n,e,r,o,u,i,a;if(e=p.measure(t,{full:!0}),r=null,o=null,e.right<0&&(r=-e.right),e.bottom<0&&(o=-e.bottom),e.left<0&&(r=e.left),e.top<0&&(o=e.top),r&&((u=parseInt(t.css("left")))?t.css("left",u-r):(i=parseInt(t.css("right")))&&t.css("right",i+r)),o){if(a=parseInt(t.css("top")))return t.css("top",a-o);if(n=parseInt(t.css("bottom")))return t.css("bottom",n+o)}},l=function(){var t;return t=$(".up-popup"),t.attr("up-previous-url",up.browser.url()),t.attr("up-previous-title",document.title)},u=function(){var t;return t=$(".up-popup"),t.removeAttr("up-previous-url"),t.removeAttr("up-previous-title")},r=function(t,n,e){var r,o;return o=p.$createElementFromSelector(".up-popup"),e&&o.attr("up-sticky",""),r=p.$createElementFromSelector(n),r.appendTo(o),o.appendTo(document.body),l(),o.hide(),o},f=function(t,n,e,r){return n.show(),s(t,n,e),up.animate(n,r)},a=function(t,o){var u,i,a,s,l,c,d,m;return u=$(t),o=p.options(o),m=p.option(o.url,u.attr("href")),c=p.option(o.target,u.attr("up-popup"),"body"),l=p.option(o.origin,u.attr("up-origin"),e.origin),a=p.option(o.animation,u.attr("up-animation"),e.openAnimation),d=p.option(o.sticky,u.is("[up-sticky]")),s=up.browser.canPushState()?p.option(o.history,u.attr("up-history"),!1):!1,n(),i=r(u,c,d),up.replace(c,m,{history:s,insert:function(){return f(u,i,l,a)}})},c=function(){var t;return t=$(".up-popup"),t.is(".up-destroying")?void 0:t.find("[up-source]").attr("up-source")},n=function(t){var n;return n=$(".up-popup"),n.length?(t=p.options(t,{animation:e.closeAnimation,url:n.attr("up-previous-url"),title:n.attr("up-previous-title")}),up.destroy(n,t)):void 0},t=function(){return $(".up-popup").is("[up-sticky]")?void 0:n()},up.on("click","a[up-popup]",function(t,e){return t.preventDefault(),e.is(".up-current")?n():a(e)}),up.on("click","body",function(t){var e;return e=$(t.target),e.closest(".up-popup").length||e.closest("[up-popup]").length?void 0:n()}),up.bus.on("fragment:ready",function(n){return n.closest(".up-popup").length?void 0:(u(),t())}),up.magic.onEscape(function(){return n()}),up.on("click","[up-close]",function(t,e){return e.closest(".up-popup")?n():void 0}),up.bus.on("framework:reset",n),{open:a,close:n,source:c,defaults:o}}()}.call(this),function(){var t=[].slice;up.modal=function(){var n,e,r,o,u,i,a,s,l,c,p,f;return p=up.util,r={width:"auto",height:"auto",openAnimation:"fade-in",closeAnimation:"fade-out",closeLabel:"X",template:function(t){return'<div class="up-modal">\n <div class="up-modal-dialog">\n <div class="up-modal-close" up-close>'+t.closeLabel+'</div>\n <div class="up-modal-content"></div>\n </div>\n</div>'}},u=function(t){return p.extend(r,t)},c=function(){var t;return t=r.template,p.isFunction(t)?t(r):t},s=function(){var t;return t=$(".up-modal"),t.attr("up-previous-url",up.browser.url()),t.attr("up-previous-title",document.title)},i=function(){var t;return t=$(".up-modal"),t.removeAttr("up-previous-url"),t.removeAttr("up-previous-title")},o=function(t,n,e,r){var o,u,i,a;return i=$(c()),r&&i.attr("up-sticky",""),i.attr("up-previous-url",up.browser.url()),i.attr("up-previous-title",document.title),u=i.find(".up-modal-dialog"),p.isPresent(n)&&u.css("width",n),p.isPresent(e)&&u.css("height",e),o=u.find(".up-modal-content"),a=p.$createElementFromSelector(t),a.appendTo(o),i.appendTo(document.body),s(),i.hide(),i},f=function(t,n){return t.show(),up.animate(t,n)},a=function(){var n,u,i,a,s,l,c,d,m,h,v;return a=1<=arguments.length?t.call(arguments,0):[],!p.isObject(a[0])||p.isElement(a[0])||p.isJQuery(a[0])?(n=$(a[0]),c=a[1]):(n=p.nullJquery(),c=a[0]),c=p.options(c),h=p.option(c.url,n.attr("href"),n.attr("up-href")),d=p.option(c.target,n.attr("up-modal"),"body"),v=p.option(c.width,n.attr("up-width"),r.width),s=p.option(c.height,n.attr("up-height"),r.height),i=p.option(c.animation,n.attr("up-animation"),r.openAnimation),m=p.option(c.sticky,n.is("[up-sticky]")),l=up.browser.canPushState()?p.option(c.history,n.attr("up-history"),!0):!1,e(),u=o(d,v,s,m),up.replace(d,h,{history:l,insert:function(){return f(u,i)
2
+ }})},l=function(){var t;return t=$(".up-modal"),t.is(".up-destroying")?void 0:t.find("[up-source]").attr("up-source")},e=function(t){var n;return n=$(".up-modal"),n.length?(t=p.options(t,{animation:r.closeAnimation,url:n.attr("up-previous-url"),title:n.attr("up-previous-title")}),up.destroy(n,t)):void 0},n=function(){return $(".up-modal").is("[up-sticky]")?void 0:(i(),e())},up.on("click","a[up-modal]",function(t,n){return t.preventDefault(),n.is(".up-current")?e():a(n)}),up.on("click","body",function(t){var n;return n=$(t.target),n.closest(".up-modal-dialog").length||n.closest("[up-modal]").length?void 0:e()}),up.bus.on("fragment:ready",function(t){return t.closest(".up-modal").length?void 0:n()}),up.magic.onEscape(function(){return e()}),up.on("click","[up-close]",function(t,n){return n.closest(".up-modal")?e():void 0}),up.bus.on("framework:reset",e),{open:a,close:e,source:l,defaults:u}}()}.call(this),function(){up.tooltip=function(){var t,n,e,r,o;return o=up.util,r=function(t,n,e){var r,u,i;return u=o.measure(t),i=o.measure(n),r=function(){switch(e){case"top":return{left:u.left+.5*(u.width-i.width),top:u.top-i.height};case"bottom":return{left:u.left+.5*(u.width-i.width),top:u.top+u.height};default:return o.error("Unknown origin %o",e)}}(),n.attr("up-origin",e),n.css(r)},n=function(t){return o.$createElementFromSelector(".up-tooltip").html(t).appendTo(document.body)},e=function(e,u){var i,a,s,l,c;return null==u&&(u={}),i=$(e),l=o.option(u.html,i.attr("up-tooltip"),i.attr("title")),c=o.option(u.origin,i.attr("up-origin"),"top"),s=o.option(u.animation,i.attr("up-animation"),"fade-in"),t(),a=n(l),r(i,a,c),up.animate(a,s,u)},t=function(t){var n;return n=$(".up-tooltip"),n.length?(t=o.options(t,{animation:"fade-out"}),up.destroy(n,t)):void 0},up.awaken("[up-tooltip]",function(n){return n.on("mouseover",function(){return e(n)}),n.on("mouseout",function(){return t()})}),up.on("click","body",function(){return t()}),up.bus.on("framework:reset",t),up.magic.onEscape(function(){return t()}),{open:e,close:t}}()}.call(this),function(){up.navigation=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d;return f=up.util,t="up-active",n="up-current",e=["a[href]","a[up-target]","[up-follow]","[up-modal]","[up-popup]","[up-href]"],o=e.join(", "),u=function(){var t,n,r;for(r=[],t=0,n=e.length;n>t;t++)p=e[t],r.push(p+"[up-instant]");return r}().join(", "),r="."+t,s=function(t){return f.isPresent(t)?f.normalizeUrl(t,{search:!1,stripTrailingSlash:!0}):void 0},c=function(t){var n,e,r,o,u,i,a;if(o=[],n=up.link.resolve(t))for(a=["href","up-follow","up-href"],u=0,i=a.length;i>u;u++)e=a[u],(r=f.presentAttr(n,e))&&(r=s(r),o.push(r));return o},a=function(){var t;return t=f.stringSet([s(up.browser.url()),s(up.modal.source()),s(up.popup.source())]),f.each($(o),function(e){var r,o;return r=$(e),o=c(r),t.includesAny(o)?r.addClass(n):r.removeClass(n)})},l=function(n){return d(),n=i(n),n.addClass(t)},i=function(t){return f.presence(t.parents(o))||t},d=function(){return $(r).removeClass(t)},up.on("click",o,function(t,n){return n.is("[up-instant]")?void 0:l(n)}),up.on("mousedown",u,function(t,n){return f.isUnmodifiedMouseEvent(t)?l(n):void 0}),up.bus.on("fragment:ready",function(){return d(),a()}),up.bus.on("fragment:destroy",function(t){return t.is(".up-modal, .up-popup")?a():void 0})}()}.call(this),function(){up.marker=function(){var t,n,e;return e=up.util,n=function(t){return""!==e.trim(t.html())},t=function(t){return e.findWithSelf(t,"[up-marker]").each(function(){var t;return t=$(this),n(t)?void 0:t.hide()})},up.bus.on("fragment:ready",t)}()}.call(this),function(){up.browser.ensureRecentJquery(),up.browser.isSupported()&&(up.browser.ensureConsoleExists(),up.bus.emit("framework:ready"),$(document).on("ready",function(){return up.bus.emit("app:ready")}))}.call(this);
@@ -50,6 +50,8 @@ up.flow = (->
50
50
  @param {String} [options.transition]
51
51
  @param {String} [options.scroll='body']
52
52
  @param {String} [options.historyMethod='push']
53
+ @return {Promise}
54
+ A promise that will be resolved when the page has been updated.
53
55
  ###
54
56
  replace = (selectorOrElement, url, options) ->
55
57
 
@@ -120,7 +120,7 @@ up.link = (->
120
120
  or to `body` if such an attribute does not exist.
121
121
  @param {Function|String} [options.transition]
122
122
  A transition function or name.
123
- @param {Element|jQuery|String} scroll
123
+ @param {Element|jQuery|String} [options.scroll]
124
124
  An element or selector that will be scrolled to the top in
125
125
  case the replaced element is not visible in the viewport.
126
126
  ###
@@ -132,7 +132,7 @@ up.link = (->
132
132
  selector = u.option(options.target, $link.attr('up-target'), 'body')
133
133
  options.transition = u.option(options.transition, $link.attr('up-transition'), $link.attr('up-animation'))
134
134
  options.history = u.option(options.history, $link.attr('up-history'))
135
- options.scroll = u.option(options.history, $link.attr('up-scroll'), 'body')
135
+ options.scroll = u.option(options.scroll, $link.attr('up-scroll'), 'body')
136
136
 
137
137
  up.replace(selector, url, options)
138
138
 
@@ -5,15 +5,7 @@ Modal dialogs
5
5
  Instead of linking to another page fragment, you can also choose
6
6
  to open any target CSS selector in a modal dialog.
7
7
 
8
- For popup overlays see [up.popup](/up.popup) instead.
9
-
10
- \#\#\# Incomplete documentation!
11
-
12
- We need to work on this page:
13
-
14
- - Show the HTML structure of the dialog elements, and how to style them via CSS
15
- - Explain how dialogs auto-close themselves when a fragment changes behind the modal layer
16
- - Document method parameters
8
+ For small popup overlays ("dropdowns") see [up.popup](/up.popup) instead.
17
9
 
18
10
  @class up.modal
19
11
  ###
@@ -38,13 +30,31 @@ up.modal = (->
38
30
  """
39
31
 
40
32
  ###*
33
+ Sets default options for future modals.
34
+
41
35
  @method up.modal.defaults
42
- @param {Number} [options.width]
43
- @param {Number} [options.height]
36
+ @param {Number} [options.width='auto']
37
+ The width of the dialog.
38
+ Defaults to `'auto'`, meaning that the dialog will grow to fit its contents.
39
+ @param {Number} [options.height='auto']
40
+ The height of the dialog.
41
+ Defaults to `'auto'`, meaning that the dialog will grow to fit its contents.
44
42
  @param {String|Function(config)} [options.template]
45
- @param {String} [options.closeLabel]
46
- @param {String} [options.openAnimation]
47
- @param {String} [options.closeAnimation]
43
+ A string containing the HTML structure of the modal.
44
+ You can supply an alternative template string, but make sure that it
45
+ contains tags with the classes `up-modal`, `up-modal-dialog` and `up-modal-content`.
46
+
47
+ You can also supply a function that returns a HTML string.
48
+ The function will be called with the modal options (merged from these defaults
49
+ and any per-open overrides) whenever a modal opens.
50
+ @param {String} [options.closeLabel='X']
51
+ The label of the button that closes the dialog.
52
+ @param {String} [options.openAnimation='fade-in']
53
+ The animation used to open the modal. The animation will be applied
54
+ to both the dialog box and the overlay dimming the page.
55
+ @param {String} [options.closeAnimation='fade-out']
56
+ The animation used to close the modal. The animation will be applied
57
+ to both the dialog box and the overlay dimming the page.
48
58
  ###
49
59
  defaults = (options) ->
50
60
  u.extend(config, options)
@@ -87,24 +97,40 @@ up.modal = (->
87
97
  up.animate($modal, animation)
88
98
 
89
99
  ###*
90
- Opens a modal overlay.
100
+ Opens the given link's destination in a modal overlay:
101
+
102
+ var $link = $('...');
103
+ up.modal.open($link);
104
+
105
+ Any option attributes for [`a[up-modal]`](#a.up-modal) will be honored.
106
+
107
+ You can also open a URL directly like this:
108
+
109
+ up.modal.open({ url: '/foo' })
91
110
 
92
111
  @method up.modal.open
93
112
  @param {Element|jQuery|String} elementOrSelector
113
+ @param {String} [options.url]
94
114
  @param {Number} [options.width]
95
115
  @param {Number} [options.height]
96
- @param {String} [options.origin='bottom-right']
97
116
  @param {String} [options.animation]
98
117
  @param {Boolean} [options.sticky=false]
99
118
  If set to `true`, the modal remains
100
119
  open even if the page changes in the background.
101
120
  @param {Object} [options.history=true]
121
+ @return {Promise}
122
+ A promise that will be resolved when the modal has finished loading.
102
123
  ###
103
- open = (linkOrSelector, options) ->
104
- $link = $(linkOrSelector)
124
+ open = (args...) ->
125
+ if u.isObject(args[0]) && !u.isElement(args[0]) && !u.isJQuery(args[0])
126
+ $link = u.nullJquery()
127
+ options = args[0]
128
+ else
129
+ $link = $(args[0])
130
+ options = args[1]
105
131
 
106
132
  options = u.options(options)
107
- url = u.option($link.attr('href'))
133
+ url = u.option(options.url, $link.attr('href'), $link.attr('up-href'))
108
134
  selector = u.option(options.target, $link.attr('up-modal'), 'body')
109
135
  width = u.option(options.width, $link.attr('up-width'), config.width)
110
136
  height = u.option(options.height, $link.attr('up-height'), config.height)
@@ -158,18 +184,68 @@ up.modal = (->
158
184
  close()
159
185
 
160
186
  ###*
161
- Opens the target of this link in a modal dialog:
187
+ Clicking this link will load the destination via AJAX and open
188
+ the given selector in a modal dialog.
189
+
190
+ Example:
191
+
192
+ <a href="/blogs" up-modal=".blog-list">Switch blog</a>
193
+
194
+ Clicking would request the path `/blog` and select `.blog-list` from
195
+ the HTML response. Up.js will dim the page with an overlay
196
+ and place the matching `.blog_list` tag will be placed in
197
+ a modal dialog.
162
198
 
163
- <a href="/decks" up-modal=".deck_list">Switch deck</a>
164
199
 
165
- If the `up-sticky` attribute is set, the dialog does not auto-close
166
- if a page fragment below the dialog updates:
200
+ \#\#\#\# Customizing the dialog design
201
+
202
+ Loading the Up.js stylesheet will give you a minimal dialog design:
203
+
204
+ - Dialog contents are displayed in a white box that is centered vertically and horizontally.
205
+ - There is a a subtle box shadow around the dialog
206
+ - The box will grow to fit the dialog contents, but never grow larger than the screen
207
+ - The box is placed over a semi-transparent background to dim the rest of the page
208
+ - There is a button to close the dialog in the top-right corner
209
+
210
+ The easiest way to change how the dialog looks is by overriding the [default CSS styles](https://github.com/makandra/upjs/blob/master/lib/assets/stylesheets/up/modal.css.sass).
211
+
212
+ By default the dialog uses the following DOM structure (continuing the blog-switcher example from above):
213
+
214
+ <div class="up-modal">
215
+ <div class="up-modal-dialog">
216
+ <div class="up-modal-close" up-close>X</div>
217
+ <div class="up-modal-content">
218
+ <ul class="blog-list">
219
+ ...
220
+ </ul>
221
+ </div>
222
+ </div>
223
+ </div>
224
+
225
+ If you want to change the design beyond CSS, you can
226
+ configure Up.js to [use a different HTML structure](#up.modal.defaults).
227
+
228
+
229
+ \#\#\#\# Closing behavior
230
+
231
+ By default the dialog automatically closes
232
+ *whenever a page fragment below the dialog is updated*.
233
+ This is useful to have the dialog interact with the page that
234
+ opened it, e.g. by updating parts of a larger form or by signing in a user
235
+ and revealing additional information.
236
+
237
+ To disable this behavior, give the opening link an `up-sticky` attribute:
167
238
 
168
239
  <a href="/settings" up-modal=".options" up-sticky>Settings</a>
169
240
 
241
+
170
242
  @method a[up-modal]
171
243
  @ujs
172
244
  @param [up-sticky]
245
+ @param [up-animation]
246
+ @param [up-height]
247
+ @param [up-width]
248
+ @param [up-history]
173
249
  ###
174
250
  up.on('click', 'a[up-modal]', (event, $link) ->
175
251
  event.preventDefault()
@@ -115,6 +115,7 @@ up.popup = (->
115
115
 
116
116
  @method up.popup.open
117
117
  @param {Element|jQuery|String} elementOrSelector
118
+ @param {String} [options.url]
118
119
  @param {String} [options.origin='bottom-right']
119
120
  @param {String} [options.animation]
120
121
  @param {Boolean} [options.sticky=false]
@@ -126,7 +127,7 @@ up.popup = (->
126
127
  $link = $(linkOrSelector)
127
128
 
128
129
  options = u.options(options)
129
- url = u.option($link.attr('href'))
130
+ url = u.option(options.url, $link.attr('href'))
130
131
  selector = u.option(options.target, $link.attr('up-popup'), 'body')
131
132
  origin = u.option(options.origin, $link.attr('up-origin'), config.origin)
132
133
  animation = u.option(options.animation, $link.attr('up-animation'), config.openAnimation)
@@ -262,6 +262,9 @@ up.util = (->
262
262
  isObject = (object) ->
263
263
  isHash(object) || (typeof object == 'function')
264
264
 
265
+ isElement = (object) ->
266
+ !!(object && object.nodeType == 1)
267
+
265
268
  isJQuery = (object) ->
266
269
  object instanceof jQuery
267
270
 
@@ -551,6 +554,11 @@ up.util = (->
551
554
  resolvedPromise = ->
552
555
  resolvedDeferred().promise()
553
556
 
557
+ nullJquery = ->
558
+ is: -> false
559
+ attr: ->
560
+ find: -> []
561
+
554
562
  resolvableWhen = (deferreds...) ->
555
563
  joined = $.when(deferreds...)
556
564
  joined.resolve = ->
@@ -630,6 +638,7 @@ up.util = (->
630
638
  isObject: isObject
631
639
  isFunction: isFunction
632
640
  isString: isString
641
+ isElement: isElement
633
642
  isJQuery: isJQuery
634
643
  isPromise: isPromise
635
644
  isDeferred: isDeferred
@@ -637,6 +646,7 @@ up.util = (->
637
646
  ifGiven: ifGiven
638
647
  isUnmodifiedKeyEvent: isUnmodifiedKeyEvent
639
648
  isUnmodifiedMouseEvent: isUnmodifiedMouseEvent
649
+ nullJquery: nullJquery
640
650
  unwrap: unwrap
641
651
  nextFrame: nextFrame
642
652
  measure: measure
@@ -1,5 +1,5 @@
1
1
  module Upjs
2
2
  module Rails
3
- VERSION = '0.4.3'
3
+ VERSION = '0.4.4'
4
4
  end
5
5
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- upjs-rails (0.4.1)
4
+ upjs-rails (0.4.2)
5
5
  rails (>= 3)
6
6
 
7
7
  GEM
@@ -8,7 +8,29 @@ describe 'up.modal', ->
8
8
 
9
9
  describe 'up.modal.open', ->
10
10
 
11
- it 'should have tests'
11
+ it "loads the given link's destination in a dialog window", (done) ->
12
+ jasmine.Ajax.install()
13
+ $link = affix('a[href="/path/to"][up-modal=".middle"]').text('link')
14
+ promise = up.modal.open($link)
15
+ request = jasmine.Ajax.requests.mostRecent()
16
+ expect(request.url).toMatch /\/path\/to$/
17
+ request.respondWith
18
+ status: 200
19
+ contentType: 'text/html'
20
+ responseText:
21
+ """
22
+ <div class="before">new-before</div>
23
+ <div class="middle">new-middle</div>
24
+ <div class="after">new-after</div>
25
+ """
26
+ promise.then ->
27
+ expect($('.up-modal')).toExist()
28
+ expect($('.up-modal-dialog')).toExist()
29
+ expect($('.up-modal-dialog .middle')).toExist()
30
+ expect($('.up-modal-dialog .middle')).toHaveText('new-middle')
31
+ expect($('.up-modal-dialog .before')).not.toExist()
32
+ expect($('.up-modal-dialog .after')).not.toExist()
33
+ done()
12
34
 
13
35
  describe 'up.modal.close', ->
14
36
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: upjs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-16 00:00:00.000000000 Z
11
+ date: 2015-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails