upjs-rails 0.8.1 → 0.8.2

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: ecc6be254f1153c1739bcf87f37a89b14fab0726
4
- data.tar.gz: 3b898c2a41c31f3c27a1279adb926d08bbe2a60a
3
+ metadata.gz: 1a8cf11326d2f0ca81fbed53af3ffd3d43762bde
4
+ data.tar.gz: 96caa5a3b6239a921f66c0d39fe237dc5bca2949
5
5
  SHA512:
6
- metadata.gz: 9b933e7d623752ef3fd92f36cc2e58c0c37b8a81d3b9bb93cd7015feee4155eacfa687744d11b70903aac98346ae8f094e2e35675ce0a39e476c2cec6b22382c
7
- data.tar.gz: 3376e6b16ac416328e5f3e24a3613f0d60b80071d93b3062b0822208a199112aa749acd1efc8fb546931c187d11ea42dfb3ba97da617b35ab560d5172099221a
6
+ metadata.gz: f3124e80cbab1474ac49621e5b127194316e7db2728b41ec1a453d88ec67242802c808abb70649feab5f4b626b9099c038913ae9fc062b424daa3073bb578136
7
+ data.tar.gz: 25abfbe06ad4e1a0689038ab20b8f0862b1f05bf8526b2064618e13065d9f603aac44a968eb59ec666ef9ab4b7ba61a44f999264eb8135ffd111acfaf61796a6
data/dist/up.js CHANGED
@@ -786,7 +786,7 @@ If you use them in your own code, you will get hurt.
786
786
  hash = {
787
787
  reset: function() {
788
788
  var j, key, len, ownKeys;
789
- ownKeys = Object.getOwnPropertyNames(hash);
789
+ ownKeys = copy(Object.getOwnPropertyNames(hash));
790
790
  for (j = 0, len = ownKeys.length; j < len; j++) {
791
791
  key = ownKeys[j];
792
792
  if (!contains(apiKeys, key)) {
@@ -796,7 +796,17 @@ If you use them in your own code, you will get hurt.
796
796
  return hash.update(copy(factoryOptions));
797
797
  },
798
798
  update: function(options) {
799
- return extend(hash, options);
799
+ var key, results, value;
800
+ results = [];
801
+ for (key in options) {
802
+ value = options[key];
803
+ if (factoryOptions.hasOwnProperty(key)) {
804
+ results.push(hash[key] = value);
805
+ } else {
806
+ results.push(error("Unknown setting %o", key));
807
+ }
808
+ }
809
+ return results;
800
810
  }
801
811
  };
802
812
  apiKeys = Object.getOwnPropertyNames(hash);
@@ -1156,24 +1166,30 @@ This modules contains functions to scroll the viewport and reveal contained elem
1156
1166
 
1157
1167
  By default Up.js will always scroll to an element before updating it.
1158
1168
 
1169
+ The container that will be scrolled is the closest parent of the element that is either:
1170
+
1171
+ - The currently open [modal](/up.modal)
1172
+ - An element with the attribute `[up-viewport]`
1173
+ - The `<body>` element
1174
+ - An element matching the selector you have configured using `up.viewport.defaults({ viewSelector: 'my-custom-selector' })`.
1175
+
1159
1176
  @class up.viewport
1160
1177
  */
1161
1178
 
1162
1179
  (function() {
1163
1180
  up.viewport = (function() {
1164
- var SCROLL_PROMISE_KEY, config, finishScrolling, reset, reveal, scroll, u;
1181
+ var SCROLL_PROMISE_KEY, config, findView, finishScrolling, reset, reveal, scroll, u;
1165
1182
  u = up.util;
1166
1183
 
1167
1184
  /**
1168
1185
  @method up.viewport.defaults
1169
1186
  @param {Number} [options.duration]
1170
1187
  @param {String} [options.easing]
1171
- @param {Number} [options.padding]
1172
- @param {String|Element|jQuery} [options.view]
1188
+ @param {String} [options.viewSelector]
1173
1189
  */
1174
1190
  config = u.config({
1175
1191
  duration: 0,
1176
- view: 'body',
1192
+ viewSelector: 'body, .up-modal, [up-viewport]',
1177
1193
  easing: 'swing'
1178
1194
  });
1179
1195
  reset = function() {
@@ -1190,7 +1206,7 @@ By default Up.js will always scroll to an element before updating it.
1190
1206
  @return {Deferred}
1191
1207
  @protected
1192
1208
  */
1193
- scroll = function(viewOrSelector, scrollPos, options) {
1209
+ scroll = function(viewOrSelector, scrollTop, options) {
1194
1210
  var $view, deferred, duration, easing, targetProps;
1195
1211
  $view = $(viewOrSelector);
1196
1212
  options = u.options(options);
@@ -1205,7 +1221,7 @@ By default Up.js will always scroll to an element before updating it.
1205
1221
  return $view.finish();
1206
1222
  });
1207
1223
  targetProps = {
1208
- scrollTop: scrollPos
1224
+ scrollTop: scrollTop
1209
1225
  };
1210
1226
  $view.animate(targetProps, {
1211
1227
  duration: duration,
@@ -1216,7 +1232,7 @@ By default Up.js will always scroll to an element before updating it.
1216
1232
  });
1217
1233
  return deferred;
1218
1234
  } else {
1219
- $view.scrollTop(scrollPos);
1235
+ $view.scrollTop(scrollTop);
1220
1236
  return u.resolvedDeferred();
1221
1237
  }
1222
1238
  };
@@ -1240,33 +1256,67 @@ By default Up.js will always scroll to an element before updating it.
1240
1256
  @param {String|Element|jQuery} [options.view]
1241
1257
  @param {Number} [options.duration]
1242
1258
  @param {String} [options.easing]
1243
- @param {Number} [options.padding]
1244
1259
  @return {Deferred}
1245
1260
  @protected
1246
1261
  */
1247
1262
  reveal = function(elementOrSelector, options) {
1248
- var $element, $view, elementTooHigh, elementTooLow, elementTop, firstVisibleRow, lastVisibleRow, padding, scrollPos, view, viewHeight;
1263
+ var $element, $view, elementDims, firstElementRow, firstVisibleRow, lastElementRow, lastVisibleRow, newScrollPos, offsetShift, originalScrollPos, viewHeight, viewIsBody;
1249
1264
  options = u.options(options);
1250
- view = u.option(options.view, config.view);
1251
- padding = u.option(options.padding, config.padding);
1252
1265
  $element = $(elementOrSelector);
1253
- $view = $(view);
1254
- viewHeight = $view.height();
1255
- scrollPos = $view.scrollTop();
1256
- firstVisibleRow = scrollPos;
1257
- lastVisibleRow = scrollPos + viewHeight;
1258
- elementTop = $element.position().top;
1259
- elementTooHigh = elementTop - padding < firstVisibleRow;
1260
- elementTooLow = elementTop > lastVisibleRow - padding;
1261
- if (elementTooHigh || elementTooLow) {
1262
- scrollPos = elementTop - padding;
1263
- scrollPos = Math.max(scrollPos, 0);
1264
- scrollPos = Math.min(scrollPos, viewHeight - 1);
1265
- return scroll($view, scrollPos, options);
1266
+ $view = findView($element, options.view);
1267
+ viewIsBody = $view.is('body');
1268
+ viewHeight = viewIsBody ? u.clientSize().height : $view.height();
1269
+ originalScrollPos = $view.scrollTop();
1270
+ newScrollPos = originalScrollPos;
1271
+ offsetShift = viewIsBody ? 0 : originalScrollPos;
1272
+ firstVisibleRow = function() {
1273
+ return newScrollPos;
1274
+ };
1275
+ lastVisibleRow = function() {
1276
+ return newScrollPos + viewHeight - 1;
1277
+ };
1278
+ elementDims = u.measure($element, {
1279
+ relative: true
1280
+ });
1281
+ firstElementRow = elementDims.top + offsetShift;
1282
+ lastElementRow = firstElementRow + elementDims.height - 1;
1283
+ if (lastElementRow > lastVisibleRow()) {
1284
+ newScrollPos += lastElementRow - lastVisibleRow();
1285
+ }
1286
+ if (firstElementRow < firstVisibleRow()) {
1287
+ newScrollPos = firstElementRow;
1288
+ }
1289
+ if (newScrollPos !== originalScrollPos) {
1290
+ return scroll($view, newScrollPos, options);
1266
1291
  } else {
1267
1292
  return u.resolvedDeferred();
1268
1293
  }
1269
1294
  };
1295
+
1296
+ /**
1297
+ @private
1298
+ @method up.viewport.findView
1299
+ */
1300
+ findView = function($element, viewSelectorOrElement) {
1301
+ var $view, viewSelector;
1302
+ $view = void 0;
1303
+ if (u.isJQuery(viewSelectorOrElement)) {
1304
+ $view = viewSelectorOrElement;
1305
+ } else {
1306
+ viewSelector = u.presence(viewSelectorOrElement) || config.viewSelector;
1307
+ $view = $element.closest(viewSelector);
1308
+ }
1309
+ $view.length || u.error("Could not find view to scroll for %o (tried selectors %o)", $element, viewSelectors);
1310
+ return $view;
1311
+ };
1312
+
1313
+ /**
1314
+ Marks this element as a scrolling container.
1315
+ Use this e.g. if your app uses a custom panel layout with fixed positioning
1316
+ instead of scrolling `<body>`.
1317
+
1318
+ @method [up-viewport]
1319
+ */
1270
1320
  up.bus.on('framework:reset', reset);
1271
1321
  return {
1272
1322
  reveal: reveal,
@@ -4178,7 +4228,7 @@ For small popup overlays ("dropdowns") see [up.popup](/up.popup) instead.
4178
4228
  @param {String|Function(config)} [options.template]
4179
4229
  A string containing the HTML structure of the modal.
4180
4230
  You can supply an alternative template string, but make sure that it
4181
- contains a containing tag with the class `up-modal`.
4231
+ defines tag with the classes `up-modal`, `up-modal-dialog` and `up-modal-content`.
4182
4232
 
4183
4233
  You can also supply a function that returns a HTML string.
4184
4234
  The function will be called with the modal options (merged from these defaults
@@ -4714,9 +4764,9 @@ by providing instant feedback for user interactions.
4714
4764
  /**
4715
4765
  Sets default options for this module.
4716
4766
 
4767
+ @method up.navigation.defaults
4717
4768
  @param {Number} [options.currentClass]
4718
4769
  The class to set on [links that point the current location](#up-current).
4719
- @method up.navigation.defaults
4720
4770
  */
4721
4771
  config = u.config({
4722
4772
  currentClass: 'up-current'
@@ -4754,20 +4804,23 @@ by providing instant feedback for user interactions.
4754
4804
  }
4755
4805
  };
4756
4806
  sectionUrls = function($section) {
4757
- var aliases, attr, i, len, ref, urls, value, values;
4807
+ var attr, i, j, len, len1, ref, url, urls, value, values;
4758
4808
  urls = [];
4759
- ref = ['href', 'up-href'];
4809
+ ref = ['href', 'up-href', 'up-alias'];
4760
4810
  for (i = 0, len = ref.length; i < len; i++) {
4761
4811
  attr = ref[i];
4762
4812
  if (value = u.presentAttr($section, attr)) {
4763
- urls.push(value);
4813
+ values = attr === 'up-alias' ? value.split(' ') : [value];
4814
+ for (j = 0, len1 = values.length; j < len1; j++) {
4815
+ url = values[j];
4816
+ if (url !== '#') {
4817
+ url = normalizeUrl(url);
4818
+ urls.push(url);
4819
+ }
4820
+ }
4764
4821
  }
4765
4822
  }
4766
- if (aliases = u.presentAttr($section, 'up-alias')) {
4767
- values = aliases.split(' ');
4768
- urls = urls.concat(values);
4769
- }
4770
- return urls.map(normalizeUrl);
4823
+ return urls;
4771
4824
  };
4772
4825
  urlSet = function(urls) {
4773
4826
  var doesMatchFully, doesMatchPrefix, matches, matchesAny;
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,j,W,L,N,I,H,q,G,J,R,X,K,V,B,_,Q,Z,Y,tn,nn,en,rn,on,un,an,sn,ln,cn,pn,fn,dn,mn,hn,vn,gn,yn,bn,wn,kn,$n,xn,Cn,Tn,En,Sn;return Z=function(n){var e,r;return e=void 0,r=!1,function(){var o;return o=1<=arguments.length?t.call(arguments,0):[],r?e:(r=!0,e=n.apply(null,o))}},S=function(t,n){return n=n||{},n.url=t,o(n)},o=function(t){return t.selector&&(t.headers={"X-Up-Selector":t.selector}),$.ajax(t)},G=function(t,n){return(""===n||"80"===n)&&"http:"===t||"443"===n&&"https:"===t},rn=function(t,n){var e,r,o;return e=null,J(t)?(e=$("<a>").attr({href:t}).get(0),D(e.hostname)&&(e.href=e.href)):e=En(t),r=e.protocol+"//"+e.hostname,G(e.protocol,e.port)||(r+=":"+e.port),o=e.pathname,"/"!==o[0]&&(o="/"+o),(null!=n?n.stripTrailingSlash:void 0)===!0&&(o=o.replace(/\/$/,"")),r+=o,(null!=n?n.hash:void 0)===!0&&(r+=e.hash),(null!=n?n.search:void 0)!==!1&&(r+=e.search),r},en=function(t){return t?t.toUpperCase():"GET"},n=function(t){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v;for(h=t.split(/[ >]/),r=null,c=p=0,d=h.length;d>p;c=++p){for(i=h[c],u=i.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),v="div",o=[],l=null,f=0,m=u.length;m>f;f++)switch(a=u[f],a[0]){case".":o.push(a.substr(1));break;case"#":l=a.substr(1);break;default:v=a}s="<"+v,o.length&&(s+=' class="'+o.join(" ")+'"'),l&&(s+=' id="'+l+'"'),s+=">",n=$(s),e&&n.appendTo(e),0===c&&(r=n),e=n}return r},d=function(t,n){var e;return e=document.createElement(t),H(n)&&(e.innerHTML=n),e},g=function(){var n,e;return e=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],e="[UP] "+e,console.debug.apply(console,[e].concat(t.call(n)))},Sn=function(){var n,e;return e=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],e="[UP] "+e,console.warn.apply(console,[e].concat(t.call(n)))},w=function(){var n,e,r;throw e=1<=arguments.length?t.call(arguments,0):[],e[0]="[UP] "+e[0],console.error.apply(console,e),r=wn(e),n=pn($(".up-error"))||$('<div class="up-error"></div>').prependTo("body"),n.addClass("up-error"),n.text(r),new Error(r)},r=/\%[odisf]/g,wn=function(t){var n,e,o;return o=t[0],n=0,e=30,o.replace(r,function(){var r,o;return n+=1,r=t[n],o=typeof r,"string"===o?(r=r.replace(/\s+/g," "),r.length>e&&(r=r.substr(0,e)+"\u2026"),'"'+r+'"'):"number"===o?r.toString():"("+o+")"})},h=function(t){var n,e,r,o,u,i,a;for(g("Creating selector from element %o",t),e=(n=t.attr("class"))?n.split(" "):[],r=t.attr("id"),a=t.prop("tagName").toLowerCase(),r&&(a+="#"+r),o=0,i=e.length;i>o;o++)u=e[o],a+="."+u;return a},m=function(t){var n,e,r,o,u,i,a,s,l,c,p,f;return l=function(t){return"<"+t+"(?: [^>]*)?>"},i=function(t){return"</"+t+">"},n="(?:.|\\n)*?",u=function(t){return"("+t+")"},f=new RegExp(l("head")+n+l("title")+u(n)+i("title")+n+i("body"),"i"),o=new RegExp(l("body")+u(n)+i("body"),"i"),(r=t.match(o))?(s=document.createElement("html"),e=d("body",r[1]),s.appendChild(e),(p=t.match(f))&&(a=d("head"),s.appendChild(a),c=d("title",p[1]),a.appendChild(c)),s):d("div",t)},x=$.extend,Cn=$.trim,V=Object.keys||function(t){var n,e,r,o;for(o=[],n=0,r=t.length;r>n;n++)e=t[n],t.hasOwnProperty(e)&&o.push(e);return o},b=function(t,n){var e,r,o,u,i;for(i=[],e=o=0,u=t.length;u>o;e=++o)r=t[e],i.push(n(r,e));return i},$n=function(t,n){var e,r,o,u;for(u=[],e=r=0,o=t-1;o>=0?o>=r:r>=o;e=o>=0?++r:--r)u.push(n(e));return u},N=function(t){return null===t},R=function(t){return void 0===t},U=function(t){return!R(t)},L=function(t){return R(t)||N(t)},z=function(t){return!L(t)},D=function(t){return L(t)||I(t)&&0===V(t).length||0===t.length},pn=function(t,n){return null==n&&(n=H),n(t)?t:null},H=function(t){return!D(t)},M=function(t){return"function"==typeof t},J=function(t){return"string"==typeof t},j=function(t){return"object"==typeof t&&!!t},I=function(t){return j(t)||"function"==typeof t},F=function(t){return!(!t||1!==t.nodeType)},W=function(t){return t instanceof jQuery},q=function(t){return I(t)&&M(t.then)},O=function(t){return q(t)&&M(t.resolve)},P=function(t){return z(t)?t:void 0},A=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},xn=function(t){return Array.prototype.slice.call(t)},p=function(t){return A(t)?t.slice():x({},t)},En=function(t){return W(t)?t.get(0):t},Y=function(t,n){return x(p(t),n)},ln=function(t,n){var e,r,o,u;if(o=t?p(t):{},n)for(r in n)e=n[r],u=o[r],z(u)?I(e)&&I(u)&&(o[r]=ln(u,e)):o[r]=e;return o},sn=function(){var n,e,r,o,u,i;for(e=1<=arguments.length?t.call(arguments,0):[],u=null,r=0,o=e.length;o>r;r++)if(n=e[r],i=n,M(i)&&(i=i()),z(i)){u=i;break}return u},y=function(t,n){var e,r,o,u;for(u=null,r=0,o=t.length;o>r;r++)if(e=t[r],n(e)){u=e;break}return u},s=function(t){return yn(t,z)},Tn=function(t){var n;return n={},yn(t,function(t){return n.hasOwnProperty(t)?!1:n[t]=!0})},yn=function(t,n){var e;return e=[],b(t,function(t){return n(t)?e.push(t):void 0}),e},fn=function(){var n,e,r,o;return n=arguments[0],r=2<=arguments.length?t.call(arguments,1):[],o=function(){var t,o,u;for(u=[],t=0,o=r.length;o>t;t++)e=r[t],u.push(n.attr(e));return u}(),y(o,H)},nn=function(t){return setTimeout(t,0)},B=function(t){return t[t.length-1]},a=function(){var t;return t=document.documentElement,{width:t.clientWidth,height:t.clientHeight}},gn=Z(function(){var t,n,e;return t=$("<div>").css({position:"absolute",top:"0",left:"0",width:"50px",height:"50px",overflowY:"scroll"}),t.appendTo(document.body),n=t.get(0),e=n.offsetWidth-n.clientWidth,t.remove(),e}),un=function(t){var n;return n=void 0,function(){return null!=t&&(n=t()),t=void 0,n}},kn=function(t,n,e){var r,o;return o=t.css(V(n)),t.css(n),r=function(){return t.css(o)},e?(e(),r()):un(r)},E=function(t){var n,e;return e=t.css(["transform","-webkit-transform"]),D(e)?(n=function(){return t.css(e)},t.css({transform:"translateZ(0)","-webkit-transform":"translateZ(0)"})):n=function(){},n},v=function(t,n,r){var o,u,i,a,s,l;return o=$(t),up.browser.canCssAnimation()?(r=ln(r,{duration:300,delay:0,easing:"ease"}),u=$.Deferred(),a={"transition-property":V(n).join(", "),"transition-duration":r.duration+"ms","transition-delay":r.delay+"ms","transition-timing-function":r.easing},s=E(o),l=kn(o,a),o.css(n),u.then(s),u.then(l),o.data(e,u),u.then(function(){return o.removeData(e)}),i=setTimeout(function(){return u.resolve()},r.duration+r.delay),u.then(function(){return clearTimeout(i)}),u):(o.css(n),vn())},e="up-animation-promise",T=function(t){return $(t).each(function(){var t;return(t=$(this).data(e))?t.resolve():void 0})},Q=function(t,n){var e,r,o;return r=(null!=n?n.relative:void 0)?t.position():t.offset(),e={left:r.left,top:r.top},(null!=n?n.inner:void 0)?(e.width=t.width(),e.height=t.height()):(e.width=t.outerWidth(),e.height=t.outerHeight()),(null!=n?n.full:void 0)&&(o=a(),e.right=o.width-(e.left+e.width),e.bottom=o.height-(e.top+e.height)),e},f=function(t,n){var e,r,o,u,i;for(u=t.get(0).attributes,i=[],r=0,o=u.length;o>r;r++)e=u[r],i.push(e.specified?n.attr(e.name,e.value):void 0);return i},cn=function(t){var n,e;return e=Q(t,{relative:!0,inner:!0}),n=t.clone(),n.find("script").remove(),n.css({right:"",bottom:"",position:"absolute"}),n.css(e),n.addClass("up-ghost"),n.insertBefore(t)},C=function(t,n){return t.find(n).addBack(n)},k=function(t){return 27===t.keyCode},c=function(t,n){return t.indexOf(n)>=0},i=function(t){return"true"===String(t)},u=function(t){return"false"===String(t)},_=function(t){return t.getResponseHeader("X-Up-Location")},tn=function(t){return t.getResponseHeader("X-Up-Method")},an=function(){var n,e,r,o,u,i;for(i=arguments[0],o=2<=arguments.length?t.call(arguments,1):[],n={},e=0,u=o.length;u>e;e++)r=o[e],i.hasOwnProperty(r)&&(n[r]=i[r]);return n},X=function(t){return!(t.metaKey||t.shiftKey||t.ctrlKey)},K=function(t){var n;return n=R(t.button)||0===t.button,n&&X(t)},hn=function(){var t;return t=$.Deferred(),t.resolve(),t},vn=function(){return hn().promise()},on=function(){return{is:function(){return!1},attr:function(){},find:function(){return[]}}},mn=function(){var n,e;return n=1<=arguments.length?t.call(arguments,0):[],e=$.when.apply($,n),e.resolve=function(){return b(n,function(t){return"function"==typeof t.resolve?t.resolve():void 0})},e},bn=function(t,n){var e,r,o;r=[];for(e in n)o=n[e],r.push(L(t.attr(e))?t.attr(e,o):void 0);return r},dn=function(t,n){var e;return e=t.indexOf(n),e>=0?(t.splice(e,1),n):void 0},l=function(t){var n,e;return null==t&&(t={}),e={reset:function(){var r,o,u,i;for(i=Object.getOwnPropertyNames(e),r=0,u=i.length;u>r;r++)o=i[r],c(n,o)||delete e[o];return e.update(p(t))},update:function(t){return x(e,t)}},n=Object.getOwnPropertyNames(e),e.reset(),e},{presentAttr:fn,createElement:d,normalizeUrl:rn,normalizeMethod:en,createElementFromHtml:m,$createElementFromSelector:n,createSelectorFromElement:h,get:S,ajax:o,extend:x,copy:p,merge:Y,options:ln,option:sn,error:w,debug:g,warn:Sn,each:b,times:$n,detect:y,select:yn,compact:s,uniq:Tn,last:B,isNull:N,isDefined:U,isUndefined:R,isGiven:z,isMissing:L,isPresent:H,isBlank:D,presence:pn,isObject:I,isFunction:M,isString:J,isElement:F,isJQuery:W,isPromise:q,isDeferred:O,isHash:j,ifGiven:P,isUnmodifiedKeyEvent:X,isUnmodifiedMouseEvent:K,nullJquery:on,unwrap:En,nextFrame:nn,measure:Q,temporaryCss:kn,cssAnimate:v,finishCssAnimate:T,forceCompositing:E,prependGhost:cn,escapePressed:k,copyAttributes:f,findWithSelf:C,contains:c,isArray:A,toArray:xn,castsToTrue:i,castsToFalse:u,locationFromXhr:_,methodFromXhr:tn,clientSize:a,only:an,trim:Cn,keys:V,resolvedPromise:vn,resolvedDeferred:hn,resolvableWhen:mn,setMissingAttrs:bn,remove:dn,memoize:Z,scrollbarWidth:gn,config:l}}()}.call(this),function(){up.browser=function(){var t,n,e,r,o,u,i,a,s;return a=up.util,i=function(t,n){var e,r,o,u,i,s;return null==n&&(n={}),i=a.option(n.method,"get").toLowerCase(),"get"===i?location.href=t:$.rails?(s=n.target,o=$.rails.csrfToken(),r=$.rails.csrfParam(),e=$("<form method='post' action='"+t+"'></form>"),u="<input name='_method' value='"+i+"' type='hidden' />",a.isDefined(r)&&a.isDefined(o)&&(u+="<input name='"+r+"' value='"+o+"' type='hidden' />"),s&&e.attr("target",s),e.hide().append(u).appendTo("body"),e.submit()):error("Can't fake a "+i.toUpperCase()+" request without Rails UJS")},s=function(){return location.href},r=function(){var t,n,e,r,o,u,i,a,s;return window.console||(window.console={}),s=function(){},(t=window.console).log||(t.log=s),(n=window.console).info||(n.info=s),(e=window.console).error||(e.error=s),(r=window.console).debug||(r.debug=s),(o=window.console).warn||(o.warn=s),(u=window.console).group||(u.group=s),(i=window.console).groupCollapsed||(i.groupCollapsed=s),(a=window.console).groupEnd||(a.groupEnd=s)},e=a.memoize(function(){return a.isDefined(history.pushState)}),t=a.memoize(function(){return"transition"in document.documentElement.style}),n=a.memoize(function(){return"oninput"in document.createElement("input")}),o=function(){var t,n,e,r,o;return o=$.fn.jquery,r=o.split("."),n=parseInt(r[0]),e=parseInt(r[1]),t=n>=2||1===n&&e>=9,t||a.error("jQuery %o found, but Up.js requires 1.9+",o)},u=a.memoize(function(){return a.isDefined(document.addEventListener)}),{url:s,ensureConsoleExists:r,loadPage:i,canPushState:e,canCssAnimation:t,canInputEvent:n,isSupported:u,ensureRecentJquery:o}}()}.call(this),function(){var t=[].slice;up.bus=function(){var n,e,r,o,u,i,a,s,l;return l=up.util,n={},r={},i=function(){return n=l.copy(r)},e=function(t){return n[t]||(n[t]=[])},a=function(){var t,e,o;r={},o=[];for(e in n)t=n[e],o.push(r[e]=l.copy(t));return o},u=function(t,n){var r,o,u,i;for(i=t.split(" "),o=0,u=i.length;u>o;o++)r=i[o],e(r).push(n);return function(){return s(t,n)}},s=function(t,n){var r,o,u,i,a;for(i=t.split(" "),a=[],o=0,u=i.length;u>o;o++)r=i[o],a.push(l.remove(e(r),n));return a},o=function(){var n,r,o;return o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],l.debug("Emitting event %o with args %o",o,n),r=e(o),l.each(r,function(t){return t.apply(null,n)})},u("framework:ready",a),u("framework:reset",i),{on:u,off:s,emit:o}}()}.call(this),function(){up.viewport=function(){var t,n,e,r,o,u,i;return i=up.util,n=i.config({duration:0,view:"body",easing:"swing"}),r=function(){return n.reset()},t="up-scroll-promise",u=function(r,o,u){var a,s,l,c,p;return a=$(r),u=i.options(u),l=i.option(u.duration,n.duration),c=i.option(u.easing,n.easing),e(a),l>0?(s=$.Deferred(),a.data(t,s),s.then(function(){return a.removeData(t),a.finish()}),p={scrollTop:o},a.animate(p,{duration:l,easing:c,complete:function(){return s.resolve()}}),s):(a.scrollTop(o),i.resolvedDeferred())},e=function(n){return $(n).each(function(){var n;return(n=$(this).data(t))?n.resolve():void 0})},o=function(t,e){var r,o,a,s,l,c,p,f,d,m,h;return e=i.options(e),m=i.option(e.view,n.view),f=i.option(e.padding,n.padding),r=$(t),o=$(m),h=o.height(),d=o.scrollTop(),c=d,p=d+h,l=r.position().top,a=c>l-f,s=l>p-f,a||s?(d=l-f,d=Math.max(d,0),d=Math.min(d,h-1),u(o,d,e)):i.resolvedDeferred()},up.bus.on("framework:reset",r),{reveal:o,scroll:u,finishScrolling:e,defaults:n.update}}(),up.scroll=up.viewport.scroll,up.reveal=up.viewport.reveal}.call(this),function(){up.flow=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y;return y=up.util,h=function(t,n){var e;return e=$(t),y.isPresent(n)&&(n=y.normalizeUrl(n)),e.attr("up-source",n)},v=function(t){var n;return n=$(t).closest("[up-source]"),y.presence(n.attr("up-source"))||up.browser.url()},f=function(t,n,e){var r,o,u;return e=y.options(e),u=y.presence(t)?t:y.createSelectorFromElement($(t)),up.browser.canPushState()||y.castsToFalse(e.history)?(o={url:n,method:e.method,selector:u,cache:e.cache,preload:e.preload},r=up.proxy.ajax(o),r.done(function(t,r,a){var s,l;return(s=y.locationFromXhr(a))&&(y.debug("Location from server: %o",s),l={url:s,method:y.methodFromXhr(a),selector:u},up.proxy.alias(o,l),n=s),(y.isMissing(e.history)||y.castsToTrue(e.history))&&(e.history=n),(y.isMissing(e.source)||y.castsToTrue(e.source))&&(e.source=n),e.preload?void 0:i(u,t,e)}),r.fail(y.error),r):(e.preload||up.browser.loadPage(n,y.only(e,"method")),y.resolvedPromise())},i=function(t,n,e){var o,u,i,a,p,f,d,m;for(e=y.options(e,{historyMethod:"push"}),y.castsToFalse(e.history)&&(e.history=null),y.castsToFalse(e.scroll)&&(e.scroll=null),e.source=y.option(e.source,e.history),f=l(n),e.title||(e.title=f.title()),p=s(t,e),d=[],i=0,a=p.length;a>i;i++)m=p[i],u=r(m.selector),o=f.find(m.selector),d.push(c(u,e).then(function(){return g(u,o,m.pseudoClass,m.transition,e)}));return d},r=function(t){return o(".up-popup "+t)||o(".up-modal "+t)||o(t)||u(t)},u=function(t){var n;return n="Could not find selector %o in current body HTML","#"===n[0]&&(n+=" (avoid using IDs)"),y.error(n,t)},l=function(t){var n;return n=y.createElementFromHtml(t),{title:function(){var t;return null!=(t=n.querySelector("title"))?t.textContent:void 0},find:function(e){var r;return(r=n.querySelector(e))?$(r):y.error("Could not find selector %o in response %o",e,t)}}},c=function(t,n){return up.motion.finish(t),m(t,n.scroll)},m=function(t,n){return n?up.reveal(t,{view:n}):y.resolvedDeferred()},e=function(n,e){return"function"==typeof e.insert&&e.insert(n),e.history&&(e.title&&(document.title=e.title),up.history[e.historyMethod](e.history)),h(n,e.source),t(n),up.ready(n)},g=function(t,r,o,u,i){var a,s;return u||(u="none"),o?(s="before"===o?"prepend":"append",a=r.children(),t[s](r.contents()),y.copyAttributes(r,t),e(a,i),up.animate(r,u,i)):n(t,{animation:function(){return r.insertBefore(t),e(r,i),t.is("body")&&"none"!==u&&y.error("Cannot apply transitions to body-elements (%o)",u),up.morph(t,r,u,i)}})},s=function(t,n){var e,r,o,u,i,a,s,l,c,p,f;for(p=n.transition||n.animation||"none",e=/\ *,\ */,r=t.split(e),y.isPresent(p)&&(f=p.split(e)),a=[],o=u=0,i=r.length;i>u;o=++u)s=r[o],l=s.match(/^(.+?)(?:\:(before|after))?$/),c=f[o]||y.last(f),a.push({selector:l[1],pseudoClass:l[2],transition:c});return a},t=function(t){var n,e;return e="[autofocus]:last",n=y.findWithSelf(t,e),n.length&&n.get(0)!==document.activeElement?n.focus():void 0},a=function(t){var n;return n=".up-ghost, .up-destroying",0===t.closest(n).length},o=function(t){var n,e,r,o,u,i;for(o=$(t).get(),e=null,u=0,i=o.length;i>u;u++)if(r=o[u],n=$(r),a(n)){e=n;break}return e},n=function(t,n){var e,r,o;return e=$(t),n=y.options(n,{animation:"none"}),r=up.motion.animateOptions(n),e.addClass("up-destroying"),y.isPresent(n.url)&&up.history.push(n.url),y.isPresent(n.title)&&(document.title=n.title),up.bus.emit("fragment:destroy",e),o=y.presence(n.animation,y.isPromise)||up.motion.animate(e,n.animation,r),o.then(function(){return e.remove()})},p=function(t,n){var e;return n=y.options(n,{cache:!1}),e=n.url||v(t),f(t,e,n)},d=function(){return up.bus.emit("framework:reset")},up.bus.on("app:ready",function(){return h(document.body,up.browser.url())}),{replace:f,reload:p,destroy:n,implant:i,reset:d,first:o}}(),up.replace=up.flow.replace,up.reload=up.flow.reload,up.destroy=up.flow.destroy,up.reset=up.flow.reset,up.first=up.flow.first}.call(this),function(){var t=[].slice;up.magic=function(){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g;return g=up.util,n="up-destroyable",e="up-destroyer",f=[],l=null,p=function(t,n,e){var r,o;if(up.browser.isSupported())return r=[t,n,function(t){return e.apply(this,[t,$(this),a(this)])}],f.push(r),(o=$(document)).on.apply(o,r)},i=[],s=null,u=function(){var n,e,r;return r=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],up.browser.isSupported()?(u=n.pop(),e=g.options(n[0],{batch:!1}),i.push({selector:r,callback:u,batch:e.batch})):void 0},r=function(t,r,o){var u;return g.debug("Applying compiler %o on %o",t.selector,o),u=t.callback.apply(o,[r,a(r)]),g.isFunction(u)?(r.addClass(n),r.data(e,u)):void 0},o=function(t){var n,e,o,a;for(g.debug("Compiling fragment %o",t),a=[],e=0,o=i.length;o>e;e++)u=i[e],n=g.findWithSelf(t,u.selector),a.push(n.length?u.batch?r(u,n,n.get()):n.each(function(){return r(u,$(this),this)}):void 0);return a},c=function(t){return g.findWithSelf(t,"."+n).each(function(){var t,n;return t=$(this),(n=t.data(e))()})},a=function(t){var n,e;return n=$(t),e=n.attr("up-data"),g.isString(e)&&""!==g.trim(e)?JSON.parse(e):{}},v=function(){return l=g.copy(f),s=g.copy(i)},h=function(){var t,n,e,r;for(n=0,e=f.length;e>n;n++)t=f[n],g.contains(l,t)||(r=$(document)).off.apply(r,t);return f=g.copy(l),i=g.copy(s)},m=function(t){var n;return n=$(t),up.bus.emit("fragment:ready",n),n},d=function(t){return p("keydown","body",function(n){return g.escapePressed(n)?t(n):void 0})},up.bus.on("app:ready",function(){return m(document.body)}),up.bus.on("fragment:ready",o),up.bus.on("fragment:destroy",c),up.bus.on("framework:ready",v),up.bus.on("framework:reset",h),{compiler:u,on:p,ready:m,onEscape:d,data:a}}(),up.compiler=up.magic.compiler,up.on=up.magic.on,up.ready=up.magic.ready,up.awaken=function(){var n;return n=1<=arguments.length?t.call(arguments,0):[],up.util.warn("up.awaken has been renamed to up.compiler and will be removed in a future version"),up.compiler.apply(up,n)}}.call(this),function(){up.history=function(){var t,n,e,r,o,u;return u=up.util,t=function(t){return u.normalizeUrl(t,{hash:!0})===u.normalizeUrl(up.browser.url(),{hash:!0})},o=function(e,r){return r=u.options(r,{force:!1}),r.force||!t(e)?n("replace",e):void 0},r=function(e){return t(e)?void 0:n("push",e)},n=function(t,n){return up.browser.canPushState()?(t+="State",window.history[t]({fromUp:!0},"",n)):u.error("This browser doesn't support history.pushState")},e=function(t){var n;return n=t.originalEvent.state,(null!=n?n.fromUp:void 0)?(u.debug("Restoring state %o (now on "+up.browser.url()+")",n),up.visit(up.browser.url(),{historyMethod:"replace"})):u.debug("Discarding unknown state %o",n)},up.browser.canPushState()&&setTimeout(function(){return $(window).on("popstate",e),o(up.browser.url(),{force:!0})},200),{push:r,replace:o}}()}.call(this),function(){up.motion=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w;return b=up.util,o={},a={},y={},s={},i=b.config({duration:300,delay:0,easing:"ease"}),m=function(){return o=b.copy(a),y=b.copy(s),i.reset()},n=function(t,r,o){var i;return i=$(t),c(i),o=e(o),b.isFunction(r)?u(r(i,o),r):b.isString(r)?n(i,l(r),o):b.isHash(r)?b.cssAnimate(i,r,o):b.error("Unknown animation type %o",r)},e=function(t,n){var e;return null==n&&(n=null),t=b.options(t),e={},e.easing=b.option(t.easing,null!=n?n.attr("up-easing"):void 0,i.easing),e.duration=Number(b.option(t.duration,null!=n?n.attr("up-duration"):void 0,i.duration)),e.delay=Number(b.option(t.delay,null!=n?n.attr("up-delay"):void 0,i.delay)),e},l=function(t){return o[t]||b.error("Unknown animation %o",r)},t="up-ghosting-promise",w=function(n,e,r){var o,u,i,a;return u=null,o=null,b.temporaryCss(e,{display:"none"},function(){return u=b.prependGhost(n).addClass("up-destroying")}),b.temporaryCss(n,{display:"none"},function(){return o=b.prependGhost(e)}),n.css({visibility:"hidden"}),a=b.temporaryCss(e,{display:"none"}),i=r(u,o),n.data(t,i),e.data(t,i),i.then(function(){return n.removeData(t),e.removeData(t),u.remove(),o.remove(),n.css({display:"none"}),a()}),i},c=function(t){return $(t).each(function(){var t;return t=$(this),b.finishCssAnimate(t),p(t)})},p=function(n){var e;return(e=n.data(t))?(b.debug("Canceling existing ghosting on %o",n),"function"==typeof e.resolve?e.resolve():void 0):void 0},u=function(t,n){return b.isDeferred(t)?t:b.error("Did not return a promise with .then and .resolve methods: %o",n)},f=function(t,r,i,a){var s,l,p,m,v;return up.browser.canCssAnimation()?(a=e(a),l=$(t),s=$(r),c(l),c(s),"none"===i?d():(v=b.presence(i,b.isFunction)||y[i])?w(l,s,function(t,n){return u(v(t,n,a),i)}):(p=o[i])?(l.hide(),n(s,p,a)):b.isString(i)&&i.indexOf("/")>=0?(m=i.split("/"),v=function(t,e,r){return h(n(t,m[0],r),n(e,m[1],r))},f(l,s,v,a)):b.error("Unknown transition %o",i)):b.resolvedDeferred()},g=function(t,n){return y[t]=n},r=function(t,n){return o[t]=n},v=function(){return a=b.copy(o),s=b.copy(y)},h=b.resolvableWhen,d=b.resolvedDeferred,r("none",d),r("fade-in",function(t,e){return t.css({opacity:0}),n(t,{opacity:1},e)}),r("fade-out",function(t,e){return t.css({opacity:1}),n(t,{opacity:0},e)}),r("move-to-top",function(t,e){var r,o;return r=b.measure(t),o=r.top+r.height,t.css({"margin-top":"0px"}),n(t,{"margin-top":"-"+o+"px"},e)}),r("move-from-top",function(t,e){var r,o;return r=b.measure(t),o=r.top+r.height,t.css({"margin-top":"-"+o+"px"}),n(t,{"margin-top":"0px"},e)}),r("move-to-bottom",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().height-r.top,t.css({"margin-top":"0px"}),n(t,{"margin-top":o+"px"},e)}),r("move-from-bottom",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().height-r.top,t.css({"margin-top":o+"px"}),n(t,{"margin-top":"0px"},e)}),r("move-to-left",function(t,e){var r,o;return r=b.measure(t),o=r.left+r.width,t.css({"margin-left":"0px"}),n(t,{"margin-left":"-"+o+"px"},e)}),r("move-from-left",function(t,e){var r,o;return r=b.measure(t),o=r.left+r.width,t.css({"margin-left":"-"+o+"px"}),n(t,{"margin-left":"0px"},e)}),r("move-to-right",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().width-r.left,t.css({"margin-left":"0px"}),n(t,{"margin-left":o+"px"},e)}),r("move-from-right",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().width-r.left,t.css({"margin-left":o+"px"}),n(t,{"margin-left":"0px"},e)}),r("roll-down",function(t,e){var r,o;return r=t.height(),o=b.temporaryCss(t,{height:"0px",overflow:"hidden"}),n(t,{height:r+"px"},e).then(o)}),g("none",d),g("move-left",function(t,e,r){return h(n(t,"move-to-left",r),n(e,"move-from-right",r))}),g("move-right",function(t,e,r){return h(n(t,"move-to-right",r),n(e,"move-from-left",r))}),g("move-up",function(t,e,r){return h(n(t,"move-to-top",r),n(e,"move-from-bottom",r))}),g("move-down",function(t,e,r){return h(n(t,"move-to-bottom",r),n(e,"move-from-top",r))}),g("cross-fade",function(t,e,r){return h(n(t,"fade-out",r),n(e,"fade-in",r))}),up.bus.on("framework:ready",v),up.bus.on("framework:reset",m),{morph:f,animate:n,animateOptions:e,finish:c,transition:g,animation:r,defaults:i.update,none:d,when:h}}(),up.transition=up.motion.transition,up.animation=up.motion.animation,up.morph=up.motion.morph,up.animate=up.motion.animate}.call(this),function(){up.proxy=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,x,C,T,E,S,P,A,D,O,U;return U=up.util,a=void 0,t=void 0,T=void 0,u=void 0,x=void 0,i=void 0,d=U.config({busyDelay:300,preloadDelay:75,cacheSize:70,cacheExpiry:3e5}),c=function(){return clearTimeout(T),T=null},l=function(){return clearTimeout(u),u=null},S=function(){return a={},t=null,c(),l(),x=0,d.reset(),i=!1},S(),s=function(t){return k(t),[t.url,t.method,t.data,t.selector].join("|")},O=function(){var t,n,e;return t=U.keys(a),t.length>d.cacheSize&&(n=null,e=null,U.each(t,function(t){var r,o;return r=a[t],o=r.timestamp,!e||e>o?(n=t,e=o):void 0}),n)?delete a[n]:void 0},D=function(){return(new Date).valueOf()},k=function(t){return t._normalized||(t.method=U.normalizeMethod(t.method),t.url&&(t.url=U.normalizeUrl(t.url)),t.selector||(t.selector="body"),t._normalized=!0),t},r=function(t,n){var e;return U.debug("Aliasing %o to %o",t,n),(e=m(t))?P(n,e):void 0},e=function(t){var n,e,r,o,u;return n=U.castsToTrue(t.cache),e=U.castsToFalse(t.cache),u=U.only(t,"url","method","data","selector","_normalized"),r=!0,g(u)||n?(o=m(u))&&!e?r="pending"===o.state():(o=y(u),P(u,o)):(f(),o=y(u)),r&&!t.preload&&(w(),o.then(b)),o},n=["GET","OPTIONS","HEAD"],h=function(){return 0===x},o=function(){return x>0},w=function(){var t,n;return n=h(),x+=1,n?(t=function(){return o()?(up.bus.emit("proxy:busy"),i=!0):void 0},d.busyDelay>0?u=setTimeout(t,d.busyDelay):t()):void 0},b=function(){return x-=1,h()&&i?(up.bus.emit("proxy:idle"),i=!1):void 0},y=function(t){var n;return up.bus.emit("proxy:load",t),n=U.ajax(t),n.then(function(){return up.bus.emit("proxy:receive",t)}),n},g=function(t){return k(t),U.contains(n,t.method)},v=function(t){var n;return n=D()-t.timestamp,n<d.cacheExpiry},m=function(t){var n,e;return n=s(t),(e=a[n])?v(e)?(U.debug("Cache hit for %o (%o)",t.url,t),e):(U.debug("Discarding stale cache entry for %o (%o)",t.url,t),void E(t)):void U.debug("Cache miss for %o (%o)",t.url,t)},P=function(t,n){var e;return O(),e=s(t),n.timestamp=D(),a[e]=n,n},E=function(t){var n;return n=s(t),delete a[n]},f=function(){return a={}},p=function(n){var e,r;return r=parseInt(U.presentAttr(n,"up-delay"))||d.preloadDelay,n.is(t)?void 0:(t=n,c(),e=function(){return C(n)},A(e,r))},A=function(t,n){return T=setTimeout(t,n)},C=function(t,n){var e,r;return e=$(t),n=U.options(n),r=up.link.followMethod(e,n),g({method:r})?(U.debug("Preloading %o",e),n.preload=!0,up.link.follow(e,n)):(U.debug("Won't preload %o due to unsafe method %o",e,r),U.resolvedPromise())},up.on("mouseover mousedown touchstart","[up-preload]",function(t,n){return up.link.childClicked(t,n)?void 0:p(n)}),up.bus.on("framework:reset",S),{preload:C,ajax:e,get:m,set:P,alias:r,clear:f,remove:E,idle:h,busy:o,defaults:d.update}}()}.call(this),function(){up.link=function(){var childClicked,follow,followMethod,shouldProcessLinkEvent,u,visit;return u=up.util,visit=function(t,n){return u.debug("Visiting "+t),up.replace("body",t,n)},follow=function(t,n){var e,r,o;return e=$(t),n=u.options(n),o=u.option(e.attr("up-href"),e.attr("href")),r=u.option(n.target,e.attr("up-target"),"body"),n.transition=u.option(n.transition,e.attr("up-transition"),e.attr("up-animation")),n.history=u.option(n.history,e.attr("up-history")),n.scroll=u.option(n.scroll,e.attr("up-scroll"),"body"),n.cache=u.option(n.cache,e.attr("up-cache")),n.method=followMethod(e,n),n=u.merge(n,up.motion.animateOptions(n,e)),up.replace(r,o,n)},followMethod=function(t,n){return n=u.options(n),u.option(n.method,t.attr("up-method"),t.attr("data-method"),"get").toUpperCase()},up.on("click","a[up-target], [up-href][up-target]",function(t,n){return shouldProcessLinkEvent(t,n)?n.is("[up-instant]")?t.preventDefault():(t.preventDefault(),follow(n)):void 0}),up.on("mousedown","a[up-instant], [up-href][up-instant]",function(t,n){return shouldProcessLinkEvent(t,n)?(t.preventDefault(),follow(n)):void 0}),childClicked=function(t,n){var e,r;return e=$(t.target),r=e.closest("a, [up-href]"),r.length&&n.find(r).length},shouldProcessLinkEvent=function(t,n){return u.isUnmodifiedMouseEvent(t)&&!childClicked(t,n)},up.on("click","a[up-follow], [up-href][up-follow]",function(t,n){return shouldProcessLinkEvent(t,n)?n.is("[up-instant]")?t.preventDefault():(t.preventDefault(),follow(n)):void 0}),up.compiler("[up-expand]",function(t){var n,e,r,o,i,a,s,l;for(o=t.find("a, [up-href]").get(0),o||u.error("No link to expand within %o",t),l=/^up-/,a={},a["up-href"]=$(o).attr("href"),s=o.attributes,e=0,r=s.length;r>e;e++)n=s[e],i=n.name,i.match(l)&&(a[i]=n.value);return u.isGiven(a["up-target"])||(a["up-follow"]=""),u.setMissingAttrs(t,a),t.removeAttr("up-expand")}),up.compiler("[up-dash]",function(t){var n,e;return e=t.attr("up-dash"),n={"up-preload":"true","up-instant":"true"},u.isBlank(e)||u.castsToTrue(e)?n["up-follow"]="":n["up-target"]=e,u.setMissingAttrs(t,n),t.removeAttr("up-dash")}),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visit,follow:follow,childClicked:childClicked,followMethod:followMethod}}(),up.visit=up.link.visit,up.follow=up.link.follow}.call(this),function(){up.form=function(){var observe,submit,u;return u=up.util,submit=function(t,n){var e,r,o,i,a,s,l,c,p,f,d,m;return e=$(t).closest("form"),n=u.options(n),c=u.option(n.target,e.attr("up-target"),"body"),o=u.option(n.failTarget,e.attr("up-fail-target"),function(){return u.createSelectorFromElement(e)}),a=u.option(n.history,e.attr("up-history"),!0),p=u.option(n.transition,e.attr("up-transition")),i=u.option(n.failTransition,e.attr("up-fail-transition"),p),s=u.option(n.method,e.attr("up-method"),e.attr("data-method"),e.attr("method"),"post").toUpperCase(),r=up.motion.animateOptions(n,e),m=u.option(n.cache,e.attr("up-cache")),d=u.option(n.url,e.attr("action"),up.browser.url()),e.addClass("up-active"),up.browser.canPushState()||u.castsToFalse(a)?(l={url:d,method:s,data:e.serialize(),selector:c,cache:m},f=function(t){var n;return d=a?u.castsToFalse(a)?!1:u.isString(a)?a:(n=u.locationFromXhr(t))?n:"GET"===l.type?l.url+"?"+l.data:void 0:void 0,u.option(d,!1)},up.proxy.ajax(l).always(function(){return e.removeClass("up-active")}).done(function(t,n,e){var o;return o=u.merge(r,{history:f(e),transition:p}),up.flow.implant(c,t,o)}).fail(function(t){var n,e;return e=t.responseText,n=u.merge(r,{transition:i}),up.flow.implant(o,e,n)})):void e.get(0).submit()},observe=function(fieldOrSelector,options){var $field,callback,callbackPromise,callbackTimer,changeEvents,check,clearTimer,codeOnChange,delay,knownValue,nextCallback,runNextCallback;return $field=$(fieldOrSelector),options=u.options(options),delay=u.option($field.attr("up-delay"),options.delay,0),delay=parseInt(delay),knownValue=null,callback=null,callbackTimer=null,(codeOnChange=$field.attr("up-observe"))?callback=function(value,$field){return eval(codeOnChange)}:options.change?callback=options.change:u.error("up.observe: No change callback given"),callbackPromise=u.resolvedPromise(),nextCallback=null,runNextCallback=function(){var t;return nextCallback?(t=nextCallback(),nextCallback=null,t):void 0},check=function(){var t,n;return n=$field.val(),t=u.isNull(knownValue),knownValue===n||(knownValue=n,t)?void 0:(clearTimer(),nextCallback=function(){return callback.apply($field.get(0),[n,$field])},callbackTimer=setTimeout(function(){return callbackPromise.then(function(){var t;return t=runNextCallback(),callbackPromise=u.isPromise(t)?t:u.resolvedPromise()})},delay))},clearTimer=function(){return clearTimeout(callbackTimer)},changeEvents=up.browser.canInputEvent()?"input change":"input change keypress paste cut click propertychange",$field.on(changeEvents,check),check(),clearTimer},up.on("submit","form[up-target]",function(t,n){return t.preventDefault(),submit(n)}),up.compiler("[up-observe]",function(t){return observe(t)}),{submit:submit,observe:observe}}(),up.submit=up.form.submit,up.observe=up.form.observe}.call(this),function(){up.popup=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m;return d=up.util,u=void 0,e=d.config({openAnimation:"fade-in",closeAnimation:"fade-out",position:"bottom-right"}),c=function(){return n(),e.reset()},p=function(t,n,e){var r,o;return o=d.measure(t,{full:!0}),r=function(){switch(e){case"bottom-right":return{right:o.right,top:o.top+o.height};case"bottom-left":return{left:o.left,top:o.bottom+o.height};case"top-right":return{right:o.right,bottom:o.top};case"top-left":return{left:o.left,bottom:o.top};default:return d.error("Unknown position %o",e)}}(),n.attr("up-position",e),n.css(r),a(n)},a=function(t){var n,e,r,o,u,i,a;if(e=d.measure(t,{full:!0}),r=null,o=null,e.right<0&&(r=-e.right),e.bottom<0&&(o=-e.bottom),e.left<0&&(r=e.left),e.top<0&&(o=e.top),r&&((u=parseInt(t.css("left")))?t.css("left",u-r):(i=parseInt(t.css("right")))&&t.css("right",i+r)),o){if(a=parseInt(t.css("top")))return t.css("top",a-o);
2
- if(n=parseInt(t.css("bottom")))return t.css("bottom",n+o)}},l=function(){var t;return t=$(".up-popup"),t.attr("up-previous-url",up.browser.url()),t.attr("up-previous-title",document.title)},i=function(){var t;return t=$(".up-popup"),t.removeAttr("up-previous-url"),t.removeAttr("up-previous-title")},o=function(t,n,e){var r,o;return o=d.$createElementFromSelector(".up-popup"),e&&o.attr("up-sticky",""),r=d.$createElementFromSelector(n),r.appendTo(o),o.appendTo(document.body),l(),o.hide(),o},m=function(t,n,e,r,o){return n.show(),p(t,n,e),up.animate(n,r,o)},s=function(t,r){var u,i,a,s,l,c,p,f,h;return u=$(t),r=d.options(r),h=d.option(r.url,u.attr("href")),p=d.option(r.target,u.attr("up-popup"),"body"),c=d.option(r.position,u.attr("up-position"),e.position),s=d.option(r.animation,u.attr("up-animation"),e.openAnimation),f=d.option(r.sticky,u.is("[up-sticky]")),l=up.browser.canPushState()?d.option(r.history,u.attr("up-history"),!1):!1,a=up.motion.animateOptions(r,u),n(),i=o(u,p,f),up.replace(p,h,{history:l,insert:function(){return m(u,i,c,s,a)}})},f=function(){return u},n=function(t){var n;return n=$(".up-popup"),n.length?(t=d.options(t,{animation:e.closeAnimation,url:n.attr("up-previous-url"),title:n.attr("up-previous-title")}),u=void 0,up.destroy(n,t)):d.resolvedPromise()},t=function(){return $(".up-popup").is("[up-sticky]")?void 0:(i(),n())},r=function(t){var n;return n=$(t),n.closest(".up-popup").length>0},up.on("click","a[up-popup]",function(t,e){return t.preventDefault(),e.is(".up-current")?n():s(e)}),up.on("click","body",function(t){var e;return e=$(t.target),e.closest(".up-popup").length||e.closest("[up-popup]").length?void 0:n()}),up.bus.on("fragment:ready",function(n){var e;return r(n)?(e=n.attr("up-source"))?u=e:void 0:t()}),up.magic.onEscape(function(){return n()}),up.on("click","[up-close]",function(t,e){return e.closest(".up-popup")?n():void 0}),up.bus.on("framework:reset",c),{open:s,close:n,source:f,defaults:e.update,contains:r}}()}.call(this),function(){var t=[].slice;up.modal=function(){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v;return m=up.util,r=m.config({maxWidth:void 0,minWidth:void 0,width:void 0,height:void 0,openAnimation:"fade-in",closeAnimation:"fade-out",closeLabel:"\xd7",template:function(t){return'<div class="up-modal">\n <div class="up-modal-dialog">\n <div class="up-modal-close" up-close>'+t.closeLabel+'</div>\n <div class="up-modal-content"></div>\n </div>\n</div>'}}),i=void 0,c=function(){return e(),i=void 0,r.reset()},d=function(){var t;return t=r.template,m.isFunction(t)?t(r):t},l=function(){var t;return t=$(".up-modal"),t.attr("up-previous-url",up.browser.url()),t.attr("up-previous-title",document.title)},a=function(){var t;return t=$(".up-modal"),t.removeAttr("up-previous-url"),t.removeAttr("up-previous-title")},u=function(t){var n,e,r,o;return r=$(d()),t.sticky&&r.attr("up-sticky",""),r.attr("up-previous-url",up.browser.url()),r.attr("up-previous-title",document.title),e=r.find(".up-modal-dialog"),m.isPresent(t.width)&&e.css("width",t.width),m.isPresent(t.maxWidth)&&e.css("max-width",t.maxWidth),m.isPresent(t.height)&&e.css("height",t.height),n=r.find(".up-modal-content"),o=m.$createElementFromSelector(t.selector),o.appendTo(n),r.appendTo(document.body),l(),r.hide(),r},h=void 0,p=function(){var t,n,e;return e=m.scrollbarWidth(),t=parseInt($("body").css("padding-right")),n=e+t,h=m.temporaryCss($("body"),{"padding-right":n+"px","overflow-y":"hidden"})},v=function(t,n,e){var r;return up.bus.emit("modal:open"),p(),t.show(),r=up.animate(t,n,e),r.then(function(){return up.bus.emit("modal:opened")}),r},s=function(){var n,o,i,a,s,l,c,p,f,d,h,g,y;return s=1<=arguments.length?t.call(arguments,0):[],!m.isObject(s[0])||m.isElement(s[0])||m.isJQuery(s[0])?(n=$(s[0]),f=s[1]):(n=m.nullJquery(),f=s[0]),f=m.options(f),g=m.option(f.url,n.attr("up-href"),n.attr("href")),d=m.option(f.target,n.attr("up-modal"),"body"),y=m.option(f.width,n.attr("up-width"),r.width),p=m.option(f.maxWidth,n.attr("up-max-width"),r.maxWidth),l=m.option(f.height,n.attr("up-height"),r.height),a=m.option(f.animation,n.attr("up-animation"),r.openAnimation),h=m.option(f.sticky,n.is("[up-sticky]")),c=up.browser.canPushState()?m.option(f.history,n.attr("up-history"),!0):!1,i=up.motion.animateOptions(f,n),e(),o=u({selector:d,width:y,maxWidth:p,height:l,sticky:h}),up.replace(d,g,{history:c,insert:function(){return v(o,a,i)}})},f=function(){return i},e=function(t){var n,e;return n=$(".up-modal"),n.length?(t=m.options(t,{animation:r.closeAnimation,url:n.attr("up-previous-url"),title:n.attr("up-previous-title")}),i=void 0,up.bus.emit("modal:close"),e=up.destroy(n,t),e.then(function(){return h(),up.bus.emit("modal:closed")}),e):m.resolvedPromise()},n=function(){return $(".up-modal").is("[up-sticky]")?void 0:(a(),e())},o=function(t){var n;return n=$(t),n.closest(".up-modal").length>0},up.on("click","a[up-modal]",function(t,n){return t.preventDefault(),n.is(".up-current")?e():s(n)}),up.on("click","body",function(t){var n;return n=$(t.target),n.closest(".up-modal-dialog").length||n.closest("[up-modal]").length?void 0:e()}),up.bus.on("fragment:ready",function(t){var e;if(o(t)){if(e=t.attr("up-source"))return i=e}else if(!up.popup.contains(t))return n()}),up.magic.onEscape(function(){return e()}),up.on("click","[up-close]",function(t,n){return n.closest(".up-modal")?e():void 0}),up.bus.on("framework:reset",c),{open:s,close:e,source:f,defaults:r.update,contains:o}}()}.call(this),function(){up.tooltip=function(){var t,n,e,r,o;return o=up.util,r=function(t,n,e){var r,u,i;return u=o.measure(t),i=o.measure(n),r=function(){switch(e){case"top":return{left:u.left+.5*(u.width-i.width),top:u.top-i.height};case"bottom":return{left:u.left+.5*(u.width-i.width),top:u.top+u.height};default:return o.error("Unknown position %o",e)}}(),n.attr("up-position",e),n.css(r)},n=function(t){return o.$createElementFromSelector(".up-tooltip").html(t).appendTo(document.body)},e=function(e,u){var i,a,s,l,c,p;return null==u&&(u={}),i=$(e),c=o.option(u.html,i.attr("up-tooltip"),i.attr("title")),p=o.option(u.position,i.attr("up-position"),"top"),l=o.option(u.animation,i.attr("up-animation"),"fade-in"),s=up.motion.animateOptions(u,i),t(),a=n(c),r(i,a,p),up.animate(a,l,s)},t=function(t){var n;return n=$(".up-tooltip"),n.length?(t=o.options(t,{animation:"fade-out"}),t=o.merge(t,up.motion.animateOptions(t)),up.destroy(n,t)):void 0},up.compiler("[up-tooltip]",function(n){return n.on("mouseover",function(){return e(n)}),n.on("mouseout",function(){return t()})}),up.on("click","body",function(){return t()}),up.bus.on("framework:reset",t),up.magic.onEscape(function(){return t()}),{open:e,close:t}}()}.call(this),function(){up.navigation=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v;return m=up.util,u=m.config({currentClass:"up-current"}),c=function(){return u.reset()},i=function(){var t;return t=u.currentClass,m.contains(t,"up-current")||(t+=" up-current"),t},t="up-active",n=["a","[up-href]","[up-alias]"],r=n.join(", "),o=function(){var t,e,r;for(r=[],t=0,e=n.length;e>t;t++)d=n[t],r.push(d+"[up-instant]");return r}().join(", "),e="."+t,l=function(t){return m.isPresent(t)?m.normalizeUrl(t,{search:!1,stripTrailingSlash:!0}):void 0},f=function(t){var n,e,r,o,u,i,a,s;for(i=[],u=["href","up-href"],r=0,o=u.length;o>r;r++)e=u[r],(a=m.presentAttr(t,e))&&i.push(a);return(n=m.presentAttr(t,"up-alias"))&&(s=n.split(" "),i=i.concat(s)),i.map(l)},v=function(t){var n,e,r,o;return t=m.compact(t),r=function(t){return"*"===t.substr(-1)?e(t.slice(0,-1)):n(t)},n=function(n){return m.contains(t,n)},e=function(n){return m.detect(t,function(t){return 0===t.indexOf(n)})},o=function(t){return m.detect(t,r)},{matchesAny:o}},s=function(){var t,n;return t=v([l(up.browser.url()),l(up.modal.source()),l(up.popup.source())]),n=i(),m.each($(r),function(e){var r,o;return r=$(e),o=f(r),t.matchesAny(o)?r.addClass(n):r.removeClass(n)})},p=function(n){return h(),n=a(n),n.addClass(t)},a=function(t){return m.presence(t.parents(r))||t},h=function(){return $(e).removeClass(t)},up.on("click",r,function(t,n){return m.isUnmodifiedMouseEvent(t)&&!n.is("[up-instant]")?p(n):void 0}),up.on("mousedown",o,function(t,n){return m.isUnmodifiedMouseEvent(t)?p(n):void 0}),up.bus.on("fragment:ready",function(){return h(),s()}),up.bus.on("fragment:destroy",function(t){return t.is(".up-modal, .up-popup")?s():void 0}),up.bus.on("framework:reset",c),{defaults:u.update}}()}.call(this),function(){up.slot=function(){var t,n,e;return e=up.util,n=function(t){return""!==e.trim(t.html())},t=function(t){return e.findWithSelf(t,"[up-slot]").each(function(){var t;return t=$(this),n(t)?void 0:t.hide()})},up.bus.on("fragment:ready",t)}()}.call(this),function(){up.browser.ensureRecentJquery(),up.browser.isSupported()&&(up.browser.ensureConsoleExists(),up.bus.emit("framework:ready"),$(document).on("ready",function(){return up.bus.emit("app:ready")}))}.call(this);
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,z,M,j,W,L,N,I,H,q,G,J,R,X,K,V,B,Q,_,Z,Y,tn,nn,en,rn,on,un,an,sn,ln,cn,pn,fn,dn,mn,hn,vn,gn,yn,bn,wn,kn,$n,xn,Cn,Tn,Sn,En;return Z=function(n){var e,r;return e=void 0,r=!1,function(){var o;return o=1<=arguments.length?t.call(arguments,0):[],r?e:(r=!0,e=n.apply(null,o))}},E=function(t,n){return n=n||{},n.url=t,o(n)},o=function(t){return t.selector&&(t.headers={"X-Up-Selector":t.selector}),$.ajax(t)},G=function(t,n){return(""===n||"80"===n)&&"http:"===t||"443"===n&&"https:"===t},rn=function(t,n){var e,r,o;return e=null,J(t)?(e=$("<a>").attr({href:t}).get(0),D(e.hostname)&&(e.href=e.href)):e=Sn(t),r=e.protocol+"//"+e.hostname,G(e.protocol,e.port)||(r+=":"+e.port),o=e.pathname,"/"!==o[0]&&(o="/"+o),(null!=n?n.stripTrailingSlash:void 0)===!0&&(o=o.replace(/\/$/,"")),r+=o,(null!=n?n.hash:void 0)===!0&&(r+=e.hash),(null!=n?n.search:void 0)!==!1&&(r+=e.search),r},en=function(t){return t?t.toUpperCase():"GET"},n=function(t){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v;for(h=t.split(/[ >]/),r=null,c=p=0,d=h.length;d>p;c=++p){for(i=h[c],u=i.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),v="div",o=[],l=null,f=0,m=u.length;m>f;f++)switch(a=u[f],a[0]){case".":o.push(a.substr(1));break;case"#":l=a.substr(1);break;default:v=a}s="<"+v,o.length&&(s+=' class="'+o.join(" ")+'"'),l&&(s+=' id="'+l+'"'),s+=">",n=$(s),e&&n.appendTo(e),0===c&&(r=n),e=n}return r},d=function(t,n){var e;return e=document.createElement(t),H(n)&&(e.innerHTML=n),e},g=function(){var n,e;return e=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],e="[UP] "+e,console.debug.apply(console,[e].concat(t.call(n)))},En=function(){var n,e;return e=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],e="[UP] "+e,console.warn.apply(console,[e].concat(t.call(n)))},w=function(){var n,e,r;throw e=1<=arguments.length?t.call(arguments,0):[],e[0]="[UP] "+e[0],console.error.apply(console,e),r=wn(e),n=pn($(".up-error"))||$('<div class="up-error"></div>').prependTo("body"),n.addClass("up-error"),n.text(r),new Error(r)},r=/\%[odisf]/g,wn=function(t){var n,e,o;return o=t[0],n=0,e=30,o.replace(r,function(){var r,o;return n+=1,r=t[n],o=typeof r,"string"===o?(r=r.replace(/\s+/g," "),r.length>e&&(r=r.substr(0,e)+"\u2026"),'"'+r+'"'):"number"===o?r.toString():"("+o+")"})},h=function(t){var n,e,r,o,u,i,a;for(g("Creating selector from element %o",t),e=(n=t.attr("class"))?n.split(" "):[],r=t.attr("id"),a=t.prop("tagName").toLowerCase(),r&&(a+="#"+r),o=0,i=e.length;i>o;o++)u=e[o],a+="."+u;return a},m=function(t){var n,e,r,o,u,i,a,s,l,c,p,f;return l=function(t){return"<"+t+"(?: [^>]*)?>"},i=function(t){return"</"+t+">"},n="(?:.|\\n)*?",u=function(t){return"("+t+")"},f=new RegExp(l("head")+n+l("title")+u(n)+i("title")+n+i("body"),"i"),o=new RegExp(l("body")+u(n)+i("body"),"i"),(r=t.match(o))?(s=document.createElement("html"),e=d("body",r[1]),s.appendChild(e),(p=t.match(f))&&(a=d("head"),s.appendChild(a),c=d("title",p[1]),a.appendChild(c)),s):d("div",t)},x=$.extend,Cn=$.trim,V=Object.keys||function(t){var n,e,r,o;for(o=[],n=0,r=t.length;r>n;n++)e=t[n],t.hasOwnProperty(e)&&o.push(e);return o},b=function(t,n){var e,r,o,u,i;for(i=[],e=o=0,u=t.length;u>o;e=++o)r=t[e],i.push(n(r,e));return i},$n=function(t,n){var e,r,o,u;for(u=[],e=r=0,o=t-1;o>=0?o>=r:r>=o;e=o>=0?++r:--r)u.push(n(e));return u},N=function(t){return null===t},R=function(t){return void 0===t},U=function(t){return!R(t)},L=function(t){return R(t)||N(t)},M=function(t){return!L(t)},D=function(t){return L(t)||I(t)&&0===V(t).length||0===t.length},pn=function(t,n){return null==n&&(n=H),n(t)?t:null},H=function(t){return!D(t)},z=function(t){return"function"==typeof t},J=function(t){return"string"==typeof t},j=function(t){return"object"==typeof t&&!!t},I=function(t){return j(t)||"function"==typeof t},F=function(t){return!(!t||1!==t.nodeType)},W=function(t){return t instanceof jQuery},q=function(t){return I(t)&&z(t.then)},O=function(t){return q(t)&&z(t.resolve)},P=function(t){return M(t)?t:void 0},A=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},xn=function(t){return Array.prototype.slice.call(t)},p=function(t){return A(t)?t.slice():x({},t)},Sn=function(t){return W(t)?t.get(0):t},Y=function(t,n){return x(p(t),n)},ln=function(t,n){var e,r,o,u;if(o=t?p(t):{},n)for(r in n)e=n[r],u=o[r],M(u)?I(e)&&I(u)&&(o[r]=ln(u,e)):o[r]=e;return o},sn=function(){var n,e,r,o,u,i;for(e=1<=arguments.length?t.call(arguments,0):[],u=null,r=0,o=e.length;o>r;r++)if(n=e[r],i=n,z(i)&&(i=i()),M(i)){u=i;break}return u},y=function(t,n){var e,r,o,u;for(u=null,r=0,o=t.length;o>r;r++)if(e=t[r],n(e)){u=e;break}return u},s=function(t){return yn(t,M)},Tn=function(t){var n;return n={},yn(t,function(t){return n.hasOwnProperty(t)?!1:n[t]=!0})},yn=function(t,n){var e;return e=[],b(t,function(t){return n(t)?e.push(t):void 0}),e},fn=function(){var n,e,r,o;return n=arguments[0],r=2<=arguments.length?t.call(arguments,1):[],o=function(){var t,o,u;for(u=[],t=0,o=r.length;o>t;t++)e=r[t],u.push(n.attr(e));return u}(),y(o,H)},nn=function(t){return setTimeout(t,0)},B=function(t){return t[t.length-1]},a=function(){var t;return t=document.documentElement,{width:t.clientWidth,height:t.clientHeight}},gn=Z(function(){var t,n,e;return t=$("<div>").css({position:"absolute",top:"0",left:"0",width:"50px",height:"50px",overflowY:"scroll"}),t.appendTo(document.body),n=t.get(0),e=n.offsetWidth-n.clientWidth,t.remove(),e}),un=function(t){var n;return n=void 0,function(){return null!=t&&(n=t()),t=void 0,n}},kn=function(t,n,e){var r,o;return o=t.css(V(n)),t.css(n),r=function(){return t.css(o)},e?(e(),r()):un(r)},S=function(t){var n,e;return e=t.css(["transform","-webkit-transform"]),D(e)?(n=function(){return t.css(e)},t.css({transform:"translateZ(0)","-webkit-transform":"translateZ(0)"})):n=function(){},n},v=function(t,n,r){var o,u,i,a,s,l;return o=$(t),up.browser.canCssAnimation()?(r=ln(r,{duration:300,delay:0,easing:"ease"}),u=$.Deferred(),a={"transition-property":V(n).join(", "),"transition-duration":r.duration+"ms","transition-delay":r.delay+"ms","transition-timing-function":r.easing},s=S(o),l=kn(o,a),o.css(n),u.then(s),u.then(l),o.data(e,u),u.then(function(){return o.removeData(e)}),i=setTimeout(function(){return u.resolve()},r.duration+r.delay),u.then(function(){return clearTimeout(i)}),u):(o.css(n),vn())},e="up-animation-promise",T=function(t){return $(t).each(function(){var t;return(t=$(this).data(e))?t.resolve():void 0})},_=function(t,n){var e,r,o;return r=(null!=n?n.relative:void 0)?t.position():t.offset(),e={left:r.left,top:r.top},(null!=n?n.inner:void 0)?(e.width=t.width(),e.height=t.height()):(e.width=t.outerWidth(),e.height=t.outerHeight()),(null!=n?n.full:void 0)&&(o=a(),e.right=o.width-(e.left+e.width),e.bottom=o.height-(e.top+e.height)),e},f=function(t,n){var e,r,o,u,i;for(u=t.get(0).attributes,i=[],r=0,o=u.length;o>r;r++)e=u[r],i.push(e.specified?n.attr(e.name,e.value):void 0);return i},cn=function(t){var n,e;return e=_(t,{relative:!0,inner:!0}),n=t.clone(),n.find("script").remove(),n.css({right:"",bottom:"",position:"absolute"}),n.css(e),n.addClass("up-ghost"),n.insertBefore(t)},C=function(t,n){return t.find(n).addBack(n)},k=function(t){return 27===t.keyCode},c=function(t,n){return t.indexOf(n)>=0},i=function(t){return"true"===String(t)},u=function(t){return"false"===String(t)},Q=function(t){return t.getResponseHeader("X-Up-Location")},tn=function(t){return t.getResponseHeader("X-Up-Method")},an=function(){var n,e,r,o,u,i;for(i=arguments[0],o=2<=arguments.length?t.call(arguments,1):[],n={},e=0,u=o.length;u>e;e++)r=o[e],i.hasOwnProperty(r)&&(n[r]=i[r]);return n},X=function(t){return!(t.metaKey||t.shiftKey||t.ctrlKey)},K=function(t){var n;return n=R(t.button)||0===t.button,n&&X(t)},hn=function(){var t;return t=$.Deferred(),t.resolve(),t},vn=function(){return hn().promise()},on=function(){return{is:function(){return!1},attr:function(){},find:function(){return[]}}},mn=function(){var n,e;return n=1<=arguments.length?t.call(arguments,0):[],e=$.when.apply($,n),e.resolve=function(){return b(n,function(t){return"function"==typeof t.resolve?t.resolve():void 0})},e},bn=function(t,n){var e,r,o;r=[];for(e in n)o=n[e],r.push(L(t.attr(e))?t.attr(e,o):void 0);return r},dn=function(t,n){var e;return e=t.indexOf(n),e>=0?(t.splice(e,1),n):void 0},l=function(t){var n,e;return null==t&&(t={}),e={reset:function(){var r,o,u,i;for(i=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,u;o=[];for(r in n)u=n[r],o.push(t.hasOwnProperty(r)?e[r]=u:w("Unknown setting %o",r));return o}},n=Object.getOwnPropertyNames(e),e.reset(),e},{presentAttr:fn,createElement:d,normalizeUrl:rn,normalizeMethod:en,createElementFromHtml:m,$createElementFromSelector:n,createSelectorFromElement:h,get:E,ajax:o,extend:x,copy:p,merge:Y,options:ln,option:sn,error:w,debug:g,warn:En,each:b,times:$n,detect:y,select:yn,compact:s,uniq:Tn,last:B,isNull:N,isDefined:U,isUndefined:R,isGiven:M,isMissing:L,isPresent:H,isBlank:D,presence:pn,isObject:I,isFunction:z,isString:J,isElement:F,isJQuery:W,isPromise:q,isDeferred:O,isHash:j,ifGiven:P,isUnmodifiedKeyEvent:X,isUnmodifiedMouseEvent:K,nullJquery:on,unwrap:Sn,nextFrame:nn,measure:_,temporaryCss:kn,cssAnimate:v,finishCssAnimate:T,forceCompositing:S,prependGhost:cn,escapePressed:k,copyAttributes:f,findWithSelf:C,contains:c,isArray:A,toArray:xn,castsToTrue:i,castsToFalse:u,locationFromXhr:Q,methodFromXhr:tn,clientSize:a,only:an,trim:Cn,keys:V,resolvedPromise:vn,resolvedDeferred:hn,resolvableWhen:mn,setMissingAttrs:bn,remove:dn,memoize:Z,scrollbarWidth:gn,config:l}}()}.call(this),function(){up.browser=function(){var t,n,e,r,o,u,i,a,s;return a=up.util,i=function(t,n){var e,r,o,u,i,s;return null==n&&(n={}),i=a.option(n.method,"get").toLowerCase(),"get"===i?location.href=t:$.rails?(s=n.target,o=$.rails.csrfToken(),r=$.rails.csrfParam(),e=$("<form method='post' action='"+t+"'></form>"),u="<input name='_method' value='"+i+"' type='hidden' />",a.isDefined(r)&&a.isDefined(o)&&(u+="<input name='"+r+"' value='"+o+"' type='hidden' />"),s&&e.attr("target",s),e.hide().append(u).appendTo("body"),e.submit()):error("Can't fake a "+i.toUpperCase()+" request without Rails UJS")},s=function(){return location.href},r=function(){var t,n,e,r,o,u,i,a,s;return window.console||(window.console={}),s=function(){},(t=window.console).log||(t.log=s),(n=window.console).info||(n.info=s),(e=window.console).error||(e.error=s),(r=window.console).debug||(r.debug=s),(o=window.console).warn||(o.warn=s),(u=window.console).group||(u.group=s),(i=window.console).groupCollapsed||(i.groupCollapsed=s),(a=window.console).groupEnd||(a.groupEnd=s)},e=a.memoize(function(){return a.isDefined(history.pushState)}),t=a.memoize(function(){return"transition"in document.documentElement.style}),n=a.memoize(function(){return"oninput"in document.createElement("input")}),o=function(){var t,n,e,r,o;return o=$.fn.jquery,r=o.split("."),n=parseInt(r[0]),e=parseInt(r[1]),t=n>=2||1===n&&e>=9,t||a.error("jQuery %o found, but Up.js requires 1.9+",o)},u=a.memoize(function(){return a.isDefined(document.addEventListener)}),{url:s,ensureConsoleExists:r,loadPage:i,canPushState:e,canCssAnimation:t,canInputEvent:n,isSupported:u,ensureRecentJquery:o}}()}.call(this),function(){var t=[].slice;up.bus=function(){var n,e,r,o,u,i,a,s,l;return l=up.util,n={},r={},i=function(){return n=l.copy(r)},e=function(t){return n[t]||(n[t]=[])},a=function(){var t,e,o;r={},o=[];for(e in n)t=n[e],o.push(r[e]=l.copy(t));return o},u=function(t,n){var r,o,u,i;for(i=t.split(" "),o=0,u=i.length;u>o;o++)r=i[o],e(r).push(n);return function(){return s(t,n)}},s=function(t,n){var r,o,u,i,a;for(i=t.split(" "),a=[],o=0,u=i.length;u>o;o++)r=i[o],a.push(l.remove(e(r),n));return a},o=function(){var n,r,o;return o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],l.debug("Emitting event %o with args %o",o,n),r=e(o),l.each(r,function(t){return t.apply(null,n)})},u("framework:ready",a),u("framework:reset",i),{on:u,off:s,emit:o}}()}.call(this),function(){up.viewport=function(){var t,n,e,r,o,u,i,a;return a=up.util,n=a.config({duration:0,viewSelector:"body, .up-modal, [up-viewport]",easing:"swing"}),o=function(){return n.reset()},t="up-scroll-promise",i=function(e,o,u){var i,s,l,c,p;return i=$(e),u=a.options(u),l=a.option(u.duration,n.duration),c=a.option(u.easing,n.easing),r(i),l>0?(s=$.Deferred(),i.data(t,s),s.then(function(){return i.removeData(t),i.finish()}),p={scrollTop:o},i.animate(p,{duration:l,easing:c,complete:function(){return s.resolve()}}),s):(i.scrollTop(o),a.resolvedDeferred())},r=function(n){return $(n).each(function(){var n;return(n=$(this).data(t))?n.resolve():void 0})},u=function(t,n){var r,o,u,s,l,c,p,f,d,m,h,v;return n=a.options(n),r=$(t),o=e(r,n.view),v=o.is("body"),h=v?a.clientSize().height:o.height(),m=o.scrollTop(),f=m,d=v?0:m,l=function(){return f},p=function(){return f+h-1},u=a.measure(r,{relative:!0}),s=u.top+d,c=s+u.height-1,c>p()&&(f+=c-p()),s<l()&&(f=s),f!==m?i(o,f,n):a.resolvedDeferred()},e=function(t,e){var r,o;return r=void 0,a.isJQuery(e)?r=e:(o=a.presence(e)||n.viewSelector,r=t.closest(o)),r.length||a.error("Could not find view to scroll for %o (tried selectors %o)",t,viewSelectors),r},up.bus.on("framework:reset",o),{reveal:u,scroll:i,finishScrolling:r,defaults:n.update}}(),up.scroll=up.viewport.scroll,up.reveal=up.viewport.reveal}.call(this),function(){up.flow=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y;return y=up.util,h=function(t,n){var e;return e=$(t),y.isPresent(n)&&(n=y.normalizeUrl(n)),e.attr("up-source",n)},v=function(t){var n;return n=$(t).closest("[up-source]"),y.presence(n.attr("up-source"))||up.browser.url()},f=function(t,n,e){var r,o,u;return e=y.options(e),u=y.presence(t)?t:y.createSelectorFromElement($(t)),up.browser.canPushState()||y.castsToFalse(e.history)?(o={url:n,method:e.method,selector:u,cache:e.cache,preload:e.preload},r=up.proxy.ajax(o),r.done(function(t,r,a){var s,l;return(s=y.locationFromXhr(a))&&(y.debug("Location from server: %o",s),l={url:s,method:y.methodFromXhr(a),selector:u},up.proxy.alias(o,l),n=s),(y.isMissing(e.history)||y.castsToTrue(e.history))&&(e.history=n),(y.isMissing(e.source)||y.castsToTrue(e.source))&&(e.source=n),e.preload?void 0:i(u,t,e)}),r.fail(y.error),r):(e.preload||up.browser.loadPage(n,y.only(e,"method")),y.resolvedPromise())},i=function(t,n,e){var o,u,i,a,p,f,d,m;for(e=y.options(e,{historyMethod:"push"}),y.castsToFalse(e.history)&&(e.history=null),y.castsToFalse(e.scroll)&&(e.scroll=null),e.source=y.option(e.source,e.history),f=l(n),e.title||(e.title=f.title()),p=s(t,e),d=[],i=0,a=p.length;a>i;i++)m=p[i],u=r(m.selector),o=f.find(m.selector),d.push(c(u,e).then(function(){return g(u,o,m.pseudoClass,m.transition,e)}));return d},r=function(t){return o(".up-popup "+t)||o(".up-modal "+t)||o(t)||u(t)},u=function(t){var n;return n="Could not find selector %o in current body HTML","#"===n[0]&&(n+=" (avoid using IDs)"),y.error(n,t)},l=function(t){var n;return n=y.createElementFromHtml(t),{title:function(){var t;return null!=(t=n.querySelector("title"))?t.textContent:void 0},find:function(e){var r;return(r=n.querySelector(e))?$(r):y.error("Could not find selector %o in response %o",e,t)}}},c=function(t,n){return up.motion.finish(t),m(t,n.scroll)},m=function(t,n){return n?up.reveal(t,{view:n}):y.resolvedDeferred()},e=function(n,e){return"function"==typeof e.insert&&e.insert(n),e.history&&(e.title&&(document.title=e.title),up.history[e.historyMethod](e.history)),h(n,e.source),t(n),up.ready(n)},g=function(t,r,o,u,i){var a,s;return u||(u="none"),o?(s="before"===o?"prepend":"append",a=r.children(),t[s](r.contents()),y.copyAttributes(r,t),e(a,i),up.animate(r,u,i)):n(t,{animation:function(){return r.insertBefore(t),e(r,i),t.is("body")&&"none"!==u&&y.error("Cannot apply transitions to body-elements (%o)",u),up.morph(t,r,u,i)}})},s=function(t,n){var e,r,o,u,i,a,s,l,c,p,f;for(p=n.transition||n.animation||"none",e=/\ *,\ */,r=t.split(e),y.isPresent(p)&&(f=p.split(e)),a=[],o=u=0,i=r.length;i>u;o=++u)s=r[o],l=s.match(/^(.+?)(?:\:(before|after))?$/),c=f[o]||y.last(f),a.push({selector:l[1],pseudoClass:l[2],transition:c});return a},t=function(t){var n,e;return e="[autofocus]:last",n=y.findWithSelf(t,e),n.length&&n.get(0)!==document.activeElement?n.focus():void 0},a=function(t){var n;return n=".up-ghost, .up-destroying",0===t.closest(n).length},o=function(t){var n,e,r,o,u,i;for(o=$(t).get(),e=null,u=0,i=o.length;i>u;u++)if(r=o[u],n=$(r),a(n)){e=n;break}return e},n=function(t,n){var e,r,o;return e=$(t),n=y.options(n,{animation:"none"}),r=up.motion.animateOptions(n),e.addClass("up-destroying"),y.isPresent(n.url)&&up.history.push(n.url),y.isPresent(n.title)&&(document.title=n.title),up.bus.emit("fragment:destroy",e),o=y.presence(n.animation,y.isPromise)||up.motion.animate(e,n.animation,r),o.then(function(){return e.remove()})},p=function(t,n){var e;return n=y.options(n,{cache:!1}),e=n.url||v(t),f(t,e,n)},d=function(){return up.bus.emit("framework:reset")},up.bus.on("app:ready",function(){return h(document.body,up.browser.url())}),{replace:f,reload:p,destroy:n,implant:i,reset:d,first:o}}(),up.replace=up.flow.replace,up.reload=up.flow.reload,up.destroy=up.flow.destroy,up.reset=up.flow.reset,up.first=up.flow.first}.call(this),function(){var t=[].slice;up.magic=function(){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g;return g=up.util,n="up-destroyable",e="up-destroyer",f=[],l=null,p=function(t,n,e){var r,o;if(up.browser.isSupported())return r=[t,n,function(t){return e.apply(this,[t,$(this),a(this)])}],f.push(r),(o=$(document)).on.apply(o,r)},i=[],s=null,u=function(){var n,e,r;return r=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],up.browser.isSupported()?(u=n.pop(),e=g.options(n[0],{batch:!1}),i.push({selector:r,callback:u,batch:e.batch})):void 0},r=function(t,r,o){var u;return g.debug("Applying compiler %o on %o",t.selector,o),u=t.callback.apply(o,[r,a(r)]),g.isFunction(u)?(r.addClass(n),r.data(e,u)):void 0},o=function(t){var n,e,o,a;for(g.debug("Compiling fragment %o",t),a=[],e=0,o=i.length;o>e;e++)u=i[e],n=g.findWithSelf(t,u.selector),a.push(n.length?u.batch?r(u,n,n.get()):n.each(function(){return r(u,$(this),this)}):void 0);return a},c=function(t){return g.findWithSelf(t,"."+n).each(function(){var t,n;return t=$(this),(n=t.data(e))()})},a=function(t){var n,e;return n=$(t),e=n.attr("up-data"),g.isString(e)&&""!==g.trim(e)?JSON.parse(e):{}},v=function(){return l=g.copy(f),s=g.copy(i)},h=function(){var t,n,e,r;for(n=0,e=f.length;e>n;n++)t=f[n],g.contains(l,t)||(r=$(document)).off.apply(r,t);return f=g.copy(l),i=g.copy(s)},m=function(t){var n;return n=$(t),up.bus.emit("fragment:ready",n),n},d=function(t){return p("keydown","body",function(n){return g.escapePressed(n)?t(n):void 0})},up.bus.on("app:ready",function(){return m(document.body)}),up.bus.on("fragment:ready",o),up.bus.on("fragment:destroy",c),up.bus.on("framework:ready",v),up.bus.on("framework:reset",h),{compiler:u,on:p,ready:m,onEscape:d,data:a}}(),up.compiler=up.magic.compiler,up.on=up.magic.on,up.ready=up.magic.ready,up.awaken=function(){var n;return n=1<=arguments.length?t.call(arguments,0):[],up.util.warn("up.awaken has been renamed to up.compiler and will be removed in a future version"),up.compiler.apply(up,n)}}.call(this),function(){up.history=function(){var t,n,e,r,o,u;return u=up.util,t=function(t){return u.normalizeUrl(t,{hash:!0})===u.normalizeUrl(up.browser.url(),{hash:!0})},o=function(e,r){return r=u.options(r,{force:!1}),r.force||!t(e)?n("replace",e):void 0},r=function(e){return t(e)?void 0:n("push",e)},n=function(t,n){return up.browser.canPushState()?(t+="State",window.history[t]({fromUp:!0},"",n)):u.error("This browser doesn't support history.pushState")},e=function(t){var n;return n=t.originalEvent.state,(null!=n?n.fromUp:void 0)?(u.debug("Restoring state %o (now on "+up.browser.url()+")",n),up.visit(up.browser.url(),{historyMethod:"replace"})):u.debug("Discarding unknown state %o",n)},up.browser.canPushState()&&setTimeout(function(){return $(window).on("popstate",e),o(up.browser.url(),{force:!0})},200),{push:r,replace:o}}()}.call(this),function(){up.motion=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w;return b=up.util,o={},a={},y={},s={},i=b.config({duration:300,delay:0,easing:"ease"}),m=function(){return o=b.copy(a),y=b.copy(s),i.reset()},n=function(t,r,o){var i;return i=$(t),c(i),o=e(o),b.isFunction(r)?u(r(i,o),r):b.isString(r)?n(i,l(r),o):b.isHash(r)?b.cssAnimate(i,r,o):b.error("Unknown animation type %o",r)},e=function(t,n){var e;return null==n&&(n=null),t=b.options(t),e={},e.easing=b.option(t.easing,null!=n?n.attr("up-easing"):void 0,i.easing),e.duration=Number(b.option(t.duration,null!=n?n.attr("up-duration"):void 0,i.duration)),e.delay=Number(b.option(t.delay,null!=n?n.attr("up-delay"):void 0,i.delay)),e},l=function(t){return o[t]||b.error("Unknown animation %o",r)},t="up-ghosting-promise",w=function(n,e,r){var o,u,i,a;return u=null,o=null,b.temporaryCss(e,{display:"none"},function(){return u=b.prependGhost(n).addClass("up-destroying")}),b.temporaryCss(n,{display:"none"},function(){return o=b.prependGhost(e)}),n.css({visibility:"hidden"}),a=b.temporaryCss(e,{display:"none"}),i=r(u,o),n.data(t,i),e.data(t,i),i.then(function(){return n.removeData(t),e.removeData(t),u.remove(),o.remove(),n.css({display:"none"}),a()}),i},c=function(t){return $(t).each(function(){var t;return t=$(this),b.finishCssAnimate(t),p(t)})},p=function(n){var e;return(e=n.data(t))?(b.debug("Canceling existing ghosting on %o",n),"function"==typeof e.resolve?e.resolve():void 0):void 0},u=function(t,n){return b.isDeferred(t)?t:b.error("Did not return a promise with .then and .resolve methods: %o",n)},f=function(t,r,i,a){var s,l,p,m,v;return up.browser.canCssAnimation()?(a=e(a),l=$(t),s=$(r),c(l),c(s),"none"===i?d():(v=b.presence(i,b.isFunction)||y[i])?w(l,s,function(t,n){return u(v(t,n,a),i)}):(p=o[i])?(l.hide(),n(s,p,a)):b.isString(i)&&i.indexOf("/")>=0?(m=i.split("/"),v=function(t,e,r){return h(n(t,m[0],r),n(e,m[1],r))},f(l,s,v,a)):b.error("Unknown transition %o",i)):b.resolvedDeferred()},g=function(t,n){return y[t]=n},r=function(t,n){return o[t]=n},v=function(){return a=b.copy(o),s=b.copy(y)},h=b.resolvableWhen,d=b.resolvedDeferred,r("none",d),r("fade-in",function(t,e){return t.css({opacity:0}),n(t,{opacity:1},e)}),r("fade-out",function(t,e){return t.css({opacity:1}),n(t,{opacity:0},e)}),r("move-to-top",function(t,e){var r,o;return r=b.measure(t),o=r.top+r.height,t.css({"margin-top":"0px"}),n(t,{"margin-top":"-"+o+"px"},e)}),r("move-from-top",function(t,e){var r,o;return r=b.measure(t),o=r.top+r.height,t.css({"margin-top":"-"+o+"px"}),n(t,{"margin-top":"0px"},e)}),r("move-to-bottom",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().height-r.top,t.css({"margin-top":"0px"}),n(t,{"margin-top":o+"px"},e)}),r("move-from-bottom",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().height-r.top,t.css({"margin-top":o+"px"}),n(t,{"margin-top":"0px"},e)}),r("move-to-left",function(t,e){var r,o;return r=b.measure(t),o=r.left+r.width,t.css({"margin-left":"0px"}),n(t,{"margin-left":"-"+o+"px"},e)}),r("move-from-left",function(t,e){var r,o;return r=b.measure(t),o=r.left+r.width,t.css({"margin-left":"-"+o+"px"}),n(t,{"margin-left":"0px"},e)}),r("move-to-right",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().width-r.left,t.css({"margin-left":"0px"}),n(t,{"margin-left":o+"px"},e)}),r("move-from-right",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().width-r.left,t.css({"margin-left":o+"px"}),n(t,{"margin-left":"0px"},e)}),r("roll-down",function(t,e){var r,o;return r=t.height(),o=b.temporaryCss(t,{height:"0px",overflow:"hidden"}),n(t,{height:r+"px"},e).then(o)}),g("none",d),g("move-left",function(t,e,r){return h(n(t,"move-to-left",r),n(e,"move-from-right",r))}),g("move-right",function(t,e,r){return h(n(t,"move-to-right",r),n(e,"move-from-left",r))}),g("move-up",function(t,e,r){return h(n(t,"move-to-top",r),n(e,"move-from-bottom",r))}),g("move-down",function(t,e,r){return h(n(t,"move-to-bottom",r),n(e,"move-from-top",r))}),g("cross-fade",function(t,e,r){return h(n(t,"fade-out",r),n(e,"fade-in",r))}),up.bus.on("framework:ready",v),up.bus.on("framework:reset",m),{morph:f,animate:n,animateOptions:e,finish:c,transition:g,animation:r,defaults:i.update,none:d,when:h}}(),up.transition=up.motion.transition,up.animation=up.motion.animation,up.morph=up.motion.morph,up.animate=up.motion.animate}.call(this),function(){up.proxy=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,x,C,T,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){return u.debug("Visiting "+t),up.replace("body",t,n)},follow=function(t,n){var e,r,o;return e=$(t),n=u.options(n),o=u.option(e.attr("up-href"),e.attr("href")),r=u.option(n.target,e.attr("up-target"),"body"),n.transition=u.option(n.transition,e.attr("up-transition"),e.attr("up-animation")),n.history=u.option(n.history,e.attr("up-history")),n.scroll=u.option(n.scroll,e.attr("up-scroll"),"body"),n.cache=u.option(n.cache,e.attr("up-cache")),n.method=followMethod(e,n),n=u.merge(n,up.motion.animateOptions(n,e)),up.replace(r,o,n)},followMethod=function(t,n){return n=u.options(n),u.option(n.method,t.attr("up-method"),t.attr("data-method"),"get").toUpperCase()},up.on("click","a[up-target], [up-href][up-target]",function(t,n){return shouldProcessLinkEvent(t,n)?n.is("[up-instant]")?t.preventDefault():(t.preventDefault(),follow(n)):void 0}),up.on("mousedown","a[up-instant], [up-href][up-instant]",function(t,n){return shouldProcessLinkEvent(t,n)?(t.preventDefault(),follow(n)):void 0}),childClicked=function(t,n){var e,r;return e=$(t.target),r=e.closest("a, [up-href]"),r.length&&n.find(r).length},shouldProcessLinkEvent=function(t,n){return u.isUnmodifiedMouseEvent(t)&&!childClicked(t,n)},up.on("click","a[up-follow], [up-href][up-follow]",function(t,n){return shouldProcessLinkEvent(t,n)?n.is("[up-instant]")?t.preventDefault():(t.preventDefault(),follow(n)):void 0}),up.compiler("[up-expand]",function(t){var n,e,r,o,i,a,s,l;for(o=t.find("a, [up-href]").get(0),o||u.error("No link to expand within %o",t),l=/^up-/,a={},a["up-href"]=$(o).attr("href"),s=o.attributes,e=0,r=s.length;r>e;e++)n=s[e],i=n.name,i.match(l)&&(a[i]=n.value);return u.isGiven(a["up-target"])||(a["up-follow"]=""),u.setMissingAttrs(t,a),t.removeAttr("up-expand")}),up.compiler("[up-dash]",function(t){var n,e;return e=t.attr("up-dash"),n={"up-preload":"true","up-instant":"true"},u.isBlank(e)||u.castsToTrue(e)?n["up-follow"]="":n["up-target"]=e,u.setMissingAttrs(t,n),t.removeAttr("up-dash")}),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visit,follow:follow,childClicked:childClicked,followMethod:followMethod}}(),up.visit=up.link.visit,up.follow=up.link.follow}.call(this),function(){up.form=function(){var observe,submit,u;return u=up.util,submit=function(t,n){var e,r,o,i,a,s,l,c,p,f,d,m;return e=$(t).closest("form"),n=u.options(n),c=u.option(n.target,e.attr("up-target"),"body"),o=u.option(n.failTarget,e.attr("up-fail-target"),function(){return u.createSelectorFromElement(e)}),a=u.option(n.history,e.attr("up-history"),!0),p=u.option(n.transition,e.attr("up-transition")),i=u.option(n.failTransition,e.attr("up-fail-transition"),p),s=u.option(n.method,e.attr("up-method"),e.attr("data-method"),e.attr("method"),"post").toUpperCase(),r=up.motion.animateOptions(n,e),m=u.option(n.cache,e.attr("up-cache")),d=u.option(n.url,e.attr("action"),up.browser.url()),e.addClass("up-active"),up.browser.canPushState()||u.castsToFalse(a)?(l={url:d,method:s,data:e.serialize(),selector:c,cache:m},f=function(t){var n;return d=a?u.castsToFalse(a)?!1:u.isString(a)?a:(n=u.locationFromXhr(t))?n:"GET"===l.type?l.url+"?"+l.data:void 0:void 0,u.option(d,!1)},up.proxy.ajax(l).always(function(){return e.removeClass("up-active")}).done(function(t,n,e){var o;return o=u.merge(r,{history:f(e),transition:p}),up.flow.implant(c,t,o)}).fail(function(t){var n,e;return e=t.responseText,n=u.merge(r,{transition:i}),up.flow.implant(o,e,n)})):void e.get(0).submit()},observe=function(fieldOrSelector,options){var $field,callback,callbackPromise,callbackTimer,changeEvents,check,clearTimer,codeOnChange,delay,knownValue,nextCallback,runNextCallback;return $field=$(fieldOrSelector),options=u.options(options),delay=u.option($field.attr("up-delay"),options.delay,0),delay=parseInt(delay),knownValue=null,callback=null,callbackTimer=null,(codeOnChange=$field.attr("up-observe"))?callback=function(value,$field){return eval(codeOnChange)}:options.change?callback=options.change:u.error("up.observe: No change callback given"),callbackPromise=u.resolvedPromise(),nextCallback=null,runNextCallback=function(){var t;return nextCallback?(t=nextCallback(),nextCallback=null,t):void 0},check=function(){var t,n;return n=$field.val(),t=u.isNull(knownValue),knownValue===n||(knownValue=n,t)?void 0:(clearTimer(),nextCallback=function(){return callback.apply($field.get(0),[n,$field])},callbackTimer=setTimeout(function(){return callbackPromise.then(function(){var t;return t=runNextCallback(),callbackPromise=u.isPromise(t)?t:u.resolvedPromise()})},delay))},clearTimer=function(){return clearTimeout(callbackTimer)},changeEvents=up.browser.canInputEvent()?"input change":"input change keypress paste cut click propertychange",$field.on(changeEvents,check),check(),clearTimer},up.on("submit","form[up-target]",function(t,n){return t.preventDefault(),submit(n)}),up.compiler("[up-observe]",function(t){return observe(t)}),{submit:submit,observe:observe}}(),up.submit=up.form.submit,up.observe=up.form.observe}.call(this),function(){up.popup=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m;return d=up.util,u=void 0,e=d.config({openAnimation:"fade-in",closeAnimation:"fade-out",position:"bottom-right"}),c=function(){return n(),e.reset()},p=function(t,n,e){var r,o;return o=d.measure(t,{full:!0}),r=function(){switch(e){case"bottom-right":return{right:o.right,top:o.top+o.height};
2
+ 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);
@@ -168,15 +168,14 @@ up.flow = (->
168
168
  u.error("Could not find selector %o in response %o", selector, html)
169
169
 
170
170
  prepareForReplacement = ($element, options) ->
171
- # Before we select a replacement target, ensure that all transitions
172
- # and animations have been run. Finishing a transition usually removes
173
- # the element that is being morphed, so it will affect further selections
174
- # using the same selector.
171
+ # Ensure that all transitions and animations have completed.
175
172
  up.motion.finish($element)
173
+ # Make sure the old element is visible in the viewport
174
+ # to mimick browser behavior during a page switch.
176
175
  reveal($element, options.scroll)
177
176
 
178
177
  reveal = ($element, view) ->
179
- if view
178
+ if view # empty strings are falsish in Javascript
180
179
  up.reveal($element, view: view)
181
180
  else
182
181
  u.resolvedDeferred()
@@ -49,13 +49,14 @@ up.navigation = (->
49
49
 
50
50
  sectionUrls = ($section) ->
51
51
  urls = []
52
- for attr in ['href', 'up-href']
52
+ for attr in ['href', 'up-href', 'up-alias']
53
53
  if value = u.presentAttr($section, attr)
54
- urls.push(value)
55
- if aliases = u.presentAttr($section, 'up-alias')
56
- values = aliases.split(' ')
57
- urls = urls.concat(values)
58
- urls.map normalizeUrl
54
+ values = if attr == 'up-alias' then value.split(' ') else [value]
55
+ for url in values
56
+ unless url == '#'
57
+ url = normalizeUrl(url)
58
+ urls.push(url)
59
+ urls
59
60
 
60
61
  urlSet = (urls) ->
61
62
  urls = u.compact(urls)
@@ -623,12 +623,16 @@ up.util = (->
623
623
  config = (factoryOptions = {}) ->
624
624
  hash =
625
625
  reset: ->
626
- ownKeys = Object.getOwnPropertyNames(hash)
626
+ ownKeys = copy(Object.getOwnPropertyNames(hash))
627
627
  for key in ownKeys
628
628
  delete hash[key] unless contains(apiKeys, key)
629
629
  hash.update copy(factoryOptions)
630
630
  update: (options) ->
631
- extend(hash, options)
631
+ for key, value of options
632
+ if factoryOptions.hasOwnProperty(key)
633
+ hash[key] = value
634
+ else
635
+ error("Unknown setting %o", key)
632
636
  apiKeys = Object.getOwnPropertyNames(hash)
633
637
  hash.reset()
634
638
  hash
@@ -6,6 +6,13 @@ This modules contains functions to scroll the viewport and reveal contained elem
6
6
 
7
7
  By default Up.js will always scroll to an element before updating it.
8
8
 
9
+ The container that will be scrolled is the closest parent of the element that is either:
10
+
11
+ - The currently open [modal](/up.modal)
12
+ - An element with the attribute `[up-viewport]`
13
+ - The `<body>` element
14
+ - An element matching the selector you have configured using `up.viewport.defaults({ viewSelector: 'my-custom-selector' })`.
15
+
9
16
  @class up.viewport
10
17
  ###
11
18
  up.viewport = (->
@@ -16,12 +23,11 @@ up.viewport = (->
16
23
  @method up.viewport.defaults
17
24
  @param {Number} [options.duration]
18
25
  @param {String} [options.easing]
19
- @param {Number} [options.padding]
20
- @param {String|Element|jQuery} [options.view]
26
+ @param {String} [options.viewSelector]
21
27
  ###
22
28
  config = u.config
23
29
  duration: 0
24
- view: 'body'
30
+ viewSelector: 'body, .up-modal, [up-viewport]'
25
31
  easing: 'swing'
26
32
 
27
33
  reset = ->
@@ -38,7 +44,7 @@ up.viewport = (->
38
44
  @return {Deferred}
39
45
  @protected
40
46
  ###
41
- scroll = (viewOrSelector, scrollPos, options) ->
47
+ scroll = (viewOrSelector, scrollTop, options) ->
42
48
  $view = $(viewOrSelector)
43
49
  options = u.options(options)
44
50
  duration = u.option(options.duration, config.duration)
@@ -52,10 +58,13 @@ up.viewport = (->
52
58
  $view.data(SCROLL_PROMISE_KEY, deferred)
53
59
  deferred.then ->
54
60
  $view.removeData(SCROLL_PROMISE_KEY)
61
+ # Since we're scrolling using #animate, #finish can be
62
+ # used to jump to the last frame:
63
+ # https://api.jquery.com/finish/
55
64
  $view.finish()
56
65
 
57
66
  targetProps =
58
- scrollTop: scrollPos
67
+ scrollTop: scrollTop
59
68
 
60
69
  $view.animate targetProps,
61
70
  duration: duration,
@@ -64,7 +73,7 @@ up.viewport = (->
64
73
 
65
74
  deferred
66
75
  else
67
- $view.scrollTop(scrollPos)
76
+ $view.scrollTop(scrollTop)
68
77
  u.resolvedDeferred()
69
78
 
70
79
  ###*
@@ -82,38 +91,76 @@ up.viewport = (->
82
91
  @param {String|Element|jQuery} [options.view]
83
92
  @param {Number} [options.duration]
84
93
  @param {String} [options.easing]
85
- @param {Number} [options.padding]
86
94
  @return {Deferred}
87
95
  @protected
88
96
  ###
89
97
  reveal = (elementOrSelector, options) ->
90
98
 
91
99
  options = u.options(options)
92
- view = u.option(options.view, config.view)
93
- padding = u.option(options.padding, config.padding)
94
100
 
95
101
  $element = $(elementOrSelector)
96
- $view = $(view)
102
+ $view = findView($element, options.view)
103
+ viewIsBody = $view.is('body')
104
+
105
+ viewHeight = if viewIsBody then u.clientSize().height else $view.height()
106
+
107
+ originalScrollPos = $view.scrollTop()
108
+ newScrollPos = originalScrollPos
97
109
 
98
- viewHeight = $view.height()
99
- scrollPos = $view.scrollTop()
110
+ # When the scrolled element is not <body> but instead a container
111
+ # with overflow-y: scroll, $.position returns the position the
112
+ # the first row of the client area instead of the first row of
113
+ # the canvas buffer.
114
+ # http://codepen.io/anon/pen/jPojGE
115
+ offsetShift = if viewIsBody then 0 else originalScrollPos
100
116
 
101
- firstVisibleRow = scrollPos
102
- lastVisibleRow = scrollPos + viewHeight
117
+ firstVisibleRow = -> newScrollPos
118
+ lastVisibleRow = -> newScrollPos + viewHeight - 1
103
119
 
104
- elementTop = $element.position().top
105
-
106
- elementTooHigh = elementTop - padding < firstVisibleRow
107
- elementTooLow = elementTop > lastVisibleRow - padding
120
+ elementDims = u.measure($element, relative: true)
121
+ firstElementRow = elementDims.top + offsetShift
122
+ lastElementRow = firstElementRow + elementDims.height - 1
108
123
 
109
- if elementTooHigh || elementTooLow
110
- scrollPos = elementTop - padding
111
- scrollPos = Math.max(scrollPos, 0)
112
- scrollPos = Math.min(scrollPos, viewHeight - 1)
113
- scroll($view, scrollPos, options)
124
+ if lastElementRow > lastVisibleRow()
125
+ # Try to show the full height of the element
126
+ newScrollPos += (lastElementRow - lastVisibleRow())
127
+
128
+ if firstElementRow < firstVisibleRow()
129
+ # If the full element does not fit, scroll to the first row
130
+ newScrollPos = firstElementRow
131
+
132
+ if newScrollPos != originalScrollPos
133
+ scroll($view, newScrollPos, options)
114
134
  else
115
135
  u.resolvedDeferred()
116
136
 
137
+ ###*
138
+ @private
139
+ @method up.viewport.findView
140
+ ###
141
+ findView = ($element, viewSelectorOrElement) ->
142
+ $view = undefined
143
+ # If someone has handed as a jQuery element, that's the
144
+ # view period.
145
+ if u.isJQuery(viewSelectorOrElement)
146
+ $view = viewSelectorOrElement
147
+ else
148
+ # If we have been given
149
+ viewSelector = u.presence(viewSelectorOrElement) || config.viewSelector
150
+ $view = $element.closest(viewSelector)
151
+
152
+ $view.length or u.error("Could not find view to scroll for %o (tried selectors %o)", $element, viewSelectors)
153
+ $view
154
+
155
+
156
+ ###*
157
+ Marks this element as a scrolling container.
158
+ Use this e.g. if your app uses a custom panel layout with fixed positioning
159
+ instead of scrolling `<body>`.
160
+
161
+ @method [up-viewport]
162
+ ###
163
+
117
164
  up.bus.on 'framework:reset', reset
118
165
 
119
166
  reveal: reveal
@@ -1,5 +1,5 @@
1
1
  module Upjs
2
2
  module Rails
3
- VERSION = '0.8.1'
3
+ VERSION = '0.8.2'
4
4
  end
5
5
  end
@@ -27,6 +27,10 @@ describe 'up.navigation', ->
27
27
  inserter = -> up.ready(affix('a[up-alias="/qqqq*"]'))
28
28
  expect(inserter).not.toThrow()
29
29
 
30
+ it 'does not highlight a link to "#" (commonly used for JS-only buttons)', ->
31
+ $link = up.ready(affix('a[href="#"]'))
32
+ expect($link).not.toHaveClass('up-current')
33
+
30
34
  it 'marks URL prefixes as .up-current if an up-alias value ends in *', ->
31
35
  spyOn(up.browser, 'url').and.returnValue('/foo/123')
32
36
  $currentLink = up.ready(affix('span[up-alias="/aaa /foo/* /bbb"]'))
@@ -64,19 +64,32 @@ describe 'up.util', ->
64
64
  expect(object.a).toBe(1)
65
65
  expect(object.b).toBe(2)
66
66
 
67
- it 'provies an #update method that merges the given options into the object', ->
68
- object = up.util.config(a: 1)
69
- object.update(b: 2, c: 3)
70
- expect(object.b).toBe(2)
71
- expect(object.c).toBe(3)
67
+ describe '#update', ->
72
68
 
73
- it 'provides a #reset method that resets the object to its original state', ->
74
- object = up.util.config(a: 1)
75
- expect(object.b).toBeUndefined()
76
- object.b = 2
77
- expect(object.b).toBe(2)
78
- object.reset()
79
- expect(object.b).toBeUndefined()
80
- # Make sure that resetting doesn't remove #reset or #update
81
- expect(object.reset).toBeDefined()
82
- expect(object.update).toBeDefined()
69
+ it 'merges the given options into the object', ->
70
+ object = up.util.config(a: 1, b: undefined, c: undefined)
71
+ object.update(b: 2, c: 3)
72
+ expect(object.b).toBe(2)
73
+ expect(object.c).toBe(3)
74
+
75
+ it 'throws an error when setting a key that was not included in the factory settings', ->
76
+ object = up.util.config(a: 1)
77
+ update = -> object.update(b: 2)
78
+ expect(update).toThrowError(/unknown setting/i)
79
+
80
+ describe '#reset', ->
81
+
82
+ it 'resets the object to its original state', ->
83
+ object = up.util.config(a: 1)
84
+ expect(object.b).toBeUndefined()
85
+ object.b = 2
86
+ expect(object.b).toBe(2)
87
+ object.reset()
88
+ expect(object.b).toBeUndefined()
89
+
90
+ it 'does not remove #reset or #update methods from the object', ->
91
+ object = up.util.config(a: 1)
92
+ object.b = 2
93
+ object.reset()
94
+ expect(object.reset).toBeDefined()
95
+ expect(object.update).toBeDefined()
@@ -0,0 +1,122 @@
1
+ describe 'up.viewport', ->
2
+
3
+ u = up.util
4
+
5
+ describe 'Javascript functions', ->
6
+
7
+ describe 'up.reveal', ->
8
+
9
+ describe 'when the container is body', ->
10
+
11
+ beforeEach ->
12
+ @restoreMargin = u.temporaryCss($('body'), 'margin-top': 0)
13
+
14
+ afterEach ->
15
+ @$container.remove()
16
+ @restoreMargin()
17
+
18
+ it 'reveals the given element', ->
19
+ $view = $('body')
20
+ $view.scrollTop(0)
21
+ $elements = []
22
+ @$container = $('<div class="container">').prependTo($view)
23
+
24
+ for i in [0..2]
25
+ $element = $('<div>').css(height: '5000px').text("Child #{i}")
26
+ $element.appendTo(@$container)
27
+ $elements.push($element)
28
+
29
+ # --------------
30
+ # [0] 00000..04999
31
+ # --------------
32
+ # [1] 05000..09999
33
+ # [3] 10000..14999
34
+ expect($view.scrollTop()).toBe(0)
35
+
36
+ up.reveal($elements[1], view: $view)
37
+ # [0] 00000..04999
38
+ # --------------
39
+ # [1] 05000..09999
40
+ # --------------
41
+ # [3] 10000..14999
42
+ expect($view.scrollTop()).toBe(5000)
43
+
44
+ up.reveal($elements[2], view: $view)
45
+ # [0] 00000..04999
46
+ # [1] 05000..09999
47
+ # --------------
48
+ # [3] 10000..14999
49
+ # --------------
50
+ expect($view.scrollTop()).toBe(10000)
51
+
52
+ describe 'when the view is a container with overflow-y: scroll', ->
53
+
54
+ it 'reveals the given element', ->
55
+ $view = affix('div').css
56
+ 'position': 'absolute'
57
+ 'width': '100px'
58
+ 'height': '100px'
59
+ 'overflow-y': 'scroll'
60
+ $elements = []
61
+ u.each [0..5], ->
62
+ $element = $('<div>').css(height: '50px')
63
+ $element.appendTo($view)
64
+ $elements.push($element)
65
+
66
+ # --------------
67
+ # [0] 000..049
68
+ # [1] 050..099
69
+ # --------------
70
+ # [2] 100..149
71
+ # [3] 150..199
72
+ # [4] 200..249
73
+ # [5] 250..399
74
+ expect($view.scrollTop()).toBe(0)
75
+
76
+ # See that the view only scrolls down as little as possible
77
+ # in order to reveal the element
78
+ up.reveal($elements[3], view: $view)
79
+ # [0] 000..049
80
+ # [1] 050..099
81
+ # --------------
82
+ # [2] 100..149
83
+ # [3] 150..199
84
+ # --------------
85
+ # [4] 200..249
86
+ # [5] 250..399
87
+ expect($view.scrollTop()).toBe(100)
88
+
89
+ # See that the view doesn't move if the element
90
+ # is already revealed
91
+ up.reveal($elements[2], view: $view)
92
+ expect($view.scrollTop()).toBe(100)
93
+
94
+ # See that the view scrolls as far down as it cans
95
+ # to show the bottom element
96
+ up.reveal($elements[5], view: $view)
97
+ # [0] 000..049
98
+ # [1] 050..099
99
+ # [2] 100..149
100
+ # [3] 150..199
101
+ # --------------
102
+ # [4] 200..249
103
+ # [5] 250..399
104
+ # --------------
105
+ expect($view.scrollTop()).toBe(200)
106
+
107
+ # See that the view only scrolls up as little as possible
108
+ # in order to reveal the element
109
+ up.reveal($elements[1], view: $view)
110
+ # [0] 000..049
111
+ # --------------
112
+ # [1] 050..099
113
+ # [2] 100..149
114
+ # --------------
115
+ # [3] 150..199
116
+ # [4] 200..249
117
+ # [5] 250..399
118
+ expect($view.scrollTop()).toBe(50)
119
+
120
+ describe 'up.scroll', ->
121
+
122
+ it 'should have tests'
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.8.1
4
+ version: 0.8.2
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-15 00:00:00.000000000 Z
11
+ date: 2015-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -220,6 +220,7 @@ files:
220
220
  - spec_app/spec/javascripts/up/slot_spec.js.coffee
221
221
  - spec_app/spec/javascripts/up/tooltip_spec.js.coffee
222
222
  - spec_app/spec/javascripts/up/util_spec.js.coffee
223
+ - spec_app/spec/javascripts/up/viewport_spec.js.coffee
223
224
  - spec_app/test/controllers/.keep
224
225
  - spec_app/test/fixtures/.keep
225
226
  - spec_app/test/helpers/.keep
@@ -573,7 +574,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
573
574
  version: '0'
574
575
  requirements: []
575
576
  rubyforge_project:
576
- rubygems_version: 2.2.2
577
+ rubygems_version: 2.4.8
577
578
  signing_key:
578
579
  specification_version: 4
579
580
  summary: Snappy UI for server-side web applications