upjs-rails 0.6.5 → 0.7.0

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: 0711cc4a37fe441b4cc7e9a752f7b6311d9826ff
4
- data.tar.gz: 5bba4cd822f064d7887b8e9d9cbd7bbbfc21adfd
3
+ metadata.gz: f53141ffd99539ab7bc215ba15ab960e977dd880
4
+ data.tar.gz: 8239bca9c301220a7a9a8b40e1ec5b0ee70e37d4
5
5
  SHA512:
6
- metadata.gz: c0d9251537916aea147145968772666c9971b78ddd1ee0e35238bd2b535acd3c8cc11daa910e23acc0e8dc03df58bb5886781e84f34e6a98ad8fd475a6312def
7
- data.tar.gz: 109a412229be04f509f1ebf01e14d6f52f490e00fcd82f35fdc7f041d3e651da27cb19c87cb581aaacbb0d991bb1a49ff2b95ca5b9e3847414cee906cfbb3126
6
+ metadata.gz: 2ac8d0ad08fd44a6bd63bfe67a11e7388ec79af88659cda42995e64c3687ddf390bdddb13b0a4995b8336eff19d2bc7042c9780ce0fd9478f02d9e94cb3c38ef
7
+ data.tar.gz: 91d72658bc7b13e5966223a885fb6c169fe60c0464e818c6f4b472eecdee52a51bd7b0d30b8c954faa1f7fae91038f02d482b35845fea8d222fb2667d70b3329
data/README.md CHANGED
@@ -33,15 +33,13 @@ We are currently feeding three release channels:
33
33
  - Bower
34
34
  - Rubygems (as the `upjs-rails` gem)
35
35
 
36
- To make a new Release, start with the gem:
36
+ To make a new release:
37
37
 
38
38
  - Edit `lib/upjs/rails/version.rb` and bump the version number. Use [semantic versioning](http://semver.org/).
39
39
  - Commit and push the version bump
40
+ - From the project root, type `rake assets:compile`. This will output minified JS and CSS files to the `dist` folder.
41
+ - Commit and push the generated files
40
42
  - From the project root, type `rake release`. This will publish a new gem version to Rubygems.org.
41
43
  It will also push a tag for this version, which Bower requires for its own versioning scheme.
42
-
43
- Now make the release for manual download and bower:
44
44
 
45
- - From the project root, type `rake assets:compile`
46
- - This will output minified JS and CSS files to the `dist` folder
47
- - Commit and push the generated files
45
+ Always run `rake assets:compile` before `rake release` so the git tag points to the correct commit (required for Bower versioning).
data/dist/up.js CHANGED
@@ -2627,7 +2627,7 @@ response will already be cached when the user performs the click.
2627
2627
 
2628
2628
  (function() {
2629
2629
  up.proxy = (function() {
2630
- var $waitingLink, SAFE_HTTP_METHODS, ajax, alias, cache, cacheKey, cancelDelay, checkPreload, clear, config, defaults, delayTimer, ensureIsIdempotent, get, isFresh, isIdempotent, normalizeRequest, preload, remove, reset, set, startDelay, timestamp, trim, u;
2630
+ var $waitingLink, SAFE_HTTP_METHODS, ajax, alias, cache, cacheKey, cancelDelay, checkPreload, clear, config, defaults, delayTimer, get, isFresh, isIdempotent, normalizeRequest, preload, remove, reset, set, startDelay, timestamp, trim, u;
2631
2631
  config = {
2632
2632
  preloadDelay: 75,
2633
2633
  cacheSize: 70,
@@ -2740,9 +2740,6 @@ response will already be cached when the user performs the click.
2740
2740
  normalizeRequest(request);
2741
2741
  return u.contains(SAFE_HTTP_METHODS, request.method);
2742
2742
  };
2743
- ensureIsIdempotent = function(request) {
2744
- return isIdempotent(request) || u.error("Won't preload non-GET request %o", request);
2745
- };
2746
2743
  isFresh = function(promise) {
2747
2744
  var timeSinceTouch;
2748
2745
  timeSinceTouch = timestamp() - promise.timestamp;
@@ -2865,7 +2862,7 @@ response will already be cached when the user performs the click.
2865
2862
  */
2866
2863
  up.on('mouseover mousedown touchstart', '[up-preload]', function(event, $element) {
2867
2864
  if (!up.link.childClicked(event, $element)) {
2868
- return checkPreload(up.link.resolve($element));
2865
+ return checkPreload($element);
2869
2866
  }
2870
2867
  });
2871
2868
  return {
@@ -2968,7 +2965,7 @@ Read on
2968
2965
 
2969
2966
  (function() {
2970
2967
  up.link = (function() {
2971
- var childClicked, follow, followMethod, resolve, shouldProcessLinkEvent, u, visit;
2968
+ var childClicked, follow, followMethod, shouldProcessLinkEvent, u, visit;
2972
2969
  u = up.util;
2973
2970
 
2974
2971
  /**
@@ -3028,7 +3025,7 @@ Read on
3028
3025
  var $link, selector, url;
3029
3026
  $link = $(link);
3030
3027
  options = u.options(options);
3031
- url = u.option($link.attr('href'), $link.attr('up-follow'));
3028
+ url = u.option($link.attr('href'), $link.attr('up-href'));
3032
3029
  selector = u.option(options.target, $link.attr('up-target'), 'body');
3033
3030
  options.transition = u.option(options.transition, $link.attr('up-transition'), $link.attr('up-animation'));
3034
3031
  options.history = u.option(options.history, $link.attr('up-history'));
@@ -3047,16 +3044,6 @@ Read on
3047
3044
  options = u.options(options);
3048
3045
  return u.option(options.method, $link.attr('up-method'), $link.attr('data-method'), 'get').toUpperCase();
3049
3046
  };
3050
- resolve = function(element) {
3051
- var $element, followAttr;
3052
- $element = $(element);
3053
- followAttr = $element.attr('up-follow');
3054
- if ($element.is('a') || (u.isPresent(followAttr) && !u.castsToTrue(followAttr))) {
3055
- return $element;
3056
- } else {
3057
- return $element.find('a:first');
3058
- }
3059
- };
3060
3047
 
3061
3048
  /**
3062
3049
  Follows this link via AJAX and replaces a CSS selector in the current page
@@ -3095,27 +3082,25 @@ Read on
3095
3082
  Load more tasks
3096
3083
  </a>
3097
3084
 
3098
- \#\#\#\# Following on mousedown
3085
+ \#\#\#\# Following elements that are no links
3099
3086
 
3100
- By also adding an `up-instant` attribute, the page will be fetched
3101
- on `mousedown` instead of `click`, making the interaction even faster:
3087
+ You can also use `[up-target]` to turn an arbitrary element into a link.
3088
+ In this case, put the link's destination into the `up-href` attribute:
3102
3089
 
3103
- <a href="/users" up-target=".main" up-instant>User list</a>
3090
+ <button up-target=".main" up-href="/foo/bar">Go</button>
3104
3091
 
3105
- Note that using `[up-instant]` will prevent a user from canceling a link
3106
- click by moving the mouse away from the interaction area. However, for
3107
- navigation actions this isn't needed. E.g. popular operation
3108
- systems switch tabs on `mousedown`.
3092
+ Note that using any element other than `<a>` will prevent users from
3093
+ opening the destination in a new tab.
3109
3094
 
3110
- @method a[up-target]
3095
+ @method [up-target]
3111
3096
  @ujs
3112
3097
  @param {String} up-target
3113
3098
  The CSS selector to replace
3114
- @param up-instant
3115
- If set, fetches the element on `mousedown` instead of `click`.
3116
- This makes the interaction faster.
3099
+ @param [up-href]
3100
+ The destination URL to follow.
3101
+ If omitted, the the link's `href` attribute will be used.
3117
3102
  */
3118
- up.on('click', 'a[up-target]', function(event, $link) {
3103
+ up.on('click', '[up-target]', function(event, $link) {
3119
3104
  if (shouldProcessLinkEvent(event, $link)) {
3120
3105
  if ($link.is('[up-instant]')) {
3121
3106
  return event.preventDefault();
@@ -3125,10 +3110,30 @@ Read on
3125
3110
  }
3126
3111
  }
3127
3112
  });
3128
- up.on('mousedown', 'a[up-target][up-instant]', function(event, $link) {
3113
+
3114
+ /**
3115
+ By adding an `up-instant` attribute to a link, the destination will be
3116
+ fetched on `mousedown` instead of `click` (`mouseup`).
3117
+
3118
+ <a href="/users" up-target=".main" up-instant>User list</a>
3119
+
3120
+ This will save precious milliseconds that otherwise spent
3121
+ on waiting for the user to release the mouse button. Since an
3122
+ AJAX request will be triggered right way, the interaction will
3123
+ appear faster.
3124
+
3125
+ Note that using `[up-instant]` will prevent a user from canceling a link
3126
+ click by moving the mouse away from the interaction area. However, for
3127
+ navigation actions this isn't needed. E.g. popular operation
3128
+ systems switch tabs on `mousedown` instead of `click`.
3129
+
3130
+ @method [up-instant]
3131
+ @ujs
3132
+ */
3133
+ up.on('mousedown', '[up-instant]', function(event, $link) {
3129
3134
  if (shouldProcessLinkEvent(event, $link)) {
3130
3135
  event.preventDefault();
3131
- return up.follow($link);
3136
+ return follow($link);
3132
3137
  }
3133
3138
  });
3134
3139
 
@@ -3148,40 +3153,31 @@ Read on
3148
3153
 
3149
3154
  /**
3150
3155
  If applied on a link, Follows this link via AJAX and replaces the
3151
- current `<body>` element with the response's `<body>` element
3156
+ current `<body>` element with the response's `<body>` element.
3152
3157
 
3153
- <a href="/users" up-follow>User list</a>
3158
+ Example:
3154
3159
 
3155
- \#\#\#\# Following on mousedown
3160
+ <a href="/users" up-follow>User list</a>
3156
3161
 
3157
- By also adding an `up-instant` attribute, the page will be fetched
3158
- on `mousedown` instead of `click`, making the interaction even faster:
3162
+ To only update a fragment instead of the entire page,
3163
+ see [`up-target`](#up-target).
3159
3164
 
3160
- <a href="/users" up-follow up-instant>User list</a>
3165
+ \#\#\#\# Turn any element into a link
3161
3166
 
3162
- Note that using `[up-instant]` will prevent a user from canceling a link
3163
- click by moving the mouse away from the interaction area. However, for
3164
- navigation actions this isn't needed. E.g. popular operation
3165
- systems switch tabs on `mousedown`.
3167
+ You can also use `[up-follow]` to turn an arbitrary element into a link.
3168
+ In this case, put the link's destination into the `up-href` attribute:
3166
3169
 
3167
- \#\#\#\# Enlarging the click area
3170
+ <span up-follow up-href="/foo/bar">Go</span>
3168
3171
 
3169
- You can also apply `[up-follow]` to any element that contains a link
3170
- in order to enlarge the link's click area:
3171
-
3172
- <div class="notification" up-follow>
3173
- Record was saved!
3174
- <a href="/records">Close</a>
3175
- </div>
3176
-
3177
- In the example above, clicking anywhere within `.notification` element
3178
- would follow the *Close* link.
3172
+ Note that using any element other than `<a>` will prevent users from
3173
+ opening the destination in a new tab.
3179
3174
 
3180
3175
  @method [up-follow]
3181
3176
  @ujs
3182
3177
  @param {String} [up-follow]
3183
- @param up-instant
3184
- If set, fetches the element on `mousedown` instead of `click`.
3178
+ @param [up-href]
3179
+ The destination URL to follow.
3180
+ If omitted, the the link's `href` attribute will be used.
3185
3181
  */
3186
3182
  up.on('click', '[up-follow]', function(event, $link) {
3187
3183
  if (shouldProcessLinkEvent(event, $link)) {
@@ -3189,15 +3185,45 @@ Read on
3189
3185
  return event.preventDefault();
3190
3186
  } else {
3191
3187
  event.preventDefault();
3192
- return follow(resolve($link));
3188
+ return follow($link);
3193
3189
  }
3194
3190
  }
3195
3191
  });
3196
- up.on('mousedown', '[up-follow][up-instant]', function(event, $link) {
3197
- if (shouldProcessLinkEvent(event, $link)) {
3198
- event.preventDefault();
3199
- return follow(resolve($link));
3192
+
3193
+ /**
3194
+ Add an `up-expand` class to any element that contains a link
3195
+ in order to enlarge the link's click area:
3196
+
3197
+ <div class="notification" up-expand>
3198
+ Record was saved!
3199
+ <a href="/records">Close</a>
3200
+ </div>
3201
+
3202
+ In the example above, clicking anywhere within `.notification` element
3203
+ would [follow](#up-follow) the *Close* link.
3204
+
3205
+ `up-expand` honors all the UJS behavior in expanded links
3206
+ (`up-target`, `up-instant`, `up-preload`, etc.).
3207
+
3208
+ @ujs
3209
+ @method [up-expand]
3210
+ */
3211
+ up.compiler('[up-expand]', function($fragment) {
3212
+ var attribute, i, len, link, name, newAttrs, ref, upAttributePattern;
3213
+ link = $fragment.find('[up-href], [href]').get(0);
3214
+ link || u.error('No link to expand within %o', $fragment);
3215
+ upAttributePattern = /^up-/;
3216
+ newAttrs = {};
3217
+ ref = link.attributes;
3218
+ for (i = 0, len = ref.length; i < len; i++) {
3219
+ attribute = ref[i];
3220
+ name = attribute.name;
3221
+ if (name === 'href' || name.match(upAttributePattern)) {
3222
+ newAttrs[name] = attribute.value;
3223
+ }
3200
3224
  }
3225
+ u.setMissingAttrs($fragment, newAttrs);
3226
+ return $fragment.removeAttr('up-expand');
3201
3227
  });
3202
3228
 
3203
3229
  /**
@@ -3216,14 +3242,6 @@ Read on
3216
3242
 
3217
3243
  <a href="/users" up-target=".main" up-instant up-preload>User list</a>
3218
3244
 
3219
- You can also apply `[up-dash]` to any element that contains a link
3220
- in order to enlarge the link's click area:
3221
-
3222
- <div class="notification" up-dash>
3223
- Record was saved!
3224
- <a href="/records" up-dash='.main'>Close</a>
3225
- </div>
3226
-
3227
3245
  @method [up-dash]
3228
3246
  @ujs
3229
3247
  */
@@ -3246,7 +3264,6 @@ Read on
3246
3264
  knife: eval(typeof Knife !== "undefined" && Knife !== null ? Knife.point : void 0),
3247
3265
  visit: visit,
3248
3266
  follow: follow,
3249
- resolve: resolve,
3250
3267
  childClicked: childClicked,
3251
3268
  followMethod: followMethod
3252
3269
  };
@@ -4020,7 +4037,7 @@ For small popup overlays ("dropdowns") see [up.popup](/up.popup) instead.
4020
4037
  options = args[1];
4021
4038
  }
4022
4039
  options = u.options(options);
4023
- url = u.option(options.url, $link.attr('href'), $link.attr('up-href'));
4040
+ url = u.option(options.url, $link.attr('up-href'), $link.attr('href'));
4024
4041
  selector = u.option(options.target, $link.attr('up-modal'), 'body');
4025
4042
  width = u.option(options.width, $link.attr('up-width'), config.width);
4026
4043
  height = u.option(options.height, $link.attr('up-height'), config.height);
@@ -4340,18 +4357,6 @@ to the current location (class `up-current`).
4340
4357
  This dramatically improves the perceived speed of your user interface
4341
4358
  by providing instant feedback for user interactions.
4342
4359
 
4343
- The classes are added and removed automatically whenever
4344
- a page fragment is added, changed or destroyed through Up.js.
4345
-
4346
- How Up.js computes the current location
4347
- ---------------------------------------
4348
-
4349
- From Up's point of view the "current" location is either:
4350
-
4351
- - the URL displayed in the browser window's location bar
4352
- - the source URL of a currently opened [modal dialog](/up.modal)
4353
- - the source URL of a currently opened [popup overlay](/up.popup)
4354
-
4355
4360
  @class up.navigation
4356
4361
  */
4357
4362
 
@@ -4361,7 +4366,7 @@ From Up's point of view the "current" location is either:
4361
4366
  u = up.util;
4362
4367
  CLASS_ACTIVE = 'up-active';
4363
4368
  CLASS_CURRENT = 'up-current';
4364
- SELECTORS_SECTION = ['a[href]', 'a[up-target]', '[up-follow]', '[up-modal]', '[up-popup]', '[up-href]'];
4369
+ SELECTORS_SECTION = ['[href]', '[up-target]', '[up-follow]', '[up-modal]', '[up-popup]', '[up-href]'];
4365
4370
  SELECTOR_SECTION = SELECTORS_SECTION.join(', ');
4366
4371
  SELECTOR_SECTION_INSTANT = ((function() {
4367
4372
  var i, len, results;
@@ -4382,16 +4387,14 @@ From Up's point of view the "current" location is either:
4382
4387
  }
4383
4388
  };
4384
4389
  sectionUrls = function($section) {
4385
- var $link, attr, i, len, ref, url, urls;
4390
+ var attr, i, len, ref, url, urls;
4386
4391
  urls = [];
4387
- if ($link = up.link.resolve($section)) {
4388
- ref = ['href', 'up-follow', 'up-href'];
4389
- for (i = 0, len = ref.length; i < len; i++) {
4390
- attr = ref[i];
4391
- if (url = u.presentAttr($link, attr)) {
4392
- url = normalizeUrl(url);
4393
- urls.push(url);
4394
- }
4392
+ ref = ['up-href', 'href'];
4393
+ for (i = 0, len = ref.length; i < len; i++) {
4394
+ attr = ref[i];
4395
+ if (url = u.presentAttr($section, attr)) {
4396
+ url = normalizeUrl(url);
4397
+ urls.push(url);
4395
4398
  }
4396
4399
  }
4397
4400
  return urls;
@@ -4410,6 +4413,34 @@ From Up's point of view the "current" location is either:
4410
4413
  }
4411
4414
  });
4412
4415
  };
4416
+
4417
+ /**
4418
+ Links that are currently loading are assigned the `up-active`
4419
+ class automatically. Style `.up-active` in your CSS to improve the
4420
+ perceived responsiveness of your user interface.
4421
+
4422
+ The `up-active` class will be removed as soon as another
4423
+ page fragment is added or updated through Up.js.
4424
+
4425
+ \#\#\#\# Example
4426
+
4427
+ We have a link:
4428
+
4429
+ <a href="/foo" up-follow>Foo</a>
4430
+
4431
+ The user clicks on the link. While the request is loading,
4432
+ the link has the `up-active` class:
4433
+
4434
+ <a href="/foo" up-follow up-active>Foo</a>
4435
+
4436
+ Once the fragment is loaded the browser's location bar is updated
4437
+ to `http://yourhost/foo` via [`history.pushState`](https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history#Adding_and_modifying_history_entries):
4438
+
4439
+ <a href="/foo" up-follow up-current>Foo</a>
4440
+
4441
+ @ujs
4442
+ @method [up-active]
4443
+ */
4413
4444
  sectionClicked = function($section) {
4414
4445
  unmarkActive();
4415
4446
  $section = enlargeClickArea($section);
@@ -4431,6 +4462,41 @@ From Up's point of view the "current" location is either:
4431
4462
  return sectionClicked($section);
4432
4463
  }
4433
4464
  });
4465
+
4466
+ /**
4467
+ Links that point to the current location are assigned
4468
+ the `up-current` class automatically.
4469
+
4470
+ The use case for this is navigation bars:
4471
+
4472
+ <nav>
4473
+ <a href="/foo">Foo</a>
4474
+ <a href="/bar">Bar</a>
4475
+ </nav>
4476
+
4477
+ If the browser location changes to `/foo`, the markup changes to this:
4478
+
4479
+ <nav>
4480
+ <a href="/foo" up-current>Foo</a>
4481
+ <a href="/bar">Bar</a>
4482
+ </nav>
4483
+
4484
+ \#\#\#\# What's considered to be "current"?
4485
+
4486
+ The current location is considered to be either:
4487
+
4488
+ - the URL displayed in the browser window's location bar
4489
+ - the source URL of a currently opened [modal dialog](/up.modal)
4490
+ - the source URL of a currently opened [popup overlay](/up.popup)
4491
+
4492
+ A link matches the current location (and is marked as `.up-current`) if it matches either:
4493
+
4494
+ - the link's `href` attribute
4495
+ - the link's [`up-href`](/up.link#turn-any-element-into-a-link) attribute
4496
+
4497
+ @method [up-current]
4498
+ @ujs
4499
+ */
4434
4500
  up.bus.on('fragment:ready', function() {
4435
4501
  unmarkActive();
4436
4502
  return locationChanged();
data/dist/up.min.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(){window.up={}}).call(this),function(){var t=[].slice;up.util=function(){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,C,T,x,E,S,P,A,D,U,F,M,O,j,z,L,H,I,N,W,q,G,X,J,R,K,V,_,B,Q,Z,Y,tn,nn,en,rn,on,un,an,sn,ln,cn,pn,fn,dn,mn,hn,vn,gn,yn,bn,wn,kn;return x=function(t,n){return n=n||{},n.url=t,o(n)},o=function(t){return t.selector&&(t.headers={"X-Up-Selector":t.selector}),$.ajax(t)},W=function(t,n){return(""===n||"80"===n)&&"http:"===t||"443"===n&&"https:"===t},tn=function(t,n){var e,r,o;return e=null,q(t)?(e=$("<a>").attr({href:t}).get(0),P(e.hostname)&&(e.href=e.href)):e=wn(t),r=e.protocol+"//"+e.hostname,W(e.protocol,e.port)||(r+=":"+e.port),o=e.pathname,"/"!==o[0]&&(o="/"+o),(null!=n?n.stripTrailingSlash:void 0)===!0&&(o=o.replace(/\/$/,"")),r+=o,(null!=n?n.hash:void 0)===!0&&(r+=e.hash),(null!=n?n.search:void 0)!==!1&&(r+=e.search),r},Y=function(t){return t?t.toUpperCase():"GET"},n=function(t){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v;for(h=t.split(/[ >]/),r=null,c=p=0,d=h.length;d>p;c=++p){for(i=h[c],u=i.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),v="div",o=[],l=null,f=0,m=u.length;m>f;f++)switch(a=u[f],a[0]){case".":o.push(a.substr(1));break;case"#":l=a.substr(1);break;default:v=a}s="<"+v,o.length&&(s+=' class="'+o.join(" ")+'"'),l&&(s+=' id="'+l+'"'),s+=">",n=$(s),e&&n.appendTo(e),0===c&&(r=n),e=n}return r},p=function(t,n){var e;return e=document.createElement(t),I(n)&&(e.innerHTML=n),e},h=function(){var n,e;return e=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],e="[UP] "+e,console.debug.apply(console,[e].concat(t.call(n)))},kn=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)))},y=function(){var n,e,r;throw e=1<=arguments.length?t.call(arguments,0):[],e[0]="[UP] "+e[0],console.error.apply(console,e),r=hn(e),n=an($(".up-error"))||$('<div class="up-error"></div>').prependTo("body"),n.addClass("up-error"),n.text(r),new Error(r)},r=/\%[odisf]/g,hn=function(t){var n,e,o;return o=t[0],n=0,e=30,o.replace(r,function(){var r,o;return n+=1,r=t[n],o=typeof r,"string"===o?(r=r.replace(/\s+/g," "),r.length>e&&(r=r.substr(0,e)+"\u2026"),'"'+r+'"'):"number"===o?r.toString():"("+o+")"})},d=function(t){var n,e,r,o,u,i,a;for(h("Creating selector from element %o",t),e=(n=t.attr("class"))?n.split(" "):[],r=t.attr("id"),a=t.prop("tagName").toLowerCase(),r&&(a+="#"+r),o=0,i=e.length;i>o;o++)u=e[o],a+="."+u;return a},f=function(t){var n,e,r,o,u,i,a,s,l,c,f,d;return l=function(t){return"<"+t+"(?: [^>]*)?>"},i=function(t){return"</"+t+">"},n="(?:.|\\n)*?",u=function(t){return"("+t+")"},d=new RegExp(l("head")+n+l("title")+u(n)+i("title")+n+i("body"),"i"),o=new RegExp(l("body")+u(n)+i("body"),"i"),(r=t.match(o))?(s=document.createElement("html"),e=p("body",r[1]),s.appendChild(e),(f=t.match(d))&&(a=p("head"),s.appendChild(a),c=p("title",f[1]),a.appendChild(c)),s):p("div",t)},w=$.extend,bn=$.trim,R=Object.keys||function(t){var n,e,r,o;for(o=[],n=0,r=t.length;r>n;n++)e=t[n],t.hasOwnProperty(e)&&o.push(e);return o},g=function(t,n){var e,r,o,u,i;for(i=[],e=o=0,u=t.length;u>o;e=++o)r=t[e],i.push(n(r,e));return i},gn=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},L=function(t){return null===t},G=function(t){return void 0===t},D=function(t){return!G(t)},z=function(t){return G(t)||L(t)},M=function(t){return!z(t)},P=function(t){return z(t)||H(t)&&0===R(t).length||0===t.length},an=function(t,n){return null==n&&(n=I),n(t)?t:null},I=function(t){return!P(t)},F=function(t){return"function"==typeof t},q=function(t){return"string"==typeof t},O=function(t){return"object"==typeof t&&!!t},H=function(t){return O(t)||"function"==typeof t},U=function(t){return!(!t||1!==t.nodeType)},j=function(t){return t instanceof jQuery},N=function(t){return H(t)&&F(t.then)},A=function(t){return N(t)&&F(t.resolve)},E=function(t){return M(t)?t:void 0},S=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},yn=function(t){return Array.prototype.slice.call(t)},l=function(t){return S(t)?t.slice():w({},t)},wn=function(t){return j(t)?t.get(0):t},B=function(t,n){return w(l(t),n)},on=function(t,n){var e,r,o,u;if(o=t?l(t):{},n)for(r in n)e=n[r],u=o[r],M(u)?H(e)&&H(u)&&(o[r]=on(u,e)):o[r]=e;return o},rn=function(){var n,e,r,o,u,i;for(e=1<=arguments.length?t.call(arguments,0):[],u=null,r=0,o=e.length;o>r;r++)if(n=e[r],i=n,F(i)&&(i=i()),M(i)){u=i;break}return u},v=function(t,n){var e,r,o,u;for(u=null,r=0,o=t.length;o>r;r++)if(e=t[r],n(e)){u=e;break}return u},fn=function(t,n){var e;return e=[],g(t,function(t){return n(t)?e.push(t):void 0}),e},sn=function(){var n,e,r,o;return n=arguments[0],r=2<=arguments.length?t.call(arguments,1):[],o=function(){var t,o,u;for(u=[],t=0,o=r.length;o>t;t++)e=r[t],u.push(n.attr(e));return u}(),v(o,I)},Z=function(t){return setTimeout(t,0)},K=function(t){return t[t.length-1]},a=function(){var t;return t=document.documentElement,{width:t.clientWidth,height:t.clientHeight}},vn=function(t,n,e){var r,o;return o=t.css(R(n)),t.css(n),r=function(){return t.css(o)},e?(e(),r()):r},T=function(t){var n,e;return e=t.css(["transform","-webkit-transform"]),P(e)?(n=function(){return t.css(e)},t.css({transform:"translateZ(0)","-webkit-transform":"translateZ(0)"})):n=function(){},n},m=function(t,n,r){var o,u,i,a,s,l;return o=$(t),up.browser.canCssAnimation()?(r=on(r,{duration:300,delay:0,easing:"ease"}),u=$.Deferred(),a={"transition-property":R(n).join(", "),"transition-duration":r.duration+"ms","transition-delay":r.delay+"ms","transition-timing-function":r.easing},s=T(o),l=vn(o,a),o.css(n),u.then(s),u.then(l),o.data(e,u),u.then(function(){return o.removeData(e)}),i=setTimeout(function(){return u.resolve()},r.duration+r.delay),u.then(function(){return clearTimeout(i)}),u):(o.css(n),pn())},e="up-animation-promise",C=function(t){return $(t).each(function(){var t;return(t=$(this).data(e))?t.resolve():void 0})},_=function(t,n){var e,r,o;return r=(null!=n?n.relative:void 0)?t.position():t.offset(),e={left:r.left,top:r.top},(null!=n?n.inner:void 0)?(e.width=t.width(),e.height=t.height()):(e.width=t.outerWidth(),e.height=t.outerHeight()),(null!=n?n.full:void 0)&&(o=a(),e.right=o.width-(e.left+e.width),e.bottom=o.height-(e.top+e.height)),e},c=function(t,n){var e,r,o,u,i;for(u=t.get(0).attributes,i=[],r=0,o=u.length;o>r;r++)e=u[r],i.push(e.specified?n.attr(e.name,e.value):void 0);return i},un=function(t){var n,e;return e=_(t,{relative:!0,inner:!0}),n=t.clone(),n.find("script").remove(),n.css({right:"",bottom:"",position:"absolute"}),n.css(e),n.addClass("up-ghost"),n.insertBefore(t)},k=function(t,n){return t.find(n).addBack(n)},b=function(t){return 27===t.keyCode},s=function(t,n){return t.indexOf(n)>=0},i=function(t){return"true"===String(t)},u=function(t){return"false"===String(t)},V=function(t){return t.getResponseHeader("X-Up-Location")},Q=function(t){return t.getResponseHeader("X-Up-Method")},en=function(){var n,e,r,o,u,i;for(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)},J=function(t){var n;return n=G(t.button)||0===t.button,n&&X(t)},cn=function(){var t;return t=$.Deferred(),t.resolve(),t},pn=function(){return cn().promise()},nn=function(){return{is:function(){return!1},attr:function(){},find:function(){return[]}}},ln=function(){var n,e;return n=1<=arguments.length?t.call(arguments,0):[],e=$.when.apply($,n),e.resolve=function(){return g(n,function(t){return"function"==typeof t.resolve?t.resolve():void 0})},e},dn=function(t,n){var e,r,o;r=[];for(e in n)o=n[e],r.push(z(t.attr(e))?t.attr(e,o):void 0);return r},mn=function(t){var n,e,r,o,u,i,a,s;for(a={},n=function(t){return a[o(t)]},e=function(t){return v(t,n)},i=function(t){return a[o(t)]=!0},o=function(t){return"_"+t},r=0,u=t.length;u>r;r++)s=t[r],i(s);return{put:i,includes:n,includesAny:e}},{presentAttr:sn,createElement:p,normalizeUrl:tn,normalizeMethod:Y,createElementFromHtml:f,$createElementFromSelector:n,createSelectorFromElement:d,get:x,ajax:o,extend:w,copy:l,merge:B,options:on,option:rn,error:y,debug:h,warn:kn,each:g,times:gn,detect:v,select:fn,last:K,isNull:L,isDefined:D,isUndefined:G,isGiven:M,isMissing:z,isPresent:I,isBlank:P,presence:an,isObject:H,isFunction:F,isString:q,isElement:U,isJQuery:j,isPromise:N,isDeferred:A,isHash:O,ifGiven:E,isUnmodifiedKeyEvent:X,isUnmodifiedMouseEvent:J,nullJquery:nn,unwrap:wn,nextFrame:Z,measure:_,temporaryCss:vn,cssAnimate:m,finishCssAnimate:C,forceCompositing:T,prependGhost:un,escapePressed:b,copyAttributes:c,findWithSelf:k,contains:s,isArray:S,toArray:yn,castsToTrue:i,castsToFalse:u,locationFromXhr:V,methodFromXhr:Q,clientSize:a,only:en,trim:bn,keys:R,resolvedPromise:pn,resolvedDeferred:cn,resolvableWhen:ln,setMissingAttrs:dn,stringSet:mn}}()}.call(this),function(){var t=[].slice;up.browser=function(){var n,e,r,o,u,i,a,s,l,c;return l=up.util,a=function(t,n){var e,r,o,u,i,a;return null==n&&(n={}),i=l.option(n.method,"get").toLowerCase(),"get"===i?location.href=t:$.rails?(a=n.target,o=$.rails.csrfToken(),r=$.rails.csrfParam(),e=$("<form method='post' action='"+t+"'></form>"),u="<input name='_method' value='"+i+"' type='hidden' />",l.isDefined(r)&&l.isDefined(o)&&(u+="<input name='"+r+"' value='"+o+"' type='hidden' />"),a&&e.attr("target",a),e.hide().append(u).appendTo("body"),e.submit()):error("Can't fake a "+i.toUpperCase()+" request without Rails UJS")},c=function(){return location.href},o=function(){var t,n,e,r,o,u,i,a,s;return window.console||(window.console={}),s=function(){},(t=window.console).log||(t.log=s),(n=window.console).info||(n.info=s),(e=window.console).error||(e.error=s),(r=window.console).debug||(r.debug=s),(o=window.console).warn||(o.warn=s),(u=window.console).group||(u.group=s),(i=window.console).groupCollapsed||(i.groupCollapsed=s),(a=window.console).groupEnd||(a.groupEnd=s)},s=function(n){var e,r;return e=void 0,r=!1,function(){var o;return o=1<=arguments.length?t.call(arguments,0):[],r?e:(r=!0,e=n.apply(null,o))}},r=s(function(){return l.isDefined(history.pushState)}),n=s(function(){return"transition"in document.documentElement.style}),e=s(function(){return"oninput"in document.createElement("input")}),u=function(){var t,n,e,r,o;return o=$.fn.jquery,r=o.split("."),n=parseInt(r[0]),e=parseInt(r[1]),t=n>=2||1===n&&e>=9,t||l.error("jQuery %o found, but Up.js requires 1.9+",o)},i=s(function(){return l.isDefined(document.addEventListener)}),{url:c,ensureConsoleExists:o,loadPage:a,canPushState:r,canCssAnimation:n,canInputEvent:e,isSupported:i,ensureRecentJquery:u}}()}.call(this),function(){var t=[].slice;up.bus=function(){var n,e,r,o,u,i,a,s;return s=up.util,n={},r={},e=function(t){return n[t]||(n[t]=[])},a=function(){var t,e,o;r={},o=[];for(e in n)t=n[e],o.push(r[e]=s.copy(t));return o},i=function(){return n=s.copy(r)},u=function(t,n){return e(t).push(n)},o=function(){var n,r,o;return o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],s.debug("Emitting event %o with args %o",o,n),r=e(o),s.each(r,function(t){return t.apply(null,n)})},u("framework:ready",a),u("framework:reset",i),{on:u,emit:o}}()}.call(this),function(){up.viewport=function(){var t,n,e,r,o,u,i;return i=up.util,n={duration:0,view:"body",easing:"swing"},e=function(t){return i.extend(n,t)},t="up-scroll-promise",u=function(e,o,u){var a,s,l,c,p;return a=$(e),u=i.options(u),l=i.option(u.duration,n.duration),c=i.option(u.easing,n.easing),r(a),l>0?(s=$.Deferred(),a.data(t,s),s.then(function(){return a.removeData(t),a.finish()}),p={scrollTop:o},a.animate(p,{duration:l,easing:c,complete:function(){return s.resolve()}}),s):(a.scrollTop(o),i.resolvedDeferred())},r=function(n){return $(n).each(function(){var n;return(n=$(this).data(t))?n.resolve():void 0})},o=function(t,e){var r,o,a,s,l,c,p,f,d,m,h;return e=i.options(e),m=i.option(e.view,n.view),f=i.option(e.padding,n.padding),r=$(t),o=$(m),h=o.height(),d=o.scrollTop(),c=d,p=d+h,l=r.position().top,a=c>l-f,s=l>p-f,a||s?(d=l-f,d=Math.max(d,0),d=Math.min(d,h-1),u(o,d,e)):i.resolvedDeferred()},{reveal:o,scroll:u,finishScrolling:r,defaults:e}}(),up.scroll=up.viewport.scroll,up.reveal=up.viewport.reveal}.call(this),function(){up.flow=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v;return v=up.util,d=function(t,n){var e;return e=$(t),v.isPresent(n)&&(n=v.normalizeUrl(n)),e.attr("up-source",n)},m=function(t){var n;return n=$(t).closest("[up-source]"),v.presence(n.attr("up-source"))||up.browser.url()},c=function(t,n,e){var r,o,i;return e=v.options(e),i=v.presence(t)?t:v.createSelectorFromElement($(t)),up.browser.canPushState()||v.castsToFalse(e.history)?(o={url:n,method:e.method,selector:i,cache:e.cache},r=up.proxy.ajax(o),r.done(function(t,r,a){var s,l;return(s=v.locationFromXhr(a))&&(v.debug("Location from server: %o",s),l={url:s,method:v.methodFromXhr(a),selector:i},up.proxy.alias(o,l),n=s),(v.isMissing(e.history)||v.castsToTrue(e.history))&&(e.history=n),(v.isMissing(e.source)||v.castsToTrue(e.source))&&(e.source=n),e.preload?void 0:u(i,t,e)}),r.fail(v.error),r):(e.preload||up.browser.loadPage(n,v.only(e,"method")),v.resolvedPromise())},u=function(t,n,e){var o,u,l,c,p,f,d,m;for(e=v.options(e,{historyMethod:"push"}),v.castsToFalse(e.history)&&(e.history=null),v.castsToFalse(e.scroll)&&(e.scroll=null),e.source=v.option(e.source,e.history),f=a(n),e.title||(e.title=f.title()),p=i(t,e),d=[],l=0,c=p.length;c>l;l++)m=p[l],u=r(m.selector),o=f.find(m.selector),d.push(s(u,e).then(function(){return h(u,o,m.pseudoClass,m.transition,e)}));return d},r=function(t){var n;return n=t+":not(.up-ghost, .up-destroying)",v.presence($(".up-popup "+n))||v.presence($(".up-modal "+n))||v.presence($(n))||o(t)},o=function(t){var n;return n="Could not find selector %o in current body HTML","#"===n[0]&&(n+=" (avoid using IDs)"),v.error(n,t)},a=function(t){var n;return n=v.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):v.error("Could not find selector %o in response %o",e,t)}}},s=function(t,n){return up.motion.finish(t),f(t,n.scroll)},f=function(t,n){return n?up.reveal(t,{view:n}):v.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)),d(n,e.source),t(n),up.ready(n)},h=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()),v.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&&v.error("Cannot apply transitions to body-elements (%o)",u),up.morph(t,r,u,i)}})},i=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),v.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]||v.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=v.findWithSelf(t,e),n.length&&n.get(0)!==document.activeElement?n.focus():void 0},n=function(t,n){var e,r,o;return e=$(t),n=v.options(n,{animation:"none"}),r=up.motion.animateOptions(n),e.addClass("up-destroying"),v.isPresent(n.url)&&up.history.push(n.url),v.isPresent(n.title)&&(document.title=n.title),up.bus.emit("fragment:destroy",e),o=v.presence(n.animation,v.isPromise)||up.motion.animate(e,n.animation,r),o.then(function(){return e.remove()})},l=function(t,n){var e;return n=v.options(n,{cache:!1}),e=n.url||m(t),c(t,e,n)},p=function(){return up.bus.emit("framework:reset")},up.bus.on("app:ready",function(){return d(document.body,up.browser.url())}),{replace:c,reload:l,destroy:n,implant:u,reset:p}}(),up.replace=up.flow.replace,up.reload=up.flow.reload,up.destroy=up.flow.destroy,up.reset=up.flow.reset}.call(this),function(){var t=[].slice;up.magic=function(){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g;return g=up.util,n="up-destroyable",e="up-destroyer",f=[],l=null,p=function(t,n,e){var r,o;if(up.browser.isSupported())return r=[t,n,function(t){return e.apply(this,[t,$(this),a(this)])}],f.push(r),(o=$(document)).on.apply(o,r)},i=[],s=null,u=function(){var n,e,r;return r=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],up.browser.isSupported()?(u=n.pop(),e=g.options(n[0],{batch:!1}),i.push({selector:r,callback:u,batch:e.batch})):void 0},r=function(t,r,o){var u;return g.debug("Applying compiler %o on %o",t.selector,o),u=t.callback.apply(o,[r,a(r)]),g.isFunction(u)?(r.addClass(n),r.data(e,u)):void 0},o=function(t){var n,e,o,a;for(g.debug("Compiling fragment %o",t),a=[],e=0,o=i.length;o>e;e++)u=i[e],n=g.findWithSelf(t,u.selector),a.push(n.length?u.batch?r(u,n,n.get()):n.each(function(){return r(u,$(this),this)}):void 0);return a},c=function(t){return g.findWithSelf(t,"."+n).each(function(){var t,n;return t=$(this),(n=t.data(e))()})},a=function(t){var n,e;return n=$(t),e=n.attr("up-data"),g.isString(e)&&""!==g.trim(e)?JSON.parse(e):{}},v=function(){return l=g.copy(f),s=g.copy(i)},h=function(){var t,n,e,r;for(n=0,e=f.length;e>n;n++)t=f[n],g.contains(l,t)||(r=$(document)).off.apply(r,t);return f=g.copy(l),i=g.copy(s)},m=function(t){var n;return n=$(t),up.bus.emit("fragment:ready",n),n},d=function(t){return p("keydown","body",function(n){return g.escapePressed(n)?t(n):void 0})},up.bus.on("app:ready",function(){return m(document.body)}),up.bus.on("fragment:ready",o),up.bus.on("fragment:destroy",c),up.bus.on("framework:ready",v),up.bus.on("framework:reset",h),{compiler:u,on:p,ready:m,onEscape:d,data:a}}(),up.compiler=up.magic.compiler,up.on=up.magic.on,up.ready=up.magic.ready,up.awaken=function(){var n;return n=1<=arguments.length?t.call(arguments,0):[],up.util.warn("up.awaken has been renamed to up.compiler and will be removed in a future version"),up.compiler.apply(up,n)}}.call(this),function(){up.history=function(){var t,n,e,r,o,u;return u=up.util,t=function(t){return u.normalizeUrl(t,{hash:!0})===u.normalizeUrl(up.browser.url(),{hash:!0})},o=function(e,r){return r=u.options(r,{force:!1}),r.force||!t(e)?n("replace",e):void 0},r=function(e){return t(e)?void 0:n("push",e)},n=function(t,n){return up.browser.canPushState()?(t+="State",window.history[t]({fromUp:!0},"",n)):u.error("This browser doesn't support history.pushState")},e=function(t){var n;return n=t.originalEvent.state,(null!=n?n.fromUp:void 0)?(u.debug("Restoring state %o (now on "+up.browser.url()+")",n),up.visit(up.browser.url(),{historyMethod:"replace"})):u.debug("Discarding unknown state %o",n)},up.browser.canPushState()&&setTimeout(function(){return $(window).on("popstate",e),o(up.browser.url(),{force:!0})},200),{push:r,replace:o}}()}.call(this),function(){up.motion=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k;return w=up.util,o={},a={},b={},s={},i={duration:300,delay:0,easing:"ease"},l=function(t){return w.extend(i,t)},n=function(t,r,o){var i;return i=$(t),p(i),o=e(o),w.isFunction(r)?u(r(i,o),r):w.isString(r)?n(i,c(r),o):w.isHash(r)?w.cssAnimate(i,r,o):w.error("Unknown animation type %o",r)},e=function(t,n){var e;return null==n&&(n=null),t=w.options(t),e={},e.easing=w.option(t.easing,null!=n?n.attr("up-easing"):void 0,i.easing),e.duration=Number(w.option(t.duration,null!=n?n.attr("up-duration"):void 0,i.duration)),e.delay=Number(w.option(t.delay,null!=n?n.attr("up-delay"):void 0,i.delay)),e},c=function(t){return o[t]||w.error("Unknown animation %o",r)},t="up-ghosting-promise",k=function(n,e,r){var o,u,i,a;return u=null,o=null,w.temporaryCss(e,{display:"none"},function(){return u=w.prependGhost(n).addClass("up-destroying")}),w.temporaryCss(n,{display:"none"},function(){return o=w.prependGhost(e)}),n.css({visibility:"hidden"}),a=w.temporaryCss(e,{display:"none"}),i=r(u,o),n.data(t,i),e.data(t,i),i.then(function(){return n.removeData(t),e.removeData(t),u.remove(),o.remove(),n.css({display:"none"}),a()}),i},p=function(t){return $(t).each(function(){var t;return t=$(this),w.finishCssAnimate(t),f(t)})},f=function(n){var e;return(e=n.data(t))?(w.debug("Canceling existing ghosting on %o",n),"function"==typeof e.resolve?e.resolve():void 0):void 0},u=function(t,n){return w.isDeferred(t)?t:w.error("Did not return a promise with .then and .resolve methods: %o",n)},d=function(t,r,i,a){var s,l,c,f,h;return up.browser.canCssAnimation()?(a=e(a),l=$(t),s=$(r),p(l),p(s),"none"===i?m():(h=w.presence(i,w.isFunction)||b[i])?k(l,s,function(t,n){return u(h(t,n,a),i)}):(c=o[i])?(l.hide(),n(s,c,a)):w.isString(i)&&i.indexOf("/")>=0?(f=i.split("/"),h=function(t,e,r){return v(n(t,f[0],r),n(e,f[1],r))},d(l,s,h,a)):w.error("Unknown transition %o",i)):w.resolvedDeferred()},y=function(t,n){return b[t]=n},r=function(t,n){return o[t]=n},g=function(){return a=w.copy(o),s=w.copy(b)},h=function(){return o=w.copy(a),b=w.copy(s)},v=w.resolvableWhen,m=w.resolvedDeferred,r("none",m),r("fade-in",function(t,e){return t.css({opacity:0}),n(t,{opacity:1},e)}),r("fade-out",function(t,e){return t.css({opacity:1}),n(t,{opacity:0},e)}),r("move-to-top",function(t,e){var r,o;return r=w.measure(t),o=r.top+r.height,t.css({"margin-top":"0px"}),n(t,{"margin-top":"-"+o+"px"},e)}),r("move-from-top",function(t,e){var r,o;return r=w.measure(t),o=r.top+r.height,t.css({"margin-top":"-"+o+"px"}),n(t,{"margin-top":"0px"},e)}),r("move-to-bottom",function(t,e){var r,o;return r=w.measure(t),o=w.clientSize().height-r.top,t.css({"margin-top":"0px"}),n(t,{"margin-top":o+"px"},e)}),r("move-from-bottom",function(t,e){var r,o;return r=w.measure(t),o=w.clientSize().height-r.top,t.css({"margin-top":o+"px"}),n(t,{"margin-top":"0px"},e)}),r("move-to-left",function(t,e){var r,o;return r=w.measure(t),o=r.left+r.width,t.css({"margin-left":"0px"}),n(t,{"margin-left":"-"+o+"px"},e)}),r("move-from-left",function(t,e){var r,o;return r=w.measure(t),o=r.left+r.width,t.css({"margin-left":"-"+o+"px"}),n(t,{"margin-left":"0px"},e)}),r("move-to-right",function(t,e){var r,o;return r=w.measure(t),o=w.clientSize().width-r.left,t.css({"margin-left":"0px"}),n(t,{"margin-left":o+"px"},e)}),r("move-from-right",function(t,e){var r,o;return r=w.measure(t),o=w.clientSize().width-r.left,t.css({"margin-left":o+"px"}),n(t,{"margin-left":"0px"},e)}),r("roll-down",function(t,e){var r,o;return r=t.height(),o=w.temporaryCss(t,{height:"0px",overflow:"hidden"}),n(t,{height:r+"px"},e).then(o)}),y("none",m),y("move-left",function(t,e,r){return v(n(t,"move-to-left",r),n(e,"move-from-right",r))}),y("move-right",function(t,e,r){return v(n(t,"move-to-right",r),n(e,"move-from-left",r))}),y("move-up",function(t,e,r){return v(n(t,"move-to-top",r),n(e,"move-from-bottom",r))}),y("move-down",function(t,e,r){return v(n(t,"move-to-bottom",r),n(e,"move-from-top",r))}),y("cross-fade",function(t,e,r){return v(n(t,"fade-out",r),n(e,"fade-in",r))}),up.bus.on("framework:ready",g),up.bus.on("framework:reset",h),{morph:d,animate:n,animateOptions:e,finish:p,transition:y,animation:r,defaults:l,none:m,when:v}}(),up.transition=up.motion.transition,up.animation=up.motion.animation,up.morph=up.motion.morph,up.animate=up.motion.animate}.call(this),function(){up.proxy=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,C,T,x;return l={preloadDelay:75,cacheSize:70,cacheExpiry:3e5},c=function(t){return x.extend(l,t)},o={},x=up.util,t=null,p=null,u=function(t){return v(t),[t.url,t.method,t.selector].join("|")},T=function(){var t,n,e;return t=x.keys(o),t.length>l.cacheSize&&(n=null,e=null,x.each(t,function(t){var r,u;return r=o[t],u=r.timestamp,!e||e>u?(n=t,e=u):void 0}),n)?delete o[n]:void 0},C=function(){return(new Date).valueOf()},v=function(t){return!x.isHash(t),t._normalized||(t.method=x.normalizeMethod(t.method),t.url&&(t.url=x.normalizeUrl(t.url)),t.selector||(t.selector="body"),t._normalized=!0),t},r=function(t,n){var e;return x.debug("Aliasing %o to %o",t,n),(e=d(t))?w(n,e):void 0},e=function(t){var n,e,r,o;return n=x.castsToTrue(t.cache),e=x.castsToFalse(t.cache),o=x.only(t,"url","method","selector","_normalized"),h(o)||n?(r=d(o))&&!e||(r=x.ajax(o),w(o,r)):(s(),r=x.ajax(o)),r},n=["GET","OPTIONS","HEAD"],h=function(t){return v(t),x.contains(n,t.method)},f=function(t){return h(t)||x.error("Won't preload non-GET request %o",t)},m=function(t){var n;return n=C()-t.timestamp,n<l.cacheExpiry},d=function(t){var n,e;return n=u(t),(e=o[n])?m(e)?(x.debug("Cache hit for %o (%o)",t.url,t),e):(x.debug("Discarding stale cache entry for %o (%o)",t.url,t),void y(t)):void x.debug("Cache miss for %o (%o)",t.url,t)},w=function(t,n){var e;return T(),e=u(t),n.timestamp=C(),o[e]=n,n},y=function(t){var n;return n=u(t),delete o[n]},s=function(){return o={}},a=function(n){var e,r;return r=parseInt(x.presentAttr(n,"up-delay"))||l.preloadDelay,n.is(t)?void 0:(t=n,i(),e=function(){return g(n)},k(e,r))},k=function(t,n){return p=setTimeout(t,n)},i=function(){return clearTimeout(p),p=null},g=function(t,n){var e,r;return e=$(t),n=x.options(n),r=up.link.followMethod(e,n),h({method:r})?(x.debug("Preloading %o",e),n.preload=!0,up.link.follow(e,n)):(x.debug("Won't preload %o due to unsafe method %o",e,r),x.resolvedPromise())},b=function(){return i(),o={}},up.bus.on("framework:reset",b),up.on("mouseover mousedown touchstart","[up-preload]",function(t,n){return up.link.childClicked(t,n)?void 0:a(up.link.resolve(n))}),{preload:g,ajax:e,get:d,set:w,alias:r,clear:s,remove:y,defaults:c}}()}.call(this),function(){up.link=function(){var childClicked,follow,followMethod,resolve,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("href"),e.attr("up-follow")),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()},resolve=function(t){var n,e;return n=$(t),e=n.attr("up-follow"),n.is("a")||u.isPresent(e)&&!u.castsToTrue(e)?n:n.find("a:first")},up.on("click","a[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-target][up-instant]",function(t,n){return shouldProcessLinkEvent(t,n)?(t.preventDefault(),up.follow(n)):void 0}),childClicked=function(t,n){var e,r;return e=$(t.target),r=e.closest("a, [up-follow]"),r.length&&n.find(r).length},shouldProcessLinkEvent=function(t,n){return u.isUnmodifiedMouseEvent(t)&&!childClicked(t,n)},up.on("click","[up-follow]",function(t,n){return shouldProcessLinkEvent(t,n)?n.is("[up-instant]")?t.preventDefault():(t.preventDefault(),follow(resolve(n))):void 0}),up.on("mousedown","[up-follow][up-instant]",function(t,n){return shouldProcessLinkEvent(t,n)?(t.preventDefault(),follow(resolve(n))):void 0}),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,resolve:resolve,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,type: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)},u.ajax(l).always(function(){return e.removeClass("up-active")}).done(function(t,n,e){var o;return o=u.merge(r,{history:f(e),transition:p}),up.flow.implant(c,t,o)}).fail(function(t){var n,e;return e=t.responseText,n=u.merge(r,{transition:i}),up.flow.implant(o,e,n)})):void e.get(0).submit()},observe=function(fieldOrSelector,options){var $field,callback,callbackPromise,callbackTimer,changeEvents,check,clearTimer,codeOnChange,delay,knownValue,nextCallback,runNextCallback;return $field=$(fieldOrSelector),options=u.options(options),delay=u.option($field.attr("up-delay"),options.delay,0),delay=parseInt(delay),knownValue=null,callback=null,callbackTimer=null,(codeOnChange=$field.attr("up-observe"))?callback=function(value,$field){return eval(codeOnChange)}:options.change?callback=options.change:u.error("up.observe: No change callback given"),callbackPromise=u.resolvedPromise(),nextCallback=null,runNextCallback=function(){var t;return nextCallback?(t=nextCallback(),nextCallback=null,t):void 0},check=function(){var t,n;return n=$field.val(),t=u.isNull(knownValue),knownValue===n||(knownValue=n,t)?void 0:(clearTimer(),nextCallback=function(){return callback.apply($field.get(0),[n,$field])},callbackTimer=setTimeout(function(){return callbackPromise.then(function(){var t;return t=runNextCallback(),callbackPromise=u.isPromise(t)?t:u.resolvedPromise()})},delay))},clearTimer=function(){return clearTimeout(callbackTimer)},changeEvents=up.browser.canInputEvent()?"input change":"input change keypress paste cut click propertychange",$field.on(changeEvents,check),check(),clearTimer},up.on("submit","form[up-target]",function(t,n){return t.preventDefault(),submit(n)}),up.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;return p=up.util,e={openAnimation:"fade-in",closeAnimation:"fade-out",position:"bottom-right"},o=function(t){return p.extend(e,t)},l=function(t,n,e){var r,o;return o=p.measure(t,{full:!0}),r=function(){switch(e){case"bottom-right":return{right:o.right,top:o.top+o.height};case"bottom-left":return{left:o.left,top:o.bottom+o.height};case"top-right":return{right:o.right,bottom:o.top};case"top-left":return{left:o.left,bottom:o.top};default:return p.error("Unknown position %o",e)}}(),n.attr("up-position",e),n.css(r),i(n)},i=function(t){var n,e,r,o,u,i,a;if(e=p.measure(t,{full:!0}),r=null,o=null,e.right<0&&(r=-e.right),e.bottom<0&&(o=-e.bottom),e.left<0&&(r=e.left),e.top<0&&(o=e.top),r&&((u=parseInt(t.css("left")))?t.css("left",u-r):(i=parseInt(t.css("right")))&&t.css("right",i+r)),o){if(a=parseInt(t.css("top")))return t.css("top",a-o);if(n=parseInt(t.css("bottom")))return t.css("bottom",n+o)}},s=function(){var t;return t=$(".up-popup"),t.attr("up-previous-url",up.browser.url()),t.attr("up-previous-title",document.title)},u=function(){var t;return t=$(".up-popup"),t.removeAttr("up-previous-url"),t.removeAttr("up-previous-title")},r=function(t,n,e){var r,o;return o=p.$createElementFromSelector(".up-popup"),e&&o.attr("up-sticky",""),r=p.$createElementFromSelector(n),r.appendTo(o),o.appendTo(document.body),s(),o.hide(),o},f=function(t,n,e,r,o){return n.show(),l(t,n,e),up.animate(n,r,o)},a=function(t,o){var u,i,a,s,l,c,d,m,h;return u=$(t),o=p.options(o),h=p.option(o.url,u.attr("href")),d=p.option(o.target,u.attr("up-popup"),"body"),c=p.option(o.position,u.attr("up-position"),e.position),s=p.option(o.animation,u.attr("up-animation"),e.openAnimation),m=p.option(o.sticky,u.is("[up-sticky]")),l=up.browser.canPushState()?p.option(o.history,u.attr("up-history"),!1):!1,a=up.motion.animateOptions(o,u),n(),i=r(u,d,m),up.replace(d,h,{history:l,insert:function(){return f(u,i,c,s,a)}})},c=function(){var t;return t=$(".up-popup"),t.is(".up-destroying")?void 0:t.find("[up-source]").attr("up-source")},n=function(t){var n;return n=$(".up-popup"),n.length?(t=p.options(t,{animation:e.closeAnimation,url:n.attr("up-previous-url"),title:n.attr("up-previous-title")}),up.destroy(n,t)):void 0},t=function(){return $(".up-popup").is("[up-sticky]")?void 0:n()},up.on("click","a[up-popup]",function(t,e){return t.preventDefault(),e.is(".up-current")?n():a(e)
2
- }),up.on("click","body",function(t){var e;return e=$(t.target),e.closest(".up-popup").length||e.closest("[up-popup]").length?void 0:n()}),up.bus.on("fragment:ready",function(n){return n.closest(".up-popup").length?void 0:(u(),t())}),up.magic.onEscape(function(){return n()}),up.on("click","[up-close]",function(t,e){return e.closest(".up-popup")?n():void 0}),up.bus.on("framework:reset",n),{open:a,close:n,source:c,defaults:o}}()}.call(this),function(){var t=[].slice;up.modal=function(){var n,e,r,o,u,i,a,s,l,c,p,f;return p=up.util,r={width:"auto",height:"auto",openAnimation:"fade-in",closeAnimation:"fade-out",closeLabel:"X",template:function(t){return'<div class="up-modal">\n <div class="up-modal-dialog">\n <div class="up-modal-close" up-close>'+t.closeLabel+'</div>\n <div class="up-modal-content"></div>\n </div>\n</div>'}},u=function(t){return p.extend(r,t)},c=function(){var t;return t=r.template,p.isFunction(t)?t(r):t},s=function(){var t;return t=$(".up-modal"),t.attr("up-previous-url",up.browser.url()),t.attr("up-previous-title",document.title)},i=function(){var t;return t=$(".up-modal"),t.removeAttr("up-previous-url"),t.removeAttr("up-previous-title")},o=function(t,n,e,r){var o,u,i,a;return i=$(c()),r&&i.attr("up-sticky",""),i.attr("up-previous-url",up.browser.url()),i.attr("up-previous-title",document.title),u=i.find(".up-modal-dialog"),p.isPresent(n)&&u.css("width",n),p.isPresent(e)&&u.css("height",e),o=u.find(".up-modal-content"),a=p.$createElementFromSelector(t),a.appendTo(o),i.appendTo(document.body),s(),i.hide(),i},f=function(t,n,e){return t.show(),up.animate(t,n,e)},a=function(){var n,u,i,a,s,l,c,d,m,h,v,g;return s=1<=arguments.length?t.call(arguments,0):[],!p.isObject(s[0])||p.isElement(s[0])||p.isJQuery(s[0])?(n=$(s[0]),d=s[1]):(n=p.nullJquery(),d=s[0]),d=p.options(d),v=p.option(d.url,n.attr("href"),n.attr("up-href")),m=p.option(d.target,n.attr("up-modal"),"body"),g=p.option(d.width,n.attr("up-width"),r.width),l=p.option(d.height,n.attr("up-height"),r.height),a=p.option(d.animation,n.attr("up-animation"),r.openAnimation),h=p.option(d.sticky,n.is("[up-sticky]")),c=up.browser.canPushState()?p.option(d.history,n.attr("up-history"),!0):!1,i=up.motion.animateOptions(d,n),e(),u=o(m,g,l,h),up.replace(m,v,{history:c,insert:function(){return f(u,a,i)}})},l=function(){var t;return t=$(".up-modal"),t.is(".up-destroying")?void 0:t.find("[up-source]").attr("up-source")},e=function(t){var n;return n=$(".up-modal"),n.length?(t=p.options(t,{animation:r.closeAnimation,url:n.attr("up-previous-url"),title:n.attr("up-previous-title")}),up.destroy(n,t)):void 0},n=function(){return $(".up-modal").is("[up-sticky]")?void 0:(i(),e())},up.on("click","a[up-modal]",function(t,n){return t.preventDefault(),n.is(".up-current")?e():a(n)}),up.on("click","body",function(t){var n;return n=$(t.target),n.closest(".up-modal-dialog").length||n.closest("[up-modal]").length?void 0:e()}),up.bus.on("fragment:ready",function(t){return t.closest(".up-modal").length?void 0:n()}),up.magic.onEscape(function(){return e()}),up.on("click","[up-close]",function(t,n){return n.closest(".up-modal")?e():void 0}),up.bus.on("framework:reset",e),{open:a,close:e,source:l,defaults:u}}()}.call(this),function(){up.tooltip=function(){var t,n,e,r,o;return o=up.util,r=function(t,n,e){var r,u,i;return u=o.measure(t),i=o.measure(n),r=function(){switch(e){case"top":return{left:u.left+.5*(u.width-i.width),top:u.top-i.height};case"bottom":return{left:u.left+.5*(u.width-i.width),top:u.top+u.height};default:return o.error("Unknown 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;return f=up.util,t="up-active",n="up-current",e=["a[href]","a[up-target]","[up-follow]","[up-modal]","[up-popup]","[up-href]"],o=e.join(", "),u=function(){var t,n,r;for(r=[],t=0,n=e.length;n>t;t++)p=e[t],r.push(p+"[up-instant]");return r}().join(", "),r="."+t,s=function(t){return f.isPresent(t)?f.normalizeUrl(t,{search:!1,stripTrailingSlash:!0}):void 0},c=function(t){var n,e,r,o,u,i,a;if(a=[],n=up.link.resolve(t))for(u=["href","up-follow","up-href"],r=0,o=u.length;o>r;r++)e=u[r],(i=f.presentAttr(n,e))&&(i=s(i),a.push(i));return a},a=function(){var t;return t=f.stringSet([s(up.browser.url()),s(up.modal.source()),s(up.popup.source())]),f.each($(o),function(e){var r,o;return r=$(e),o=c(r),t.includesAny(o)?r.addClass(n):r.removeClass(n)})},l=function(n){return d(),n=i(n),n.addClass(t)},i=function(t){return f.presence(t.parents(o))||t},d=function(){return $(r).removeClass(t)},up.on("click",o,function(t,n){return f.isUnmodifiedMouseEvent(t)&&!n.is("[up-instant]")?l(n):void 0}),up.on("mousedown",u,function(t,n){return f.isUnmodifiedMouseEvent(t)?l(n):void 0}),up.bus.on("fragment:ready",function(){return d(),a()}),up.bus.on("fragment:destroy",function(t){return t.is(".up-modal, .up-popup")?a():void 0})}()}.call(this),function(){up.slot=function(){var t,n,e;return e=up.util,n=function(t){return""!==e.trim(t.html())},t=function(t){return e.findWithSelf(t,"[up-slot]").each(function(){var t;return t=$(this),n(t)?void 0:t.hide()})},up.bus.on("fragment:ready",t)}()}.call(this),function(){up.browser.ensureRecentJquery(),up.browser.isSupported()&&(up.browser.ensureConsoleExists(),up.bus.emit("framework:ready"),$(document).on("ready",function(){return up.bus.emit("app:ready")}))}.call(this);
1
+ (function(){window.up={}}).call(this),function(){var t=[].slice;up.util=function(){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,C,x,T,S,E,P,A,D,U,F,M,O,j,z,L,H,I,N,W,q,X,G,J,R,K,V,_,B,Q,Z,Y,tn,nn,en,rn,on,un,an,sn,ln,cn,pn,fn,dn,mn,hn,vn,gn,yn,bn,wn,kn;return T=function(t,n){return n=n||{},n.url=t,o(n)},o=function(t){return t.selector&&(t.headers={"X-Up-Selector":t.selector}),$.ajax(t)},W=function(t,n){return(""===n||"80"===n)&&"http:"===t||"443"===n&&"https:"===t},tn=function(t,n){var e,r,o;return e=null,q(t)?(e=$("<a>").attr({href:t}).get(0),P(e.hostname)&&(e.href=e.href)):e=wn(t),r=e.protocol+"//"+e.hostname,W(e.protocol,e.port)||(r+=":"+e.port),o=e.pathname,"/"!==o[0]&&(o="/"+o),(null!=n?n.stripTrailingSlash:void 0)===!0&&(o=o.replace(/\/$/,"")),r+=o,(null!=n?n.hash:void 0)===!0&&(r+=e.hash),(null!=n?n.search:void 0)!==!1&&(r+=e.search),r},Y=function(t){return t?t.toUpperCase():"GET"},n=function(t){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v;for(h=t.split(/[ >]/),r=null,c=p=0,d=h.length;d>p;c=++p){for(i=h[c],u=i.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),v="div",o=[],l=null,f=0,m=u.length;m>f;f++)switch(a=u[f],a[0]){case".":o.push(a.substr(1));break;case"#":l=a.substr(1);break;default:v=a}s="<"+v,o.length&&(s+=' class="'+o.join(" ")+'"'),l&&(s+=' id="'+l+'"'),s+=">",n=$(s),e&&n.appendTo(e),0===c&&(r=n),e=n}return r},p=function(t,n){var e;return e=document.createElement(t),I(n)&&(e.innerHTML=n),e},h=function(){var n,e;return e=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],e="[UP] "+e,console.debug.apply(console,[e].concat(t.call(n)))},kn=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)))},y=function(){var n,e,r;throw e=1<=arguments.length?t.call(arguments,0):[],e[0]="[UP] "+e[0],console.error.apply(console,e),r=hn(e),n=an($(".up-error"))||$('<div class="up-error"></div>').prependTo("body"),n.addClass("up-error"),n.text(r),new Error(r)},r=/\%[odisf]/g,hn=function(t){var n,e,o;return o=t[0],n=0,e=30,o.replace(r,function(){var r,o;return n+=1,r=t[n],o=typeof r,"string"===o?(r=r.replace(/\s+/g," "),r.length>e&&(r=r.substr(0,e)+"\u2026"),'"'+r+'"'):"number"===o?r.toString():"("+o+")"})},d=function(t){var n,e,r,o,u,i,a;for(h("Creating selector from element %o",t),e=(n=t.attr("class"))?n.split(" "):[],r=t.attr("id"),a=t.prop("tagName").toLowerCase(),r&&(a+="#"+r),o=0,i=e.length;i>o;o++)u=e[o],a+="."+u;return a},f=function(t){var n,e,r,o,u,i,a,s,l,c,f,d;return l=function(t){return"<"+t+"(?: [^>]*)?>"},i=function(t){return"</"+t+">"},n="(?:.|\\n)*?",u=function(t){return"("+t+")"},d=new RegExp(l("head")+n+l("title")+u(n)+i("title")+n+i("body"),"i"),o=new RegExp(l("body")+u(n)+i("body"),"i"),(r=t.match(o))?(s=document.createElement("html"),e=p("body",r[1]),s.appendChild(e),(f=t.match(d))&&(a=p("head"),s.appendChild(a),c=p("title",f[1]),a.appendChild(c)),s):p("div",t)},w=$.extend,bn=$.trim,R=Object.keys||function(t){var n,e,r,o;for(o=[],n=0,r=t.length;r>n;n++)e=t[n],t.hasOwnProperty(e)&&o.push(e);return o},g=function(t,n){var e,r,o,u,i;for(i=[],e=o=0,u=t.length;u>o;e=++o)r=t[e],i.push(n(r,e));return i},gn=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},L=function(t){return null===t},X=function(t){return void 0===t},D=function(t){return!X(t)},z=function(t){return X(t)||L(t)},M=function(t){return!z(t)},P=function(t){return z(t)||H(t)&&0===R(t).length||0===t.length},an=function(t,n){return null==n&&(n=I),n(t)?t:null},I=function(t){return!P(t)},F=function(t){return"function"==typeof t},q=function(t){return"string"==typeof t},O=function(t){return"object"==typeof t&&!!t},H=function(t){return O(t)||"function"==typeof t},U=function(t){return!(!t||1!==t.nodeType)},j=function(t){return t instanceof jQuery},N=function(t){return H(t)&&F(t.then)},A=function(t){return N(t)&&F(t.resolve)},S=function(t){return M(t)?t:void 0},E=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},yn=function(t){return Array.prototype.slice.call(t)},l=function(t){return E(t)?t.slice():w({},t)},wn=function(t){return j(t)?t.get(0):t},B=function(t,n){return w(l(t),n)},on=function(t,n){var e,r,o,u;if(o=t?l(t):{},n)for(r in n)e=n[r],u=o[r],M(u)?H(e)&&H(u)&&(o[r]=on(u,e)):o[r]=e;return o},rn=function(){var n,e,r,o,u,i;for(e=1<=arguments.length?t.call(arguments,0):[],u=null,r=0,o=e.length;o>r;r++)if(n=e[r],i=n,F(i)&&(i=i()),M(i)){u=i;break}return u},v=function(t,n){var e,r,o,u;for(u=null,r=0,o=t.length;o>r;r++)if(e=t[r],n(e)){u=e;break}return u},fn=function(t,n){var e;return e=[],g(t,function(t){return n(t)?e.push(t):void 0}),e},sn=function(){var n,e,r,o;return n=arguments[0],r=2<=arguments.length?t.call(arguments,1):[],o=function(){var t,o,u;for(u=[],t=0,o=r.length;o>t;t++)e=r[t],u.push(n.attr(e));return u}(),v(o,I)},Z=function(t){return setTimeout(t,0)},K=function(t){return t[t.length-1]},a=function(){var t;return t=document.documentElement,{width:t.clientWidth,height:t.clientHeight}},vn=function(t,n,e){var r,o;return o=t.css(R(n)),t.css(n),r=function(){return t.css(o)},e?(e(),r()):r},x=function(t){var n,e;return e=t.css(["transform","-webkit-transform"]),P(e)?(n=function(){return t.css(e)},t.css({transform:"translateZ(0)","-webkit-transform":"translateZ(0)"})):n=function(){},n},m=function(t,n,r){var o,u,i,a,s,l;return o=$(t),up.browser.canCssAnimation()?(r=on(r,{duration:300,delay:0,easing:"ease"}),u=$.Deferred(),a={"transition-property":R(n).join(", "),"transition-duration":r.duration+"ms","transition-delay":r.delay+"ms","transition-timing-function":r.easing},s=x(o),l=vn(o,a),o.css(n),u.then(s),u.then(l),o.data(e,u),u.then(function(){return o.removeData(e)}),i=setTimeout(function(){return u.resolve()},r.duration+r.delay),u.then(function(){return clearTimeout(i)}),u):(o.css(n),pn())},e="up-animation-promise",C=function(t){return $(t).each(function(){var t;return(t=$(this).data(e))?t.resolve():void 0})},_=function(t,n){var e,r,o;return r=(null!=n?n.relative:void 0)?t.position():t.offset(),e={left:r.left,top:r.top},(null!=n?n.inner:void 0)?(e.width=t.width(),e.height=t.height()):(e.width=t.outerWidth(),e.height=t.outerHeight()),(null!=n?n.full:void 0)&&(o=a(),e.right=o.width-(e.left+e.width),e.bottom=o.height-(e.top+e.height)),e},c=function(t,n){var e,r,o,u,i;for(u=t.get(0).attributes,i=[],r=0,o=u.length;o>r;r++)e=u[r],i.push(e.specified?n.attr(e.name,e.value):void 0);return i},un=function(t){var n,e;return e=_(t,{relative:!0,inner:!0}),n=t.clone(),n.find("script").remove(),n.css({right:"",bottom:"",position:"absolute"}),n.css(e),n.addClass("up-ghost"),n.insertBefore(t)},k=function(t,n){return t.find(n).addBack(n)},b=function(t){return 27===t.keyCode},s=function(t,n){return t.indexOf(n)>=0},i=function(t){return"true"===String(t)},u=function(t){return"false"===String(t)},V=function(t){return t.getResponseHeader("X-Up-Location")},Q=function(t){return t.getResponseHeader("X-Up-Method")},en=function(){var n,e,r,o,u,i;for(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},G=function(t){return!(t.metaKey||t.shiftKey||t.ctrlKey)},J=function(t){var n;return n=X(t.button)||0===t.button,n&&G(t)},cn=function(){var t;return t=$.Deferred(),t.resolve(),t},pn=function(){return cn().promise()},nn=function(){return{is:function(){return!1},attr:function(){},find:function(){return[]}}},ln=function(){var n,e;return n=1<=arguments.length?t.call(arguments,0):[],e=$.when.apply($,n),e.resolve=function(){return g(n,function(t){return"function"==typeof t.resolve?t.resolve():void 0})},e},dn=function(t,n){var e,r,o;r=[];for(e in n)o=n[e],r.push(z(t.attr(e))?t.attr(e,o):void 0);return r},mn=function(t){var n,e,r,o,u,i,a,s;for(a={},n=function(t){return a[o(t)]},e=function(t){return v(t,n)},i=function(t){return a[o(t)]=!0},o=function(t){return"_"+t},r=0,u=t.length;u>r;r++)s=t[r],i(s);return{put:i,includes:n,includesAny:e}},{presentAttr:sn,createElement:p,normalizeUrl:tn,normalizeMethod:Y,createElementFromHtml:f,$createElementFromSelector:n,createSelectorFromElement:d,get:T,ajax:o,extend:w,copy:l,merge:B,options:on,option:rn,error:y,debug:h,warn:kn,each:g,times:gn,detect:v,select:fn,last:K,isNull:L,isDefined:D,isUndefined:X,isGiven:M,isMissing:z,isPresent:I,isBlank:P,presence:an,isObject:H,isFunction:F,isString:q,isElement:U,isJQuery:j,isPromise:N,isDeferred:A,isHash:O,ifGiven:S,isUnmodifiedKeyEvent:G,isUnmodifiedMouseEvent:J,nullJquery:nn,unwrap:wn,nextFrame:Z,measure:_,temporaryCss:vn,cssAnimate:m,finishCssAnimate:C,forceCompositing:x,prependGhost:un,escapePressed:b,copyAttributes:c,findWithSelf:k,contains:s,isArray:E,toArray:yn,castsToTrue:i,castsToFalse:u,locationFromXhr:V,methodFromXhr:Q,clientSize:a,only:en,trim:bn,keys:R,resolvedPromise:pn,resolvedDeferred:cn,resolvableWhen:ln,setMissingAttrs:dn,stringSet:mn}}()}.call(this),function(){var t=[].slice;up.browser=function(){var n,e,r,o,u,i,a,s,l,c;return l=up.util,a=function(t,n){var e,r,o,u,i,a;return null==n&&(n={}),i=l.option(n.method,"get").toLowerCase(),"get"===i?location.href=t:$.rails?(a=n.target,o=$.rails.csrfToken(),r=$.rails.csrfParam(),e=$("<form method='post' action='"+t+"'></form>"),u="<input name='_method' value='"+i+"' type='hidden' />",l.isDefined(r)&&l.isDefined(o)&&(u+="<input name='"+r+"' value='"+o+"' type='hidden' />"),a&&e.attr("target",a),e.hide().append(u).appendTo("body"),e.submit()):error("Can't fake a "+i.toUpperCase()+" request without Rails UJS")},c=function(){return location.href},o=function(){var t,n,e,r,o,u,i,a,s;return window.console||(window.console={}),s=function(){},(t=window.console).log||(t.log=s),(n=window.console).info||(n.info=s),(e=window.console).error||(e.error=s),(r=window.console).debug||(r.debug=s),(o=window.console).warn||(o.warn=s),(u=window.console).group||(u.group=s),(i=window.console).groupCollapsed||(i.groupCollapsed=s),(a=window.console).groupEnd||(a.groupEnd=s)},s=function(n){var e,r;return e=void 0,r=!1,function(){var o;return o=1<=arguments.length?t.call(arguments,0):[],r?e:(r=!0,e=n.apply(null,o))}},r=s(function(){return l.isDefined(history.pushState)}),n=s(function(){return"transition"in document.documentElement.style}),e=s(function(){return"oninput"in document.createElement("input")}),u=function(){var t,n,e,r,o;return o=$.fn.jquery,r=o.split("."),n=parseInt(r[0]),e=parseInt(r[1]),t=n>=2||1===n&&e>=9,t||l.error("jQuery %o found, but Up.js requires 1.9+",o)},i=s(function(){return l.isDefined(document.addEventListener)}),{url:c,ensureConsoleExists:o,loadPage:a,canPushState:r,canCssAnimation:n,canInputEvent:e,isSupported:i,ensureRecentJquery:u}}()}.call(this),function(){var t=[].slice;up.bus=function(){var n,e,r,o,u,i,a,s;return s=up.util,n={},r={},e=function(t){return n[t]||(n[t]=[])},a=function(){var t,e,o;r={},o=[];for(e in n)t=n[e],o.push(r[e]=s.copy(t));return o},i=function(){return n=s.copy(r)},u=function(t,n){return e(t).push(n)},o=function(){var n,r,o;return o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],s.debug("Emitting event %o with args %o",o,n),r=e(o),s.each(r,function(t){return t.apply(null,n)})},u("framework:ready",a),u("framework:reset",i),{on:u,emit:o}}()}.call(this),function(){up.viewport=function(){var t,n,e,r,o,u,i;return i=up.util,n={duration:0,view:"body",easing:"swing"},e=function(t){return i.extend(n,t)},t="up-scroll-promise",u=function(e,o,u){var a,s,l,c,p;return a=$(e),u=i.options(u),l=i.option(u.duration,n.duration),c=i.option(u.easing,n.easing),r(a),l>0?(s=$.Deferred(),a.data(t,s),s.then(function(){return a.removeData(t),a.finish()}),p={scrollTop:o},a.animate(p,{duration:l,easing:c,complete:function(){return s.resolve()}}),s):(a.scrollTop(o),i.resolvedDeferred())},r=function(n){return $(n).each(function(){var n;return(n=$(this).data(t))?n.resolve():void 0})},o=function(t,e){var r,o,a,s,l,c,p,f,d,m,h;return e=i.options(e),m=i.option(e.view,n.view),f=i.option(e.padding,n.padding),r=$(t),o=$(m),h=o.height(),d=o.scrollTop(),c=d,p=d+h,l=r.position().top,a=c>l-f,s=l>p-f,a||s?(d=l-f,d=Math.max(d,0),d=Math.min(d,h-1),u(o,d,e)):i.resolvedDeferred()},{reveal:o,scroll:u,finishScrolling:r,defaults:e}}(),up.scroll=up.viewport.scroll,up.reveal=up.viewport.reveal}.call(this),function(){up.flow=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v;return v=up.util,d=function(t,n){var e;return e=$(t),v.isPresent(n)&&(n=v.normalizeUrl(n)),e.attr("up-source",n)},m=function(t){var n;return n=$(t).closest("[up-source]"),v.presence(n.attr("up-source"))||up.browser.url()},c=function(t,n,e){var r,o,i;return e=v.options(e),i=v.presence(t)?t:v.createSelectorFromElement($(t)),up.browser.canPushState()||v.castsToFalse(e.history)?(o={url:n,method:e.method,selector:i,cache:e.cache},r=up.proxy.ajax(o),r.done(function(t,r,a){var s,l;return(s=v.locationFromXhr(a))&&(v.debug("Location from server: %o",s),l={url:s,method:v.methodFromXhr(a),selector:i},up.proxy.alias(o,l),n=s),(v.isMissing(e.history)||v.castsToTrue(e.history))&&(e.history=n),(v.isMissing(e.source)||v.castsToTrue(e.source))&&(e.source=n),e.preload?void 0:u(i,t,e)}),r.fail(v.error),r):(e.preload||up.browser.loadPage(n,v.only(e,"method")),v.resolvedPromise())},u=function(t,n,e){var o,u,l,c,p,f,d,m;for(e=v.options(e,{historyMethod:"push"}),v.castsToFalse(e.history)&&(e.history=null),v.castsToFalse(e.scroll)&&(e.scroll=null),e.source=v.option(e.source,e.history),f=a(n),e.title||(e.title=f.title()),p=i(t,e),d=[],l=0,c=p.length;c>l;l++)m=p[l],u=r(m.selector),o=f.find(m.selector),d.push(s(u,e).then(function(){return h(u,o,m.pseudoClass,m.transition,e)}));return d},r=function(t){var n;return n=t+":not(.up-ghost, .up-destroying)",v.presence($(".up-popup "+n))||v.presence($(".up-modal "+n))||v.presence($(n))||o(t)},o=function(t){var n;return n="Could not find selector %o in current body HTML","#"===n[0]&&(n+=" (avoid using IDs)"),v.error(n,t)},a=function(t){var n;return n=v.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):v.error("Could not find selector %o in response %o",e,t)}}},s=function(t,n){return up.motion.finish(t),f(t,n.scroll)},f=function(t,n){return n?up.reveal(t,{view:n}):v.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)),d(n,e.source),t(n),up.ready(n)},h=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()),v.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&&v.error("Cannot apply transitions to body-elements (%o)",u),up.morph(t,r,u,i)}})},i=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),v.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]||v.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=v.findWithSelf(t,e),n.length&&n.get(0)!==document.activeElement?n.focus():void 0},n=function(t,n){var e,r,o;return e=$(t),n=v.options(n,{animation:"none"}),r=up.motion.animateOptions(n),e.addClass("up-destroying"),v.isPresent(n.url)&&up.history.push(n.url),v.isPresent(n.title)&&(document.title=n.title),up.bus.emit("fragment:destroy",e),o=v.presence(n.animation,v.isPromise)||up.motion.animate(e,n.animation,r),o.then(function(){return e.remove()})},l=function(t,n){var e;return n=v.options(n,{cache:!1}),e=n.url||m(t),c(t,e,n)},p=function(){return up.bus.emit("framework:reset")},up.bus.on("app:ready",function(){return d(document.body,up.browser.url())}),{replace:c,reload:l,destroy:n,implant:u,reset:p}}(),up.replace=up.flow.replace,up.reload=up.flow.reload,up.destroy=up.flow.destroy,up.reset=up.flow.reset}.call(this),function(){var t=[].slice;up.magic=function(){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g;return g=up.util,n="up-destroyable",e="up-destroyer",f=[],l=null,p=function(t,n,e){var r,o;if(up.browser.isSupported())return r=[t,n,function(t){return e.apply(this,[t,$(this),a(this)])}],f.push(r),(o=$(document)).on.apply(o,r)},i=[],s=null,u=function(){var n,e,r;return r=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],up.browser.isSupported()?(u=n.pop(),e=g.options(n[0],{batch:!1}),i.push({selector:r,callback:u,batch:e.batch})):void 0},r=function(t,r,o){var u;return g.debug("Applying compiler %o on %o",t.selector,o),u=t.callback.apply(o,[r,a(r)]),g.isFunction(u)?(r.addClass(n),r.data(e,u)):void 0},o=function(t){var n,e,o,a;for(g.debug("Compiling fragment %o",t),a=[],e=0,o=i.length;o>e;e++)u=i[e],n=g.findWithSelf(t,u.selector),a.push(n.length?u.batch?r(u,n,n.get()):n.each(function(){return r(u,$(this),this)}):void 0);return a},c=function(t){return g.findWithSelf(t,"."+n).each(function(){var t,n;return t=$(this),(n=t.data(e))()})},a=function(t){var n,e;return n=$(t),e=n.attr("up-data"),g.isString(e)&&""!==g.trim(e)?JSON.parse(e):{}},v=function(){return l=g.copy(f),s=g.copy(i)},h=function(){var t,n,e,r;for(n=0,e=f.length;e>n;n++)t=f[n],g.contains(l,t)||(r=$(document)).off.apply(r,t);return f=g.copy(l),i=g.copy(s)},m=function(t){var n;return n=$(t),up.bus.emit("fragment:ready",n),n},d=function(t){return p("keydown","body",function(n){return g.escapePressed(n)?t(n):void 0})},up.bus.on("app:ready",function(){return m(document.body)}),up.bus.on("fragment:ready",o),up.bus.on("fragment:destroy",c),up.bus.on("framework:ready",v),up.bus.on("framework:reset",h),{compiler:u,on:p,ready:m,onEscape:d,data:a}}(),up.compiler=up.magic.compiler,up.on=up.magic.on,up.ready=up.magic.ready,up.awaken=function(){var n;return n=1<=arguments.length?t.call(arguments,0):[],up.util.warn("up.awaken has been renamed to up.compiler and will be removed in a future version"),up.compiler.apply(up,n)}}.call(this),function(){up.history=function(){var t,n,e,r,o,u;return u=up.util,t=function(t){return u.normalizeUrl(t,{hash:!0})===u.normalizeUrl(up.browser.url(),{hash:!0})},o=function(e,r){return r=u.options(r,{force:!1}),r.force||!t(e)?n("replace",e):void 0},r=function(e){return t(e)?void 0:n("push",e)},n=function(t,n){return up.browser.canPushState()?(t+="State",window.history[t]({fromUp:!0},"",n)):u.error("This browser doesn't support history.pushState")},e=function(t){var n;return n=t.originalEvent.state,(null!=n?n.fromUp:void 0)?(u.debug("Restoring state %o (now on "+up.browser.url()+")",n),up.visit(up.browser.url(),{historyMethod:"replace"})):u.debug("Discarding unknown state %o",n)},up.browser.canPushState()&&setTimeout(function(){return $(window).on("popstate",e),o(up.browser.url(),{force:!0})},200),{push:r,replace:o}}()}.call(this),function(){up.motion=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k;return w=up.util,o={},a={},b={},s={},i={duration:300,delay:0,easing:"ease"},l=function(t){return w.extend(i,t)},n=function(t,r,o){var i;return i=$(t),p(i),o=e(o),w.isFunction(r)?u(r(i,o),r):w.isString(r)?n(i,c(r),o):w.isHash(r)?w.cssAnimate(i,r,o):w.error("Unknown animation type %o",r)},e=function(t,n){var e;return null==n&&(n=null),t=w.options(t),e={},e.easing=w.option(t.easing,null!=n?n.attr("up-easing"):void 0,i.easing),e.duration=Number(w.option(t.duration,null!=n?n.attr("up-duration"):void 0,i.duration)),e.delay=Number(w.option(t.delay,null!=n?n.attr("up-delay"):void 0,i.delay)),e},c=function(t){return o[t]||w.error("Unknown animation %o",r)},t="up-ghosting-promise",k=function(n,e,r){var o,u,i,a;return u=null,o=null,w.temporaryCss(e,{display:"none"},function(){return u=w.prependGhost(n).addClass("up-destroying")}),w.temporaryCss(n,{display:"none"},function(){return o=w.prependGhost(e)}),n.css({visibility:"hidden"}),a=w.temporaryCss(e,{display:"none"}),i=r(u,o),n.data(t,i),e.data(t,i),i.then(function(){return n.removeData(t),e.removeData(t),u.remove(),o.remove(),n.css({display:"none"}),a()}),i},p=function(t){return $(t).each(function(){var t;return t=$(this),w.finishCssAnimate(t),f(t)})},f=function(n){var e;return(e=n.data(t))?(w.debug("Canceling existing ghosting on %o",n),"function"==typeof e.resolve?e.resolve():void 0):void 0},u=function(t,n){return w.isDeferred(t)?t:w.error("Did not return a promise with .then and .resolve methods: %o",n)},d=function(t,r,i,a){var s,l,c,f,h;return up.browser.canCssAnimation()?(a=e(a),l=$(t),s=$(r),p(l),p(s),"none"===i?m():(h=w.presence(i,w.isFunction)||b[i])?k(l,s,function(t,n){return u(h(t,n,a),i)}):(c=o[i])?(l.hide(),n(s,c,a)):w.isString(i)&&i.indexOf("/")>=0?(f=i.split("/"),h=function(t,e,r){return v(n(t,f[0],r),n(e,f[1],r))},d(l,s,h,a)):w.error("Unknown transition %o",i)):w.resolvedDeferred()},y=function(t,n){return b[t]=n},r=function(t,n){return o[t]=n},g=function(){return a=w.copy(o),s=w.copy(b)},h=function(){return o=w.copy(a),b=w.copy(s)},v=w.resolvableWhen,m=w.resolvedDeferred,r("none",m),r("fade-in",function(t,e){return t.css({opacity:0}),n(t,{opacity:1},e)}),r("fade-out",function(t,e){return t.css({opacity:1}),n(t,{opacity:0},e)}),r("move-to-top",function(t,e){var r,o;return r=w.measure(t),o=r.top+r.height,t.css({"margin-top":"0px"}),n(t,{"margin-top":"-"+o+"px"},e)}),r("move-from-top",function(t,e){var r,o;return r=w.measure(t),o=r.top+r.height,t.css({"margin-top":"-"+o+"px"}),n(t,{"margin-top":"0px"},e)}),r("move-to-bottom",function(t,e){var r,o;return r=w.measure(t),o=w.clientSize().height-r.top,t.css({"margin-top":"0px"}),n(t,{"margin-top":o+"px"},e)}),r("move-from-bottom",function(t,e){var r,o;return r=w.measure(t),o=w.clientSize().height-r.top,t.css({"margin-top":o+"px"}),n(t,{"margin-top":"0px"},e)}),r("move-to-left",function(t,e){var r,o;return r=w.measure(t),o=r.left+r.width,t.css({"margin-left":"0px"}),n(t,{"margin-left":"-"+o+"px"},e)}),r("move-from-left",function(t,e){var r,o;return r=w.measure(t),o=r.left+r.width,t.css({"margin-left":"-"+o+"px"}),n(t,{"margin-left":"0px"},e)}),r("move-to-right",function(t,e){var r,o;return r=w.measure(t),o=w.clientSize().width-r.left,t.css({"margin-left":"0px"}),n(t,{"margin-left":o+"px"},e)}),r("move-from-right",function(t,e){var r,o;return r=w.measure(t),o=w.clientSize().width-r.left,t.css({"margin-left":o+"px"}),n(t,{"margin-left":"0px"},e)}),r("roll-down",function(t,e){var r,o;return r=t.height(),o=w.temporaryCss(t,{height:"0px",overflow:"hidden"}),n(t,{height:r+"px"},e).then(o)}),y("none",m),y("move-left",function(t,e,r){return v(n(t,"move-to-left",r),n(e,"move-from-right",r))}),y("move-right",function(t,e,r){return v(n(t,"move-to-right",r),n(e,"move-from-left",r))}),y("move-up",function(t,e,r){return v(n(t,"move-to-top",r),n(e,"move-from-bottom",r))}),y("move-down",function(t,e,r){return v(n(t,"move-to-bottom",r),n(e,"move-from-top",r))}),y("cross-fade",function(t,e,r){return v(n(t,"fade-out",r),n(e,"fade-in",r))}),up.bus.on("framework:ready",g),up.bus.on("framework:reset",h),{morph:d,animate:n,animateOptions:e,finish:p,transition:y,animation:r,defaults:l,none:m,when:v}}(),up.transition=up.motion.transition,up.animation=up.motion.animation,up.morph=up.motion.morph,up.animate=up.motion.animate}.call(this),function(){up.proxy=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,C,x;return l={preloadDelay:75,cacheSize:70,cacheExpiry:3e5},c=function(t){return x.extend(l,t)},o={},x=up.util,t=null,p=null,u=function(t){return h(t),[t.url,t.method,t.selector].join("|")},C=function(){var t,n,e;return t=x.keys(o),t.length>l.cacheSize&&(n=null,e=null,x.each(t,function(t){var r,u;return r=o[t],u=r.timestamp,!e||e>u?(n=t,e=u):void 0}),n)?delete o[n]:void 0},k=function(){return(new Date).valueOf()},h=function(t){return!x.isHash(t),t._normalized||(t.method=x.normalizeMethod(t.method),t.url&&(t.url=x.normalizeUrl(t.url)),t.selector||(t.selector="body"),t._normalized=!0),t},r=function(t,n){var e;return x.debug("Aliasing %o to %o",t,n),(e=f(t))?b(n,e):void 0},e=function(t){var n,e,r,o;return n=x.castsToTrue(t.cache),e=x.castsToFalse(t.cache),o=x.only(t,"url","method","selector","_normalized"),m(o)||n?(r=f(o))&&!e||(r=x.ajax(o),b(o,r)):(s(),r=x.ajax(o)),r},n=["GET","OPTIONS","HEAD"],m=function(t){return h(t),x.contains(n,t.method)},d=function(t){var n;return n=k()-t.timestamp,n<l.cacheExpiry},f=function(t){var n,e;return n=u(t),(e=o[n])?d(e)?(x.debug("Cache hit for %o (%o)",t.url,t),e):(x.debug("Discarding stale cache entry for %o (%o)",t.url,t),void g(t)):void x.debug("Cache miss for %o (%o)",t.url,t)},b=function(t,n){var e;return C(),e=u(t),n.timestamp=k(),o[e]=n,n},g=function(t){var n;return n=u(t),delete o[n]},s=function(){return o={}},a=function(n){var e,r;return r=parseInt(x.presentAttr(n,"up-delay"))||l.preloadDelay,n.is(t)?void 0:(t=n,i(),e=function(){return v(n)},w(e,r))},w=function(t,n){return p=setTimeout(t,n)},i=function(){return clearTimeout(p),p=null},v=function(t,n){var e,r;return e=$(t),n=x.options(n),r=up.link.followMethod(e,n),m({method:r})?(x.debug("Preloading %o",e),n.preload=!0,up.link.follow(e,n)):(x.debug("Won't preload %o due to unsafe method %o",e,r),x.resolvedPromise())},y=function(){return i(),o={}},up.bus.on("framework:reset",y),up.on("mouseover mousedown touchstart","[up-preload]",function(t,n){return up.link.childClicked(t,n)?void 0:a(n)}),{preload:v,ajax:e,get:f,set:b,alias:r,clear:s,remove:g,defaults:c}}()}.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("href"),e.attr("up-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","[up-target]",function(t,n){return shouldProcessLinkEvent(t,n)?n.is("[up-instant]")?t.preventDefault():(t.preventDefault(),follow(n)):void 0}),up.on("mousedown","[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-follow]"),r.length&&n.find(r).length},shouldProcessLinkEvent=function(t,n){return u.isUnmodifiedMouseEvent(t)&&!childClicked(t,n)},up.on("click","[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("[up-href], [href]").get(0),o||u.error("No link to expand within %o",t),l=/^up-/,a={},s=o.attributes,e=0,r=s.length;r>e;e++)n=s[e],i=n.name,("href"===i||i.match(l))&&(a[i]=n.value);return 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,type: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)},u.ajax(l).always(function(){return e.removeClass("up-active")}).done(function(t,n,e){var o;return o=u.merge(r,{history:f(e),transition:p}),up.flow.implant(c,t,o)}).fail(function(t){var n,e;return e=t.responseText,n=u.merge(r,{transition:i}),up.flow.implant(o,e,n)})):void e.get(0).submit()},observe=function(fieldOrSelector,options){var $field,callback,callbackPromise,callbackTimer,changeEvents,check,clearTimer,codeOnChange,delay,knownValue,nextCallback,runNextCallback;return $field=$(fieldOrSelector),options=u.options(options),delay=u.option($field.attr("up-delay"),options.delay,0),delay=parseInt(delay),knownValue=null,callback=null,callbackTimer=null,(codeOnChange=$field.attr("up-observe"))?callback=function(value,$field){return eval(codeOnChange)}:options.change?callback=options.change:u.error("up.observe: No change callback given"),callbackPromise=u.resolvedPromise(),nextCallback=null,runNextCallback=function(){var t;return nextCallback?(t=nextCallback(),nextCallback=null,t):void 0},check=function(){var t,n;return n=$field.val(),t=u.isNull(knownValue),knownValue===n||(knownValue=n,t)?void 0:(clearTimer(),nextCallback=function(){return callback.apply($field.get(0),[n,$field])},callbackTimer=setTimeout(function(){return callbackPromise.then(function(){var t;return t=runNextCallback(),callbackPromise=u.isPromise(t)?t:u.resolvedPromise()})},delay))},clearTimer=function(){return clearTimeout(callbackTimer)},changeEvents=up.browser.canInputEvent()?"input change":"input change keypress paste cut click propertychange",$field.on(changeEvents,check),check(),clearTimer},up.on("submit","form[up-target]",function(t,n){return t.preventDefault(),submit(n)}),up.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;return p=up.util,e={openAnimation:"fade-in",closeAnimation:"fade-out",position:"bottom-right"},o=function(t){return p.extend(e,t)},l=function(t,n,e){var r,o;return o=p.measure(t,{full:!0}),r=function(){switch(e){case"bottom-right":return{right:o.right,top:o.top+o.height};case"bottom-left":return{left:o.left,top:o.bottom+o.height};case"top-right":return{right:o.right,bottom:o.top};case"top-left":return{left:o.left,bottom:o.top};default:return p.error("Unknown position %o",e)}}(),n.attr("up-position",e),n.css(r),i(n)},i=function(t){var n,e,r,o,u,i,a;if(e=p.measure(t,{full:!0}),r=null,o=null,e.right<0&&(r=-e.right),e.bottom<0&&(o=-e.bottom),e.left<0&&(r=e.left),e.top<0&&(o=e.top),r&&((u=parseInt(t.css("left")))?t.css("left",u-r):(i=parseInt(t.css("right")))&&t.css("right",i+r)),o){if(a=parseInt(t.css("top")))return t.css("top",a-o);if(n=parseInt(t.css("bottom")))return t.css("bottom",n+o)}},s=function(){var t;return t=$(".up-popup"),t.attr("up-previous-url",up.browser.url()),t.attr("up-previous-title",document.title)},u=function(){var t;return t=$(".up-popup"),t.removeAttr("up-previous-url"),t.removeAttr("up-previous-title")},r=function(t,n,e){var r,o;return o=p.$createElementFromSelector(".up-popup"),e&&o.attr("up-sticky",""),r=p.$createElementFromSelector(n),r.appendTo(o),o.appendTo(document.body),s(),o.hide(),o},f=function(t,n,e,r,o){return n.show(),l(t,n,e),up.animate(n,r,o)},a=function(t,o){var u,i,a,s,l,c,d,m,h;return u=$(t),o=p.options(o),h=p.option(o.url,u.attr("href")),d=p.option(o.target,u.attr("up-popup"),"body"),c=p.option(o.position,u.attr("up-position"),e.position),s=p.option(o.animation,u.attr("up-animation"),e.openAnimation),m=p.option(o.sticky,u.is("[up-sticky]")),l=up.browser.canPushState()?p.option(o.history,u.attr("up-history"),!1):!1,a=up.motion.animateOptions(o,u),n(),i=r(u,d,m),up.replace(d,h,{history:l,insert:function(){return f(u,i,c,s,a)}})},c=function(){var t;return t=$(".up-popup"),t.is(".up-destroying")?void 0:t.find("[up-source]").attr("up-source")},n=function(t){var n;return n=$(".up-popup"),n.length?(t=p.options(t,{animation:e.closeAnimation,url:n.attr("up-previous-url"),title:n.attr("up-previous-title")}),up.destroy(n,t)):void 0},t=function(){return $(".up-popup").is("[up-sticky]")?void 0:n()},up.on("click","a[up-popup]",function(t,e){return t.preventDefault(),e.is(".up-current")?n():a(e)}),up.on("click","body",function(t){var e;
2
+ return e=$(t.target),e.closest(".up-popup").length||e.closest("[up-popup]").length?void 0:n()}),up.bus.on("fragment:ready",function(n){return n.closest(".up-popup").length?void 0:(u(),t())}),up.magic.onEscape(function(){return n()}),up.on("click","[up-close]",function(t,e){return e.closest(".up-popup")?n():void 0}),up.bus.on("framework:reset",n),{open:a,close:n,source:c,defaults:o}}()}.call(this),function(){var t=[].slice;up.modal=function(){var n,e,r,o,u,i,a,s,l,c,p,f;return p=up.util,r={width:"auto",height:"auto",openAnimation:"fade-in",closeAnimation:"fade-out",closeLabel:"X",template:function(t){return'<div class="up-modal">\n <div class="up-modal-dialog">\n <div class="up-modal-close" up-close>'+t.closeLabel+'</div>\n <div class="up-modal-content"></div>\n </div>\n</div>'}},u=function(t){return p.extend(r,t)},c=function(){var t;return t=r.template,p.isFunction(t)?t(r):t},s=function(){var t;return t=$(".up-modal"),t.attr("up-previous-url",up.browser.url()),t.attr("up-previous-title",document.title)},i=function(){var t;return t=$(".up-modal"),t.removeAttr("up-previous-url"),t.removeAttr("up-previous-title")},o=function(t,n,e,r){var o,u,i,a;return i=$(c()),r&&i.attr("up-sticky",""),i.attr("up-previous-url",up.browser.url()),i.attr("up-previous-title",document.title),u=i.find(".up-modal-dialog"),p.isPresent(n)&&u.css("width",n),p.isPresent(e)&&u.css("height",e),o=u.find(".up-modal-content"),a=p.$createElementFromSelector(t),a.appendTo(o),i.appendTo(document.body),s(),i.hide(),i},f=function(t,n,e){return t.show(),up.animate(t,n,e)},a=function(){var n,u,i,a,s,l,c,d,m,h,v,g;return s=1<=arguments.length?t.call(arguments,0):[],!p.isObject(s[0])||p.isElement(s[0])||p.isJQuery(s[0])?(n=$(s[0]),d=s[1]):(n=p.nullJquery(),d=s[0]),d=p.options(d),v=p.option(d.url,n.attr("up-href"),n.attr("href")),m=p.option(d.target,n.attr("up-modal"),"body"),g=p.option(d.width,n.attr("up-width"),r.width),l=p.option(d.height,n.attr("up-height"),r.height),a=p.option(d.animation,n.attr("up-animation"),r.openAnimation),h=p.option(d.sticky,n.is("[up-sticky]")),c=up.browser.canPushState()?p.option(d.history,n.attr("up-history"),!0):!1,i=up.motion.animateOptions(d,n),e(),u=o(m,g,l,h),up.replace(m,v,{history:c,insert:function(){return f(u,a,i)}})},l=function(){var t;return t=$(".up-modal"),t.is(".up-destroying")?void 0:t.find("[up-source]").attr("up-source")},e=function(t){var n;return n=$(".up-modal"),n.length?(t=p.options(t,{animation:r.closeAnimation,url:n.attr("up-previous-url"),title:n.attr("up-previous-title")}),up.destroy(n,t)):void 0},n=function(){return $(".up-modal").is("[up-sticky]")?void 0:(i(),e())},up.on("click","a[up-modal]",function(t,n){return t.preventDefault(),n.is(".up-current")?e():a(n)}),up.on("click","body",function(t){var n;return n=$(t.target),n.closest(".up-modal-dialog").length||n.closest("[up-modal]").length?void 0:e()}),up.bus.on("fragment:ready",function(t){return t.closest(".up-modal").length?void 0:n()}),up.magic.onEscape(function(){return e()}),up.on("click","[up-close]",function(t,n){return n.closest(".up-modal")?e():void 0}),up.bus.on("framework:reset",e),{open:a,close:e,source:l,defaults:u}}()}.call(this),function(){up.tooltip=function(){var t,n,e,r,o;return o=up.util,r=function(t,n,e){var r,u,i;return u=o.measure(t),i=o.measure(n),r=function(){switch(e){case"top":return{left:u.left+.5*(u.width-i.width),top:u.top-i.height};case"bottom":return{left:u.left+.5*(u.width-i.width),top:u.top+u.height};default:return o.error("Unknown 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;return f=up.util,t="up-active",n="up-current",e=["[href]","[up-target]","[up-follow]","[up-modal]","[up-popup]","[up-href]"],o=e.join(", "),u=function(){var t,n,r;for(r=[],t=0,n=e.length;n>t;t++)p=e[t],r.push(p+"[up-instant]");return r}().join(", "),r="."+t,s=function(t){return f.isPresent(t)?f.normalizeUrl(t,{search:!1,stripTrailingSlash:!0}):void 0},c=function(t){var n,e,r,o,u,i;for(i=[],o=["up-href","href"],e=0,r=o.length;r>e;e++)n=o[e],(u=f.presentAttr(t,n))&&(u=s(u),i.push(u));return i},a=function(){var t;return t=f.stringSet([s(up.browser.url()),s(up.modal.source()),s(up.popup.source())]),f.each($(o),function(e){var r,o;return r=$(e),o=c(r),t.includesAny(o)?r.addClass(n):r.removeClass(n)})},l=function(n){return d(),n=i(n),n.addClass(t)},i=function(t){return f.presence(t.parents(o))||t},d=function(){return $(r).removeClass(t)},up.on("click",o,function(t,n){return f.isUnmodifiedMouseEvent(t)&&!n.is("[up-instant]")?l(n):void 0}),up.on("mousedown",u,function(t,n){return f.isUnmodifiedMouseEvent(t)?l(n):void 0}),up.bus.on("fragment:ready",function(){return d(),a()}),up.bus.on("fragment:destroy",function(t){return t.is(".up-modal, .up-popup")?a():void 0})}()}.call(this),function(){up.slot=function(){var t,n,e;return e=up.util,n=function(t){return""!==e.trim(t.html())},t=function(t){return e.findWithSelf(t,"[up-slot]").each(function(){var t;return t=$(this),n(t)?void 0:t.hide()})},up.bus.on("fragment:ready",t)}()}.call(this),function(){up.browser.ensureRecentJquery(),up.browser.isSupported()&&(up.browser.ensureConsoleExists(),up.bus.emit("framework:ready"),$(document).on("ready",function(){return up.bus.emit("app:ready")}))}.call(this);
@@ -143,7 +143,7 @@ up.link = (->
143
143
  $link = $(link)
144
144
 
145
145
  options = u.options(options)
146
- url = u.option($link.attr('href'), $link.attr('up-follow'))
146
+ url = u.option($link.attr('href'), $link.attr('up-href'))
147
147
  selector = u.option(options.target, $link.attr('up-target'), 'body')
148
148
  options.transition = u.option(options.transition, $link.attr('up-transition'), $link.attr('up-animation'))
149
149
  options.history = u.option(options.history, $link.attr('up-history'))
@@ -162,14 +162,6 @@ up.link = (->
162
162
  options = u.options(options)
163
163
  u.option(options.method, $link.attr('up-method'), $link.attr('data-method'), 'get').toUpperCase()
164
164
 
165
- resolve = (element) ->
166
- $element = $(element)
167
- followAttr = $element.attr('up-follow')
168
- if $element.is('a') || (u.isPresent(followAttr) && !u.castsToTrue(followAttr))
169
- $element
170
- else
171
- $element.find('a:first')
172
-
173
165
  ###*
174
166
  Follows this link via AJAX and replaces a CSS selector in the current page
175
167
  with corresponding elements from a new page fetched from the server:
@@ -207,27 +199,25 @@ up.link = (->
207
199
  Load more tasks
208
200
  </a>
209
201
 
210
- \#\#\#\# Following on mousedown
211
-
212
- By also adding an `up-instant` attribute, the page will be fetched
213
- on `mousedown` instead of `click`, making the interaction even faster:
214
-
215
- <a href="/users" up-target=".main" up-instant>User list</a>
216
-
217
- Note that using `[up-instant]` will prevent a user from canceling a link
218
- click by moving the mouse away from the interaction area. However, for
219
- navigation actions this isn't needed. E.g. popular operation
220
- systems switch tabs on `mousedown`.
202
+ \#\#\#\# Following elements that are no links
203
+
204
+ You can also use `[up-target]` to turn an arbitrary element into a link.
205
+ In this case, put the link's destination into the `up-href` attribute:
206
+
207
+ <button up-target=".main" up-href="/foo/bar">Go</button>
221
208
 
222
- @method a[up-target]
209
+ Note that using any element other than `<a>` will prevent users from
210
+ opening the destination in a new tab.
211
+
212
+ @method [up-target]
223
213
  @ujs
224
214
  @param {String} up-target
225
215
  The CSS selector to replace
226
- @param up-instant
227
- If set, fetches the element on `mousedown` instead of `click`.
228
- This makes the interaction faster.
216
+ @param [up-href]
217
+ The destination URL to follow.
218
+ If omitted, the the link's `href` attribute will be used.
229
219
  ###
230
- up.on 'click', 'a[up-target]', (event, $link) ->
220
+ up.on 'click', '[up-target]', (event, $link) ->
231
221
  if shouldProcessLinkEvent(event, $link)
232
222
  if $link.is('[up-instant]')
233
223
  # If the link was already processed on mousedown, we still need
@@ -237,10 +227,29 @@ up.link = (->
237
227
  event.preventDefault()
238
228
  follow($link)
239
229
 
240
- up.on 'mousedown', 'a[up-target][up-instant]', (event, $link) ->
230
+ ###*
231
+ By adding an `up-instant` attribute to a link, the destination will be
232
+ fetched on `mousedown` instead of `click` (`mouseup`).
233
+
234
+ <a href="/users" up-target=".main" up-instant>User list</a>
235
+
236
+ This will save precious milliseconds that otherwise spent
237
+ on waiting for the user to release the mouse button. Since an
238
+ AJAX request will be triggered right way, the interaction will
239
+ appear faster.
240
+
241
+ Note that using `[up-instant]` will prevent a user from canceling a link
242
+ click by moving the mouse away from the interaction area. However, for
243
+ navigation actions this isn't needed. E.g. popular operation
244
+ systems switch tabs on `mousedown` instead of `click`.
245
+
246
+ @method [up-instant]
247
+ @ujs
248
+ ###
249
+ up.on 'mousedown', '[up-instant]', (event, $link) ->
241
250
  if shouldProcessLinkEvent(event, $link)
242
251
  event.preventDefault()
243
- up.follow($link)
252
+ follow($link)
244
253
 
245
254
  ###*
246
255
  @method up.link.childClicked
@@ -256,40 +265,31 @@ up.link = (->
256
265
 
257
266
  ###*
258
267
  If applied on a link, Follows this link via AJAX and replaces the
259
- current `<body>` element with the response's `<body>` element
268
+ current `<body>` element with the response's `<body>` element.
269
+
270
+ Example:
260
271
 
261
272
  <a href="/users" up-follow>User list</a>
262
273
 
263
- \#\#\#\# Following on mousedown
274
+ To only update a fragment instead of the entire page,
275
+ see [`up-target`](#up-target).
264
276
 
265
- By also adding an `up-instant` attribute, the page will be fetched
266
- on `mousedown` instead of `click`, making the interaction even faster:
267
-
268
- <a href="/users" up-follow up-instant>User list</a>
269
-
270
- Note that using `[up-instant]` will prevent a user from canceling a link
271
- click by moving the mouse away from the interaction area. However, for
272
- navigation actions this isn't needed. E.g. popular operation
273
- systems switch tabs on `mousedown`.
277
+ \#\#\#\# Turn any element into a link
274
278
 
275
- \#\#\#\# Enlarging the click area
279
+ You can also use `[up-follow]` to turn an arbitrary element into a link.
280
+ In this case, put the link's destination into the `up-href` attribute:
276
281
 
277
- You can also apply `[up-follow]` to any element that contains a link
278
- in order to enlarge the link's click area:
279
-
280
- <div class="notification" up-follow>
281
- Record was saved!
282
- <a href="/records">Close</a>
283
- </div>
282
+ <span up-follow up-href="/foo/bar">Go</span>
284
283
 
285
- In the example above, clicking anywhere within `.notification` element
286
- would follow the *Close* link.
284
+ Note that using any element other than `<a>` will prevent users from
285
+ opening the destination in a new tab.
287
286
 
288
287
  @method [up-follow]
289
288
  @ujs
290
289
  @param {String} [up-follow]
291
- @param up-instant
292
- If set, fetches the element on `mousedown` instead of `click`.
290
+ @param [up-href]
291
+ The destination URL to follow.
292
+ If omitted, the the link's `href` attribute will be used.
293
293
  ###
294
294
  up.on 'click', '[up-follow]', (event, $link) ->
295
295
  if shouldProcessLinkEvent(event, $link)
@@ -299,12 +299,37 @@ up.link = (->
299
299
  event.preventDefault()
300
300
  else
301
301
  event.preventDefault()
302
- follow(resolve($link))
302
+ follow($link)
303
303
 
304
- up.on 'mousedown', '[up-follow][up-instant]', (event, $link) ->
305
- if shouldProcessLinkEvent(event, $link)
306
- event.preventDefault()
307
- follow(resolve($link))
304
+ ###*
305
+ Add an `up-expand` class to any element that contains a link
306
+ in order to enlarge the link's click area:
307
+
308
+ <div class="notification" up-expand>
309
+ Record was saved!
310
+ <a href="/records">Close</a>
311
+ </div>
312
+
313
+ In the example above, clicking anywhere within `.notification` element
314
+ would [follow](#up-follow) the *Close* link.
315
+
316
+ `up-expand` honors all the UJS behavior in expanded links
317
+ (`up-target`, `up-instant`, `up-preload`, etc.).
318
+
319
+ @ujs
320
+ @method [up-expand]
321
+ ###
322
+ up.compiler '[up-expand]', ($fragment) ->
323
+ link = $fragment.find('[up-href], [href]').get(0)
324
+ link or u.error('No link to expand within %o', $fragment)
325
+ upAttributePattern = /^up-/
326
+ newAttrs = {}
327
+ for attribute in link.attributes
328
+ name = attribute.name
329
+ if name == 'href' || name.match(upAttributePattern)
330
+ newAttrs[name] = attribute.value
331
+ u.setMissingAttrs($fragment, newAttrs)
332
+ $fragment.removeAttr('up-expand')
308
333
 
309
334
  ###*
310
335
  Marks up the current link to be followed *as fast as possible*.
@@ -322,14 +347,6 @@ up.link = (->
322
347
 
323
348
  <a href="/users" up-target=".main" up-instant up-preload>User list</a>
324
349
 
325
- You can also apply `[up-dash]` to any element that contains a link
326
- in order to enlarge the link's click area:
327
-
328
- <div class="notification" up-dash>
329
- Record was saved!
330
- <a href="/records" up-dash='.main'>Close</a>
331
- </div>
332
-
333
350
  @method [up-dash]
334
351
  @ujs
335
352
  ###
@@ -349,7 +366,6 @@ up.link = (->
349
366
  knife: eval(Knife?.point)
350
367
  visit: visit
351
368
  follow: follow
352
- resolve: resolve
353
369
  childClicked: childClicked
354
370
  followMethod: followMethod
355
371
 
@@ -151,7 +151,7 @@ up.modal = (->
151
151
  options = args[1]
152
152
 
153
153
  options = u.options(options)
154
- url = u.option(options.url, $link.attr('href'), $link.attr('up-href'))
154
+ url = u.option(options.url, $link.attr('up-href'), $link.attr('href'))
155
155
  selector = u.option(options.target, $link.attr('up-modal'), 'body')
156
156
  width = u.option(options.width, $link.attr('up-width'), config.width)
157
157
  height = u.option(options.height, $link.attr('up-height'), config.height)
@@ -9,18 +9,6 @@ to the current location (class `up-current`).
9
9
  This dramatically improves the perceived speed of your user interface
10
10
  by providing instant feedback for user interactions.
11
11
 
12
- The classes are added and removed automatically whenever
13
- a page fragment is added, changed or destroyed through Up.js.
14
-
15
- How Up.js computes the current location
16
- ---------------------------------------
17
-
18
- From Up's point of view the "current" location is either:
19
-
20
- - the URL displayed in the browser window's location bar
21
- - the source URL of a currently opened [modal dialog](/up.modal)
22
- - the source URL of a currently opened [popup overlay](/up.popup)
23
-
24
12
  @class up.navigation
25
13
  ###
26
14
  up.navigation = (->
@@ -29,7 +17,7 @@ up.navigation = (->
29
17
 
30
18
  CLASS_ACTIVE = 'up-active'
31
19
  CLASS_CURRENT = 'up-current'
32
- SELECTORS_SECTION = ['a[href]', 'a[up-target]', '[up-follow]', '[up-modal]', '[up-popup]', '[up-href]']
20
+ SELECTORS_SECTION = ['[href]', '[up-target]', '[up-follow]', '[up-modal]', '[up-popup]', '[up-href]']
33
21
  SELECTOR_SECTION = SELECTORS_SECTION.join(', ')
34
22
  SELECTOR_SECTION_INSTANT = ("#{selector}[up-instant]" for selector in SELECTORS_SECTION).join(', ')
35
23
  SELECTOR_ACTIVE = ".#{CLASS_ACTIVE}"
@@ -43,11 +31,10 @@ up.navigation = (->
43
31
 
44
32
  sectionUrls = ($section) ->
45
33
  urls = []
46
- if $link = up.link.resolve($section)
47
- for attr in ['href', 'up-follow', 'up-href']
48
- if url = u.presentAttr($link, attr)
49
- url = normalizeUrl(url)
50
- urls.push(url)
34
+ for attr in ['up-href', 'href']
35
+ if url = u.presentAttr($section, attr)
36
+ url = normalizeUrl(url)
37
+ urls.push(url)
51
38
  urls
52
39
 
53
40
  locationChanged = ->
@@ -67,6 +54,33 @@ up.navigation = (->
67
54
  else
68
55
  $section.removeClass(CLASS_CURRENT)
69
56
 
57
+ ###*
58
+ Links that are currently loading are assigned the `up-active`
59
+ class automatically. Style `.up-active` in your CSS to improve the
60
+ perceived responsiveness of your user interface.
61
+
62
+ The `up-active` class will be removed as soon as another
63
+ page fragment is added or updated through Up.js.
64
+
65
+ \#\#\#\# Example
66
+
67
+ We have a link:
68
+
69
+ <a href="/foo" up-follow>Foo</a>
70
+
71
+ The user clicks on the link. While the request is loading,
72
+ the link has the `up-active` class:
73
+
74
+ <a href="/foo" up-follow up-active>Foo</a>
75
+
76
+ Once the fragment is loaded the browser's location bar is updated
77
+ to `http://yourhost/foo` via [`history.pushState`](https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history#Adding_and_modifying_history_entries):
78
+
79
+ <a href="/foo" up-follow up-current>Foo</a>
80
+
81
+ @ujs
82
+ @method [up-active]
83
+ ###
70
84
  sectionClicked = ($section) ->
71
85
  unmarkActive()
72
86
  $section = enlargeClickArea($section)
@@ -85,12 +99,46 @@ up.navigation = (->
85
99
  up.on 'mousedown', SELECTOR_SECTION_INSTANT, (event, $section) ->
86
100
  if u.isUnmodifiedMouseEvent(event)
87
101
  sectionClicked($section)
88
-
89
- # When a fragment is ready it might either have brought a location change
90
- # with it, or it might have opened a modal / popup which we consider
91
- # to be secondary location sources (the primary being the browser's
92
- # location bar.
102
+
103
+ ###*
104
+ Links that point to the current location are assigned
105
+ the `up-current` class automatically.
106
+
107
+ The use case for this is navigation bars:
108
+
109
+ <nav>
110
+ <a href="/foo">Foo</a>
111
+ <a href="/bar">Bar</a>
112
+ </nav>
113
+
114
+ If the browser location changes to `/foo`, the markup changes to this:
115
+
116
+ <nav>
117
+ <a href="/foo" up-current>Foo</a>
118
+ <a href="/bar">Bar</a>
119
+ </nav>
120
+
121
+ \#\#\#\# What's considered to be "current"?
122
+
123
+ The current location is considered to be either:
124
+
125
+ - the URL displayed in the browser window's location bar
126
+ - the source URL of a currently opened [modal dialog](/up.modal)
127
+ - the source URL of a currently opened [popup overlay](/up.popup)
128
+
129
+ A link matches the current location (and is marked as `.up-current`) if it matches either:
130
+
131
+ - the link's `href` attribute
132
+ - the link's [`up-href`](/up.link#turn-any-element-into-a-link) attribute
133
+
134
+ @method [up-current]
135
+ @ujs
136
+ ###
93
137
  up.bus.on 'fragment:ready', ->
138
+ # When a fragment is ready it might either have brought a location change
139
+ # with it, or it might have opened a modal / popup which we consider
140
+ # to be secondary location sources (the primary being the browser's
141
+ # location bar).
94
142
  unmarkActive()
95
143
  # If a new fragment is inserted, it's likely to be the result
96
144
  # to the active action. So we can remove the active marker.
@@ -126,10 +126,7 @@ up.proxy = (->
126
126
  isIdempotent = (request) ->
127
127
  normalizeRequest(request)
128
128
  u.contains(SAFE_HTTP_METHODS, request.method)
129
-
130
- ensureIsIdempotent = (request) ->
131
- isIdempotent(request) or u.error("Won't preload non-GET request %o", request)
132
-
129
+
133
130
  isFresh = (promise) ->
134
131
  timeSinceTouch = timestamp() - promise.timestamp
135
132
  timeSinceTouch < config.cacheExpiry
@@ -238,7 +235,7 @@ up.proxy = (->
238
235
  # of a link. The actual link will receive the event
239
236
  # and bubble in a second.
240
237
  unless up.link.childClicked(event, $element)
241
- checkPreload(up.link.resolve($element))
238
+ checkPreload($element)
242
239
 
243
240
  preload: preload
244
241
  ajax: ajax
@@ -1,5 +1,5 @@
1
1
  module Upjs
2
2
  module Rails
3
- VERSION = '0.6.5'
3
+ VERSION = '0.7.0'
4
4
  end
5
5
  end
@@ -57,14 +57,29 @@ describe 'up.link', ->
57
57
 
58
58
  describe 'unobtrusive behavior', ->
59
59
 
60
- describe 'a[up-target]', ->
60
+ describe '[up-target]', ->
61
61
 
62
62
  it 'should have tests'
63
63
 
64
64
  describe '[up-follow]', ->
65
65
 
66
- it 'should have tests'
67
-
66
+ it "calls up.follow with the clicked link", ->
67
+ followSpy = up.link.knife.mock('follow')
68
+ $link = affix('a[href="/path"][up-follow]')
69
+ up.ready($link)
70
+ $link.click()
71
+ expect(followSpy).toHaveBeenCalledWith($link)
72
+
73
+ describe '[up-expand]', ->
74
+
75
+ it 'copies up-related attributes of a contained link', ->
76
+ $area = affix('div[up-expand] a[href="/path"][up-target="selector"][up-instant][up-preload]')
77
+ up.ready($area)
78
+ expect($area.attr('href')).toEqual('/path')
79
+ expect($area.attr('up-target')).toEqual('selector')
80
+ expect($area.attr('up-instant')).toEqual('')
81
+ expect($area.attr('up-preload')).toEqual('')
82
+
68
83
  describe '[up-instant]', ->
69
84
 
70
85
  beforeEach ->
@@ -74,14 +89,10 @@ describe 'up.link', ->
74
89
  afterEach ->
75
90
  Knife.reset()
76
91
 
77
- it 'follows an [up-follow] link on mousedown (instead of on click)', ->
92
+ it 'follows a link on mousedown (instead of on click)', ->
78
93
  Trigger.mousedown(@$link)
79
94
  expect(@followSpy.calls.mostRecent().args[0]).toEqual(@$link)
80
-
81
- it 'follows an [up-target] link on mousedown (instead of on click)', ->
82
- Trigger.mousedown(@$link)
83
- expect(@followSpy.calls.mostRecent().args[0]).toEqual(@$link)
84
-
95
+
85
96
  it 'does nothing on mouseup', ->
86
97
  Trigger.mouseup(@$link)
87
98
  expect(@followSpy).not.toHaveBeenCalled()
@@ -60,8 +60,10 @@ describe 'up.navigation', ->
60
60
  expect($link).not.toHaveClass('up-active')
61
61
  expect($link).toHaveClass('up-current')
62
62
 
63
- it 'prefers to mark an enclosing [up-follow] click area', ->
64
- $area = affix('div[up-follow] a[href="/foo"][up-target=".main"]')
63
+ it 'prefers to mark an enclosing [up-expand] click area', ->
64
+ $area = affix('div[up-expand] a[href="/foo"][up-target=".main"]')
65
+ up.ready($area)
66
+ console.log($area)
65
67
  $link = $area.find('a')
66
68
  affix('.main')
67
69
  $link.click()
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: upjs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch