upjs-rails 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dc09b20d83f04c7aab8c11e39ee0eb4f7eb6f9e3
4
- data.tar.gz: 0f6e623d66e8d2bd8a5ec25aa906e3999eaf5cc3
3
+ metadata.gz: daa8399fa2cc832ee5539baa91ca77ffebf3d327
4
+ data.tar.gz: 82206c9b5bf483b6bd9284cc6168ebd2a0f4fa6b
5
5
  SHA512:
6
- metadata.gz: 0adae829accb44dd0fea004cd41bd27169a9c8cc33ea4cbb4ce9639bd81639506d617eb49206a11917b6e0851e9d2d9d1c2ff6b4ead30c987ea53d9aeaabfea6
7
- data.tar.gz: 688bf765d4cf1dde1aeb9193f17f41c253c9788b66c8e54cdb73ea1027102f4356c551d46c1aab5b161bf407ba4f3b88ca9d185d3ad6f56d94f88f9c3b8a98d7
6
+ metadata.gz: aa9ad36a2f58172a7c4e9d10487c628e5a831935ec9465b5e3b0970c8b9827156e7d66ce0134e99e95940cdc8c679bf1fbf6d3ed6d53a2becba09bff2520f9d0
7
+ data.tar.gz: 8f5eeba7bcd463dce586ac1a75d4140c214f21bc27f2a5709c0f196c476bf5c8ee0ad1a065343373e4c85de90eeda10d7acc0b08e4f8c42506ec13b7c8878eb2
data/dist/up.js CHANGED
@@ -25,7 +25,7 @@ If you use them in your own code, you will get hurt.
25
25
  var slice = [].slice;
26
26
 
27
27
  up.util = (function() {
28
- var $createElementFromSelector, ANIMATION_PROMISE_KEY, CONSOLE_PLACEHOLDERS, ajax, castsToFalse, castsToTrue, clientSize, compact, config, contains, copy, copyAttributes, createElement, createElementFromHtml, createSelectorFromElement, cssAnimate, debug, detect, each, endsWith, error, escapePressed, extend, findWithSelf, finishCssAnimate, forceCompositing, get, identity, ifGiven, isArray, isBlank, isDeferred, isDefined, isElement, isFunction, isGiven, isHash, isJQuery, isMissing, isNull, isObject, isPresent, isPromise, isStandardPort, isString, isUndefined, isUnmodifiedKeyEvent, isUnmodifiedMouseEvent, keys, last, locationFromXhr, map, measure, memoize, merge, methodFromXhr, nextFrame, normalizeMethod, normalizeUrl, nullJquery, once, only, option, options, prependGhost, presence, presentAttr, remove, resolvableWhen, resolvedDeferred, resolvedPromise, scrollbarWidth, select, setMissingAttrs, startsWith, stringifyConsoleArgs, temporaryCss, times, toArray, trim, unJquery, uniq, unwrapElement, warn;
28
+ var $createElementFromSelector, ANIMATION_PROMISE_KEY, CONSOLE_PLACEHOLDERS, ajax, castsToFalse, castsToTrue, clientSize, compact, config, contains, copy, copyAttributes, createElement, createElementFromHtml, createSelectorFromElement, cssAnimate, debug, detect, each, endsWith, error, escapePressed, extend, findWithSelf, finishCssAnimate, forceCompositing, get, identity, ifGiven, isArray, isBlank, isDeferred, isDefined, isElement, isFunction, isGiven, isHash, isJQuery, isMissing, isNull, isObject, isPresent, isPromise, isStandardPort, isString, isUndefined, isUnmodifiedKeyEvent, isUnmodifiedMouseEvent, keys, last, locationFromXhr, map, measure, memoize, merge, methodFromXhr, nextFrame, normalizeMethod, normalizeUrl, nullJquery, once, only, option, options, presence, presentAttr, remove, resolvableWhen, resolvedDeferred, resolvedPromise, scrollbarWidth, select, setMissingAttrs, startsWith, stringifyConsoleArgs, temporaryCss, times, toArray, trim, unJquery, uniq, unwrapElement, warn;
29
29
  memoize = function(func) {
30
30
  var cache, cached;
31
31
  cache = void 0;
@@ -676,23 +676,6 @@ If you use them in your own code, you will get hurt.
676
676
  }
677
677
  return results;
678
678
  };
679
- prependGhost = function($element) {
680
- var $ghost, dimensions;
681
- dimensions = measure($element, {
682
- relative: true,
683
- inner: true
684
- });
685
- $ghost = $element.clone();
686
- $ghost.find('script').remove();
687
- $ghost.css({
688
- right: '',
689
- bottom: '',
690
- position: 'absolute'
691
- });
692
- $ghost.css(dimensions);
693
- $ghost.addClass('up-ghost');
694
- return $ghost.insertBefore($element);
695
- };
696
679
  findWithSelf = function($element, selector) {
697
680
  return $element.find(selector).addBack(selector);
698
681
  };
@@ -893,7 +876,6 @@ If you use them in your own code, you will get hurt.
893
876
  cssAnimate: cssAnimate,
894
877
  finishCssAnimate: finishCssAnimate,
895
878
  forceCompositing: forceCompositing,
896
- prependGhost: prependGhost,
897
879
  escapePressed: escapePressed,
898
880
  copyAttributes: copyAttributes,
899
881
  findWithSelf: findWithSelf,
@@ -1245,10 +1227,10 @@ This modules contains functions to scroll the viewport and reveal contained elem
1245
1227
 
1246
1228
  The scrolling can (optionally) be animated.
1247
1229
 
1248
- up.scoll('.main', 100, {
1249
- easing: 'swing',
1250
- duration: 250
1251
- });
1230
+ up.scoll('.main', 100, {
1231
+ easing: 'swing',
1232
+ duration: 250
1233
+ });
1252
1234
 
1253
1235
  If the given viewport is already in a scroll animation when `up.scroll`
1254
1236
  is called a second time, the previous animation will instantly jump to the
@@ -1316,8 +1298,8 @@ This modules contains functions to scroll the viewport and reveal contained elem
1316
1298
  var $obstructor, anchorPosition;
1317
1299
  $obstructor = $(obstructor);
1318
1300
  anchorPosition = $obstructor.css(cssAttr);
1319
- if (!(anchorPosition === '0' || u.endsWith(anchorPosition, 'px'))) {
1320
- u.error("Fixed element must have an anchor position in px, but was %o", anchorPosition);
1301
+ if (!u.isPresent(anchorPosition)) {
1302
+ u.error("Fixed element %o must have a CSS attribute %o", $obstructor, cssAttr);
1321
1303
  }
1322
1304
  return parseInt(anchorPosition) + $obstructor.height();
1323
1305
  };
@@ -2475,7 +2457,7 @@ We need to work on this page:
2475
2457
 
2476
2458
  (function() {
2477
2459
  up.motion = (function() {
2478
- var GHOSTING_PROMISE_KEY, animate, animateOptions, animation, animations, assertIsDeferred, config, defaultAnimations, defaultTransitions, findAnimation, finish, finishGhosting, morph, none, reset, resolvableWhen, snapshot, transition, transitions, u, withGhosts;
2460
+ var GHOSTING_PROMISE_KEY, animate, animateOptions, animation, animations, assertIsDeferred, config, defaultAnimations, defaultTransitions, findAnimation, finish, finishGhosting, morph, none, prependGhost, reset, resolvableWhen, snapshot, transition, transitions, u, withGhosts;
2479
2461
  u = up.util;
2480
2462
  animations = {};
2481
2463
  defaultAnimations = {};
@@ -2609,18 +2591,20 @@ We need to work on this page:
2609
2591
  };
2610
2592
  GHOSTING_PROMISE_KEY = 'up-ghosting-promise';
2611
2593
  withGhosts = function($old, $new, block) {
2612
- var $newGhost, $oldGhost, promise, showNew;
2613
- $oldGhost = null;
2614
- $newGhost = null;
2594
+ var newCopy, oldCopy, promise, showNew;
2595
+ oldCopy = null;
2596
+ newCopy = null;
2615
2597
  u.temporaryCss($new, {
2616
2598
  display: 'none'
2617
2599
  }, function() {
2618
- return $oldGhost = u.prependGhost($old).addClass('up-destroying');
2600
+ oldCopy = prependGhost($old);
2601
+ oldCopy.$ghost.addClass('up-destroying');
2602
+ return oldCopy.$bounds.addClass('up-destroying');
2619
2603
  });
2620
2604
  u.temporaryCss($old, {
2621
2605
  display: 'none'
2622
2606
  }, function() {
2623
- return $newGhost = u.prependGhost($new);
2607
+ return newCopy = prependGhost($new);
2624
2608
  });
2625
2609
  $old.css({
2626
2610
  visibility: 'hidden'
@@ -2628,14 +2612,14 @@ We need to work on this page:
2628
2612
  showNew = u.temporaryCss($new, {
2629
2613
  display: 'none'
2630
2614
  });
2631
- promise = block($oldGhost, $newGhost);
2615
+ promise = block(oldCopy.$ghost, newCopy.$ghost);
2632
2616
  $old.data(GHOSTING_PROMISE_KEY, promise);
2633
2617
  $new.data(GHOSTING_PROMISE_KEY, promise);
2634
2618
  promise.then(function() {
2635
2619
  $old.removeData(GHOSTING_PROMISE_KEY);
2636
2620
  $new.removeData(GHOSTING_PROMISE_KEY);
2637
- $oldGhost.remove();
2638
- $newGhost.remove();
2621
+ oldCopy.$bounds.remove();
2622
+ newCopy.$bounds.remove();
2639
2623
  $old.css({
2640
2624
  display: 'none'
2641
2625
  });
@@ -2750,6 +2734,46 @@ We need to work on this page:
2750
2734
  }
2751
2735
  };
2752
2736
 
2737
+ /**
2738
+ @private
2739
+ */
2740
+ prependGhost = function($element) {
2741
+ var $bounds, $ghost, diff, elementDims;
2742
+ elementDims = u.measure($element, {
2743
+ relative: true,
2744
+ inner: true
2745
+ });
2746
+ $ghost = $element.clone();
2747
+ $ghost.find('script').remove();
2748
+ $ghost.css({
2749
+ position: $element.css('position') === 'static' ? 'static' : 'relative',
2750
+ top: '',
2751
+ right: '',
2752
+ bottom: '',
2753
+ left: '',
2754
+ width: '100%',
2755
+ height: '100%'
2756
+ });
2757
+ $ghost.addClass('up-ghost');
2758
+ $bounds = $('<div class="up-bounds"></div>');
2759
+ $bounds.css({
2760
+ position: 'absolute'
2761
+ });
2762
+ $bounds.css(elementDims);
2763
+ $ghost.appendTo($bounds);
2764
+ $bounds.insertBefore($element);
2765
+ diff = $ghost.offset().top - $element.offset().top;
2766
+ if (diff !== 0) {
2767
+ $bounds.css({
2768
+ top: elementDims.top - diff
2769
+ });
2770
+ }
2771
+ return {
2772
+ $ghost: $ghost,
2773
+ $bounds: $bounds
2774
+ };
2775
+ };
2776
+
2753
2777
  /**
2754
2778
  Defines a named transition.
2755
2779
 
@@ -2987,7 +3011,8 @@ We need to work on this page:
2987
3011
  animation: animation,
2988
3012
  defaults: config.update,
2989
3013
  none: none,
2990
- when: resolvableWhen
3014
+ when: resolvableWhen,
3015
+ prependGhost: prependGhost
2991
3016
  };
2992
3017
  })();
2993
3018
 
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,O,U,F,M,z,W,j,N,I,L,q,H,J,G,B,R,X,K,Q,V,_,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,Pn,An,Dn,On,Un;return nn=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))}},P=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)},B=function(t,n){return(""===n||"80"===n)&&"http:"===t||"443"===n&&"https:"===t},an=function(t,n){var e,r,o;return e=null,R(t)?(e=$("<a>").attr({href:t}).get(0),U(e.hostname)&&(e.href=e.href)):e=An(t),r=e.protocol+"//"+e.hostname,B(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},un=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),J(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)))},Un=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)))},k=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=Cn(e),n=mn($(".up-error"))||$('<div class="up-error"></div>').prependTo("body"),n.addClass("up-error"),n.text(r),new Error(r)},r=/\%[odisf]/g,Cn=function(t){var n,e,o;return o=t[0],n=0,e=50,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='"'+r+'"'):"number"===o?r=r.toString():(r=JSON.stringify(r),r.length>e&&(r=r.substr(0,e)+"\u2026")),r})},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)},C=$.extend,Pn=$.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},Y=b,A=function(t){return t},En=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},q=function(t){return null===t},X=function(t){return void 0===t},M=function(t){return!X(t)},L=function(t){return X(t)||q(t)},j=function(t){return!L(t)},U=function(t){return L(t)||H(t)&&0===V(t).length||0===t.length},mn=function(t,n){return null==n&&(n=J),n(t)?t:null},J=function(t){return!U(t)},W=function(t){return"function"==typeof t},R=function(t){return"string"==typeof t},N=function(t){return"object"==typeof t&&!!t},H=function(t){return N(t)||"function"==typeof t},z=function(t){return!(!t||1!==t.nodeType)},I=function(t){return t instanceof jQuery},G=function(t){return H(t)&&W(t.then)},F=function(t){return G(t)&&W(t.resolve)},D=function(t){return j(t)?t:void 0},O=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},Sn=function(t){return Array.prototype.slice.call(t)},p=function(t){return O(t)?t.slice():C({},t)},An=function(t){return I(t)?t.get(0):t},en=function(t,n){return C(p(t),n)},fn=function(t,n){var e,r,o,u;if(o=t?p(t):{},n)for(r in n)e=n[r],u=o[r],j(u)?H(e)&&H(u)&&(o[r]=fn(u,e)):o[r]=e;return o},pn=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,W(i)&&(i=i()),j(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 kn(t,j)},Dn=function(t){var n;return n={},kn(t,function(t){return n.hasOwnProperty(t)?!1:n[t]=!0})},kn=function(t,n){var e;return e=[],b(t,function(t){return n(t)?e.push(t):void 0}),e},hn=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,J)},on=function(t){return setTimeout(t,0)},_=function(t){return t[t.length-1]},a=function(){var t;return t=document.documentElement,{width:t.clientWidth,height:t.clientHeight}},wn=nn(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}),ln=function(t){var n;return n=void 0,function(){return null!=t&&(n=t()),t=void 0,n}},Tn=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()):ln(r)},S=function(t){var n,e;return e=t.css(["transform","-webkit-transform"]),U(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=fn(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=S(o),l=Tn(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),bn())},e="up-animation-promise",E=function(t){return $(t).each(function(){var t;return(t=$(this).data(e))?t.resolve():void 0})},tn=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},dn=function(t){var n,e;return e=tn(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)},T=function(t,n){return t.find(n).addBack(n)},x=function(t){return 27===t.keyCode},xn=function(t,n){return 0===t.indexOf(n)},w=function(t,n){return t.indexOf(n)===t.length-n.length},c=function(t,n){return t.indexOf(n)>=0},i=function(t){return"true"===String(t)},u=function(t){return"false"===String(t)},Z=function(t){return t.getResponseHeader("X-Up-Location")},rn=function(t){return t.getResponseHeader("X-Up-Method")},cn=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},K=function(t){return!(t.metaKey||t.shiftKey||t.ctrlKey)},Q=function(t){var n;return n=X(t.button)||0===t.button,n&&K(t)},yn=function(){var t;return t=$.Deferred(),t.resolve(),t},bn=function(){return yn().promise()},sn=function(){return{is:function(){return!1},attr:function(){},find:function(){return[]}}},gn=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},$n=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},vn=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=p(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(n){var r,o;null==n&&(n={});for(r in n)o=n[r],t.hasOwnProperty(r)?e[r]=o:k("Unknown setting %o",r);return e}},n=Object.getOwnPropertyNames(e),e.reset(),e},On=function(t){var n,e;return t=An(t),n=t.parentNode,e=Sn(t.childNodes),b(e,function(e){return n.insertBefore(e,t)}),n.removeChild(t)},{presentAttr:hn,createElement:d,normalizeUrl:an,normalizeMethod:un,createElementFromHtml:m,$createElementFromSelector:n,createSelectorFromElement:h,get:P,ajax:o,extend:C,copy:p,merge:en,options:fn,option:pn,error:k,debug:g,warn:Un,each:b,map:Y,identity:A,times:En,detect:y,select:kn,compact:s,uniq:Dn,last:_,isNull:q,isDefined:M,isUndefined:X,isGiven:j,isMissing:L,isPresent:J,isBlank:U,presence:mn,isObject:H,isFunction:W,isString:R,isElement:z,isJQuery:I,isPromise:G,isDeferred:F,isHash:N,ifGiven:D,isUnmodifiedKeyEvent:K,isUnmodifiedMouseEvent:Q,nullJquery:sn,unJquery:An,nextFrame:on,measure:tn,temporaryCss:Tn,cssAnimate:v,finishCssAnimate:E,forceCompositing:S,prependGhost:dn,escapePressed:x,copyAttributes:f,findWithSelf:T,contains:c,startsWith:xn,endsWith:w,isArray:O,toArray:Sn,castsToTrue:i,castsToFalse:u,locationFromXhr:Z,methodFromXhr:rn,clientSize:a,only:cn,trim:Pn,keys:V,resolvedPromise:bn,resolvedDeferred:yn,resolvableWhen:gn,setMissingAttrs:$n,remove:vn,memoize:nn,scrollbarWidth:wn,config:l,unwrapElement:On}}()}.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(){var t=[].slice;up.layout=function(){var n,e,r,o,u,i,a,s,l;return l=up.util,e=l.config({duration:0,viewport:"body, .up-modal, [up-viewport]",fixedTop:"[up-fixed~=top]",fixedBottom:"[up-fixed~=bottom]",snap:50,easing:"swing"}),i=function(){return e.reset()},n="up-scroll-promise",s=function(t,r,u){var i,a,s,c,p;return i=$(t),u=l.options(u),s=l.option(u.duration,e.duration),c=l.option(u.easing,e.easing),o(i),s>0?(a=$.Deferred(),i.data(n,a),a.then(function(){return i.removeData(n),i.finish()}),p={scrollTop:r},i.animate(p,{duration:s,easing:c,complete:function(){return a.resolve()}}),a):(i.scrollTop(r),l.resolvedDeferred())},o=function(t){return $(t).each(function(){var t;return(t=$(this).data(n))?t.resolve():void 0})},u=function(){var n,r,o,u;return o=function(t,n){var e,r;return e=$(t),r=e.css(n),"0"===r||l.endsWith(r,"px")||l.error("Fixed element must have an anchor position in px, but was %o",r),parseInt(r)+e.height()},r=function(){var t,n,r,i;for(r=$(e.fixedTop),i=[],t=0,n=r.length;n>t;t++)u=r[t],i.push(o(u,"top"));return i}(),n=function(){var t,n,r,i;for(r=$(e.fixedBottom),i=[],t=0,n=r.length;n>t;t++)u=r[t],i.push(o(u,"bottom"));return i}(),{top:Math.max.apply(Math,[0].concat(t.call(r))),bottom:Math.max.apply(Math,[0].concat(t.call(n)))}},a=function(t,n){var o,i,a,c,p,f,d,m,h,v,g,y,b,w;return n=l.options(n),o=$(t),i=r(o,n.viewport),y=l.option(n.snap,e.snap),w=i.is("body"),b=w?l.clientSize().height:i.height(),h=i.scrollTop(),f=h,m=void 0,d=void 0,w?(d=u(),m=0):(d={top:0,bottom:0},m=h),v=function(){return f+d.top},g=function(){return f+b-d.bottom-1},a=l.measure(o,{relative:!0}),c=a.top+m,p=c+a.height-1,p>g()&&(f+=p-g()),c<v()&&(f=c-d.top),y>f&&(f=0),f!==h?s(i,f,n):l.resolvedDeferred()},r=function(t,n){var r,o;return r=void 0,l.isJQuery(n)?r=n:(o=l.presence(n)||e.viewport,r=t.closest(o)),r.length||l.error("Could not find viewport for %o",t),r},up.bus.on("framework:reset",i),{reveal:a,scroll:s,finishScrolling:o,defaults:e.update}}(),up.scroll=up.layout.scroll,up.reveal=up.layout.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;return g=up.util,m=function(t,n){var e;return e=$(t),g.isPresent(n)&&(n=g.normalizeUrl(n)),e.attr("up-source",n)},h=function(t){var n;return n=$(t).closest("[up-source]"),g.presence(n.attr("up-source"))||up.browser.url()},p=function(t,n,e){var r,o,u;return e=g.options(e),u=g.presence(t)?t:g.createSelectorFromElement($(t)),up.browser.canPushState()||g.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=g.locationFromXhr(a))&&(g.debug("Location from server: %o",s),l={url:s,method:g.methodFromXhr(a),selector:u},up.proxy.alias(o,l),n=s),(g.isMissing(e.history)||g.castsToTrue(e.history))&&(e.history=n),(g.isMissing(e.source)||g.castsToTrue(e.source))&&(e.source=n),e.preload?void 0:i(u,t,e)}),r.fail(g.error),r):(e.preload||up.browser.loadPage(n,g.only(e,"method")),g.resolvedPromise())},i=function(t,n,e){var o,u,i,a,c,p,f,d;for(e=g.options(e,{historyMethod:"push"}),g.castsToFalse(e.history)&&(e.history=null),g.castsToFalse(e.scroll)&&(e.scroll=!1),e.source=g.option(e.source,e.history),p=l(n),e.title||(e.title=p.title()),c=s(t,e),f=[],i=0,a=c.length;a>i;i++)d=c[i],u=r(d.selector),o=p.find(d.selector).first(),f.push(v(u,o,d.pseudoClass,d.transition,e));return f},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)"),g.error(n,t)},l=function(t){var n;return n=g.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):g.error("Could not find selector %o in response %o",e,t)}}},d=function(t,n){var e;return e=n.scroll,e!==!1?up.reveal(t,{viewport:e}):g.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)),m(n,e.source),t(n),up.ready(n)},v=function(t,r,o,u,i){var a,s;return u||(u="none"),up.motion.finish(t),o?(s="before"===o?"prepend":"append",a=r.contents().wrap('<span class="up-insertion"></span>').parent(),t[s](a),g.copyAttributes(r,t),e(a.children(),i),d(a,i).then(function(){return up.animate(a,u,i)}).then(function(){g.unwrapElement(a)})):d(t,i).then(function(){return n(t,{animation:function(){return r.insertBefore(t),e(r,i),t.is("body")&&"none"!==u&&g.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),g.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]||g.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=g.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=g.options(n,{animation:"none"}),r=up.motion.animateOptions(n),e.addClass("up-destroying"),g.isPresent(n.url)&&up.history.push(n.url),g.isPresent(n.title)&&(document.title=n.title),up.bus.emit("fragment:destroy",e),o=g.presence(n.animation,g.isPromise)||up.motion.animate(e,n.animation,r),o.then(function(){return e.remove()}),o},c=function(t,n){var e;return n=g.options(n,{cache:!1}),e=n.url||h(t),p(t,e,n)},f=function(){return up.bus.emit("framework:reset")},up.bus.on("app:ready",function(){return m(document.body,up.browser.url())}),{replace:p,reload:c,destroy:n,implant:i,reset:f,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){var e;return n=u.options(n),e=u.option(n.target,"body"),up.replace(e,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;
2
- 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);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,c,p;for(s=[],i=["href","up-href","up-alias"],e=0,o=i.length;o>e;e++)if(n=i[e],c=m.presentAttr(t,n))for(p="up-alias"===n?c.split(" "):[c],r=0,u=p.length;u>r;r++)a=p[r],"#"!==a&&(a=l(a),s.push(a));return s},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);
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,S,E,P,A,D,O,U,F,M,z,j,W,N,I,L,q,H,J,B,R,X,G,K,Q,V,_,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,Sn,En,Pn,An,Dn,On;return nn=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))}},P=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)},R=function(t,n){return(""===n||"80"===n)&&"http:"===t||"443"===n&&"https:"===t},an=function(t,n){var e,r,o;return e=null,X(t)?(e=$("<a>").attr({href:t}).get(0),U(e.hostname)&&(e.href=e.href)):e=Pn(t),r=e.protocol+"//"+e.hostname,R(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},un=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),J(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)))},On=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)))},k=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=xn(e),n=dn($(".up-error"))||$('<div class="up-error"></div>').prependTo("body"),n.addClass("up-error"),n.text(r),new Error(r)},r=/\%[odisf]/g,xn=function(t){var n,e,o;return o=t[0],n=0,e=50,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='"'+r+'"'):"number"===o?r=r.toString():(r=JSON.stringify(r),r.length>e&&(r=r.substr(0,e)+"\u2026")),r})},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)},C=$.extend,En=$.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},Y=b,A=function(t){return t},Tn=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},q=function(t){return null===t},G=function(t){return void 0===t},M=function(t){return!G(t)},L=function(t){return G(t)||q(t)},W=function(t){return!L(t)},U=function(t){return L(t)||H(t)&&0===V(t).length||0===t.length},dn=function(t,n){return null==n&&(n=J),n(t)?t:null},J=function(t){return!U(t)},j=function(t){return"function"==typeof t},X=function(t){return"string"==typeof t},N=function(t){return"object"==typeof t&&!!t},H=function(t){return N(t)||"function"==typeof t},z=function(t){return!(!t||1!==t.nodeType)},I=function(t){return t instanceof jQuery},B=function(t){return H(t)&&j(t.then)},F=function(t){return B(t)&&j(t.resolve)},D=function(t){return W(t)?t:void 0},O=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},Sn=function(t){return Array.prototype.slice.call(t)},p=function(t){return O(t)?t.slice():C({},t)},Pn=function(t){return I(t)?t.get(0):t},en=function(t,n){return C(p(t),n)},fn=function(t,n){var e,r,o,u;if(o=t?p(t):{},n)for(r in n)e=n[r],u=o[r],W(u)?H(e)&&H(u)&&(o[r]=fn(u,e)):o[r]=e;return o},pn=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,j(i)&&(i=i()),W(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 wn(t,W)},An=function(t){var n;return n={},wn(t,function(t){return n.hasOwnProperty(t)?!1:n[t]=!0})},wn=function(t,n){var e;return e=[],b(t,function(t){return n(t)?e.push(t):void 0}),e},mn=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,J)},on=function(t){return setTimeout(t,0)},_=function(t){return t[t.length-1]},a=function(){var t;return t=document.documentElement,{width:t.clientWidth,height:t.clientHeight}},bn=nn(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}),ln=function(t){var n;return n=void 0,function(){return null!=t&&(n=t()),t=void 0,n}},Cn=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()):ln(r)},E=function(t){var n,e;return e=t.css(["transform","-webkit-transform"]),U(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=fn(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=Cn(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),yn())},e="up-animation-promise",S=function(t){return $(t).each(function(){var t;return(t=$(this).data(e))?t.resolve():void 0})},tn=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},T=function(t,n){return t.find(n).addBack(n)},x=function(t){return 27===t.keyCode},$n=function(t,n){return 0===t.indexOf(n)},w=function(t,n){return t.indexOf(n)===t.length-n.length},c=function(t,n){return t.indexOf(n)>=0},i=function(t){return"true"===String(t)},u=function(t){return"false"===String(t)},Z=function(t){return t.getResponseHeader("X-Up-Location")},rn=function(t){return t.getResponseHeader("X-Up-Method")},cn=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},K=function(t){return!(t.metaKey||t.shiftKey||t.ctrlKey)},Q=function(t){var n;return n=G(t.button)||0===t.button,n&&K(t)},gn=function(){var t;return t=$.Deferred(),t.resolve(),t},yn=function(){return gn().promise()},sn=function(){return{is:function(){return!1},attr:function(){},find:function(){return[]}}},vn=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},kn=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},hn=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=p(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(n){var r,o;null==n&&(n={});for(r in n)o=n[r],t.hasOwnProperty(r)?e[r]=o:k("Unknown setting %o",r);return e}},n=Object.getOwnPropertyNames(e),e.reset(),e},Dn=function(t){var n,e;return t=Pn(t),n=t.parentNode,e=Sn(t.childNodes),b(e,function(e){return n.insertBefore(e,t)}),n.removeChild(t)},{presentAttr:mn,createElement:d,normalizeUrl:an,normalizeMethod:un,createElementFromHtml:m,$createElementFromSelector:n,createSelectorFromElement:h,get:P,ajax:o,extend:C,copy:p,merge:en,options:fn,option:pn,error:k,debug:g,warn:On,each:b,map:Y,identity:A,times:Tn,detect:y,select:wn,compact:s,uniq:An,last:_,isNull:q,isDefined:M,isUndefined:G,isGiven:W,isMissing:L,isPresent:J,isBlank:U,presence:dn,isObject:H,isFunction:j,isString:X,isElement:z,isJQuery:I,isPromise:B,isDeferred:F,isHash:N,ifGiven:D,isUnmodifiedKeyEvent:K,isUnmodifiedMouseEvent:Q,nullJquery:sn,unJquery:Pn,nextFrame:on,measure:tn,temporaryCss:Cn,cssAnimate:v,finishCssAnimate:S,forceCompositing:E,escapePressed:x,copyAttributes:f,findWithSelf:T,contains:c,startsWith:$n,endsWith:w,isArray:O,toArray:Sn,castsToTrue:i,castsToFalse:u,locationFromXhr:Z,methodFromXhr:rn,clientSize:a,only:cn,trim:En,keys:V,resolvedPromise:yn,resolvedDeferred:gn,resolvableWhen:vn,setMissingAttrs:kn,remove:hn,memoize:nn,scrollbarWidth:bn,config:l,unwrapElement:Dn}}()}.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(){var t=[].slice;up.layout=function(){var n,e,r,o,u,i,a,s,l;return l=up.util,e=l.config({duration:0,viewport:"body, .up-modal, [up-viewport]",fixedTop:"[up-fixed~=top]",fixedBottom:"[up-fixed~=bottom]",snap:50,easing:"swing"}),i=function(){return e.reset()},n="up-scroll-promise",s=function(t,r,u){var i,a,s,c,p;return i=$(t),u=l.options(u),s=l.option(u.duration,e.duration),c=l.option(u.easing,e.easing),o(i),s>0?(a=$.Deferred(),i.data(n,a),a.then(function(){return i.removeData(n),i.finish()}),p={scrollTop:r},i.animate(p,{duration:s,easing:c,complete:function(){return a.resolve()}}),a):(i.scrollTop(r),l.resolvedDeferred())},o=function(t){return $(t).each(function(){var t;return(t=$(this).data(n))?t.resolve():void 0})},u=function(){var n,r,o,u;return o=function(t,n){var e,r;return e=$(t),r=e.css(n),l.isPresent(r)||l.error("Fixed element %o must have a CSS attribute %o",e,n),parseInt(r)+e.height()},r=function(){var t,n,r,i;for(r=$(e.fixedTop),i=[],t=0,n=r.length;n>t;t++)u=r[t],i.push(o(u,"top"));return i}(),n=function(){var t,n,r,i;for(r=$(e.fixedBottom),i=[],t=0,n=r.length;n>t;t++)u=r[t],i.push(o(u,"bottom"));return i}(),{top:Math.max.apply(Math,[0].concat(t.call(r))),bottom:Math.max.apply(Math,[0].concat(t.call(n)))}},a=function(t,n){var o,i,a,c,p,f,d,m,h,v,g,y,b,w;return n=l.options(n),o=$(t),i=r(o,n.viewport),y=l.option(n.snap,e.snap),w=i.is("body"),b=w?l.clientSize().height:i.height(),h=i.scrollTop(),f=h,m=void 0,d=void 0,w?(d=u(),m=0):(d={top:0,bottom:0},m=h),v=function(){return f+d.top},g=function(){return f+b-d.bottom-1},a=l.measure(o,{relative:!0}),c=a.top+m,p=c+a.height-1,p>g()&&(f+=p-g()),c<v()&&(f=c-d.top),y>f&&(f=0),f!==h?s(i,f,n):l.resolvedDeferred()},r=function(t,n){var r,o;return r=void 0,l.isJQuery(n)?r=n:(o=l.presence(n)||e.viewport,r=t.closest(o)),r.length||l.error("Could not find viewport for %o",t),r},up.bus.on("framework:reset",i),{reveal:a,scroll:s,finishScrolling:o,defaults:e.update}}(),up.scroll=up.layout.scroll,up.reveal=up.layout.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;return g=up.util,m=function(t,n){var e;return e=$(t),g.isPresent(n)&&(n=g.normalizeUrl(n)),e.attr("up-source",n)},h=function(t){var n;return n=$(t).closest("[up-source]"),g.presence(n.attr("up-source"))||up.browser.url()},p=function(t,n,e){var r,o,u;return e=g.options(e),u=g.presence(t)?t:g.createSelectorFromElement($(t)),up.browser.canPushState()||g.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=g.locationFromXhr(a))&&(g.debug("Location from server: %o",s),l={url:s,method:g.methodFromXhr(a),selector:u},up.proxy.alias(o,l),n=s),(g.isMissing(e.history)||g.castsToTrue(e.history))&&(e.history=n),(g.isMissing(e.source)||g.castsToTrue(e.source))&&(e.source=n),e.preload?void 0:i(u,t,e)}),r.fail(g.error),r):(e.preload||up.browser.loadPage(n,g.only(e,"method")),g.resolvedPromise())},i=function(t,n,e){var o,u,i,a,c,p,f,d;for(e=g.options(e,{historyMethod:"push"}),g.castsToFalse(e.history)&&(e.history=null),g.castsToFalse(e.scroll)&&(e.scroll=!1),e.source=g.option(e.source,e.history),p=l(n),e.title||(e.title=p.title()),c=s(t,e),f=[],i=0,a=c.length;a>i;i++)d=c[i],u=r(d.selector),o=p.find(d.selector).first(),f.push(v(u,o,d.pseudoClass,d.transition,e));return f},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)"),g.error(n,t)},l=function(t){var n;return n=g.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):g.error("Could not find selector %o in response %o",e,t)}}},d=function(t,n){var e;return e=n.scroll,e!==!1?up.reveal(t,{viewport:e}):g.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)),m(n,e.source),t(n),up.ready(n)},v=function(t,r,o,u,i){var a,s;return u||(u="none"),up.motion.finish(t),o?(s="before"===o?"prepend":"append",a=r.contents().wrap('<span class="up-insertion"></span>').parent(),t[s](a),g.copyAttributes(r,t),e(a.children(),i),d(a,i).then(function(){return up.animate(a,u,i)}).then(function(){g.unwrapElement(a)})):d(t,i).then(function(){return n(t,{animation:function(){return r.insertBefore(t),e(r,i),t.is("body")&&"none"!==u&&g.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),g.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]||g.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=g.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=g.options(n,{animation:"none"}),r=up.motion.animateOptions(n),e.addClass("up-destroying"),g.isPresent(n.url)&&up.history.push(n.url),g.isPresent(n.title)&&(document.title=n.title),up.bus.emit("fragment:destroy",e),o=g.presence(n.animation,g.isPromise)||up.motion.animate(e,n.animation,r),o.then(function(){return e.remove()}),o},c=function(t,n){var e;return n=g.options(n,{cache:!1}),e=n.url||h(t),p(t,e,n)},f=function(){return up.bus.emit("framework:reset")},up.bus.on("app:ready",function(){return m(document.body,up.browser.url())}),{replace:p,reload:c,destroy:n,implant:i,reset:f,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=w.config({duration:300,delay:0,easing:"ease"}),h=function(){return o=w.copy(a),b=w.copy(s),i.reset()},n=function(t,r,o){var i;return i=$(t),c(i),o=e(o),w.isFunction(r)?u(r(i,o),r):w.isString(r)?n(i,l(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},l=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=m(n),u.$ghost.addClass("up-destroying"),u.$bounds.addClass("up-destroying")}),w.temporaryCss(n,{display:"none"},function(){return o=m(e)}),n.css({visibility:"hidden"}),a=w.temporaryCss(e,{display:"none"}),i=r(u.$ghost,o.$ghost),n.data(t,i),e.data(t,i),i.then(function(){return n.removeData(t),e.removeData(t),u.$bounds.remove(),o.$bounds.remove(),n.css({display:"none"}),a()}),i},c=function(t){return $(t).each(function(){var t;return t=$(this),w.finishCssAnimate(t),p(t)})},p=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)},f=function(t,r,i,a){var s,l,p,m,h;return up.browser.canCssAnimation()?(a=e(a),l=$(t),s=$(r),c(l),c(s),"none"===i?d():(h=w.presence(i,w.isFunction)||b[i])?k(l,s,function(t,n){return u(h(t,n,a),i)}):(p=o[i])?(l.hide(),n(s,p,a)):w.isString(i)&&i.indexOf("/")>=0?(m=i.split("/"),h=function(t,e,r){return v(n(t,m[0],r),n(e,m[1],r))},f(l,s,h,a)):w.error("Unknown transition %o",i)):w.resolvedDeferred()},m=function(t){var n,e,r,o;return o=w.measure(t,{relative:!0,inner:!0}),e=t.clone(),e.find("script").remove(),e.css({position:"static"===t.css("position")?"static":"relative",top:"",right:"",bottom:"",left:"",width:"100%",height:"100%"}),e.addClass("up-ghost"),n=$('<div class="up-bounds"></div>'),n.css({position:"absolute"}),n.css(o),e.appendTo(n),n.insertBefore(t),r=e.offset().top-t.offset().top,0!==r&&n.css({top:o.top-r}),{$ghost:e,$bounds:n}},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)},v=w.resolvableWhen,d=w.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=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",d),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:f,animate:n,animateOptions:e,finish:c,transition:y,animation:r,defaults:i.update,none:d,when:v,prependGhost:m}}(),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,S,E,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},E=function(){return a={},t=null,c(),l(),x=0,d.reset(),i=!1},E(),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 S(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},S=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",E),{preload:C,ajax:e,get:m,set:P,alias:r,clear:f,remove:S,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){var e;return n=u.options(n),e=u.option(n.target,"body"),up.replace(e,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)
2
+ }: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);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,c,p;for(s=[],i=["href","up-href","up-alias"],e=0,o=i.length;o>e;e++)if(n=i[e],c=m.presentAttr(t,n))for(p="up-alias"===n?c.split(" "):[c],r=0,u=p.length;u>r;r++)a=p[r],"#"!==a&&(a=l(a),s.push(a));return s},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);
@@ -50,10 +50,10 @@ up.layout = (->
50
50
 
51
51
  The scrolling can (optionally) be animated.
52
52
 
53
- up.scoll('.main', 100, {
54
- easing: 'swing',
55
- duration: 250
56
- });
53
+ up.scoll('.main', 100, {
54
+ easing: 'swing',
55
+ duration: 250
56
+ });
57
57
 
58
58
  If the given viewport is already in a scroll animation when `up.scroll`
59
59
  is called a second time, the previous animation will instantly jump to the
@@ -118,8 +118,8 @@ up.layout = (->
118
118
  measurePosition = (obstructor, cssAttr) ->
119
119
  $obstructor = $(obstructor)
120
120
  anchorPosition = $obstructor.css(cssAttr)
121
- unless anchorPosition == '0' or u.endsWith(anchorPosition, 'px')
122
- u.error("Fixed element must have an anchor position in px, but was %o", anchorPosition)
121
+ unless u.isPresent(anchorPosition)
122
+ u.error("Fixed element %o must have a CSS attribute %o", $obstructor, cssAttr)
123
123
  parseInt(anchorPosition) + $obstructor.height()
124
124
 
125
125
  fixedTopBottoms = for obstructor in $(config.fixedTop)
@@ -154,25 +154,28 @@ up.motion = (->
154
154
  GHOSTING_PROMISE_KEY = 'up-ghosting-promise'
155
155
 
156
156
  withGhosts = ($old, $new, block) ->
157
- $oldGhost = null
158
- $newGhost = null
157
+ oldCopy = null
158
+ newCopy = null
159
+
159
160
  u.temporaryCss $new, display: 'none', ->
160
- $oldGhost = u.prependGhost($old).addClass('up-destroying')
161
+ oldCopy = prependGhost($old)
162
+ oldCopy.$ghost.addClass('up-destroying')
163
+ oldCopy.$bounds.addClass('up-destroying')
161
164
  u.temporaryCss $old, display: 'none', ->
162
- $newGhost = u.prependGhost($new)
165
+ newCopy = prependGhost($new)
163
166
  # $old should take up space in the page flow until the transition ends
164
167
  $old.css(visibility: 'hidden')
165
168
 
166
169
  showNew = u.temporaryCss($new, display: 'none')
167
- promise = block($oldGhost, $newGhost)
170
+ promise = block(oldCopy.$ghost, newCopy.$ghost)
168
171
  $old.data(GHOSTING_PROMISE_KEY, promise)
169
172
  $new.data(GHOSTING_PROMISE_KEY, promise)
170
173
 
171
174
  promise.then ->
172
175
  $old.removeData(GHOSTING_PROMISE_KEY)
173
176
  $new.removeData(GHOSTING_PROMISE_KEY)
174
- $oldGhost.remove()
175
- $newGhost.remove()
177
+ oldCopy.$bounds.remove()
178
+ newCopy.$bounds.remove()
176
179
  # Now that the transition is over we show $new again.
177
180
  # Since we expect $old to be removed in a heartbeat,
178
181
  # $new should take up space
@@ -281,6 +284,42 @@ up.motion = (->
281
284
  # in ancient browsers
282
285
  u.resolvedDeferred()
283
286
 
287
+ ###*
288
+ @private
289
+ ###
290
+ prependGhost = ($element) ->
291
+ elementDims = u.measure($element, relative: true, inner: true)
292
+
293
+ $ghost = $element.clone()
294
+ $ghost.find('script').remove()
295
+ $ghost.css
296
+ position: if $element.css('position') == 'static' then 'static' else 'relative'
297
+ top: ''
298
+ right: ''
299
+ bottom: ''
300
+ left: ''
301
+ width: '100%'
302
+ height: '100%'
303
+ $ghost.addClass('up-ghost')
304
+
305
+ # Wrap the ghost in another container so its margin can expand
306
+ # freely. If we would position the element directly (old implementation),
307
+ # it would gain a layout context which cannot be crossed by margins.
308
+ $bounds = $('<div class="up-bounds"></div>')
309
+ $bounds.css(position: 'absolute')
310
+ $bounds.css(elementDims)
311
+
312
+ $ghost.appendTo($bounds)
313
+ $bounds.insertBefore($element)
314
+
315
+ # Make sure that we don't shift a child element with margins
316
+ # that can no longer collapse against a previous sibling
317
+ diff = $ghost.offset().top - $element.offset().top
318
+ $bounds.css(top: elementDims.top - diff) if diff != 0
319
+
320
+ $ghost: $ghost
321
+ $bounds: $bounds
322
+
284
323
  ###*
285
324
  Defines a named transition.
286
325
 
@@ -500,6 +539,7 @@ up.motion = (->
500
539
  defaults: config.update
501
540
  none: none
502
541
  when: resolvableWhen
542
+ prependGhost: prependGhost
503
543
 
504
544
  )()
505
545
 
@@ -544,20 +544,6 @@ up.util = (->
544
544
  if attr.specified
545
545
  $target.attr(attr.name, attr.value)
546
546
 
547
- prependGhost = ($element) ->
548
- dimensions = measure($element, relative: true, inner: true)
549
- $ghost = $element.clone()
550
- $ghost.find('script').remove()
551
- $ghost.css
552
- right: ''
553
- bottom: ''
554
- # margin: 0
555
- position: 'absolute'
556
- $ghost.css(dimensions)
557
- $ghost.addClass('up-ghost')
558
- $ghost.insertBefore($element)
559
- # $ghost.prependTo(document.body)
560
-
561
547
  findWithSelf = ($element, selector) ->
562
548
  $element.find(selector).addBack(selector)
563
549
 
@@ -711,7 +697,6 @@ up.util = (->
711
697
  cssAnimate: cssAnimate
712
698
  finishCssAnimate: finishCssAnimate
713
699
  forceCompositing: forceCompositing
714
- prependGhost: prependGhost
715
700
  escapePressed: escapePressed
716
701
  copyAttributes: copyAttributes
717
702
  findWithSelf: findWithSelf
@@ -1,5 +1,5 @@
1
1
  module Upjs
2
2
  module Rails
3
- VERSION = '0.9.0'
3
+ VERSION = '0.9.1'
4
4
  end
5
5
  end
@@ -63,11 +63,16 @@ describe 'up.motion', ->
63
63
  expect($oldGhost).toExist()
64
64
  expect($newGhost).toExist()
65
65
 
66
+ $oldBounds = $oldGhost.parent('.up-bounds')
67
+ $newBounds = $newGhost.parent('.up-bounds')
68
+ expect($oldBounds).toExist()
69
+ expect($newBounds).toExist()
70
+
66
71
  # Ghosts should be inserted before (not after) the element
67
72
  # or the browser scroll position will be too low after the
68
73
  # transition ends.
69
- expect($oldGhost.next()).toEqual($old)
70
- expect($newGhost.next()).toEqual($new)
74
+ expect($oldGhost.parent().next()).toEqual($old)
75
+ expect($newGhost.parent().next()).toEqual($new)
71
76
 
72
77
  # The actual elements are hidden, but $old will take up its original
73
78
  # space until the animation completes.
@@ -82,14 +87,14 @@ describe 'up.motion', ->
82
87
 
83
88
  # Ghosts will hover over $old and $new using absolute positioning,
84
89
  # matching the coordinates of the original elements.
85
- expect($oldGhost.css(['position', 'top', 'left', 'width', 'height'])).toEqual(
90
+ expect($oldBounds.css(['position', 'top', 'left', 'width', 'height'])).toEqual(
86
91
  position: 'absolute'
87
92
  top: '10px'
88
93
  left: '11px',
89
94
  width: '12px',
90
95
  height: '13px'
91
96
  )
92
- expect($newGhost.css(['position', 'top', 'left', 'width', 'height'])).toEqual(
97
+ expect($newBounds.css(['position', 'top', 'left', 'width', 'height'])).toEqual(
93
98
  position: 'absolute'
94
99
  top: '20px'
95
100
  left: '21px',
@@ -166,4 +171,46 @@ describe 'up.motion', ->
166
171
 
167
172
  it 'should have tests'
168
173
 
169
-
174
+ describe 'up.motion.prependGhost', ->
175
+
176
+ beforeEach ->
177
+ @$element = affix('.element')
178
+
179
+ afterEach ->
180
+ $('.up-bounds, .up-ghost').remove()
181
+
182
+ it 'clones the given element into a .up-ghost-bounds container and inserts it as a sibling before the element', ->
183
+ @$element.text('element text')
184
+ up.motion.prependGhost(@$element)
185
+ $bounds = @$element.prev()
186
+ expect($bounds).toExist()
187
+ expect($bounds).toHaveClass('up-bounds')
188
+ $ghost = $bounds.children(':first')# $ghost.find('.element')
189
+ expect($ghost).toExist()
190
+ expect($ghost).toHaveClass('element')
191
+ expect($ghost).toHaveText('element text')
192
+
193
+ it 'removes <script> tags from the cloned element', ->
194
+ $('<script></script>').appendTo(@$element)
195
+ up.motion.prependGhost(@$element)
196
+ $ghost = $('.up-ghost')
197
+ expect($ghost.find('script')).not.toExist()
198
+
199
+ it 'absolutely positions the ghost over the given element', ->
200
+ up.motion.prependGhost(@$element)
201
+ $ghost = $('.up-ghost')
202
+ expect($ghost.offset()).toEqual(@$element.offset())
203
+ expect($ghost.width()).toEqual(@$element.width())
204
+ expect($ghost.height()).toEqual(@$element.height())
205
+
206
+ it 'accurately positions the ghost over an element with margins', ->
207
+ @$element.css(margin: '40px')
208
+ up.motion.prependGhost(@$element)
209
+ $ghost = $('.up-ghost')
210
+ expect($ghost.offset()).toEqual(@$element.offset())
211
+
212
+ it "doesn't change the position of a child whose margins no longer collapse", ->
213
+ $child = $('<div class="child"></div>').css(margin: '40px').appendTo(@$element)
214
+ up.motion.prependGhost(@$element)
215
+ $clonedChild = $('.up-ghost .child')
216
+ expect($clonedChild.offset()).toEqual($child.offset())
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.9.0
4
+ version: 0.9.1
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-08-26 00:00:00.000000000 Z
11
+ date: 2015-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails