upjs-rails 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dist/up.js +87 -5
- data/dist/up.min.js +2 -2
- data/lib/assets/javascripts/up/link.js.coffee +51 -2
- data/lib/assets/javascripts/up/proxy.js.coffee +19 -2
- data/lib/assets/javascripts/up/util.js.coffee +6 -0
- data/lib/upjs/rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f5272dedf0729c07b9d465df87c0849389a41f8
|
4
|
+
data.tar.gz: 21aac3463e562b39caf7920e2a66c0e7611357af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c959fc30ab815300dd3f219bc48a69c904daba8d67b19a19bc5c3d2573825685e571a3926dba0b629ac84ebbb69cea9d81bcd54f3ea467361688529065bce7bc
|
7
|
+
data.tar.gz: 55e7bb84f0c17798bdcba9add1fc3f84ea0d2ff35b871a482f82e657fd27498a4d76630387774e062ea587896c11b5e0052b26936d28911172c4388812475d45
|
data/dist/up.js
CHANGED
@@ -25,7 +25,7 @@ If you use them in your own code, you will get hurt.
|
|
25
25
|
var __slice = [].slice;
|
26
26
|
|
27
27
|
up.util = (function() {
|
28
|
-
var $createElementFromSelector, ANIMATION_PROMISE_KEY, CONSOLE_PLACEHOLDERS, ajax, castsToFalse, castsToTrue, clientSize, contains, copy, copyAttributes, createElement, createElementFromHtml, createSelectorFromElement, cssAnimate, debug, detect, each, error, escapePressed, extend, findWithSelf, finishCssAnimate, forceCompositing, get, ifGiven, isArray, isBlank, isDeferred, isDefined, isFunction, isGiven, isHash, isJQuery, isMissing, isNull, isObject, isPresent, isPromise, isStandardPort, isString, isUndefined, keys, last, locationFromXhr, measure, merge, methodFromXhr, nextFrame, normalizeMethod, normalizeUrl, only, option, options, prependGhost, presence, presentAttr, resolvableWhen, resolvedDeferred, resolvedPromise, select, stringSet, stringifyConsoleArgs, temporaryCss, toArray, trim, unwrap;
|
28
|
+
var $createElementFromSelector, ANIMATION_PROMISE_KEY, CONSOLE_PLACEHOLDERS, ajax, castsToFalse, castsToTrue, clientSize, contains, copy, copyAttributes, createElement, createElementFromHtml, createSelectorFromElement, cssAnimate, debug, detect, each, error, escapePressed, extend, findWithSelf, finishCssAnimate, forceCompositing, get, ifGiven, isArray, isBlank, isDeferred, isDefined, isFunction, isGiven, isHash, isJQuery, isMissing, isNull, isObject, isPresent, isPromise, isStandardPort, isString, isUndefined, keys, last, locationFromXhr, measure, merge, methodFromXhr, nextFrame, normalizeMethod, normalizeUrl, only, option, options, prependGhost, presence, presentAttr, resolvableWhen, resolvedDeferred, resolvedPromise, select, setMissingAttrs, stringSet, stringifyConsoleArgs, temporaryCss, toArray, trim, unwrap;
|
29
29
|
get = function(url, options) {
|
30
30
|
options = options || {};
|
31
31
|
options.url = url;
|
@@ -657,6 +657,19 @@ If you use them in your own code, you will get hurt.
|
|
657
657
|
};
|
658
658
|
return joined;
|
659
659
|
};
|
660
|
+
setMissingAttrs = function($element, attrs) {
|
661
|
+
var key, value, _results;
|
662
|
+
_results = [];
|
663
|
+
for (key in attrs) {
|
664
|
+
value = attrs[key];
|
665
|
+
if (isMissing($element.attr(key))) {
|
666
|
+
_results.push($element.attr(key, value));
|
667
|
+
} else {
|
668
|
+
_results.push(void 0);
|
669
|
+
}
|
670
|
+
}
|
671
|
+
return _results;
|
672
|
+
};
|
660
673
|
stringSet = function(array) {
|
661
674
|
var includes, includesAny, key, put, set, string, _i, _len;
|
662
675
|
set = {};
|
@@ -744,6 +757,7 @@ If you use them in your own code, you will get hurt.
|
|
744
757
|
resolvedPromise: resolvedPromise,
|
745
758
|
resolvedDeferred: resolvedDeferred,
|
746
759
|
resolvableWhen: resolvableWhen,
|
760
|
+
setMissingAttrs: setMissingAttrs,
|
747
761
|
stringSet: stringSet
|
748
762
|
};
|
749
763
|
})();
|
@@ -2011,14 +2025,23 @@ We need to work on this page:
|
|
2011
2025
|
Caching and preloading
|
2012
2026
|
======================
|
2013
2027
|
|
2014
|
-
|
2028
|
+
All HTTP requests go through the Up.js proxy.
|
2029
|
+
It caches a limited number
|
2030
|
+
|
2031
|
+
The cache is cleared whenever the user makes a non-´GET` request
|
2032
|
+
(like `POST`, `PUT`, `DELETE`).
|
2033
|
+
|
2034
|
+
The proxy can also used to speed up reaction times by preloading
|
2035
|
+
links when the user hovers over the click area (or puts the mouse/finger
|
2036
|
+
down before releasing). This way the
|
2037
|
+
response will already be cached when the user performs the click.
|
2015
2038
|
|
2016
2039
|
@class up.proxy
|
2017
2040
|
*/
|
2018
2041
|
|
2019
2042
|
(function() {
|
2020
2043
|
up.proxy = (function() {
|
2021
|
-
var $waitingLink, ajax, alias, cache, cacheKey, cancelDelay, checkPreload, clear, config, defaults, delayTimer, ensureIsIdempotent, get, isFresh, isIdempotent, normalizeRequest, preload, remove, reset, set, startDelay, timestamp, touch, trim, u;
|
2044
|
+
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, touch, trim, u;
|
2022
2045
|
config = {
|
2023
2046
|
preloadDelay: 50,
|
2024
2047
|
cacheSize: 70,
|
@@ -2107,9 +2130,10 @@ Document me.
|
|
2107
2130
|
}
|
2108
2131
|
return promise;
|
2109
2132
|
};
|
2133
|
+
SAFE_HTTP_METHODS = ['GET', 'OPTIONS', 'HEAD'];
|
2110
2134
|
isIdempotent = function(request) {
|
2111
2135
|
normalizeRequest(request);
|
2112
|
-
return request.method
|
2136
|
+
return u.contains(SAFE_HTTP_METHODS, request.method);
|
2113
2137
|
};
|
2114
2138
|
ensureIsIdempotent = function(request) {
|
2115
2139
|
return isIdempotent(request) || u.error("Won't preload non-GET request %o", request);
|
@@ -2188,6 +2212,12 @@ Document me.
|
|
2188
2212
|
up.bus.on('framework:reset', reset);
|
2189
2213
|
|
2190
2214
|
/*
|
2215
|
+
Links with an `up-preload` attribute will silently fetch their target
|
2216
|
+
when the user hovers over the click area, or when the user puts her
|
2217
|
+
mouse/finger down (before releasing). This way the
|
2218
|
+
response will already be cached when the user performs the click,
|
2219
|
+
making the interaction feel instant.
|
2220
|
+
|
2191
2221
|
@method [up-preload]
|
2192
2222
|
@ujs
|
2193
2223
|
*/
|
@@ -2397,6 +2427,16 @@ Read on
|
|
2397
2427
|
|
2398
2428
|
<a href="/users" up-follow>User list</a>
|
2399
2429
|
|
2430
|
+
By also adding an `up-instant` attribute, the page will be fetched
|
2431
|
+
on `mousedown` instead of `click`, making the interaction even faster:
|
2432
|
+
|
2433
|
+
<a href="/users" up-follow up-instant>User list</a>
|
2434
|
+
|
2435
|
+
Note that using `[up-instant]` will prevent a user from canceling a link
|
2436
|
+
click by moving the mouse away from the interaction area. However, for
|
2437
|
+
navigation actions this isn't needed. E.g. popular operation
|
2438
|
+
systems switch tabs on `mousedown`.
|
2439
|
+
|
2400
2440
|
You can also apply `[up-follow]` to any element that contains a link
|
2401
2441
|
in order to enlarge the link's click area:
|
2402
2442
|
|
@@ -2413,7 +2453,6 @@ Read on
|
|
2413
2453
|
@param {String} [up-follow]
|
2414
2454
|
@param up-instant
|
2415
2455
|
If set, fetches the element on `mousedown` instead of `click`.
|
2416
|
-
This makes the interaction faster.
|
2417
2456
|
*/
|
2418
2457
|
up.on('click', '[up-follow]', function(event, $element) {
|
2419
2458
|
if (!childClicked(event, $element)) {
|
@@ -2429,6 +2468,49 @@ Read on
|
|
2429
2468
|
return follow(resolve($element));
|
2430
2469
|
}
|
2431
2470
|
});
|
2471
|
+
|
2472
|
+
/*
|
2473
|
+
Marks up the current link to be followed *as fast as possible*.
|
2474
|
+
This is done by:
|
2475
|
+
|
2476
|
+
- [Following the link through AJAX](/up.link#up-target) instead of a full page load
|
2477
|
+
- [Preloading the link's destination URL](/up.proxy#up-preload)
|
2478
|
+
- [Triggering the link on `mousedown`](/up.link#up-instant) instead of on `click`
|
2479
|
+
|
2480
|
+
Use `up-dash` like this:
|
2481
|
+
|
2482
|
+
<a href="/users" up-dash=".main">User list</a>
|
2483
|
+
|
2484
|
+
Note that this is shorthand for:
|
2485
|
+
|
2486
|
+
<a href="/users" up-target=".main" up-instant up-preload>User list</a>
|
2487
|
+
|
2488
|
+
You can also apply `[up-dash]` to any element that contains a link
|
2489
|
+
in order to enlarge the link's click area:
|
2490
|
+
|
2491
|
+
<div class="notification" up-dash>
|
2492
|
+
Record was saved!
|
2493
|
+
<a href="/records" up-dash='.main'>Close</a>
|
2494
|
+
</div>
|
2495
|
+
|
2496
|
+
@method [up-dash]
|
2497
|
+
@ujs
|
2498
|
+
*/
|
2499
|
+
up.awaken('[up-dash]', function($element) {
|
2500
|
+
var newAttrs, target;
|
2501
|
+
target = $element.attr('up-dash');
|
2502
|
+
newAttrs = {
|
2503
|
+
'up-preload': 'true',
|
2504
|
+
'up-instant': 'true'
|
2505
|
+
};
|
2506
|
+
if (u.isBlank(target) || u.castsToTrue(target)) {
|
2507
|
+
newAttrs['up-follow'] = '';
|
2508
|
+
} else {
|
2509
|
+
newAttrs['up-target'] = target;
|
2510
|
+
}
|
2511
|
+
u.setMissingAttrs($element, newAttrs);
|
2512
|
+
return $element.removeAttr('up-dash');
|
2513
|
+
});
|
2432
2514
|
return {
|
2433
2515
|
visit: visit,
|
2434
2516
|
follow: follow,
|
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,c,l,p,f,d,m,h,v,g,y,b,w,k,C,x,S,T,E,P,A,D,F,U,j,z,O,H,M,q,I,N,W,G,L,X,R,V,_,J,B,Q,Z,K,Y,tn,nn,en,rn,on,un,an,sn,cn,ln,pn,fn,dn,mn;return S=function(t,n){return n=n||{},n.url=t,o(n)},o=function(t){return t.selector&&(t.headers={"X-Up-Selector":t.selector}),$.ajax(t)},N=function(t,n){return(""===n||"80"===n)&&"http:"===t||"443"===n&&"https:"===t},Z=function(t,n){var e,r,o;return e=W(t)?$("<a>").attr({href:t}).get(0):mn(t),r=e.protocol+"//"+e.hostname,N(e.protocol,e.port)||(r+=":"+e.port),o=e.pathname,(null!=n?n.stripTrailingSlash:void 0)===!0&&(o=o.replace(/\/$/,"")),r+=o,(null!=n?n.hash:void 0)===!0&&(r+=e.hash),(null!=n?n.search:void 0)!==!1&&(r+=e.search),r},Q=function(t){return t?t.toUpperCase():"GET"},n=function(t){var n,e,r,o,u,i,a,s,c,l,p,f,d,m,h,v;for(p=t.split(/[ >]/),r=null,l=d=0,h=p.length;h>d;l=++d){for(i=p[l],u=i.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),f="div",o=[],c=null,m=0,v=u.length;v>m;m++)switch(a=u[m],a[0]){case".":o.push(a.substr(1));break;case"#":c=a.substr(1);break;default:f=a}s="<"+f,o.length&&(s+=' class="'+o.join(" ")+'"'),c&&(s+=' id="'+c+'"'),s+=">",n=$(s),e&&n.appendTo(e),0===l&&(r=n),e=n}return r},p=function(t,n){var e;return e=document.createElement(t),q(n)&&(e.innerHTML=n),e},h=function(){var n,e,o,u,i,a;if(n=1<=arguments.length?t.call(arguments,0):[],n=fn(n),o=n.shift(),o="[UP] "+o,u=(null!=(a=o.match(r))?a.length:void 0)||0,F(X(n))&&u<n.length&&(e=n.pop()),i=console.debug.apply(console,[o].concat(t.call(n))),e){console.groupCollapsed();try{i=e()}finally{console.groupEnd()}}return i},y=function(){var n,e,r;throw e=1<=arguments.length?t.call(arguments,0):[],e[0]="[UP] "+e[0],console.error.apply(console,e),r=ln(e),n=en($(".up-error"))||$('<div class="up-error"></div>').prependTo("body"),n.addClass("up-error"),n.text(r),r},r=/\%[odisf]/g,ln=function(t){var n,e,o;return o=t[0],n=0,e=30,o.replace(r,function(){var r,o;return n+=1,r=t[n],o=typeof r,"string"===o?(r=r.replace(/\s+/g," "),r.length>e&&(r=r.substr(0,e)+"\u2026"),'"'+r+'"'):"number"===o?r.toString():"("+o+")"})},d=function(t){var n,e,r,o,u,i,a;for(h("Creating selector from element %o",t),e=(n=t.attr("class"))?n.split(" "):[],r=t.attr("id"),u=t.prop("tagName").toLowerCase(),r&&(u+="#"+r),i=0,a=e.length;a>i;i++)o=e[i],u+="."+o;return u},f=function(t){var n,e,r,o,u,i,a,s,c,l,f,d;return c=function(t){return"<"+t+"(?: [^>]*)?>"},i=function(t){return"</"+t+">"},n="(?:.|\\n)*?",u=function(t){return"("+t+")"},d=new RegExp(c("head")+n+c("title")+u(n)+i("title")+n+i("body"),"i"),o=new RegExp(c("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),l=p("title",f[1]),a.appendChild(l)),s):p("div",t)},w=$.extend,dn=$.trim,L=Object.keys||function(t){var n,e,r,o;for(e=[],r=0,o=t.length;o>r;r++)n=t[r],t.hasOwnProperty(n)&&e.push(n);return e},g=function(t,n){var e,r,o,u,i;for(i=[],e=o=0,u=t.length;u>o;e=++o)r=t[e],i.push(n(r,e));return i},H=function(t){return null===t},G=function(t){return void 0===t},D=function(t){return!G(t)},O=function(t){return G(t)||H(t)},U=function(t){return!O(t)},P=function(t){return O(t)||M(t)&&0===L(t).length||0===t.length},en=function(t,n){return null==n&&(n=q),n(t)?t:null},q=function(t){return!P(t)},F=function(t){return"function"==typeof t},W=function(t){return"string"==typeof t},j=function(t){return"object"==typeof t&&!!t},M=function(t){return j(t)||"function"==typeof t},z=function(t){return t instanceof jQuery},I=function(t){return M(t)&&F(t.then)},A=function(t){return I(t)&&F(t.resolve)},T=function(t){return U(t)?t:void 0},E=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},fn=function(t){return Array.prototype.slice.call(t)},c=function(t){return E(t)?t.slice():w({},t)},mn=function(t){return z(t)?t.get(0):t},_=function(t,n){return w(c(t),n)},tn=function(t,n){var e,r,o,u;if(o=t?c(t):{},n)for(r in n)e=n[r],u=o[r],U(u)?M(e)&&M(u)&&(o[r]=tn(u,e)):o[r]=e;return o},Y=function(){var n,e,r,o,u,i;for(e=1<=arguments.length?t.call(arguments,0):[],r=null,u=0,i=e.length;i>u;u++)if(n=e[u],o=n,F(o)&&(o=o()),q(o)){r=o;break}return r},v=function(t,n){var e,r,o,u;for(r=null,o=0,u=t.length;u>o;o++)if(e=t[o],n(e)){r=e;break}return r},sn=function(t,n){var e;return e=[],g(t,function(t){return n(t)?e.push(t):void 0}),e},rn=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,q)},B=function(t){return setTimeout(t,0)},X=function(t){return t[t.length-1]},a=function(){var t;return t=document.documentElement,{width:t.clientWidth,height:t.clientHeight}},pn=function(t,n,e){var r,o;return o=t.css(L(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,c;return o=$(t),up.browser.canCssAnimation()?(r=tn(r,{duration:300,delay:0,easing:"ease"}),u=$.Deferred(),a={"transition-property":L(n).join(", "),"transition-duration":r.duration+"ms","transition-delay":r.delay+"ms","transition-timing-function":r.easing},s=x(o),c=pn(o,a),o.css(n),u.then(s),u.then(c),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),an())},e="up-animation-promise",C=function(t){return $(t).each(function(){var t;return(t=$(this).data(e))?t.resolve():void 0})},V=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},l=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},nn=function(t){var n,e;return e=V(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)},R=function(t){return t.getResponseHeader("X-Up-Location")},J=function(t){return t.getResponseHeader("X-Up-Method")},K=function(){var n,e,r,o,u,i;for(o=arguments[0],r=2<=arguments.length?t.call(arguments,1):[],n={},u=0,i=r.length;i>u;u++)e=r[u],o.hasOwnProperty(e)&&(n[e]=o[e]);return n},un=function(){var t;return t=$.Deferred(),t.resolve(),t},an=function(){return un().promise()},on=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},cn=function(t){var n,e,r,o,u,i,a,s;for(u={},n=function(t){return u[r(t)]},e=function(t){return v(t,n)},o=function(t){return u[r(t)]=!0},r=function(t){return"_"+t},a=0,s=t.length;s>a;a++)i=t[a],o(i);return{put:o,includes:n,includesAny:e}},{presentAttr:rn,createElement:p,normalizeUrl:Z,normalizeMethod:Q,createElementFromHtml:f,$createElementFromSelector:n,createSelectorFromElement:d,get:S,ajax:o,extend:w,copy:c,merge:_,options:tn,option:Y,error:y,debug:h,each:g,detect:v,select:sn,last:X,isNull:H,isDefined:D,isUndefined:G,isGiven:U,isMissing:O,isPresent:q,isBlank:P,presence:en,isObject:M,isFunction:F,isString:W,isJQuery:z,isPromise:I,isDeferred:A,isHash:j,ifGiven:T,unwrap:mn,nextFrame:B,measure:V,temporaryCss:pn,cssAnimate:m,finishCssAnimate:C,forceCompositing:x,prependGhost:nn,escapePressed:b,copyAttributes:l,findWithSelf:k,contains:s,isArray:E,toArray:fn,castsToTrue:i,castsToFalse:u,locationFromXhr:R,methodFromXhr:J,clientSize:a,only:K,trim:dn,keys:L,resolvedPromise:an,resolvedDeferred:un,resolvableWhen:on,stringSet:cn}}()}.call(this),function(){var t=[].slice;up.browser=function(){var n,e,r,o,u,i,a,s,c,l;return c=up.util,a=function(t,n){var e,r,o,u,i,a;return null==n&&(n={}),i=c.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' />",c.isDefined(r)&&c.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")},l=function(){return location.href},o=function(){var t,n,e,r,o,u,i,a;return window.console||(window.console={}),t=function(){},(n=window.console).log||(n.log=t),(e=window.console).info||(e.info=t),(r=window.console).error||(r.error=t),(o=window.console).debug||(o.debug=t),(u=window.console).group||(u.group=t),(i=window.console).groupCollapsed||(i.groupCollapsed=t),(a=window.console).groupEnd||(a.groupEnd=t)},s=function(n){var e,r;return e=void 0,r=!1,function(){var o;return o=1<=arguments.length?t.call(arguments,0):[],r?e:(r=!0,e=n.apply(null,o))}},r=s(function(){return c.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||c.error("jQuery %o found, but Up.js requires 1.9+",o)},i=s(function(){return c.isDefined(document.addEventListener)}),{url:l,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.flow=function(){var t,n,e,r,o,u,i,a,s,c,l,p;return p=up.util,s=function(t,n){var e;return e=$(t),p.isPresent(n)&&(n=p.normalizeUrl(n)),e.attr("up-source",n)},c=function(t){var n;return n=$(t).closest("[up-source]"),p.presence(n.attr("up-source"))||up.browser.url()},i=function(t,n,e){var o,u,i;return e=p.options(e),i=p.presence(t)?t:p.createSelectorFromElement($(t)),up.browser.canPushState()||p.castsToFalse(e.history)?(u={url:n,method:e.method,selector:i},o=up.proxy.ajax(u),o.done(function(t,o,a){var s,c;return(s=p.locationFromXhr(a))&&(p.debug("Location from server: %o",s),c={url:s,method:p.methodFromXhr(a),selector:i},up.proxy.alias(u,c),n=s),(p.isMissing(e.history)||p.castsToTrue(e.history))&&(e.history=n),(p.isMissing(e.source)||p.castsToTrue(e.source))&&(e.source=n),e.preload?void 0:r(i,t,e)}),o.fail(p.error),o):void(e.preload||up.browser.loadPage(n,p.only(e,"method")))},r=function(t,n,e){var r,u,i,a,s,c,f,d,m,h;for(e=p.options(e,{historyMethod:"push"}),"false"===e.history&&(e.history=null),e.source=p.option(e.source,e.history),a=p.createElementFromHtml(n),e.title||(e.title=null!=(d=a.querySelector("title"))?d.textContent:void 0),m=o(t,e),h=[],c=0,f=m.length;f>c;c++)s=m[c],up.motion.finish(s.selector),u=p.presence($(".up-popup "+s.selector))||p.presence($(".up-modal "+s.selector))||p.presence($(s.selector))||p.error("Could not find selector %o in current body HTML",s.selector),(i=a.querySelector(s.selector))?(r=$(i),h.push(l(u,r,s.pseudoClass,s.transition,e))):h.push(p.error("Could not find selector %o in response %o",s.selector,n));return h},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)),s(n,e.source),t(n),up.ready(n)},l=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()),p.copyAttributes(r,t),e(a,i),up.animate(r,u)):n(t,{animation:function(){return r.insertAfter(t),e(r,i),t.is("body")&&"none"!==u&&p.error("Cannot apply transitions to body-elements (%o)",u),up.morph(t,r,u)}})},o=function(t,n){var e,r,o,u,i,a,s,c,l,f,d;for(s=n.transition||n.animation||"none",e=/\ *,\ */,r=t.split(e),p.isPresent(s)&&(c=s.split(e)),d=[],o=l=0,f=r.length;f>l;o=++l)u=r[o],i=u.match(/^(.+?)(?:\:(before|after))?$/),a=c[o]||p.last(c),d.push({selector:i[1],pseudoClass:i[2],transition:a});return d},t=function(t){var n,e;return e="[autofocus]:last",n=p.findWithSelf(t,e),n.length&&n.get(0)!==document.activeElement?n.focus():void 0},n=function(t,n){var e,r;return e=$(t),n=p.options(n,{animation:"none"}),e.addClass("up-destroying"),p.isPresent(n.url)&&up.history.push(n.url),p.isPresent(n.title)&&(document.title=n.title),up.bus.emit("fragment:destroy",e),r=p.presence(n.animation,p.isPromise)||up.motion.animate(e,n.animation),r.then(function(){return e.remove()})},u=function(t){var n;return n=c(t),i(t,n)},a=function(){return up.bus.emit("framework:reset")},up.bus.on("app:ready",function(){return s(document.body,up.browser.url())}),{replace:i,reload:u,destroy:n,implant:r,reset:a}}(),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,c,l,p,f,d,m,h,v,g;return g=up.util,n="up-destroyable",e="up-destroyer",f=[],c=null,p=function(t,n,e){var r,o;if(up.browser.isSupported())return r=[t,n,function(t){return e.apply(this,[t,$(this),a(this)])}],f.push(r),(o=$(document)).on.apply(o,r)},u=[],s=null,o=function(){var n,e,r,o;return o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],up.browser.isSupported()?(e=n.pop(),r=g.options(n[0],{batch:!1}),u.push({selector:o,callback:e,batch:r.batch})):void 0},r=function(t,r,o){var u;return g.debug("Applying awakener %o on %o",t.selector,o),u=t.callback.apply(o,[r,a(r)]),g.isFunction(u)?(r.addClass(n),r.data(e,u)):void 0},i=function(t){var n,e,o,i,a;for(g.debug("Compiling fragment %o",t),a=[],o=0,i=u.length;i>o;o++)e=u[o],n=g.findWithSelf(t,e.selector),a.push(n.length?e.batch?r(e,n,n.get()):n.each(function(){return r(e,$(this),this)}):void 0);return a},l=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 c=g.copy(f),s=g.copy(u)},h=function(){var t,n,e,r;for(n=0,e=f.length;e>n;n++)t=f[n],g.contains(c,t)||(r=$(document)).off.apply(r,t);return f=g.copy(c),u=g.copy(s)},m=function(t){var n;return n=$(t),up.bus.emit("fragment:ready",n),n},d=function(t){return p("keydown","body",function(n){return g.escapePressed(n)?t(n):void 0})},up.bus.on("app:ready",function(){return m(document.body)}),up.bus.on("fragment:ready",i),up.bus.on("fragment:destroy",l),up.bus.on("framework:ready",v),up.bus.on("framework:reset",h),{awaken:o,on:p,ready:m,onEscape:d,data:a}}(),up.awaken=up.magic.awaken,up.on=up.magic.on,up.ready=up.magic.ready}.call(this),function(){up.history=function(){var t,n,e,r,o,u;return u=up.util,t=function(t){return u.normalizeUrl(t,{hash:!0})===u.normalizeUrl(up.browser.url(),{hash:!0})},o=function(e,r){return r=u.options(r,{force:!1}),r.force||!t(e)?n("replace",e):void 0},r=function(e){return t(e)?void 0:n("push",e)},n=function(t,n){return up.browser.canPushState()?(t+="State",window.history[t]({fromUp:!0},"",n)):u.error("This browser doesn't support history.pushState")},e=function(t){var n;return n=t.originalEvent.state,(null!=n?n.fromUp:void 0)?(u.debug("Restoring state %o (now on "+up.browser.url()+")",n),up.visit(up.browser.url(),{historyMethod:"replace"})):u.debug("Discarding unknown state %o",n)},up.browser.canPushState()&&setTimeout(function(){return $(window).on("popstate",e),o(up.browser.url(),{force:!0})},200),{push:r,replace:o}}()}.call(this),function(){up.motion=function(){var t,n,e,r,o,u,i,a,s,c,l,p,f,d,m,h,v,g,y,b,w;return b=up.util,u={duration:300,delay:0,easing:"ease"},r={},i={},y={},a={},s=function(t){return b.extend(u,t)},n=function(t,e,r){var i;return i=$(t),l(i),r=b.options(r,u),b.isFunction(e)?o(e(i,r),e):b.isString(e)?n(i,c(e),r):b.isHash(e)?b.cssAnimate(i,e,r):b.error("Unknown animation type %o",e)},c=function(t){return r[t]||b.error("Unknown animation %o",e)},t="up-ghosting-promise",w=function(n,e,r){var o,u,i,a;return u=null,o=null,b.temporaryCss(e,{display:"none"},function(){return u=b.prependGhost(n).addClass("up-destroying")}),b.temporaryCss(n,{display:"none"},function(){return o=b.prependGhost(e)}),n.css({visibility:"hidden"}),i=b.temporaryCss(e,{display:"none"}),a=r(u,o),n.data(t,a),e.data(t,a),a.then(function(){return n.removeData(t),e.removeData(t),u.remove(),o.remove(),n.css({display:"none"}),i()}),a},l=function(t){return $(t).each(function(){var t;return t=$(this),b.finishCssAnimate(t),p(t)})},p=function(n){var e;return(e=n.data(t))?(b.debug("Canceling existing ghosting on %o",n),"function"==typeof e.resolve?e.resolve():void 0):void 0},o=function(t,n){return b.isDeferred(t)?t:b.error("Did not return a promise with .then and .resolve methods: %o",n)},f=function(t,e,i,a){var s,c,p,m,v;return up.browser.canCssAnimation()?(a=b.options(u),c=$(t),s=$(e),l(c),l(s),"none"===i?d():(v=b.presence(i,b.isFunction)||y[i])?w(c,s,function(t,n){return o(v(t,n,a),i)}):(p=r[i])?(c.hide(),n(s,p,a)):b.isString(i)&&i.indexOf("/")>=0?(m=i.split("/"),v=function(t,e,r){return h(n(t,m[0],r),n(e,m[1],r))},f(c,s,v,a)):b.error("Unknown transition %o",i)):b.resolvedDeferred()},g=function(t,n){return y[t]=n},e=function(t,n){return r[t]=n},v=function(){return i=b.copy(r),a=b.copy(y)},m=function(){return r=b.copy(i),y=b.copy(a)},h=b.resolvableWhen,d=b.resolvedDeferred,e("none",d),e("fade-in",function(t,e){return t.css({opacity:0}),n(t,{opacity:1},e)}),e("fade-out",function(t,e){return t.css({opacity:1}),n(t,{opacity:0},e)}),e("move-to-top",function(t,e){var r,o;return r=b.measure(t),o=r.top+r.height,t.css({"margin-top":"0px"}),n(t,{"margin-top":"-"+o+"px"},e)}),e("move-from-top",function(t,e){var r,o;return r=b.measure(t),o=r.top+r.height,t.css({"margin-top":"-"+o+"px"}),n(t,{"margin-top":"0px"},e)}),e("move-to-bottom",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().height-r.top,t.css({"margin-top":"0px"}),n(t,{"margin-top":o+"px"},e)}),e("move-from-bottom",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().height-r.top,t.css({"margin-top":o+"px"}),n(t,{"margin-top":"0px"},e)}),e("move-to-left",function(t,e){var r,o;return r=b.measure(t),o=r.left+r.width,t.css({"margin-left":"0px"}),n(t,{"margin-left":"-"+o+"px"},e)}),e("move-from-left",function(t,e){var r,o;return r=b.measure(t),o=r.left+r.width,t.css({"margin-left":"-"+o+"px"}),n(t,{"margin-left":"0px"},e)}),e("move-to-right",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().width-r.left,t.css({"margin-left":"0px"}),n(t,{"margin-left":o+"px"},e)}),e("move-from-right",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().width-r.left,t.css({"margin-left":o+"px"}),n(t,{"margin-left":"0px"},e)}),e("roll-down",function(t,e){var r,o;return r=t.height(),o=b.temporaryCss(t,{height:"0px",overflow:"hidden"}),n(t,{height:r+"px"},e).then(o)}),g("none",d),g("move-left",function(t,e,r){return h(n(t,"move-to-left",r),n(e,"move-from-right",r))}),g("move-right",function(t,e,r){return h(n(t,"move-to-right",r),n(e,"move-from-left",r))}),g("move-up",function(t,e,r){return h(n(t,"move-to-top",r),n(e,"move-from-bottom",r))}),g("move-down",function(t,e,r){return h(n(t,"move-to-bottom",r),n(e,"move-from-top",r))}),g("cross-fade",function(t,e,r){return h(n(t,"fade-out",r),n(e,"fade-in",r))}),up.bus.on("framework:ready",v),up.bus.on("framework:reset",m),{morph:f,animate:n,finish:l,transition:g,animation:e,defaults:s,none:d,when:h}}(),up.transition=up.motion.transition,up.animation=up.motion.animation,up.morph=up.motion.morph,up.animate=up.motion.animate}.call(this),function(){up.proxy=function(){var t,n,e,r,o,u,i,a,s,c,l,p,f,d,m,h,v,g,y,b,w,k,$,C,x;return s={preloadDelay:50,cacheSize:70,cacheExpiry:3e5},c=function(t){return x.extend(s,t)},r={},x=up.util,t=null,l=null,o=function(t){return h(t),[t.url,t.method,t.selector].join("|")},C=function(){var t,n,e;return t=x.keys(r),t.length>s.cacheSize&&(n=null,e=null,x.each(t,function(t){var o,u;return o=r[t],u=o.timestamp,!e||e>u?(n=t,e=u):void 0}),n)?delete r[n]:void 0},k=function(){return(new Date).valueOf()},h=function(t){return!x.isHash(t),t._requestNormalized||(t.method=x.normalizeMethod(t.method),t.url&&(t.url=x.normalizeUrl(t.url)),t.selector||(t.selector="body"),t._requestNormalized=!0),t},e=function(t,n){var e;return x.debug("Aliasing %o to %o",t,n),(e=f(t))?b(n,e):void 0},n=function(t){var n;return m(t)?(n=f(t))?$(n):(n=x.ajax(t),b(t,n)):(a(),n=x.ajax(t)),n},m=function(t){return h(t),"GET"===t.method},p=function(t){return m(t)||x.error("Won't preload non-GET request %o",t)},d=function(t){var n;return n=k()-t.timestamp,n<s.cacheExpiry},$=function(t){return t.timestamp=k()},f=function(t){var n,e;return n=o(t),(e=r[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=o(t),r[e]=n,$(n),n},g=function(t){var n;return n=o(t),delete r[n]},a=function(){return r={}},i=function(n){var e,r;return r=parseInt(x.presentAttr(n,"up-delay"))||s.preloadDelay,n.is(t)?void 0:(t=n,u(),e=function(){return v(n)},w(e,r))},w=function(t,n){return l=setTimeout(t,n)},u=function(){return clearTimeout(l),l=null},v=function(t,n){return n=x.options(),p(n),x.debug("Preloading %o",t),n.preload=!0,up.link.follow(t,n)},y=function(){return u(),r={}},up.bus.on("framework:reset",y),up.on("mouseover mousedown touchstart","[up-preload]",function(t,n){return up.link.childClicked(t,n)?void 0:i(up.link.resolve(n))}),{preload:v,ajax:n,get:f,set:b,alias:e,clear:a,defaults:c}}()}.call(this),function(){up.link=function(){var t,n,e,r,o;return r=up.util,o=function(t,n){return r.debug("Visiting "+t),up.replace("body",t,n)},n=function(t,n){var e,o,u;return e=$(t),n=r.options(n),u=r.option(e.attr("href"),e.attr("up-follow")),o=r.option(n.target,e.attr("up-target"),"body"),n.transition=r.option(n.transition,e.attr("up-transition"),e.attr("up-animation")),n.history=r.option(n.history,e.attr("up-history")),up.replace(o,u,n)},e=function(t){var n,e;return n=$(t),e=n.attr("up-follow"),n.is("a")||r.isPresent(e)&&!r.castsToTrue(e)?n:n.find("a:first")},up.on("click","a[up-target]",function(t,e){return t.preventDefault(),e.is("[up-instant]")?void 0:n(e)}),up.on("mousedown","a[up-target][up-instant]",function(t,e){return 1===t.which?(t.preventDefault(),n(e)):void 0}),t=function(t,n){var e,r;return e=$(t.target),r=e.closest("a, [up-follow]"),r.length&&n.find(r).length},up.on("click","[up-follow]",function(r,o){return t(r,o)||(r.preventDefault(),o.is("[up-instant]"))?void 0:n(e(o))}),up.on("mousedown","[up-follow][up-instant]",function(r,o){return t(r,o)||1!==r.which?void 0:(r.preventDefault(),n(e(o)))}),{visit:o,follow:n,resolve:e,childClicked:t}}(),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,c,l,p,f;return e=$(t).closest("form"),n=u.options(n),c=u.option(n.target,e.attr("up-target"),"body"),r=u.option(n.failTarget,e.attr("up-fail-target"),function(){return u.createSelectorFromElement(e)}),i=u.option(n.history,e.attr("up-history"),!0),l=u.option(n.transition,e.attr("up-transition")),o=u.option(n.failTransition,e.attr("up-fail-transition")),a=u.option(n.method,e.attr("up-method"),e.attr("data-method"),e.attr("method"),"post").toUpperCase(),f=u.option(n.url,e.attr("action"),up.browser.url()),e.addClass("up-active"),up.browser.canPushState()||u.castsToFalse(i)?(s={url:f,type:a,data:e.serialize(),selector:c},p=function(t){var n;return f=i?"false"===i?!1:u.isString(i)?i:(n=u.locationFromXhr(t))?n:"GET"===s.type?s.url+"?"+s.data:void 0:void 0,u.option(f,!1)},u.ajax(s).always(function(){return e.removeClass("up-active")}).done(function(t,n,e){return up.flow.implant(c,t,{history:p(e),transition:l})}).fail(function(t){var n;return n=t.responseText,up.flow.implant(r,n,{transition:o})})):void e.get(0).submit()},observe=function(fieldOrSelector,options){var $field,callback,callbackPromise,callbackTimer,changeEvents,check,clearTimer,codeOnChange,delay,knownValue,nextCallback,runNextCallback;return $field=$(fieldOrSelector),options=u.options(options),delay=u.option($field.attr("up-delay"),options.delay,0),delay=parseInt(delay),knownValue=null,callback=null,callbackTimer=null,(codeOnChange=$field.attr("up-observe"))?callback=function(value,$field){return eval(codeOnChange)}:options.change?callback=options.change:u.error("up.observe: No change callback given"),callbackPromise=u.resolvedPromise(),nextCallback=null,runNextCallback=function(){var t;return nextCallback?(t=nextCallback(),nextCallback=null,t):void 0},check=function(){var t,n;return n=$field.val(),t=_.isNull(knownValue),knownValue===n||(knownValue=n,t)?void 0:(clearTimer(),nextCallback=function(){return callback.apply($field.get(0),[n,$field])},callbackTimer=setTimeout(function(){return callbackPromise.then(function(){var t;return t=runNextCallback(),callbackPromise=u.isPromise(t)?t:u.resolvedPromise()})},delay))},clearTimer=function(){return clearTimeout(callbackTimer)},changeEvents=up.browser.canInputEvent()?"input change":"input change keypress paste cut click propertychange",$field.on(changeEvents,check),check(),clearTimer},up.on("submit","form[up-target]",function(t,n){return t.preventDefault(),submit(n)}),up.awaken("[up-observe]",function(t){return observe(t)}),{submit:submit,observe:observe}}(),up.submit=up.form.submit,up.observe=up.form.observe}.call(this),function(){up.popup=function(){var t,n,e,r,o,u,i,a,s,c,l;return c=up.util,e={openAnimation:"fade-in",closeAnimation:"fade-out",origin:"bottom-right"},o=function(t){return c.extend(e,t)},a=function(t,n,e){var r,o;return o=c.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 c.error("Unknown origin %o",e)}}(),n.attr("up-origin",e),n.css(r),u(n)},u=function(t){var n,e,r,o,u,i,a;if(e=c.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)}},r=function(t,n,e){var r,o;return o=c.$createElementFromSelector(".up-popup"),e&&o.attr("up-sticky",""),o.attr("up-previous-url",up.browser.url()),o.attr("up-previous-title",document.title),r=c.$createElementFromSelector(n),r.appendTo(o),o.appendTo(document.body),o.hide(),o},l=function(t,n,e,r){return n.show(),a(t,n,e),up.animate(n,r)},i=function(t,o){var u,i,a,s,p,f,d,m;return u=$(t),o=c.options(o),m=c.option(u.attr("href")),f=c.option(o.target,u.attr("up-popup"),"body"),p=c.option(o.origin,u.attr("up-origin"),e.origin),a=c.option(o.animation,u.attr("up-animation"),e.openAnimation),d=c.option(o.sticky,u.is("[up-sticky]")),s=up.browser.canPushState()?c.option(o.history,u.attr("up-history"),!1):!1,n(),i=r(u,f,d),up.replace(f,m,{history:s,insert:function(){return l(u,i,p,a)}})},s=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=c.options(t,{animation:e.closeAnimation,url:n.attr("up-previous-url"),title:n.attr("up-previous-title")}),up.destroy(n,t)):void 0},t=function(){return $(".up-popup").is("[up-sticky]")?void 0:n()},up.on("click","a[up-popup]",function(t,e){return t.preventDefault(),e.is(".up-current")?n():i(e)}),up.on("click","body",function(t){var e;return e=$(t.target),e.closest(".up-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: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:i,close:n,source:s,defaults:o}}()}.call(this),function(){up.modal=function(){var t,n,e,r,o,u,i,a,s,c;return s=up.util,e={width:"auto",height:"auto",openAnimation:"fade-in",closeAnimation:"fade-out",closeLabel:"X",template:function(t){return'<div class="up-modal">\n <div class="up-modal-dialog">\n <div class="up-modal-close" up-close>'+t.closeLabel+'</div>\n <div class="up-modal-content"></div>\n </div>\n</div>'}},o=function(t){return s.extend(e,t)},a=function(){var t;return t=e.template,s.isFunction(t)?t(e):t},r=function(t,n,e,r){var o,u,i,c;return i=$(a()),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"),s.isPresent(n)&&u.css("width",n),s.isPresent(e)&&u.css("height",e),o=u.find(".up-modal-content"),c=s.$createElementFromSelector(t),c.appendTo(o),i.appendTo(document.body),i.hide(),i},c=function(t,n){return t.show(),up.animate(t,n)},u=function(t,o){var u,i,a,l,p,f,d,m,h;return u=$(t),o=s.options(o),m=s.option(u.attr("href")),f=s.option(o.target,u.attr("up-modal"),"body"),h=s.option(o.width,u.attr("up-width"),e.width),l=s.option(o.height,u.attr("up-height"),e.height),a=s.option(o.animation,u.attr("up-animation"),e.openAnimation),d=s.option(o.sticky,u.is("[up-sticky]")),p=up.browser.canPushState()?s.option(o.history,u.attr("up-history"),!0):!1,n(),i=r(f,h,l,d),up.replace(f,m,{history:p,insert:function(){return c(i,a)}})},i=function(){var t;return t=$(".up-modal"),t.is(".up-destroying")?void 0:t.find("[up-source]").attr("up-source")},n=function(t){var n;return n=$(".up-modal"),n.length?(t=s.options(t,{animation:e.closeAnimation,url:n.attr("up-previous-url"),title:n.attr("up-previous-title")}),up.destroy(n,t)):void 0},t=function(){return $(".up-modal").is("[up-sticky]")?void 0:n()},up.on("click","a[up-modal]",function(t,e){return t.preventDefault(),e.is(".up-current")?n():u(e)}),up.on("click","body",function(t){var e;return e=$(t.target),e.closest(".up-modal-dialog").length||e.closest("[up-modal]").length?void 0:n()}),up.bus.on("fragment:ready",function(n){return n.closest(".up-modal").length?void 0:t()}),up.magic.onEscape(function(){return n()}),up.on("click","[up-close]",function(t,e){return e.closest(".up-modal")?n():void 0}),up.bus.on("framework:reset",n),{open:u,close:n,source:i,defaults:o}}()}.call(this),function(){up.tooltip=function(){var t,n,e,r,o;return o=up.util,r=function(t,n,e){var r,u,i;return u=o.measure(t),i=o.measure(n),r=function(){switch(e){case"top":return{left:u.left+.5*(u.width-i.width),top:u.top-i.height};case"bottom":return{left:u.left+.5*(u.width-i.width),top:u.top+u.height};default:return o.error("Unknown origin %o",e)}}(),n.attr("up-origin",e),n.css(r)},n=function(t){return o.$createElementFromSelector(".up-tooltip").html(t).appendTo(document.body)},e=function(e,u){var i,a,s,c,l;return null==u&&(u={}),i=$(e),c=o.option(u.html,i.attr("up-tooltip"),i.attr("title")),l=o.option(u.origin,i.attr("up-origin"),"top"),s=o.option(u.animation,i.attr("up-animation"),"fade-in"),t(),a=n(c),r(i,a,l),up.animate(a,s,u)},t=function(t){var n;return n=$(".up-tooltip"),n.length?(t=o.options(t,{animation:"fade-out"}),up.destroy(n,t)):void 0},up.awaken("[up-tooltip]",function(n){return n.on("mouseover",function(){return e(n)}),n.on("mouseout",function(){return t()})}),up.on("click","body",function(){return t()}),up.bus.on("framework:reset",t),up.magic.onEscape(function(){return t()}),{open:e,close:t}}()}.call(this),function(){up.navigation=function(){var t,n,e,r,o,u,i,a,s,c,l;return c=up.util,t="up-active",n="up-current",r="a[href], a[up-target], [up-follow], [up-modal], [up-popup], [up-source]",e="."+t,i=function(t){return c.isPresent(t)?c.normalizeUrl(t,{search:!1,stripTrailingSlash:!0}):void 0},s=function(t){var n,e,r,o,u,a,s;if(o=[],n=up.link.resolve(t))for(s=["href","up-follow","up-source"],u=0,a=s.length;a>u;u++)e=s[u],(r=c.presentAttr(n,e))&&(r=i(r),o.push(r));
|
2
|
-
return o},u=function(){var t;return t=c.stringSet([i(up.browser.url()),i(up.modal.source()),i(up.popup.source())]),c.each($(r),function(e){var r,o;return r=$(e),o=s(r),t.includesAny(o)?r.addClass(n):r.removeClass(n)})},a=function(n){return l(),n=o(n),n.addClass(t)},o=function(t){return c.presence(t.parents(r))||t},l=function(){return $(e).removeClass(t)},up.on("click",r,function(t,n){return a(n)}),up.bus.on("fragment:ready",function(){return l(),u()}),up.bus.on("fragment:destroy",function(t){return t.is(".up-modal, .up-popup")?u():void 0})}()}.call(this),function(){up.marker=function(){var t,n,e;return e=up.util,n=function(t){return""!==e.trim(t.html())},t=function(t){return e.findWithSelf(t,"[up-marker]").each(function(){var t;return t=$(this),n(t)?void 0:t.hide()})},up.bus.on("fragment:ready",t)}()}.call(this),function(){up.browser.ensureRecentJquery(),up.browser.isSupported()&&(up.browser.ensureConsoleExists(),up.bus.emit("framework:ready"),$(document).on("ready",function(){return up.bus.emit("app:ready")}))}.call(this);
|
1
|
+
(function(){window.up={}}).call(this),function(){var t=[].slice;up.util=function(){var n,e,r,o,u,i,a,s,c,l,p,f,d,m,h,v,g,y,b,w,k,C,x,S,T,E,P,A,D,F,U,j,z,O,M,H,I,N,q,W,G,L,X,R,V,_,J,B,Q,Z,K,Y,tn,nn,en,rn,on,un,an,sn,cn,ln,pn,fn,dn,mn,hn;return S=function(t,n){return n=n||{},n.url=t,o(n)},o=function(t){return t.selector&&(t.headers={"X-Up-Selector":t.selector}),$.ajax(t)},q=function(t,n){return(""===n||"80"===n)&&"http:"===t||"443"===n&&"https:"===t},Z=function(t,n){var e,r,o;return e=W(t)?$("<a>").attr({href:t}).get(0):hn(t),r=e.protocol+"//"+e.hostname,q(e.protocol,e.port)||(r+=":"+e.port),o=e.pathname,(null!=n?n.stripTrailingSlash:void 0)===!0&&(o=o.replace(/\/$/,"")),r+=o,(null!=n?n.hash:void 0)===!0&&(r+=e.hash),(null!=n?n.search:void 0)!==!1&&(r+=e.search),r},Q=function(t){return t?t.toUpperCase():"GET"},n=function(t){var n,e,r,o,u,i,a,s,c,l,p,f,d,m,h,v;for(p=t.split(/[ >]/),r=null,l=d=0,h=p.length;h>d;l=++d){for(i=p[l],u=i.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),f="div",o=[],c=null,m=0,v=u.length;v>m;m++)switch(a=u[m],a[0]){case".":o.push(a.substr(1));break;case"#":c=a.substr(1);break;default:f=a}s="<"+f,o.length&&(s+=' class="'+o.join(" ")+'"'),c&&(s+=' id="'+c+'"'),s+=">",n=$(s),e&&n.appendTo(e),0===l&&(r=n),e=n}return r},p=function(t,n){var e;return e=document.createElement(t),I(n)&&(e.innerHTML=n),e},h=function(){var n,e,o,u,i,a;if(n=1<=arguments.length?t.call(arguments,0):[],n=dn(n),o=n.shift(),o="[UP] "+o,u=(null!=(a=o.match(r))?a.length:void 0)||0,F(X(n))&&u<n.length&&(e=n.pop()),i=console.debug.apply(console,[o].concat(t.call(n))),e){console.groupCollapsed();try{i=e()}finally{console.groupEnd()}}return i},y=function(){var n,e,r;throw e=1<=arguments.length?t.call(arguments,0):[],e[0]="[UP] "+e[0],console.error.apply(console,e),r=pn(e),n=en($(".up-error"))||$('<div class="up-error"></div>').prependTo("body"),n.addClass("up-error"),n.text(r),r},r=/\%[odisf]/g,pn=function(t){var n,e,o;return o=t[0],n=0,e=30,o.replace(r,function(){var r,o;return n+=1,r=t[n],o=typeof r,"string"===o?(r=r.replace(/\s+/g," "),r.length>e&&(r=r.substr(0,e)+"\u2026"),'"'+r+'"'):"number"===o?r.toString():"("+o+")"})},d=function(t){var n,e,r,o,u,i,a;for(h("Creating selector from element %o",t),e=(n=t.attr("class"))?n.split(" "):[],r=t.attr("id"),u=t.prop("tagName").toLowerCase(),r&&(u+="#"+r),i=0,a=e.length;a>i;i++)o=e[i],u+="."+o;return u},f=function(t){var n,e,r,o,u,i,a,s,c,l,f,d;return c=function(t){return"<"+t+"(?: [^>]*)?>"},i=function(t){return"</"+t+">"},n="(?:.|\\n)*?",u=function(t){return"("+t+")"},d=new RegExp(c("head")+n+c("title")+u(n)+i("title")+n+i("body"),"i"),o=new RegExp(c("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),l=p("title",f[1]),a.appendChild(l)),s):p("div",t)},w=$.extend,mn=$.trim,L=Object.keys||function(t){var n,e,r,o;for(e=[],r=0,o=t.length;o>r;r++)n=t[r],t.hasOwnProperty(n)&&e.push(n);return e},g=function(t,n){var e,r,o,u,i;for(i=[],e=o=0,u=t.length;u>o;e=++o)r=t[e],i.push(n(r,e));return i},M=function(t){return null===t},G=function(t){return void 0===t},D=function(t){return!G(t)},O=function(t){return G(t)||M(t)},U=function(t){return!O(t)},P=function(t){return O(t)||H(t)&&0===L(t).length||0===t.length},en=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},W=function(t){return"string"==typeof t},j=function(t){return"object"==typeof t&&!!t},H=function(t){return j(t)||"function"==typeof t},z=function(t){return t instanceof jQuery},N=function(t){return H(t)&&F(t.then)},A=function(t){return N(t)&&F(t.resolve)},T=function(t){return U(t)?t:void 0},E=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},dn=function(t){return Array.prototype.slice.call(t)},c=function(t){return E(t)?t.slice():w({},t)},hn=function(t){return z(t)?t.get(0):t},_=function(t,n){return w(c(t),n)},tn=function(t,n){var e,r,o,u;if(o=t?c(t):{},n)for(r in n)e=n[r],u=o[r],U(u)?H(e)&&H(u)&&(o[r]=tn(u,e)):o[r]=e;return o},Y=function(){var n,e,r,o,u,i;for(e=1<=arguments.length?t.call(arguments,0):[],r=null,u=0,i=e.length;i>u;u++)if(n=e[u],o=n,F(o)&&(o=o()),I(o)){r=o;break}return r},v=function(t,n){var e,r,o,u;for(r=null,o=0,u=t.length;u>o;o++)if(e=t[o],n(e)){r=e;break}return r},sn=function(t,n){var e;return e=[],g(t,function(t){return n(t)?e.push(t):void 0}),e},rn=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)},B=function(t){return setTimeout(t,0)},X=function(t){return t[t.length-1]},a=function(){var t;return t=document.documentElement,{width:t.clientWidth,height:t.clientHeight}},fn=function(t,n,e){var r,o;return o=t.css(L(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,c;return o=$(t),up.browser.canCssAnimation()?(r=tn(r,{duration:300,delay:0,easing:"ease"}),u=$.Deferred(),a={"transition-property":L(n).join(", "),"transition-duration":r.duration+"ms","transition-delay":r.delay+"ms","transition-timing-function":r.easing},s=x(o),c=fn(o,a),o.css(n),u.then(s),u.then(c),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),an())},e="up-animation-promise",C=function(t){return $(t).each(function(){var t;return(t=$(this).data(e))?t.resolve():void 0})},V=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},l=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},nn=function(t){var n,e;return e=V(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)},R=function(t){return t.getResponseHeader("X-Up-Location")},J=function(t){return t.getResponseHeader("X-Up-Method")},K=function(){var n,e,r,o,u,i;for(o=arguments[0],r=2<=arguments.length?t.call(arguments,1):[],n={},u=0,i=r.length;i>u;u++)e=r[u],o.hasOwnProperty(e)&&(n[e]=o[e]);return n},un=function(){var t;return t=$.Deferred(),t.resolve(),t},an=function(){return un().promise()},on=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},cn=function(t,n){var e,r,o;o=[];for(e in n)r=n[e],o.push(O(t.attr(e))?t.attr(e,r):void 0);return o},ln=function(t){var n,e,r,o,u,i,a,s;for(u={},n=function(t){return u[r(t)]},e=function(t){return v(t,n)},o=function(t){return u[r(t)]=!0},r=function(t){return"_"+t},a=0,s=t.length;s>a;a++)i=t[a],o(i);return{put:o,includes:n,includesAny:e}},{presentAttr:rn,createElement:p,normalizeUrl:Z,normalizeMethod:Q,createElementFromHtml:f,$createElementFromSelector:n,createSelectorFromElement:d,get:S,ajax:o,extend:w,copy:c,merge:_,options:tn,option:Y,error:y,debug:h,each:g,detect:v,select:sn,last:X,isNull:M,isDefined:D,isUndefined:G,isGiven:U,isMissing:O,isPresent:I,isBlank:P,presence:en,isObject:H,isFunction:F,isString:W,isJQuery:z,isPromise:N,isDeferred:A,isHash:j,ifGiven:T,unwrap:hn,nextFrame:B,measure:V,temporaryCss:fn,cssAnimate:m,finishCssAnimate:C,forceCompositing:x,prependGhost:nn,escapePressed:b,copyAttributes:l,findWithSelf:k,contains:s,isArray:E,toArray:dn,castsToTrue:i,castsToFalse:u,locationFromXhr:R,methodFromXhr:J,clientSize:a,only:K,trim:mn,keys:L,resolvedPromise:an,resolvedDeferred:un,resolvableWhen:on,setMissingAttrs:cn,stringSet:ln}}()}.call(this),function(){var t=[].slice;up.browser=function(){var n,e,r,o,u,i,a,s,c,l;return c=up.util,a=function(t,n){var e,r,o,u,i,a;return null==n&&(n={}),i=c.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' />",c.isDefined(r)&&c.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")},l=function(){return location.href},o=function(){var t,n,e,r,o,u,i,a;return window.console||(window.console={}),t=function(){},(n=window.console).log||(n.log=t),(e=window.console).info||(e.info=t),(r=window.console).error||(r.error=t),(o=window.console).debug||(o.debug=t),(u=window.console).group||(u.group=t),(i=window.console).groupCollapsed||(i.groupCollapsed=t),(a=window.console).groupEnd||(a.groupEnd=t)},s=function(n){var e,r;return e=void 0,r=!1,function(){var o;return o=1<=arguments.length?t.call(arguments,0):[],r?e:(r=!0,e=n.apply(null,o))}},r=s(function(){return c.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||c.error("jQuery %o found, but Up.js requires 1.9+",o)},i=s(function(){return c.isDefined(document.addEventListener)}),{url:l,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.flow=function(){var t,n,e,r,o,u,i,a,s,c,l,p;return p=up.util,s=function(t,n){var e;return e=$(t),p.isPresent(n)&&(n=p.normalizeUrl(n)),e.attr("up-source",n)},c=function(t){var n;return n=$(t).closest("[up-source]"),p.presence(n.attr("up-source"))||up.browser.url()},i=function(t,n,e){var o,u,i;return e=p.options(e),i=p.presence(t)?t:p.createSelectorFromElement($(t)),up.browser.canPushState()||p.castsToFalse(e.history)?(u={url:n,method:e.method,selector:i},o=up.proxy.ajax(u),o.done(function(t,o,a){var s,c;return(s=p.locationFromXhr(a))&&(p.debug("Location from server: %o",s),c={url:s,method:p.methodFromXhr(a),selector:i},up.proxy.alias(u,c),n=s),(p.isMissing(e.history)||p.castsToTrue(e.history))&&(e.history=n),(p.isMissing(e.source)||p.castsToTrue(e.source))&&(e.source=n),e.preload?void 0:r(i,t,e)}),o.fail(p.error),o):void(e.preload||up.browser.loadPage(n,p.only(e,"method")))},r=function(t,n,e){var r,u,i,a,s,c,f,d,m,h;for(e=p.options(e,{historyMethod:"push"}),"false"===e.history&&(e.history=null),e.source=p.option(e.source,e.history),a=p.createElementFromHtml(n),e.title||(e.title=null!=(d=a.querySelector("title"))?d.textContent:void 0),m=o(t,e),h=[],c=0,f=m.length;f>c;c++)s=m[c],up.motion.finish(s.selector),u=p.presence($(".up-popup "+s.selector))||p.presence($(".up-modal "+s.selector))||p.presence($(s.selector))||p.error("Could not find selector %o in current body HTML",s.selector),(i=a.querySelector(s.selector))?(r=$(i),h.push(l(u,r,s.pseudoClass,s.transition,e))):h.push(p.error("Could not find selector %o in response %o",s.selector,n));return h},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)),s(n,e.source),t(n),up.ready(n)},l=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()),p.copyAttributes(r,t),e(a,i),up.animate(r,u)):n(t,{animation:function(){return r.insertAfter(t),e(r,i),t.is("body")&&"none"!==u&&p.error("Cannot apply transitions to body-elements (%o)",u),up.morph(t,r,u)}})},o=function(t,n){var e,r,o,u,i,a,s,c,l,f,d;for(s=n.transition||n.animation||"none",e=/\ *,\ */,r=t.split(e),p.isPresent(s)&&(c=s.split(e)),d=[],o=l=0,f=r.length;f>l;o=++l)u=r[o],i=u.match(/^(.+?)(?:\:(before|after))?$/),a=c[o]||p.last(c),d.push({selector:i[1],pseudoClass:i[2],transition:a});return d},t=function(t){var n,e;return e="[autofocus]:last",n=p.findWithSelf(t,e),n.length&&n.get(0)!==document.activeElement?n.focus():void 0},n=function(t,n){var e,r;return e=$(t),n=p.options(n,{animation:"none"}),e.addClass("up-destroying"),p.isPresent(n.url)&&up.history.push(n.url),p.isPresent(n.title)&&(document.title=n.title),up.bus.emit("fragment:destroy",e),r=p.presence(n.animation,p.isPromise)||up.motion.animate(e,n.animation),r.then(function(){return e.remove()})},u=function(t){var n;return n=c(t),i(t,n)},a=function(){return up.bus.emit("framework:reset")},up.bus.on("app:ready",function(){return s(document.body,up.browser.url())}),{replace:i,reload:u,destroy:n,implant:r,reset:a}}(),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,c,l,p,f,d,m,h,v,g;return g=up.util,n="up-destroyable",e="up-destroyer",f=[],c=null,p=function(t,n,e){var r,o;if(up.browser.isSupported())return r=[t,n,function(t){return e.apply(this,[t,$(this),a(this)])}],f.push(r),(o=$(document)).on.apply(o,r)},u=[],s=null,o=function(){var n,e,r,o;return o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],up.browser.isSupported()?(e=n.pop(),r=g.options(n[0],{batch:!1}),u.push({selector:o,callback:e,batch:r.batch})):void 0},r=function(t,r,o){var u;return g.debug("Applying awakener %o on %o",t.selector,o),u=t.callback.apply(o,[r,a(r)]),g.isFunction(u)?(r.addClass(n),r.data(e,u)):void 0},i=function(t){var n,e,o,i,a;for(g.debug("Compiling fragment %o",t),a=[],o=0,i=u.length;i>o;o++)e=u[o],n=g.findWithSelf(t,e.selector),a.push(n.length?e.batch?r(e,n,n.get()):n.each(function(){return r(e,$(this),this)}):void 0);return a},l=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 c=g.copy(f),s=g.copy(u)},h=function(){var t,n,e,r;for(n=0,e=f.length;e>n;n++)t=f[n],g.contains(c,t)||(r=$(document)).off.apply(r,t);return f=g.copy(c),u=g.copy(s)},m=function(t){var n;return n=$(t),up.bus.emit("fragment:ready",n),n},d=function(t){return p("keydown","body",function(n){return g.escapePressed(n)?t(n):void 0})},up.bus.on("app:ready",function(){return m(document.body)}),up.bus.on("fragment:ready",i),up.bus.on("fragment:destroy",l),up.bus.on("framework:ready",v),up.bus.on("framework:reset",h),{awaken:o,on:p,ready:m,onEscape:d,data:a}}(),up.awaken=up.magic.awaken,up.on=up.magic.on,up.ready=up.magic.ready}.call(this),function(){up.history=function(){var t,n,e,r,o,u;return u=up.util,t=function(t){return u.normalizeUrl(t,{hash:!0})===u.normalizeUrl(up.browser.url(),{hash:!0})},o=function(e,r){return r=u.options(r,{force:!1}),r.force||!t(e)?n("replace",e):void 0},r=function(e){return t(e)?void 0:n("push",e)},n=function(t,n){return up.browser.canPushState()?(t+="State",window.history[t]({fromUp:!0},"",n)):u.error("This browser doesn't support history.pushState")},e=function(t){var n;return n=t.originalEvent.state,(null!=n?n.fromUp:void 0)?(u.debug("Restoring state %o (now on "+up.browser.url()+")",n),up.visit(up.browser.url(),{historyMethod:"replace"})):u.debug("Discarding unknown state %o",n)},up.browser.canPushState()&&setTimeout(function(){return $(window).on("popstate",e),o(up.browser.url(),{force:!0})},200),{push:r,replace:o}}()}.call(this),function(){up.motion=function(){var t,n,e,r,o,u,i,a,s,c,l,p,f,d,m,h,v,g,y,b,w;return b=up.util,u={duration:300,delay:0,easing:"ease"},r={},i={},y={},a={},s=function(t){return b.extend(u,t)},n=function(t,e,r){var i;return i=$(t),l(i),r=b.options(r,u),b.isFunction(e)?o(e(i,r),e):b.isString(e)?n(i,c(e),r):b.isHash(e)?b.cssAnimate(i,e,r):b.error("Unknown animation type %o",e)},c=function(t){return r[t]||b.error("Unknown animation %o",e)},t="up-ghosting-promise",w=function(n,e,r){var o,u,i,a;return u=null,o=null,b.temporaryCss(e,{display:"none"},function(){return u=b.prependGhost(n).addClass("up-destroying")}),b.temporaryCss(n,{display:"none"},function(){return o=b.prependGhost(e)}),n.css({visibility:"hidden"}),i=b.temporaryCss(e,{display:"none"}),a=r(u,o),n.data(t,a),e.data(t,a),a.then(function(){return n.removeData(t),e.removeData(t),u.remove(),o.remove(),n.css({display:"none"}),i()}),a},l=function(t){return $(t).each(function(){var t;return t=$(this),b.finishCssAnimate(t),p(t)})},p=function(n){var e;return(e=n.data(t))?(b.debug("Canceling existing ghosting on %o",n),"function"==typeof e.resolve?e.resolve():void 0):void 0},o=function(t,n){return b.isDeferred(t)?t:b.error("Did not return a promise with .then and .resolve methods: %o",n)},f=function(t,e,i,a){var s,c,p,m,v;return up.browser.canCssAnimation()?(a=b.options(u),c=$(t),s=$(e),l(c),l(s),"none"===i?d():(v=b.presence(i,b.isFunction)||y[i])?w(c,s,function(t,n){return o(v(t,n,a),i)}):(p=r[i])?(c.hide(),n(s,p,a)):b.isString(i)&&i.indexOf("/")>=0?(m=i.split("/"),v=function(t,e,r){return h(n(t,m[0],r),n(e,m[1],r))},f(c,s,v,a)):b.error("Unknown transition %o",i)):b.resolvedDeferred()},g=function(t,n){return y[t]=n},e=function(t,n){return r[t]=n},v=function(){return i=b.copy(r),a=b.copy(y)},m=function(){return r=b.copy(i),y=b.copy(a)},h=b.resolvableWhen,d=b.resolvedDeferred,e("none",d),e("fade-in",function(t,e){return t.css({opacity:0}),n(t,{opacity:1},e)}),e("fade-out",function(t,e){return t.css({opacity:1}),n(t,{opacity:0},e)}),e("move-to-top",function(t,e){var r,o;return r=b.measure(t),o=r.top+r.height,t.css({"margin-top":"0px"}),n(t,{"margin-top":"-"+o+"px"},e)}),e("move-from-top",function(t,e){var r,o;return r=b.measure(t),o=r.top+r.height,t.css({"margin-top":"-"+o+"px"}),n(t,{"margin-top":"0px"},e)}),e("move-to-bottom",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().height-r.top,t.css({"margin-top":"0px"}),n(t,{"margin-top":o+"px"},e)}),e("move-from-bottom",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().height-r.top,t.css({"margin-top":o+"px"}),n(t,{"margin-top":"0px"},e)}),e("move-to-left",function(t,e){var r,o;return r=b.measure(t),o=r.left+r.width,t.css({"margin-left":"0px"}),n(t,{"margin-left":"-"+o+"px"},e)}),e("move-from-left",function(t,e){var r,o;return r=b.measure(t),o=r.left+r.width,t.css({"margin-left":"-"+o+"px"}),n(t,{"margin-left":"0px"},e)}),e("move-to-right",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().width-r.left,t.css({"margin-left":"0px"}),n(t,{"margin-left":o+"px"},e)}),e("move-from-right",function(t,e){var r,o;return r=b.measure(t),o=b.clientSize().width-r.left,t.css({"margin-left":o+"px"}),n(t,{"margin-left":"0px"},e)}),e("roll-down",function(t,e){var r,o;return r=t.height(),o=b.temporaryCss(t,{height:"0px",overflow:"hidden"}),n(t,{height:r+"px"},e).then(o)}),g("none",d),g("move-left",function(t,e,r){return h(n(t,"move-to-left",r),n(e,"move-from-right",r))}),g("move-right",function(t,e,r){return h(n(t,"move-to-right",r),n(e,"move-from-left",r))}),g("move-up",function(t,e,r){return h(n(t,"move-to-top",r),n(e,"move-from-bottom",r))}),g("move-down",function(t,e,r){return h(n(t,"move-to-bottom",r),n(e,"move-from-top",r))}),g("cross-fade",function(t,e,r){return h(n(t,"fade-out",r),n(e,"fade-in",r))}),up.bus.on("framework:ready",v),up.bus.on("framework:reset",m),{morph:f,animate:n,finish:l,transition:g,animation:e,defaults:s,none:d,when:h}}(),up.transition=up.motion.transition,up.animation=up.motion.animation,up.morph=up.motion.morph,up.animate=up.motion.animate}.call(this),function(){up.proxy=function(){var t,n,e,r,o,u,i,a,s,c,l,p,f,d,m,h,v,g,y,b,w,k,$,C,x,S;return c={preloadDelay:50,cacheSize:70,cacheExpiry:3e5},l=function(t){return S.extend(c,t)},o={},S=up.util,t=null,p=null,u=function(t){return v(t),[t.url,t.method,t.selector].join("|")},x=function(){var t,n,e;return t=S.keys(o),t.length>c.cacheSize&&(n=null,e=null,S.each(t,function(t){var r,u;return r=o[t],u=r.timestamp,!e||e>u?(n=t,e=u):void 0}),n)?delete o[n]:void 0},$=function(){return(new Date).valueOf()},v=function(t){return!S.isHash(t),t._requestNormalized||(t.method=S.normalizeMethod(t.method),t.url&&(t.url=S.normalizeUrl(t.url)),t.selector||(t.selector="body"),t._requestNormalized=!0),t},r=function(t,n){var e;return S.debug("Aliasing %o to %o",t,n),(e=d(t))?w(n,e):void 0},e=function(t){var n;return h(t)?(n=d(t))?C(n):(n=S.ajax(t),w(t,n)):(s(),n=S.ajax(t)),n},n=["GET","OPTIONS","HEAD"],h=function(t){return v(t),S.contains(n,t.method)},f=function(t){return h(t)||S.error("Won't preload non-GET request %o",t)},m=function(t){var n;return n=$()-t.timestamp,n<c.cacheExpiry},C=function(t){return t.timestamp=$()},d=function(t){var n,e;return n=u(t),(e=o[n])?m(e)?(S.debug("Cache hit for %o (%o)",t.url,t),e):(S.debug("Discarding stale cache entry for %o (%o)",t.url,t),void y(t)):void S.debug("Cache miss for %o (%o)",t.url,t)},w=function(t,n){var e;return x(),e=u(t),o[e]=n,C(n),n},y=function(t){var n;return n=u(t),delete o[n]},s=function(){return o={}},a=function(n){var e,r;return r=parseInt(S.presentAttr(n,"up-delay"))||c.preloadDelay,n.is(t)?void 0:(t=n,i(),e=function(){return g(n)},k(e,r))},k=function(t,n){return p=setTimeout(t,n)},i=function(){return clearTimeout(p),p=null},g=function(t,n){return n=S.options(),f(n),S.debug("Preloading %o",t),n.preload=!0,up.link.follow(t,n)},b=function(){return i(),o={}},up.bus.on("framework:reset",b),up.on("mouseover mousedown touchstart","[up-preload]",function(t,n){return up.link.childClicked(t,n)?void 0:a(up.link.resolve(n))}),{preload:g,ajax:e,get:d,set:w,alias:r,clear:s,defaults:l}}()}.call(this),function(){up.link=function(){var t,n,e,r,o;return r=up.util,o=function(t,n){return r.debug("Visiting "+t),up.replace("body",t,n)},n=function(t,n){var e,o,u;return e=$(t),n=r.options(n),u=r.option(e.attr("href"),e.attr("up-follow")),o=r.option(n.target,e.attr("up-target"),"body"),n.transition=r.option(n.transition,e.attr("up-transition"),e.attr("up-animation")),n.history=r.option(n.history,e.attr("up-history")),up.replace(o,u,n)},e=function(t){var n,e;return n=$(t),e=n.attr("up-follow"),n.is("a")||r.isPresent(e)&&!r.castsToTrue(e)?n:n.find("a:first")},up.on("click","a[up-target]",function(t,e){return t.preventDefault(),e.is("[up-instant]")?void 0:n(e)}),up.on("mousedown","a[up-target][up-instant]",function(t,e){return 1===t.which?(t.preventDefault(),n(e)):void 0}),t=function(t,n){var e,r;return e=$(t.target),r=e.closest("a, [up-follow]"),r.length&&n.find(r).length},up.on("click","[up-follow]",function(r,o){return t(r,o)||(r.preventDefault(),o.is("[up-instant]"))?void 0:n(e(o))}),up.on("mousedown","[up-follow][up-instant]",function(r,o){return t(r,o)||1!==r.which?void 0:(r.preventDefault(),n(e(o)))}),up.awaken("[up-dash]",function(t){var n,e;return e=t.attr("up-dash"),n={"up-preload":"true","up-instant":"true"},r.isBlank(e)||r.castsToTrue(e)?n["up-follow"]="":n["up-target"]=e,r.setMissingAttrs(t,n),t.removeAttr("up-dash")}),{visit:o,follow:n,resolve:e,childClicked:t}}(),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,c,l,p,f;return e=$(t).closest("form"),n=u.options(n),c=u.option(n.target,e.attr("up-target"),"body"),r=u.option(n.failTarget,e.attr("up-fail-target"),function(){return u.createSelectorFromElement(e)}),i=u.option(n.history,e.attr("up-history"),!0),l=u.option(n.transition,e.attr("up-transition")),o=u.option(n.failTransition,e.attr("up-fail-transition")),a=u.option(n.method,e.attr("up-method"),e.attr("data-method"),e.attr("method"),"post").toUpperCase(),f=u.option(n.url,e.attr("action"),up.browser.url()),e.addClass("up-active"),up.browser.canPushState()||u.castsToFalse(i)?(s={url:f,type:a,data:e.serialize(),selector:c},p=function(t){var n;return f=i?"false"===i?!1:u.isString(i)?i:(n=u.locationFromXhr(t))?n:"GET"===s.type?s.url+"?"+s.data:void 0:void 0,u.option(f,!1)},u.ajax(s).always(function(){return e.removeClass("up-active")}).done(function(t,n,e){return up.flow.implant(c,t,{history:p(e),transition:l})}).fail(function(t){var n;return n=t.responseText,up.flow.implant(r,n,{transition:o})})):void e.get(0).submit()},observe=function(fieldOrSelector,options){var $field,callback,callbackPromise,callbackTimer,changeEvents,check,clearTimer,codeOnChange,delay,knownValue,nextCallback,runNextCallback;return $field=$(fieldOrSelector),options=u.options(options),delay=u.option($field.attr("up-delay"),options.delay,0),delay=parseInt(delay),knownValue=null,callback=null,callbackTimer=null,(codeOnChange=$field.attr("up-observe"))?callback=function(value,$field){return eval(codeOnChange)}:options.change?callback=options.change:u.error("up.observe: No change callback given"),callbackPromise=u.resolvedPromise(),nextCallback=null,runNextCallback=function(){var t;return nextCallback?(t=nextCallback(),nextCallback=null,t):void 0},check=function(){var t,n;return n=$field.val(),t=_.isNull(knownValue),knownValue===n||(knownValue=n,t)?void 0:(clearTimer(),nextCallback=function(){return callback.apply($field.get(0),[n,$field])},callbackTimer=setTimeout(function(){return callbackPromise.then(function(){var t;return t=runNextCallback(),callbackPromise=u.isPromise(t)?t:u.resolvedPromise()})},delay))},clearTimer=function(){return clearTimeout(callbackTimer)},changeEvents=up.browser.canInputEvent()?"input change":"input change keypress paste cut click propertychange",$field.on(changeEvents,check),check(),clearTimer},up.on("submit","form[up-target]",function(t,n){return t.preventDefault(),submit(n)}),up.awaken("[up-observe]",function(t){return observe(t)}),{submit:submit,observe:observe}}(),up.submit=up.form.submit,up.observe=up.form.observe}.call(this),function(){up.popup=function(){var t,n,e,r,o,u,i,a,s,c,l;return c=up.util,e={openAnimation:"fade-in",closeAnimation:"fade-out",origin:"bottom-right"},o=function(t){return c.extend(e,t)},a=function(t,n,e){var r,o;return o=c.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 c.error("Unknown origin %o",e)}}(),n.attr("up-origin",e),n.css(r),u(n)},u=function(t){var n,e,r,o,u,i,a;if(e=c.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)}},r=function(t,n,e){var r,o;return o=c.$createElementFromSelector(".up-popup"),e&&o.attr("up-sticky",""),o.attr("up-previous-url",up.browser.url()),o.attr("up-previous-title",document.title),r=c.$createElementFromSelector(n),r.appendTo(o),o.appendTo(document.body),o.hide(),o},l=function(t,n,e,r){return n.show(),a(t,n,e),up.animate(n,r)},i=function(t,o){var u,i,a,s,p,f,d,m;return u=$(t),o=c.options(o),m=c.option(u.attr("href")),f=c.option(o.target,u.attr("up-popup"),"body"),p=c.option(o.origin,u.attr("up-origin"),e.origin),a=c.option(o.animation,u.attr("up-animation"),e.openAnimation),d=c.option(o.sticky,u.is("[up-sticky]")),s=up.browser.canPushState()?c.option(o.history,u.attr("up-history"),!1):!1,n(),i=r(u,f,d),up.replace(f,m,{history:s,insert:function(){return l(u,i,p,a)}})},s=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=c.options(t,{animation:e.closeAnimation,url:n.attr("up-previous-url"),title:n.attr("up-previous-title")}),up.destroy(n,t)):void 0},t=function(){return $(".up-popup").is("[up-sticky]")?void 0:n()},up.on("click","a[up-popup]",function(t,e){return t.preventDefault(),e.is(".up-current")?n():i(e)}),up.on("click","body",function(t){var e;return e=$(t.target),e.closest(".up-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: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:i,close:n,source:s,defaults:o}}()}.call(this),function(){up.modal=function(){var t,n,e,r,o,u,i,a,s,c;return s=up.util,e={width:"auto",height:"auto",openAnimation:"fade-in",closeAnimation:"fade-out",closeLabel:"X",template:function(t){return'<div class="up-modal">\n <div class="up-modal-dialog">\n <div class="up-modal-close" up-close>'+t.closeLabel+'</div>\n <div class="up-modal-content"></div>\n </div>\n</div>'}},o=function(t){return s.extend(e,t)},a=function(){var t;return t=e.template,s.isFunction(t)?t(e):t},r=function(t,n,e,r){var o,u,i,c;return i=$(a()),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"),s.isPresent(n)&&u.css("width",n),s.isPresent(e)&&u.css("height",e),o=u.find(".up-modal-content"),c=s.$createElementFromSelector(t),c.appendTo(o),i.appendTo(document.body),i.hide(),i},c=function(t,n){return t.show(),up.animate(t,n)},u=function(t,o){var u,i,a,l,p,f,d,m,h;return u=$(t),o=s.options(o),m=s.option(u.attr("href")),f=s.option(o.target,u.attr("up-modal"),"body"),h=s.option(o.width,u.attr("up-width"),e.width),l=s.option(o.height,u.attr("up-height"),e.height),a=s.option(o.animation,u.attr("up-animation"),e.openAnimation),d=s.option(o.sticky,u.is("[up-sticky]")),p=up.browser.canPushState()?s.option(o.history,u.attr("up-history"),!0):!1,n(),i=r(f,h,l,d),up.replace(f,m,{history:p,insert:function(){return c(i,a)}})},i=function(){var t;return t=$(".up-modal"),t.is(".up-destroying")?void 0:t.find("[up-source]").attr("up-source")},n=function(t){var n;return n=$(".up-modal"),n.length?(t=s.options(t,{animation:e.closeAnimation,url:n.attr("up-previous-url"),title:n.attr("up-previous-title")}),up.destroy(n,t)):void 0},t=function(){return $(".up-modal").is("[up-sticky]")?void 0:n()},up.on("click","a[up-modal]",function(t,e){return t.preventDefault(),e.is(".up-current")?n():u(e)}),up.on("click","body",function(t){var e;return e=$(t.target),e.closest(".up-modal-dialog").length||e.closest("[up-modal]").length?void 0:n()}),up.bus.on("fragment:ready",function(n){return n.closest(".up-modal").length?void 0:t()}),up.magic.onEscape(function(){return n()}),up.on("click","[up-close]",function(t,e){return e.closest(".up-modal")?n():void 0}),up.bus.on("framework:reset",n),{open:u,close:n,source:i,defaults:o}}()}.call(this),function(){up.tooltip=function(){var t,n,e,r,o;return o=up.util,r=function(t,n,e){var r,u,i;return u=o.measure(t),i=o.measure(n),r=function(){switch(e){case"top":return{left:u.left+.5*(u.width-i.width),top:u.top-i.height};case"bottom":return{left:u.left+.5*(u.width-i.width),top:u.top+u.height};default:return o.error("Unknown origin %o",e)}}(),n.attr("up-origin",e),n.css(r)},n=function(t){return o.$createElementFromSelector(".up-tooltip").html(t).appendTo(document.body)},e=function(e,u){var i,a,s,c,l;return null==u&&(u={}),i=$(e),c=o.option(u.html,i.attr("up-tooltip"),i.attr("title")),l=o.option(u.origin,i.attr("up-origin"),"top"),s=o.option(u.animation,i.attr("up-animation"),"fade-in"),t(),a=n(c),r(i,a,l),up.animate(a,s,u)},t=function(t){var n;return n=$(".up-tooltip"),n.length?(t=o.options(t,{animation:"fade-out"}),up.destroy(n,t)):void 0},up.awaken("[up-tooltip]",function(n){return n.on("mouseover",function(){return e(n)}),n.on("mouseout",function(){return t()})}),up.on("click","body",function(){return t()}),up.bus.on("framework:reset",t),up.magic.onEscape(function(){return t()}),{open:e,close:t}}()}.call(this),function(){up.navigation=function(){var t,n,e,r,o,u,i,a,s,c,l;
|
2
|
+
return c=up.util,t="up-active",n="up-current",r="a[href], a[up-target], [up-follow], [up-modal], [up-popup], [up-source]",e="."+t,i=function(t){return c.isPresent(t)?c.normalizeUrl(t,{search:!1,stripTrailingSlash:!0}):void 0},s=function(t){var n,e,r,o,u,a,s;if(o=[],n=up.link.resolve(t))for(s=["href","up-follow","up-source"],u=0,a=s.length;a>u;u++)e=s[u],(r=c.presentAttr(n,e))&&(r=i(r),o.push(r));return o},u=function(){var t;return t=c.stringSet([i(up.browser.url()),i(up.modal.source()),i(up.popup.source())]),c.each($(r),function(e){var r,o;return r=$(e),o=s(r),t.includesAny(o)?r.addClass(n):r.removeClass(n)})},a=function(n){return l(),n=o(n),n.addClass(t)},o=function(t){return c.presence(t.parents(r))||t},l=function(){return $(e).removeClass(t)},up.on("click",r,function(t,n){return a(n)}),up.bus.on("fragment:ready",function(){return l(),u()}),up.bus.on("fragment:destroy",function(t){return t.is(".up-modal, .up-popup")?u():void 0})}()}.call(this),function(){up.marker=function(){var t,n,e;return e=up.util,n=function(t){return""!==e.trim(t.html())},t=function(t){return e.findWithSelf(t,"[up-marker]").each(function(){var t;return t=$(this),n(t)?void 0:t.hide()})},up.bus.on("fragment:ready",t)}()}.call(this),function(){up.browser.ensureRecentJquery(),up.browser.isSupported()&&(up.browser.ensureConsoleExists(),up.bus.emit("framework:ready"),$(document).on("ready",function(){return up.bus.emit("app:ready")}))}.call(this);
|
@@ -178,6 +178,16 @@ up.link = (->
|
|
178
178
|
current `<body>` element with the response's `<body>` element
|
179
179
|
|
180
180
|
<a href="/users" up-follow>User list</a>
|
181
|
+
|
182
|
+
By also adding an `up-instant` attribute, the page will be fetched
|
183
|
+
on `mousedown` instead of `click`, making the interaction even faster:
|
184
|
+
|
185
|
+
<a href="/users" up-follow up-instant>User list</a>
|
186
|
+
|
187
|
+
Note that using `[up-instant]` will prevent a user from canceling a link
|
188
|
+
click by moving the mouse away from the interaction area. However, for
|
189
|
+
navigation actions this isn't needed. E.g. popular operation
|
190
|
+
systems switch tabs on `mousedown`.
|
181
191
|
|
182
192
|
You can also apply `[up-follow]` to any element that contains a link
|
183
193
|
in order to enlarge the link's click area:
|
@@ -195,7 +205,6 @@ up.link = (->
|
|
195
205
|
@param {String} [up-follow]
|
196
206
|
@param up-instant
|
197
207
|
If set, fetches the element on `mousedown` instead of `click`.
|
198
|
-
This makes the interaction faster.
|
199
208
|
###
|
200
209
|
up.on 'click', '[up-follow]', (event, $element) ->
|
201
210
|
unless childClicked(event, $element)
|
@@ -203,11 +212,51 @@ up.link = (->
|
|
203
212
|
# Check if the event was already triggered by `mousedown`
|
204
213
|
unless $element.is('[up-instant]')
|
205
214
|
follow(resolve($element))
|
206
|
-
|
215
|
+
|
207
216
|
up.on 'mousedown', '[up-follow][up-instant]', (event, $element) ->
|
208
217
|
if !childClicked(event, $element) && event.which == 1
|
209
218
|
event.preventDefault()
|
210
219
|
follow(resolve($element))
|
220
|
+
|
221
|
+
###
|
222
|
+
Marks up the current link to be followed *as fast as possible*.
|
223
|
+
This is done by:
|
224
|
+
|
225
|
+
- [Following the link through AJAX](/up.link#up-target) instead of a full page load
|
226
|
+
- [Preloading the link's destination URL](/up.proxy#up-preload)
|
227
|
+
- [Triggering the link on `mousedown`](/up.link#up-instant) instead of on `click`
|
228
|
+
|
229
|
+
Use `up-dash` like this:
|
230
|
+
|
231
|
+
<a href="/users" up-dash=".main">User list</a>
|
232
|
+
|
233
|
+
Note that this is shorthand for:
|
234
|
+
|
235
|
+
<a href="/users" up-target=".main" up-instant up-preload>User list</a>
|
236
|
+
|
237
|
+
You can also apply `[up-dash]` to any element that contains a link
|
238
|
+
in order to enlarge the link's click area:
|
239
|
+
|
240
|
+
<div class="notification" up-dash>
|
241
|
+
Record was saved!
|
242
|
+
<a href="/records" up-dash='.main'>Close</a>
|
243
|
+
</div>
|
244
|
+
|
245
|
+
@method [up-dash]
|
246
|
+
@ujs
|
247
|
+
###
|
248
|
+
up.awaken '[up-dash]', ($element) ->
|
249
|
+
target = $element.attr('up-dash')
|
250
|
+
newAttrs = {
|
251
|
+
'up-preload': 'true',
|
252
|
+
'up-instant': 'true'
|
253
|
+
}
|
254
|
+
if u.isBlank(target) || u.castsToTrue(target)
|
255
|
+
newAttrs['up-follow'] = ''
|
256
|
+
else
|
257
|
+
newAttrs['up-target'] = target
|
258
|
+
u.setMissingAttrs($element, newAttrs)
|
259
|
+
$element.removeAttr('up-dash')
|
211
260
|
|
212
261
|
visit: visit
|
213
262
|
follow: follow
|
@@ -2,7 +2,16 @@
|
|
2
2
|
Caching and preloading
|
3
3
|
======================
|
4
4
|
|
5
|
-
|
5
|
+
All HTTP requests go through the Up.js proxy.
|
6
|
+
It caches a limited number
|
7
|
+
|
8
|
+
The cache is cleared whenever the user makes a non-´GET` request
|
9
|
+
(like `POST`, `PUT`, `DELETE`).
|
10
|
+
|
11
|
+
The proxy can also used to speed up reaction times by preloading
|
12
|
+
links when the user hovers over the click area (or puts the mouse/finger
|
13
|
+
down before releasing). This way the
|
14
|
+
response will already be cached when the user performs the click.
|
6
15
|
|
7
16
|
@class up.proxy
|
8
17
|
###
|
@@ -84,10 +93,12 @@ up.proxy = (->
|
|
84
93
|
promise = u.ajax(request)
|
85
94
|
set(request, promise)
|
86
95
|
promise
|
96
|
+
|
97
|
+
SAFE_HTTP_METHODS = ['GET', 'OPTIONS', 'HEAD']
|
87
98
|
|
88
99
|
isIdempotent = (request) ->
|
89
100
|
normalizeRequest(request)
|
90
|
-
request.method
|
101
|
+
u.contains(SAFE_HTTP_METHODS, request.method)
|
91
102
|
|
92
103
|
ensureIsIdempotent = (request) ->
|
93
104
|
isIdempotent(request) or u.error("Won't preload non-GET request %o", request)
|
@@ -158,6 +169,12 @@ up.proxy = (->
|
|
158
169
|
up.bus.on 'framework:reset', reset
|
159
170
|
|
160
171
|
###
|
172
|
+
Links with an `up-preload` attribute will silently fetch their target
|
173
|
+
when the user hovers over the click area, or when the user puts her
|
174
|
+
mouse/finger down (before releasing). This way the
|
175
|
+
response will already be cached when the user performs the click,
|
176
|
+
making the interaction feel instant.
|
177
|
+
|
161
178
|
@method [up-preload]
|
162
179
|
@ujs
|
163
180
|
###
|
@@ -536,6 +536,11 @@ up.util = (->
|
|
536
536
|
joined.resolve = ->
|
537
537
|
each deferreds, (deferred) -> deferred.resolve?()
|
538
538
|
joined
|
539
|
+
|
540
|
+
setMissingAttrs = ($element, attrs) ->
|
541
|
+
for key, value of attrs
|
542
|
+
if isMissing($element.attr(key))
|
543
|
+
$element.attr(key, value)
|
539
544
|
|
540
545
|
stringSet = (array) ->
|
541
546
|
set = {}
|
@@ -635,6 +640,7 @@ up.util = (->
|
|
635
640
|
resolvedPromise: resolvedPromise
|
636
641
|
resolvedDeferred: resolvedDeferred
|
637
642
|
resolvableWhen: resolvableWhen
|
643
|
+
setMissingAttrs: setMissingAttrs
|
638
644
|
stringSet: stringSet
|
639
645
|
|
640
646
|
)()
|
data/lib/upjs/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: upjs-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henning Koch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|