upjs-rails 0.6.1 → 0.6.2
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 +72 -15
- data/dist/up.min.js +2 -2
- data/lib/assets/javascripts/up/flow.js.coffee +3 -4
- data/lib/assets/javascripts/up/link.js.coffee +13 -2
- data/lib/assets/javascripts/up/proxy.js.coffee +41 -14
- data/lib/assets/javascripts/up/util.js.coffee +4 -16
- data/lib/upjs/rails/version.rb +1 -1
- data/spec_app/Gemfile.lock +1 -1
- data/spec_app/app/assets/javascripts/application.js +1 -0
- data/spec_app/spec/javascripts/helpers/knife.js.coffee +71 -0
- data/spec_app/spec/javascripts/helpers/mock_ajax.js.coffee +5 -0
- data/spec_app/spec/javascripts/helpers/mock_clock.js.coffee +2 -0
- data/spec_app/spec/javascripts/up/flow_spec.js.coffee +0 -3
- data/spec_app/spec/javascripts/up/form_spec.js.coffee +0 -2
- data/spec_app/spec/javascripts/up/link_spec.js.coffee +29 -16
- data/spec_app/spec/javascripts/up/modal_spec.js.coffee +0 -1
- data/spec_app/spec/javascripts/up/navigation_spec.js.coffee +0 -5
- data/spec_app/spec/javascripts/up/proxy_spec.js.coffee +101 -6
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b76ed1c3dc06bb01b5c0458a9d7a37882465d731
|
4
|
+
data.tar.gz: 40be17e194be6cd15655b875af2f7a4278d0493f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 719ecb782c356d473ecacb4181d38422266d2731a4c026be2b6aed7f3bd13ffbddbc11c13279d135da440350b19d836cbb8c04b2268b97707df3d460bb61fcb2
|
7
|
+
data.tar.gz: ec8008f5d9c30b8553d57409b105cf7c11c2b25cd3e1848a15986d3b13540f05398ac23cb2730af55e399bcfe61ae410e3b618ae31b0bd9b4dd4563aad78baf0
|
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, isElement, isFunction, isGiven, isHash, isJQuery, isMissing, isNull, isObject, isPresent, isPromise, isStandardPort, isString, isUndefined, isUnmodifiedKeyEvent, isUnmodifiedMouseEvent, keys, last, locationFromXhr, measure, merge, methodFromXhr, nextFrame, normalizeMethod, normalizeUrl, nullJquery, only, option, options, prependGhost, presence, presentAttr, resolvableWhen, resolvedDeferred, resolvedPromise, select, setMissingAttrs, 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, isElement, isFunction, isGiven, isHash, isJQuery, isMissing, isNull, isObject, isPresent, isPromise, isStandardPort, isString, isUndefined, isUnmodifiedKeyEvent, isUnmodifiedMouseEvent, keys, last, locationFromXhr, measure, merge, methodFromXhr, nextFrame, normalizeMethod, normalizeUrl, nullJquery, only, option, options, prependGhost, presence, presentAttr, resolvableWhen, resolvedDeferred, resolvedPromise, select, setMissingAttrs, stringSet, stringifyConsoleArgs, temporaryCss, times, toArray, trim, unwrap;
|
29
29
|
get = function(url, options) {
|
30
30
|
options = options || {};
|
31
31
|
options.url = url;
|
@@ -276,6 +276,14 @@ If you use them in your own code, you will get hurt.
|
|
276
276
|
}
|
277
277
|
return _results;
|
278
278
|
};
|
279
|
+
times = function(count, block) {
|
280
|
+
var iteration, _i, _ref, _results;
|
281
|
+
_results = [];
|
282
|
+
for (iteration = _i = 0, _ref = count - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; iteration = 0 <= _ref ? ++_i : --_i) {
|
283
|
+
_results.push(block(iteration));
|
284
|
+
}
|
285
|
+
return _results;
|
286
|
+
};
|
279
287
|
isNull = function(object) {
|
280
288
|
return object === null;
|
281
289
|
};
|
@@ -748,6 +756,7 @@ If you use them in your own code, you will get hurt.
|
|
748
756
|
error: error,
|
749
757
|
debug: debug,
|
750
758
|
each: each,
|
759
|
+
times: times,
|
751
760
|
detect: detect,
|
752
761
|
select: select,
|
753
762
|
last: last,
|
@@ -1256,7 +1265,7 @@ We need to work on this page:
|
|
1256
1265
|
if (!options.preload) {
|
1257
1266
|
up.browser.loadPage(url, u.only(options, 'method'));
|
1258
1267
|
}
|
1259
|
-
return;
|
1268
|
+
return u.resolvedPromise();
|
1260
1269
|
}
|
1261
1270
|
request = {
|
1262
1271
|
url: url,
|
@@ -2654,13 +2663,13 @@ response will already be cached when the user performs the click.
|
|
2654
2663
|
if (!u.isHash(request)) {
|
2655
2664
|
debugger;
|
2656
2665
|
}
|
2657
|
-
if (!request.
|
2666
|
+
if (!request._normalized) {
|
2658
2667
|
request.method = u.normalizeMethod(request.method);
|
2659
2668
|
if (request.url) {
|
2660
2669
|
request.url = u.normalizeUrl(request.url);
|
2661
2670
|
}
|
2662
2671
|
request.selector || (request.selector = 'body');
|
2663
|
-
request.
|
2672
|
+
request._normalized = true;
|
2664
2673
|
}
|
2665
2674
|
return request;
|
2666
2675
|
};
|
@@ -2693,7 +2702,7 @@ response will already be cached when the user performs the click.
|
|
2693
2702
|
var forceCache, ignoreCache, promise, request;
|
2694
2703
|
forceCache = u.castsToTrue(options.cache);
|
2695
2704
|
ignoreCache = u.castsToFalse(options.cache);
|
2696
|
-
request = u.only(options, 'url', 'method', 'selector');
|
2705
|
+
request = u.only(options, 'url', 'method', 'selector', '_normalized');
|
2697
2706
|
if (!isIdempotent(request) && !forceCache) {
|
2698
2707
|
clear();
|
2699
2708
|
promise = u.ajax(request);
|
@@ -2718,6 +2727,11 @@ response will already be cached when the user performs the click.
|
|
2718
2727
|
timeSinceTouch = timestamp() - promise.timestamp;
|
2719
2728
|
return timeSinceTouch < config.cacheExpiry;
|
2720
2729
|
};
|
2730
|
+
|
2731
|
+
/**
|
2732
|
+
@protected
|
2733
|
+
@method up.proxy.get
|
2734
|
+
*/
|
2721
2735
|
get = function(request) {
|
2722
2736
|
var key, promise;
|
2723
2737
|
key = cacheKey(request);
|
@@ -2735,6 +2749,11 @@ response will already be cached when the user performs the click.
|
|
2735
2749
|
return void 0;
|
2736
2750
|
}
|
2737
2751
|
};
|
2752
|
+
|
2753
|
+
/**
|
2754
|
+
@protected
|
2755
|
+
@method up.proxy.set
|
2756
|
+
*/
|
2738
2757
|
set = function(request, promise) {
|
2739
2758
|
var key;
|
2740
2759
|
trim();
|
@@ -2743,11 +2762,21 @@ response will already be cached when the user performs the click.
|
|
2743
2762
|
cache[key] = promise;
|
2744
2763
|
return promise;
|
2745
2764
|
};
|
2765
|
+
|
2766
|
+
/**
|
2767
|
+
@protected
|
2768
|
+
@method up.proxy.remove
|
2769
|
+
*/
|
2746
2770
|
remove = function(request) {
|
2747
2771
|
var key;
|
2748
2772
|
key = cacheKey(request);
|
2749
2773
|
return delete cache[key];
|
2750
2774
|
};
|
2775
|
+
|
2776
|
+
/**
|
2777
|
+
@protected
|
2778
|
+
@method up.proxy.clear
|
2779
|
+
*/
|
2751
2780
|
clear = function() {
|
2752
2781
|
return cache = {};
|
2753
2782
|
};
|
@@ -2770,12 +2799,28 @@ response will already be cached when the user performs the click.
|
|
2770
2799
|
clearTimeout(delayTimer);
|
2771
2800
|
return delayTimer = null;
|
2772
2801
|
};
|
2773
|
-
|
2774
|
-
|
2775
|
-
|
2776
|
-
|
2777
|
-
|
2778
|
-
|
2802
|
+
|
2803
|
+
/**
|
2804
|
+
@protected
|
2805
|
+
@method up.proxy.preload
|
2806
|
+
@return
|
2807
|
+
A promise that will be resolved when the request was loaded and cached
|
2808
|
+
*/
|
2809
|
+
preload = function(linkOrSelector, options) {
|
2810
|
+
var $link, method;
|
2811
|
+
$link = $(linkOrSelector);
|
2812
|
+
options = u.options(options);
|
2813
|
+
method = up.link.followMethod($link, options);
|
2814
|
+
if (isIdempotent({
|
2815
|
+
method: method
|
2816
|
+
})) {
|
2817
|
+
u.debug("Preloading %o", $link);
|
2818
|
+
options.preload = true;
|
2819
|
+
return up.link.follow($link, options);
|
2820
|
+
} else {
|
2821
|
+
u.debug("Won't preload %o due to unsafe method %o", $link, method);
|
2822
|
+
return u.resolvedPromise();
|
2823
|
+
}
|
2779
2824
|
};
|
2780
2825
|
reset = function() {
|
2781
2826
|
cancelDelay();
|
@@ -2791,7 +2836,7 @@ response will already be cached when the user performs the click.
|
|
2791
2836
|
making the interaction feel instant.
|
2792
2837
|
|
2793
2838
|
@method [up-preload]
|
2794
|
-
@param [
|
2839
|
+
@param [up-delay=75]
|
2795
2840
|
The number of milliseconds to wait between hovering
|
2796
2841
|
and preloading. Increasing this will lower the load in your server,
|
2797
2842
|
but will also make the interaction feel less instant.
|
@@ -2902,7 +2947,7 @@ Read on
|
|
2902
2947
|
|
2903
2948
|
(function() {
|
2904
2949
|
up.link = (function() {
|
2905
|
-
var activeInstantLink, childClicked, follow, resolve, u, visit;
|
2950
|
+
var activeInstantLink, childClicked, follow, followMethod, resolve, u, visit;
|
2906
2951
|
u = up.util;
|
2907
2952
|
|
2908
2953
|
/**
|
@@ -2968,9 +3013,19 @@ Read on
|
|
2968
3013
|
options.history = u.option(options.history, $link.attr('up-history'));
|
2969
3014
|
options.scroll = u.option(options.scroll, $link.attr('up-scroll'), 'body');
|
2970
3015
|
options.cache = u.option(options.cache, $link.attr('up-cache'));
|
3016
|
+
options.method = followMethod($link, options);
|
2971
3017
|
options = u.merge(options, up.motion.animateOptions(options, $link));
|
2972
3018
|
return up.replace(selector, url, options);
|
2973
3019
|
};
|
3020
|
+
|
3021
|
+
/**
|
3022
|
+
@protected
|
3023
|
+
@method up.link.followMethod
|
3024
|
+
*/
|
3025
|
+
followMethod = function($link, options) {
|
3026
|
+
options = u.options(options);
|
3027
|
+
return u.option(options.method, $link.attr('up-method'), $link.attr('data-method'), 'get').toUpperCase();
|
3028
|
+
};
|
2974
3029
|
resolve = function(element) {
|
2975
3030
|
var $element, followAttr;
|
2976
3031
|
$element = $(element);
|
@@ -3114,7 +3169,7 @@ Read on
|
|
3114
3169
|
up.on('mousedown', '[up-follow][up-instant]', function(event, $link) {
|
3115
3170
|
if (activeInstantLink(event, $link)) {
|
3116
3171
|
event.preventDefault();
|
3117
|
-
return
|
3172
|
+
return follow(resolve($link));
|
3118
3173
|
}
|
3119
3174
|
});
|
3120
3175
|
|
@@ -3161,10 +3216,12 @@ Read on
|
|
3161
3216
|
return $element.removeAttr('up-dash');
|
3162
3217
|
});
|
3163
3218
|
return {
|
3219
|
+
knife: eval(typeof Knife !== "undefined" && Knife !== null ? Knife.point : void 0),
|
3164
3220
|
visit: visit,
|
3165
3221
|
follow: follow,
|
3166
3222
|
resolve: resolve,
|
3167
|
-
childClicked: childClicked
|
3223
|
+
childClicked: childClicked,
|
3224
|
+
followMethod: followMethod
|
3168
3225
|
};
|
3169
3226
|
})();
|
3170
3227
|
|
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,S,E,A,P,D,F,U,O,j,z,M,N,q,H,I,W,G,L,X,J,R,V,B,_,K,Q,Z,Y,tn,nn,en,rn,on,un,an,sn,ln,cn,pn,fn,dn,mn,hn,vn,gn,yn,bn;return 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,G(t)?(e=$("<a>").attr({href:t}).get(0),A(e.hostname)&&(e.href=e.href)):e=bn(t),r=e.protocol+"//"+e.hostname,W(e.protocol,e.port)||(r+=":"+e.port),o=e.pathname,"/"!==o[0]&&(o="/"+o),(null!=n?n.stripTrailingSlash:void 0)===!0&&(o=o.replace(/\/$/,"")),r+=o,(null!=n?n.hash:void 0)===!0&&(r+=e.hash),(null!=n?n.search:void 0)!==!1&&(r+=e.search),r},Y=function(t){return t?t.toUpperCase():"GET"},n=function(t){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v;for(p=t.split(/[ >]/),r=null,c=d=0,h=p.length;h>d;c=++d){for(i=p[c],u=i.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),f="div",o=[],l=null,m=0,v=u.length;v>m;m++)switch(a=u[m],a[0]){case".":o.push(a.substr(1));break;case"#":l=a.substr(1);break;default:f=a}s="<"+f,o.length&&(s+=' class="'+o.join(" ")+'"'),l&&(s+=' id="'+l+'"'),s+=">",n=$(s),e&&n.appendTo(e),0===c&&(r=n),e=n}return r},p=function(t,n){var e;return e=document.createElement(t),H(n)&&(e.innerHTML=n),e},h=function(){var n,e,o,u,i,a;if(n=1<=arguments.length?t.call(arguments,0):[],n=gn(n),o=n.shift(),o="[UP] "+o,u=(null!=(a=o.match(r))?a.length:void 0)||0,U(V(n))&&u<n.length&&(e=n.pop()),i=console.debug.apply(console,[o].concat(t.call(n))),e){console.groupCollapsed();try{i=e()}finally{console.groupEnd()}}return i},y=function(){var n,e,r;throw e=1<=arguments.length?t.call(arguments,0):[],e[0]="[UP] "+e[0],console.error.apply(console,e),r=hn(e),n=an($(".up-error"))||$('<div class="up-error"></div>').prependTo("body"),n.addClass("up-error"),n.text(r),r},r=/\%[odisf]/g,hn=function(t){var n,e,o;return o=t[0],n=0,e=30,o.replace(r,function(){var r,o;return n+=1,r=t[n],o=typeof r,"string"===o?(r=r.replace(/\s+/g," "),r.length>e&&(r=r.substr(0,e)+"\u2026"),'"'+r+'"'):"number"===o?r.toString():"("+o+")"})},d=function(t){var n,e,r,o,u,i,a;for(h("Creating selector from element %o",t),e=(n=t.attr("class"))?n.split(" "):[],r=t.attr("id"),u=t.prop("tagName").toLowerCase(),r&&(u+="#"+r),i=0,a=e.length;a>i;i++)o=e[i],u+="."+o;return u},f=function(t){var n,e,r,o,u,i,a,s,l,c,f,d;return l=function(t){return"<"+t+"(?: [^>]*)?>"},i=function(t){return"</"+t+">"},n="(?:.|\\n)*?",u=function(t){return"("+t+")"},d=new RegExp(l("head")+n+l("title")+u(n)+i("title")+n+i("body"),"i"),o=new RegExp(l("body")+u(n)+i("body"),"i"),(r=t.match(o))?(s=document.createElement("html"),e=p("body",r[1]),s.appendChild(e),(f=t.match(d))&&(a=p("head"),s.appendChild(a),c=p("title",f[1]),a.appendChild(c)),s):p("div",t)},w=$.extend,yn=$.trim,R=Object.keys||function(t){var n,e,r,o;for(e=[],r=0,o=t.length;o>r;r++)n=t[r],t.hasOwnProperty(n)&&e.push(n);return e},g=function(t,n){var e,r,o,u,i;for(i=[],e=o=0,u=t.length;u>o;e=++o)r=t[e],i.push(n(r,e));return i},N=function(t){return null===t},L=function(t){return void 0===t},D=function(t){return!L(t)},M=function(t){return L(t)||N(t)},O=function(t){return!M(t)},A=function(t){return M(t)||q(t)&&0===R(t).length||0===t.length},an=function(t,n){return null==n&&(n=H),n(t)?t:null},H=function(t){return!A(t)},U=function(t){return"function"==typeof t},G=function(t){return"string"==typeof t},j=function(t){return"object"==typeof t&&!!t},q=function(t){return j(t)||"function"==typeof t},F=function(t){return!(!t||1!==t.nodeType)},z=function(t){return t instanceof jQuery},I=function(t){return q(t)&&U(t.then)},P=function(t){return I(t)&&U(t.resolve)},S=function(t){return O(t)?t:void 0},E=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},gn=function(t){return Array.prototype.slice.call(t)},l=function(t){return E(t)?t.slice():w({},t)},bn=function(t){return z(t)?t.get(0):t},K=function(t,n){return w(l(t),n)},on=function(t,n){var e,r,o,u;if(o=t?l(t):{},n)for(r in n)e=n[r],u=o[r],O(u)?q(e)&&q(u)&&(o[r]=on(u,e)):o[r]=e;return o},rn=function(){var n,e,r,o,u,i;for(e=1<=arguments.length?t.call(arguments,0):[],r=null,u=0,i=e.length;i>u;u++)if(n=e[u],o=n,U(o)&&(o=o()),O(o)){r=o;break}return r},v=function(t,n){var e,r,o,u;for(r=null,o=0,u=t.length;u>o;o++)if(e=t[o],n(e)){r=e;break}return r},fn=function(t,n){var e;return e=[],g(t,function(t){return n(t)?e.push(t):void 0}),e},sn=function(){var n,e,r,o;return n=arguments[0],r=2<=arguments.length?t.call(arguments,1):[],o=function(){var t,o,u;for(u=[],t=0,o=r.length;o>t;t++)e=r[t],u.push(n.attr(e));return u}(),v(o,H)},Z=function(t){return setTimeout(t,0)},V=function(t){return t[t.length-1]},a=function(){var t;return t=document.documentElement,{width:t.clientWidth,height:t.clientHeight}},vn=function(t,n,e){var r,o;return o=t.css(R(n)),t.css(n),r=function(){return t.css(o)},e?(e(),r()):r},T=function(t){var n,e;return e=t.css(["transform","-webkit-transform"]),A(e)?(n=function(){return t.css(e)},t.css({transform:"translateZ(0)","-webkit-transform":"translateZ(0)"})):n=function(){},n},m=function(t,n,r){var o,u,i,a,s,l;return o=$(t),up.browser.canCssAnimation()?(r=on(r,{duration:300,delay:0,easing:"ease"}),u=$.Deferred(),a={"transition-property":R(n).join(", "),"transition-duration":r.duration+"ms","transition-delay":r.delay+"ms","transition-timing-function":r.easing},s=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)},B=function(t){return t.getResponseHeader("X-Up-Location")},Q=function(t){return t.getResponseHeader("X-Up-Method")},en=function(){var n,e,r,o,u,i;for(o=arguments[0],r=2<=arguments.length?t.call(arguments,1):[],n={},u=0,i=r.length;i>u;u++)e=r[u],o.hasOwnProperty(e)&&(n[e]=o[e]);return n},X=function(t){return!(t.metaKey||t.shiftKey||t.ctrlKey)},J=function(t){return 0===t.button&&X(t)},cn=function(){var t;return t=$.Deferred(),t.resolve(),t},pn=function(){return cn().promise()},nn=function(){return{is:function(){return!1},attr:function(){},find:function(){return[]}}},ln=function(){var n,e;return n=1<=arguments.length?t.call(arguments,0):[],e=$.when.apply($,n),e.resolve=function(){return g(n,function(t){return"function"==typeof t.resolve?t.resolve():void 0})},e},dn=function(t,n){var e,r,o;o=[];for(e in n)r=n[e],o.push(M(t.attr(e))?t.attr(e,r):void 0);return o},mn=function(t){var n,e,r,o,u,i,a,s;for(u={},n=function(t){return u[r(t)]},e=function(t){return v(t,n)},o=function(t){return u[r(t)]=!0},r=function(t){return"_"+t},a=0,s=t.length;s>a;a++)i=t[a],o(i);return{put:o,includes:n,includesAny:e}},{presentAttr:sn,createElement:p,normalizeUrl:tn,normalizeMethod:Y,createElementFromHtml:f,$createElementFromSelector:n,createSelectorFromElement:d,get:x,ajax:o,extend:w,copy:l,merge:K,options:on,option:rn,error:y,debug:h,each:g,detect:v,select:fn,last:V,isNull:N,isDefined:D,isUndefined:L,isGiven:O,isMissing:M,isPresent:H,isBlank:A,presence:an,isObject:q,isFunction:U,isString:G,isElement:F,isJQuery:z,isPromise:I,isDeferred:P,isHash:j,ifGiven:S,isUnmodifiedKeyEvent:X,isUnmodifiedMouseEvent:J,nullJquery:nn,unwrap:bn,nextFrame:Z,measure:_,temporaryCss:vn,cssAnimate:m,finishCssAnimate:C,forceCompositing:T,prependGhost:un,escapePressed:b,copyAttributes:c,findWithSelf:k,contains:s,isArray:E,toArray:gn,castsToTrue:i,castsToFalse:u,locationFromXhr:B,methodFromXhr:Q,clientSize:a,only:en,trim:yn,keys:R,resolvedPromise:pn,resolvedDeferred:cn,resolvableWhen:ln,setMissingAttrs:dn,stringSet:mn}}()}.call(this),function(){var t=[].slice;up.browser=function(){var n,e,r,o,u,i,a,s,l,c;return l=up.util,a=function(t,n){var e,r,o,u,i,a;return null==n&&(n={}),i=l.option(n.method,"get").toLowerCase(),"get"===i?location.href=t:$.rails?(a=n.target,o=$.rails.csrfToken(),r=$.rails.csrfParam(),e=$("<form method='post' action='"+t+"'></form>"),u="<input name='_method' value='"+i+"' type='hidden' />",l.isDefined(r)&&l.isDefined(o)&&(u+="<input name='"+r+"' value='"+o+"' type='hidden' />"),a&&e.attr("target",a),e.hide().append(u).appendTo("body"),e.submit()):error("Can't fake a "+i.toUpperCase()+" request without Rails UJS")},c=function(){return location.href},o=function(){var t,n,e,r,o,u,i,a;return window.console||(window.console={}),t=function(){},(n=window.console).log||(n.log=t),(e=window.console).info||(e.info=t),(r=window.console).error||(r.error=t),(o=window.console).debug||(o.debug=t),(u=window.console).group||(u.group=t),(i=window.console).groupCollapsed||(i.groupCollapsed=t),(a=window.console).groupEnd||(a.groupEnd=t)},s=function(n){var e,r;return e=void 0,r=!1,function(){var o;return o=1<=arguments.length?t.call(arguments,0):[],r?e:(r=!0,e=n.apply(null,o))}},r=s(function(){return l.isDefined(history.pushState)}),n=s(function(){return"transition"in document.documentElement.style}),e=s(function(){return"oninput"in document.createElement("input")}),u=function(){var t,n,e,r,o;return o=$.fn.jquery,r=o.split("."),n=parseInt(r[0]),e=parseInt(r[1]),t=n>=2||1===n&&e>=9,t||l.error("jQuery %o found, but Up.js requires 1.9+",o)},i=s(function(){return l.isDefined(document.addEventListener)}),{url:c,ensureConsoleExists:o,loadPage:a,canPushState:r,canCssAnimation:n,canInputEvent:e,isSupported:i,ensureRecentJquery:u}}()}.call(this),function(){var t=[].slice;up.bus=function(){var n,e,r,o,u,i,a,s;return s=up.util,n={},r={},e=function(t){return n[t]||(n[t]=[])},a=function(){var t,e,o;r={},o=[];for(e in n)t=n[e],o.push(r[e]=s.copy(t));return o},i=function(){return n=s.copy(r)},u=function(t,n){return e(t).push(n)},o=function(){var n,r,o;return o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],s.debug("Emitting event %o with args %o",o,n),r=e(o),s.each(r,function(t){return t.apply(null,n)})},u("framework:ready",a),u("framework:reset",i),{on:u,emit:o}}()}.call(this),function(){up.viewport=function(){var t,n,e,r,o,u,i;return i=up.util,n={duration:0,view:"body",easing:"swing"},e=function(t){return i.extend(n,t)},t="up-scroll-promise",u=function(e,o,u){var a,s,l,c,p;return a=$(e),u=i.options(u),l=i.option(u.duration,n.duration),c=i.option(u.easing,n.easing),r(a),l>0?(s=$.Deferred(),a.data(t,s),s.then(function(){return a.removeData(t),a.finish()}),p={scrollTop:o},a.animate(p,{duration:l,easing:c,complete:function(){return s.resolve()}}),s):(a.scrollTop(o),i.resolvedDeferred())},r=function(n){return $(n).each(function(){var n;return(n=$(this).data(t))?n.resolve():void 0})},o=function(t,e){var r,o,a,s,l,c,p,f,d,m,h;return e=i.options(e),m=i.option(e.view,n.view),f=i.option(e.padding,n.padding),r=$(t),o=$(m),h=o.height(),d=o.scrollTop(),c=d,p=d+h,l=r.position().top,a=c>l-f,s=l>p-f,a||s?(d=l-f,d=Math.max(d,0),d=Math.min(d,h-1),u(o,d,e)):i.resolvedDeferred()},{reveal:o,scroll:u,finishScrolling:r,defaults:e}}(),up.scroll=up.viewport.scroll,up.reveal=up.viewport.reveal}.call(this),function(){up.flow=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h;return h=up.util,f=function(t,n){var e;return e=$(t),h.isPresent(n)&&(n=h.normalizeUrl(n)),e.attr("up-source",n)},d=function(t){var n;return n=$(t).closest("[up-source]"),h.presence(n.attr("up-source"))||up.browser.url()},l=function(t,n,e){var r,u,i;return e=h.options(e),i=h.presence(t)?t:h.createSelectorFromElement($(t)),up.browser.canPushState()||h.castsToFalse(e.history)?(u={url:n,method:e.method,selector:i,cache:e.cache},r=up.proxy.ajax(u),r.done(function(t,r,a){var s,l;return(s=h.locationFromXhr(a))&&(h.debug("Location from server: %o",s),l={url:s,method:h.methodFromXhr(a),selector:i},up.proxy.alias(u,l),n=s),(h.isMissing(e.history)||h.castsToTrue(e.history))&&(e.history=n),(h.isMissing(e.source)||h.castsToTrue(e.source))&&(e.source=n),e.preload?void 0:o(i,t,e)}),r.fail(h.error),r):void(e.preload||up.browser.loadPage(n,h.only(e,"method")))},o=function(t,n,e){var o,s,l,c,p,f,d,v;for(e=h.options(e,{historyMethod:"push"}),h.castsToFalse(e.history)&&(e.history=null),h.castsToFalse(e.scroll)&&(e.scroll=null),e.source=h.option(e.source,e.history),l=i(n),e.title||(e.title=l.title()),d=u(t,e),v=[],p=0,f=d.length;f>p;p++)c=d[p],s=r(c.selector),o=l.find(c.selector),v.push(a(s,e).then(function(){return m(s,o,c.pseudoClass,c.transition,e)}));return v},r=function(t){var n;return n=t+":not(.up-ghost, .up-destroying)",h.presence($(".up-popup "+n))||h.presence($(".up-modal "+n))||h.presence($(n))||h.error("Could not find selector %o in current body HTML",t)},i=function(t){var n;return n=h.createElementFromHtml(t),{title:function(){var t;return null!=(t=n.querySelector("title"))?t.textContent:void 0},find:function(e){var r;return(r=n.querySelector(e))?$(r):h.error("Could not find selector %o in response %o",e,t)}}},a=function(t,n){return up.motion.finish(t),p(t,n.scroll)},p=function(t,n){return n?up.reveal(t,{view:n}):h.resolvedDeferred()},e=function(n,e){return"function"==typeof e.insert&&e.insert(n),e.history&&(e.title&&(document.title=e.title),up.history[e.historyMethod](e.history)),f(n,e.source),t(n),up.ready(n)},m=function(t,r,o,u,i){var a,s;return u||(u="none"),o?(s="before"===o?"prepend":"append",a=r.children(),t[s](r.contents()),h.copyAttributes(r,t),e(a,i),up.animate(r,u,i)):n(t,{animation:function(){return r.insertBefore(t),e(r,i),t.is("body")&&"none"!==u&&h.error("Cannot apply transitions to body-elements (%o)",u),up.morph(t,r,u,i)}})},u=function(t,n){var e,r,o,u,i,a,s,l,c,p,f;for(s=n.transition||n.animation||"none",e=/\ *,\ */,r=t.split(e),h.isPresent(s)&&(l=s.split(e)),f=[],o=c=0,p=r.length;p>c;o=++c)u=r[o],i=u.match(/^(.+?)(?:\:(before|after))?$/),a=l[o]||h.last(l),f.push({selector:i[1],pseudoClass:i[2],transition:a});return f},t=function(t){var n,e;return e="[autofocus]:last",n=h.findWithSelf(t,e),n.length&&n.get(0)!==document.activeElement?n.focus():void 0},n=function(t,n){var e,r,o;return e=$(t),n=h.options(n,{animation:"none"}),r=up.motion.animateOptions(n),e.addClass("up-destroying"),h.isPresent(n.url)&&up.history.push(n.url),h.isPresent(n.title)&&(document.title=n.title),up.bus.emit("fragment:destroy",e),o=h.presence(n.animation,h.isPromise)||up.motion.animate(e,n.animation,r),o.then(function(){return e.remove()})},s=function(t,n){var e;return n=h.options(n,{cache:!1}),e=n.url||d(t),l(t,e,n)},c=function(){return up.bus.emit("framework:reset")},up.bus.on("app:ready",function(){return f(document.body,up.browser.url())}),{replace:l,reload:s,destroy:n,implant:o,reset:c}}(),up.replace=up.flow.replace,up.reload=up.flow.reload,up.destroy=up.flow.destroy,up.reset=up.flow.reset}.call(this),function(){var t=[].slice;up.magic=function(){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g;return g=up.util,n="up-destroyable",e="up-destroyer",f=[],l=null,p=function(t,n,e){var r,o;if(up.browser.isSupported())return r=[t,n,function(t){return e.apply(this,[t,$(this),a(this)])}],f.push(r),(o=$(document)).on.apply(o,r)},u=[],s=null,o=function(){var n,e,r,o;return o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],up.browser.isSupported()?(e=n.pop(),r=g.options(n[0],{batch:!1}),u.push({selector:o,callback:e,batch:r.batch})):void 0},r=function(t,r,o){var u;return g.debug("Applying awakener %o on %o",t.selector,o),u=t.callback.apply(o,[r,a(r)]),g.isFunction(u)?(r.addClass(n),r.data(e,u)):void 0},i=function(t){var n,e,o,i,a;for(g.debug("Compiling fragment %o",t),a=[],o=0,i=u.length;i>o;o++)e=u[o],n=g.findWithSelf(t,e.selector),a.push(n.length?e.batch?r(e,n,n.get()):n.each(function(){return r(e,$(this),this)}):void 0);return a},c=function(t){return g.findWithSelf(t,"."+n).each(function(){var t,n;return t=$(this),(n=t.data(e))()})},a=function(t){var n,e;return n=$(t),e=n.attr("up-data"),g.isString(e)&&""!==g.trim(e)?JSON.parse(e):{}},v=function(){return l=g.copy(f),s=g.copy(u)},h=function(){var t,n,e,r;for(n=0,e=f.length;e>n;n++)t=f[n],g.contains(l,t)||(r=$(document)).off.apply(r,t);return f=g.copy(l),u=g.copy(s)},m=function(t){var n;return n=$(t),up.bus.emit("fragment:ready",n),n},d=function(t){return p("keydown","body",function(n){return g.escapePressed(n)?t(n):void 0})},up.bus.on("app:ready",function(){return m(document.body)}),up.bus.on("fragment:ready",i),up.bus.on("fragment:destroy",c),up.bus.on("framework:ready",v),up.bus.on("framework:reset",h),{awaken:o,on:p,ready:m,onEscape:d,data:a}}(),up.awaken=up.magic.awaken,up.on=up.magic.on,up.ready=up.magic.ready}.call(this),function(){up.history=function(){var t,n,e,r,o,u;return u=up.util,t=function(t){return u.normalizeUrl(t,{hash:!0})===u.normalizeUrl(up.browser.url(),{hash:!0})},o=function(e,r){return r=u.options(r,{force:!1}),r.force||!t(e)?n("replace",e):void 0},r=function(e){return t(e)?void 0:n("push",e)},n=function(t,n){return up.browser.canPushState()?(t+="State",window.history[t]({fromUp:!0},"",n)):u.error("This browser doesn't support history.pushState")},e=function(t){var n;return n=t.originalEvent.state,(null!=n?n.fromUp:void 0)?(u.debug("Restoring state %o (now on "+up.browser.url()+")",n),up.visit(up.browser.url(),{historyMethod:"replace"})):u.debug("Discarding unknown state %o",n)},up.browser.canPushState()&&setTimeout(function(){return $(window).on("popstate",e),o(up.browser.url(),{force:!0})},200),{push:r,replace:o}}()}.call(this),function(){up.motion=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,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;return l={preloadDelay:75,cacheSize:70,cacheExpiry:3e5},c=function(t){return T.extend(l,t)},o={},T=up.util,t=null,p=null,u=function(t){return v(t),[t.url,t.method,t.selector].join("|")},C=function(){var t,n,e;return t=T.keys(o),t.length>l.cacheSize&&(n=null,e=null,T.each(t,function(t){var r,u;return r=o[t],u=r.timestamp,!e||e>u?(n=t,e=u):void 0}),n)?delete o[n]:void 0},$=function(){return(new Date).valueOf()},v=function(t){return!T.isHash(t),t._requestNormalized||(t.method=T.normalizeMethod(t.method),t.url&&(t.url=T.normalizeUrl(t.url)),t.selector||(t.selector="body"),t._requestNormalized=!0),t},r=function(t,n){var e;return T.debug("Aliasing %o to %o",t,n),(e=d(t))?w(n,e):void 0},e=function(t){var n,e,r,o;return n=T.castsToTrue(t.cache),e=T.castsToFalse(t.cache),o=T.only(t,"url","method","selector"),h(o)||n?(r=d(o))&&!e||(r=T.ajax(o),w(o,r)):(s(),r=T.ajax(o)),r},n=["GET","OPTIONS","HEAD"],h=function(t){return v(t),T.contains(n,t.method)},f=function(t){return h(t)||T.error("Won't preload non-GET request %o",t)},m=function(t){var n;return n=$()-t.timestamp,n<l.cacheExpiry},d=function(t){var n,e;return n=u(t),(e=o[n])?m(e)?(T.debug("Cache hit for %o (%o)",t.url,t),e):(T.debug("Discarding stale cache entry for %o (%o)",t.url,t),void y(t)):void T.debug("Cache miss for %o (%o)",t.url,t)},w=function(t,n){var e;return C(),e=u(t),n.timestamp=$(),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(T.presentAttr(n,"up-delay"))||l.preloadDelay,n.is(t)?void 0:(t=n,i(),e=function(){return g(n)},k(e,r))},k=function(t,n){return p=setTimeout(t,n)},i=function(){return clearTimeout(p),p=null},g=function(t,n){return n=T.options(),f(n),T.debug("Preloading %o",t),n.preload=!0,up.link.follow(t,n)},b=function(){return i(),o={}},up.bus.on("framework:reset",b),up.on("mouseover mousedown touchstart","[up-preload]",function(t,n){return up.link.childClicked(t,n)?void 0:a(up.link.resolve(n))}),{preload:g,ajax:e,get:d,set:w,alias:r,clear:s,remove:y,defaults:c}}()}.call(this),function(){up.link=function(){var t,n,e,r,o,u;return o=up.util,u=function(t,n){return o.debug("Visiting "+t),up.replace("body",t,n)},e=function(t,n){var e,r,u;return e=$(t),n=o.options(n),u=o.option(e.attr("href"),e.attr("up-follow")),r=o.option(n.target,e.attr("up-target"),"body"),n.transition=o.option(n.transition,e.attr("up-transition"),e.attr("up-animation")),n.history=o.option(n.history,e.attr("up-history")),n.scroll=o.option(n.scroll,e.attr("up-scroll"),"body"),n.cache=o.option(n.cache,e.attr("up-cache")),n=o.merge(n,up.motion.animateOptions(n,e)),up.replace(r,u,n)},r=function(t){var n,e;return n=$(t),e=n.attr("up-follow"),n.is("a")||o.isPresent(e)&&!o.castsToTrue(e)?n:n.find("a:first")},up.on("click","a[up-target]",function(t,n){return t.preventDefault(),n.is("[up-instant]")?void 0:e(n)}),up.on("mousedown","a[up-target][up-instant]",function(n,e){return t(n,e)?(n.preventDefault(),up.follow(e)):void 0}),n=function(t,n){var e,r;return e=$(t.target),r=e.closest("a, [up-follow]"),r.length&&n.find(r).length},t=function(t,e){return o.isUnmodifiedMouseEvent(t)&&!n(t,e)},up.on("click","[up-follow]",function(t,o){return n(t,o)||(t.preventDefault(),o.is("[up-instant]"))?void 0:e(r(o))}),up.on("mousedown","[up-follow][up-instant]",function(n,e){return t(n,e)?(n.preventDefault(),up.follow(r(e))):void 0}),up.awaken("[up-dash]",function(t){var n,e;return e=t.attr("up-dash"),n={"up-preload":"true","up-instant":"true"},o.isBlank(e)||o.castsToTrue(e)?n["up-follow"]="":n["up-target"]=e,o.setMissingAttrs(t,n),t.removeAttr("up-dash")}),{visit:u,follow:e,resolve:r,childClicked:n}}(),up.visit=up.link.visit,up.follow=up.link.follow}.call(this),function(){up.form=function(){var observe,submit,u;return u=up.util,submit=function(t,n){var e,r,o,i,a,s,l,c,p,f,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.awaken("[up-observe]",function(t){return observe(t)}),{submit:submit,observe:observe}}(),up.submit=up.form.submit,up.observe=up.form.observe}.call(this),function(){up.popup=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f;return p=up.util,e={openAnimation:"fade-in",closeAnimation:"fade-out",origin:"bottom-right"},o=function(t){return p.extend(e,t)},s=function(t,n,e){var r,o;return o=p.measure(t,{full:!0}),r=function(){switch(e){case"bottom-right":return{right:o.right,top:o.top+o.height};case"bottom-left":return{left:o.left,top:o.bottom+o.height};case"top-right":return{right:o.right,bottom:o.top};case"top-left":return{left:o.left,bottom:o.top};default:return p.error("Unknown origin %o",e)}}(),n.attr("up-origin",e),n.css(r),i(n)},i=function(t){var n,e,r,o,u,i,a;if(e=p.measure(t,{full:!0}),r=null,o=null,e.right<0&&(r=-e.right),e.bottom<0&&(o=-e.bottom),e.left<0&&(r=e.left),e.top<0&&(o=e.top),r&&((u=parseInt(t.css("left")))?t.css("left",u-r):(i=parseInt(t.css("right")))&&t.css("right",i+r)),o){if(a=parseInt(t.css("top")))return t.css("top",a-o);if(n=parseInt(t.css("bottom")))return t.css("bottom",n+o)}},l=function(){var t;return t=$(".up-popup"),t.attr("up-previous-url",up.browser.url()),t.attr("up-previous-title",document.title)},u=function(){var t;return t=$(".up-popup"),t.removeAttr("up-previous-url"),t.removeAttr("up-previous-title")},r=function(t,n,e){var r,o;return o=p.$createElementFromSelector(".up-popup"),e&&o.attr("up-sticky",""),r=p.$createElementFromSelector(n),r.appendTo(o),o.appendTo(document.body),l(),o.hide(),o},f=function(t,n,e,r,o){return n.show(),s(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.origin,u.attr("up-origin"),e.origin),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;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")
|
2
|
-
},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 origin %o",e)}}(),n.attr("up-origin",e),n.css(r)},n=function(t){return o.$createElementFromSelector(".up-tooltip").html(t).appendTo(document.body)},e=function(e,u){var i,a,s,l,c;return null==u&&(u={}),i=$(e),l=o.option(u.html,i.attr("up-tooltip"),i.attr("title")),c=o.option(u.origin,i.attr("up-origin"),"top"),s=o.option(u.animation,i.attr("up-animation"),"fade-in"),t(),a=n(l),r(i,a,c),up.animate(a,s,u)},t=function(t){var n;return n=$(".up-tooltip"),n.length?(t=o.options(t,{animation:"fade-out"}),up.destroy(n,t)):void 0},up.awaken("[up-tooltip]",function(n){return n.on("mouseover",function(){return e(n)}),n.on("mouseout",function(){return t()})}),up.on("click","body",function(){return t()}),up.bus.on("framework:reset",t),up.magic.onEscape(function(){return t()}),{open:e,close:t}}()}.call(this),function(){up.navigation=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d;return f=up.util,t="up-active",n="up-current",e=["a[href]","a[up-target]","[up-follow]","[up-modal]","[up-popup]","[up-href]"],o=e.join(", "),u=function(){var t,n,r;for(r=[],t=0,n=e.length;n>t;t++)p=e[t],r.push(p+"[up-instant]");return r}().join(", "),r="."+t,s=function(t){return f.isPresent(t)?f.normalizeUrl(t,{search:!1,stripTrailingSlash:!0}):void 0},c=function(t){var n,e,r,o,u,i,a;if(o=[],n=up.link.resolve(t))for(a=["href","up-follow","up-href"],u=0,i=a.length;i>u;u++)e=a[u],(r=f.presentAttr(n,e))&&(r=s(r),o.push(r));return o},a=function(){var t;return t=f.stringSet([s(up.browser.url()),s(up.modal.source()),s(up.popup.source())]),f.each($(o),function(e){var r,o;return r=$(e),o=c(r),t.includesAny(o)?r.addClass(n):r.removeClass(n)})},l=function(n){return d(),n=i(n),n.addClass(t)},i=function(t){return f.presence(t.parents(o))||t},d=function(){return $(r).removeClass(t)},up.on("click",o,function(t,n){return n.is("[up-instant]")?void 0:l(n)}),up.on("mousedown",u,function(t,n){return f.isUnmodifiedMouseEvent(t)?l(n):void 0}),up.bus.on("fragment:ready",function(){return d(),a()}),up.bus.on("fragment:destroy",function(t){return t.is(".up-modal, .up-popup")?a():void 0})}()}.call(this),function(){up.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,T,x,S,E,A,P,D,U,F,M,O,j,z,I,L,H,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;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),A(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(p=t.split(/[ >]/),r=null,c=d=0,h=p.length;h>d;c=++d){for(i=p[c],u=i.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),f="div",o=[],l=null,m=0,v=u.length;v>m;m++)switch(a=u[m],a[0]){case".":o.push(a.substr(1));break;case"#":l=a.substr(1);break;default:f=a}s="<"+f,o.length&&(s+=' class="'+o.join(" ")+'"'),l&&(s+=' id="'+l+'"'),s+=">",n=$(s),e&&n.appendTo(e),0===c&&(r=n),e=n}return r},p=function(t,n){var e;return e=document.createElement(t),H(n)&&(e.innerHTML=n),e},h=function(){var n,e,o,u,i,a;if(n=1<=arguments.length?t.call(arguments,0):[],n=yn(n),o=n.shift(),o="[UP] "+o,u=(null!=(a=o.match(r))?a.length:void 0)||0,F(K(n))&&u<n.length&&(e=n.pop()),i=console.debug.apply(console,[o].concat(t.call(n))),e){console.groupCollapsed();try{i=e()}finally{console.groupEnd()}}return i},y=function(){var n,e,r;throw e=1<=arguments.length?t.call(arguments,0):[],e[0]="[UP] "+e[0],console.error.apply(console,e),r=hn(e),n=an($(".up-error"))||$('<div class="up-error"></div>').prependTo("body"),n.addClass("up-error"),n.text(r),r},r=/\%[odisf]/g,hn=function(t){var n,e,o;return o=t[0],n=0,e=30,o.replace(r,function(){var r,o;return n+=1,r=t[n],o=typeof r,"string"===o?(r=r.replace(/\s+/g," "),r.length>e&&(r=r.substr(0,e)+"\u2026"),'"'+r+'"'):"number"===o?r.toString():"("+o+")"})},d=function(t){var n,e,r,o,u,i,a;for(h("Creating selector from element %o",t),e=(n=t.attr("class"))?n.split(" "):[],r=t.attr("id"),u=t.prop("tagName").toLowerCase(),r&&(u+="#"+r),i=0,a=e.length;a>i;i++)o=e[i],u+="."+o;return u},f=function(t){var n,e,r,o,u,i,a,s,l,c,f,d;return l=function(t){return"<"+t+"(?: [^>]*)?>"},i=function(t){return"</"+t+">"},n="(?:.|\\n)*?",u=function(t){return"("+t+")"},d=new RegExp(l("head")+n+l("title")+u(n)+i("title")+n+i("body"),"i"),o=new RegExp(l("body")+u(n)+i("body"),"i"),(r=t.match(o))?(s=document.createElement("html"),e=p("body",r[1]),s.appendChild(e),(f=t.match(d))&&(a=p("head"),s.appendChild(a),c=p("title",f[1]),a.appendChild(c)),s):p("div",t)},w=$.extend,bn=$.trim,R=Object.keys||function(t){var n,e,r,o;for(e=[],r=0,o=t.length;o>r;r++)n=t[r],t.hasOwnProperty(n)&&e.push(n);return e},g=function(t,n){var e,r,o,u,i;for(i=[],e=o=0,u=t.length;u>o;e=++o)r=t[e],i.push(n(r,e));return i},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},I=function(t){return null===t},G=function(t){return void 0===t},D=function(t){return!G(t)},z=function(t){return G(t)||I(t)},M=function(t){return!z(t)},A=function(t){return z(t)||L(t)&&0===R(t).length||0===t.length},an=function(t,n){return null==n&&(n=H),n(t)?t:null},H=function(t){return!A(t)},F=function(t){return"function"==typeof t},q=function(t){return"string"==typeof t},O=function(t){return"object"==typeof t&&!!t},L=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 L(t)&&F(t.then)},P=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)?L(e)&&L(u)&&(o[r]=on(u,e)):o[r]=e;return o},rn=function(){var n,e,r,o,u,i;for(e=1<=arguments.length?t.call(arguments,0):[],r=null,u=0,i=e.length;i>u;u++)if(n=e[u],o=n,F(o)&&(o=o()),M(o)){r=o;break}return r},v=function(t,n){var e,r,o,u;for(r=null,o=0,u=t.length;u>o;o++)if(e=t[o],n(e)){r=e;break}return r},fn=function(t,n){var e;return e=[],g(t,function(t){return n(t)?e.push(t):void 0}),e},sn=function(){var n,e,r,o;return n=arguments[0],r=2<=arguments.length?t.call(arguments,1):[],o=function(){var t,o,u;for(u=[],t=0,o=r.length;o>t;t++)e=r[t],u.push(n.attr(e));return u}(),v(o,H)},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"]),A(e)?(n=function(){return t.css(e)},t.css({transform:"translateZ(0)","-webkit-transform":"translateZ(0)"})):n=function(){},n},m=function(t,n,r){var o,u,i,a,s,l;return o=$(t),up.browser.canCssAnimation()?(r=on(r,{duration:300,delay:0,easing:"ease"}),u=$.Deferred(),a={"transition-property":R(n).join(", "),"transition-duration":r.duration+"ms","transition-delay":r.delay+"ms","transition-timing-function":r.easing},s=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(o=arguments[0],r=2<=arguments.length?t.call(arguments,1):[],n={},u=0,i=r.length;i>u;u++)e=r[u],o.hasOwnProperty(e)&&(n[e]=o[e]);return n},X=function(t){return!(t.metaKey||t.shiftKey||t.ctrlKey)},J=function(t){return 0===t.button&&X(t)},cn=function(){var t;return t=$.Deferred(),t.resolve(),t},pn=function(){return cn().promise()},nn=function(){return{is:function(){return!1},attr:function(){},find:function(){return[]}}},ln=function(){var n,e;return n=1<=arguments.length?t.call(arguments,0):[],e=$.when.apply($,n),e.resolve=function(){return g(n,function(t){return"function"==typeof t.resolve?t.resolve():void 0})},e},dn=function(t,n){var e,r,o;o=[];for(e in n)r=n[e],o.push(z(t.attr(e))?t.attr(e,r):void 0);return o},mn=function(t){var n,e,r,o,u,i,a,s;for(u={},n=function(t){return u[r(t)]},e=function(t){return v(t,n)},o=function(t){return u[r(t)]=!0},r=function(t){return"_"+t},a=0,s=t.length;s>a;a++)i=t[a],o(i);return{put:o,includes:n,includesAny:e}},{presentAttr:sn,createElement:p,normalizeUrl:tn,normalizeMethod:Y,createElementFromHtml:f,$createElementFromSelector:n,createSelectorFromElement:d,get:x,ajax:o,extend:w,copy:l,merge:B,options:on,option:rn,error:y,debug:h,each:g,times:gn,detect:v,select:fn,last:K,isNull:I,isDefined:D,isUndefined:G,isGiven:M,isMissing:z,isPresent:H,isBlank:A,presence:an,isObject:L,isFunction:F,isString:q,isElement:U,isJQuery:j,isPromise:N,isDeferred:P,isHash:O,ifGiven:S,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: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;return window.console||(window.console={}),t=function(){},(n=window.console).log||(n.log=t),(e=window.console).info||(e.info=t),(r=window.console).error||(r.error=t),(o=window.console).debug||(o.debug=t),(u=window.console).group||(u.group=t),(i=window.console).groupCollapsed||(i.groupCollapsed=t),(a=window.console).groupEnd||(a.groupEnd=t)},s=function(n){var e,r;return e=void 0,r=!1,function(){var o;return o=1<=arguments.length?t.call(arguments,0):[],r?e:(r=!0,e=n.apply(null,o))}},r=s(function(){return l.isDefined(history.pushState)}),n=s(function(){return"transition"in document.documentElement.style}),e=s(function(){return"oninput"in document.createElement("input")}),u=function(){var t,n,e,r,o;return o=$.fn.jquery,r=o.split("."),n=parseInt(r[0]),e=parseInt(r[1]),t=n>=2||1===n&&e>=9,t||l.error("jQuery %o found, but Up.js requires 1.9+",o)},i=s(function(){return l.isDefined(document.addEventListener)}),{url:c,ensureConsoleExists:o,loadPage:a,canPushState:r,canCssAnimation:n,canInputEvent:e,isSupported:i,ensureRecentJquery:u}}()}.call(this),function(){var t=[].slice;up.bus=function(){var n,e,r,o,u,i,a,s;return s=up.util,n={},r={},e=function(t){return n[t]||(n[t]=[])},a=function(){var t,e,o;r={},o=[];for(e in n)t=n[e],o.push(r[e]=s.copy(t));return o},i=function(){return n=s.copy(r)},u=function(t,n){return e(t).push(n)},o=function(){var n,r,o;return o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],s.debug("Emitting event %o with args %o",o,n),r=e(o),s.each(r,function(t){return t.apply(null,n)})},u("framework:ready",a),u("framework:reset",i),{on:u,emit:o}}()}.call(this),function(){up.viewport=function(){var t,n,e,r,o,u,i;return i=up.util,n={duration:0,view:"body",easing:"swing"},e=function(t){return i.extend(n,t)},t="up-scroll-promise",u=function(e,o,u){var a,s,l,c,p;return a=$(e),u=i.options(u),l=i.option(u.duration,n.duration),c=i.option(u.easing,n.easing),r(a),l>0?(s=$.Deferred(),a.data(t,s),s.then(function(){return a.removeData(t),a.finish()}),p={scrollTop:o},a.animate(p,{duration:l,easing:c,complete:function(){return s.resolve()}}),s):(a.scrollTop(o),i.resolvedDeferred())},r=function(n){return $(n).each(function(){var n;return(n=$(this).data(t))?n.resolve():void 0})},o=function(t,e){var r,o,a,s,l,c,p,f,d,m,h;return e=i.options(e),m=i.option(e.view,n.view),f=i.option(e.padding,n.padding),r=$(t),o=$(m),h=o.height(),d=o.scrollTop(),c=d,p=d+h,l=r.position().top,a=c>l-f,s=l>p-f,a||s?(d=l-f,d=Math.max(d,0),d=Math.min(d,h-1),u(o,d,e)):i.resolvedDeferred()},{reveal:o,scroll:u,finishScrolling:r,defaults:e}}(),up.scroll=up.viewport.scroll,up.reveal=up.viewport.reveal}.call(this),function(){up.flow=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h;return h=up.util,f=function(t,n){var e;return e=$(t),h.isPresent(n)&&(n=h.normalizeUrl(n)),e.attr("up-source",n)},d=function(t){var n;return n=$(t).closest("[up-source]"),h.presence(n.attr("up-source"))||up.browser.url()},l=function(t,n,e){var r,u,i;return e=h.options(e),i=h.presence(t)?t:h.createSelectorFromElement($(t)),up.browser.canPushState()||h.castsToFalse(e.history)?(u={url:n,method:e.method,selector:i,cache:e.cache},r=up.proxy.ajax(u),r.done(function(t,r,a){var s,l;return(s=h.locationFromXhr(a))&&(h.debug("Location from server: %o",s),l={url:s,method:h.methodFromXhr(a),selector:i},up.proxy.alias(u,l),n=s),(h.isMissing(e.history)||h.castsToTrue(e.history))&&(e.history=n),(h.isMissing(e.source)||h.castsToTrue(e.source))&&(e.source=n),e.preload?void 0:o(i,t,e)}),r.fail(h.error),r):(e.preload||up.browser.loadPage(n,h.only(e,"method")),h.resolvedPromise())},o=function(t,n,e){var o,s,l,c,p,f,d,v;for(e=h.options(e,{historyMethod:"push"}),h.castsToFalse(e.history)&&(e.history=null),h.castsToFalse(e.scroll)&&(e.scroll=null),e.source=h.option(e.source,e.history),l=i(n),e.title||(e.title=l.title()),d=u(t,e),v=[],p=0,f=d.length;f>p;p++)c=d[p],s=r(c.selector),o=l.find(c.selector),v.push(a(s,e).then(function(){return m(s,o,c.pseudoClass,c.transition,e)}));return v},r=function(t){var n;return n=t+":not(.up-ghost, .up-destroying)",h.presence($(".up-popup "+n))||h.presence($(".up-modal "+n))||h.presence($(n))||h.error("Could not find selector %o in current body HTML",t)},i=function(t){var n;return n=h.createElementFromHtml(t),{title:function(){var t;return null!=(t=n.querySelector("title"))?t.textContent:void 0},find:function(e){var r;return(r=n.querySelector(e))?$(r):h.error("Could not find selector %o in response %o",e,t)}}},a=function(t,n){return up.motion.finish(t),p(t,n.scroll)},p=function(t,n){return n?up.reveal(t,{view:n}):h.resolvedDeferred()},e=function(n,e){return"function"==typeof e.insert&&e.insert(n),e.history&&(e.title&&(document.title=e.title),up.history[e.historyMethod](e.history)),f(n,e.source),t(n),up.ready(n)},m=function(t,r,o,u,i){var a,s;return u||(u="none"),o?(s="before"===o?"prepend":"append",a=r.children(),t[s](r.contents()),h.copyAttributes(r,t),e(a,i),up.animate(r,u,i)):n(t,{animation:function(){return r.insertBefore(t),e(r,i),t.is("body")&&"none"!==u&&h.error("Cannot apply transitions to body-elements (%o)",u),up.morph(t,r,u,i)}})},u=function(t,n){var e,r,o,u,i,a,s,l,c,p,f;for(s=n.transition||n.animation||"none",e=/\ *,\ */,r=t.split(e),h.isPresent(s)&&(l=s.split(e)),f=[],o=c=0,p=r.length;p>c;o=++c)u=r[o],i=u.match(/^(.+?)(?:\:(before|after))?$/),a=l[o]||h.last(l),f.push({selector:i[1],pseudoClass:i[2],transition:a});return f},t=function(t){var n,e;return e="[autofocus]:last",n=h.findWithSelf(t,e),n.length&&n.get(0)!==document.activeElement?n.focus():void 0},n=function(t,n){var e,r,o;return e=$(t),n=h.options(n,{animation:"none"}),r=up.motion.animateOptions(n),e.addClass("up-destroying"),h.isPresent(n.url)&&up.history.push(n.url),h.isPresent(n.title)&&(document.title=n.title),up.bus.emit("fragment:destroy",e),o=h.presence(n.animation,h.isPromise)||up.motion.animate(e,n.animation,r),o.then(function(){return e.remove()})},s=function(t,n){var e;return n=h.options(n,{cache:!1}),e=n.url||d(t),l(t,e,n)},c=function(){return up.bus.emit("framework:reset")},up.bus.on("app:ready",function(){return f(document.body,up.browser.url())}),{replace:l,reload:s,destroy:n,implant:o,reset:c}}(),up.replace=up.flow.replace,up.reload=up.flow.reload,up.destroy=up.flow.destroy,up.reset=up.flow.reset}.call(this),function(){var t=[].slice;up.magic=function(){var n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g;return g=up.util,n="up-destroyable",e="up-destroyer",f=[],l=null,p=function(t,n,e){var r,o;if(up.browser.isSupported())return r=[t,n,function(t){return e.apply(this,[t,$(this),a(this)])}],f.push(r),(o=$(document)).on.apply(o,r)},u=[],s=null,o=function(){var n,e,r,o;return o=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],up.browser.isSupported()?(e=n.pop(),r=g.options(n[0],{batch:!1}),u.push({selector:o,callback:e,batch:r.batch})):void 0},r=function(t,r,o){var u;return g.debug("Applying awakener %o on %o",t.selector,o),u=t.callback.apply(o,[r,a(r)]),g.isFunction(u)?(r.addClass(n),r.data(e,u)):void 0},i=function(t){var n,e,o,i,a;for(g.debug("Compiling fragment %o",t),a=[],o=0,i=u.length;i>o;o++)e=u[o],n=g.findWithSelf(t,e.selector),a.push(n.length?e.batch?r(e,n,n.get()):n.each(function(){return r(e,$(this),this)}):void 0);return a},c=function(t){return g.findWithSelf(t,"."+n).each(function(){var t,n;return t=$(this),(n=t.data(e))()})},a=function(t){var n,e;return n=$(t),e=n.attr("up-data"),g.isString(e)&&""!==g.trim(e)?JSON.parse(e):{}},v=function(){return l=g.copy(f),s=g.copy(u)},h=function(){var t,n,e,r;for(n=0,e=f.length;e>n;n++)t=f[n],g.contains(l,t)||(r=$(document)).off.apply(r,t);return f=g.copy(l),u=g.copy(s)},m=function(t){var n;return n=$(t),up.bus.emit("fragment:ready",n),n},d=function(t){return p("keydown","body",function(n){return g.escapePressed(n)?t(n):void 0})},up.bus.on("app:ready",function(){return m(document.body)}),up.bus.on("fragment:ready",i),up.bus.on("fragment:destroy",c),up.bus.on("framework:ready",v),up.bus.on("framework:reset",h),{awaken:o,on:p,ready:m,onEscape:d,data:a}}(),up.awaken=up.magic.awaken,up.on=up.magic.on,up.ready=up.magic.ready}.call(this),function(){up.history=function(){var t,n,e,r,o,u;return u=up.util,t=function(t){return u.normalizeUrl(t,{hash:!0})===u.normalizeUrl(up.browser.url(),{hash:!0})},o=function(e,r){return r=u.options(r,{force:!1}),r.force||!t(e)?n("replace",e):void 0},r=function(e){return t(e)?void 0:n("push",e)},n=function(t,n){return up.browser.canPushState()?(t+="State",window.history[t]({fromUp:!0},"",n)):u.error("This browser doesn't support history.pushState")},e=function(t){var n;return n=t.originalEvent.state,(null!=n?n.fromUp:void 0)?(u.debug("Restoring state %o (now on "+up.browser.url()+")",n),up.visit(up.browser.url(),{historyMethod:"replace"})):u.debug("Discarding unknown state %o",n)},up.browser.canPushState()&&setTimeout(function(){return $(window).on("popstate",e),o(up.browser.url(),{force:!0})},200),{push:r,replace:o}}()}.call(this),function(){up.motion=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,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 activeInstantLink,childClicked,follow,followMethod,resolve,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 t.preventDefault(),n.is("[up-instant]")?void 0:follow(n)}),up.on("mousedown","a[up-target][up-instant]",function(t,n){return activeInstantLink(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},activeInstantLink=function(t,n){return u.isUnmodifiedMouseEvent(t)&&!childClicked(t,n)},up.on("click","[up-follow]",function(t,n){return childClicked(t,n)||(t.preventDefault(),n.is("[up-instant]"))?void 0:follow(resolve(n))}),up.on("mousedown","[up-follow][up-instant]",function(t,n){return activeInstantLink(t,n)?(t.preventDefault(),follow(resolve(n))):void 0}),up.awaken("[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.awaken("[up-observe]",function(t){return observe(t)}),{submit:submit,observe:observe}}(),up.submit=up.form.submit,up.observe=up.form.observe}.call(this),function(){up.popup=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f;return p=up.util,e={openAnimation:"fade-in",closeAnimation:"fade-out",origin:"bottom-right"},o=function(t){return p.extend(e,t)},s=function(t,n,e){var r,o;return o=p.measure(t,{full:!0}),r=function(){switch(e){case"bottom-right":return{right:o.right,top:o.top+o.height};case"bottom-left":return{left:o.left,top:o.bottom+o.height};case"top-right":return{right:o.right,bottom:o.top};case"top-left":return{left:o.left,bottom:o.top};default:return p.error("Unknown origin %o",e)}}(),n.attr("up-origin",e),n.css(r),i(n)},i=function(t){var n,e,r,o,u,i,a;if(e=p.measure(t,{full:!0}),r=null,o=null,e.right<0&&(r=-e.right),e.bottom<0&&(o=-e.bottom),e.left<0&&(r=e.left),e.top<0&&(o=e.top),r&&((u=parseInt(t.css("left")))?t.css("left",u-r):(i=parseInt(t.css("right")))&&t.css("right",i+r)),o){if(a=parseInt(t.css("top")))return t.css("top",a-o);if(n=parseInt(t.css("bottom")))return t.css("bottom",n+o)}},l=function(){var t;return t=$(".up-popup"),t.attr("up-previous-url",up.browser.url()),t.attr("up-previous-title",document.title)},u=function(){var t;return t=$(".up-popup"),t.removeAttr("up-previous-url"),t.removeAttr("up-previous-title")},r=function(t,n,e){var r,o;return o=p.$createElementFromSelector(".up-popup"),e&&o.attr("up-sticky",""),r=p.$createElementFromSelector(n),r.appendTo(o),o.appendTo(document.body),l(),o.hide(),o},f=function(t,n,e,r,o){return n.show(),s(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.origin,u.attr("up-origin"),e.origin),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;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}
|
2
|
+
}()}.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 origin %o",e)}}(),n.attr("up-origin",e),n.css(r)},n=function(t){return o.$createElementFromSelector(".up-tooltip").html(t).appendTo(document.body)},e=function(e,u){var i,a,s,l,c;return null==u&&(u={}),i=$(e),l=o.option(u.html,i.attr("up-tooltip"),i.attr("title")),c=o.option(u.origin,i.attr("up-origin"),"top"),s=o.option(u.animation,i.attr("up-animation"),"fade-in"),t(),a=n(l),r(i,a,c),up.animate(a,s,u)},t=function(t){var n;return n=$(".up-tooltip"),n.length?(t=o.options(t,{animation:"fade-out"}),up.destroy(n,t)):void 0},up.awaken("[up-tooltip]",function(n){return n.on("mouseover",function(){return e(n)}),n.on("mouseout",function(){return t()})}),up.on("click","body",function(){return t()}),up.bus.on("framework:reset",t),up.magic.onEscape(function(){return t()}),{open:e,close:t}}()}.call(this),function(){up.navigation=function(){var t,n,e,r,o,u,i,a,s,l,c,p,f,d;return f=up.util,t="up-active",n="up-current",e=["a[href]","a[up-target]","[up-follow]","[up-modal]","[up-popup]","[up-href]"],o=e.join(", "),u=function(){var t,n,r;for(r=[],t=0,n=e.length;n>t;t++)p=e[t],r.push(p+"[up-instant]");return r}().join(", "),r="."+t,s=function(t){return f.isPresent(t)?f.normalizeUrl(t,{search:!1,stripTrailingSlash:!0}):void 0},c=function(t){var n,e,r,o,u,i,a;if(o=[],n=up.link.resolve(t))for(a=["href","up-follow","up-href"],u=0,i=a.length;i>u;u++)e=a[u],(r=f.presentAttr(n,e))&&(r=s(r),o.push(r));return o},a=function(){var t;return t=f.stringSet([s(up.browser.url()),s(up.modal.source()),s(up.popup.source())]),f.each($(o),function(e){var r,o;return r=$(e),o=c(r),t.includesAny(o)?r.addClass(n):r.removeClass(n)})},l=function(n){return d(),n=i(n),n.addClass(t)},i=function(t){return f.presence(t.parents(o))||t},d=function(){return $(r).removeClass(t)},up.on("click",o,function(t,n){return n.is("[up-instant]")?void 0:l(n)}),up.on("mousedown",u,function(t,n){return f.isUnmodifiedMouseEvent(t)?l(n):void 0}),up.bus.on("fragment:ready",function(){return d(),a()}),up.bus.on("fragment:destroy",function(t){return t.is(".up-modal, .up-popup")?a():void 0})}()}.call(this),function(){up.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);
|
@@ -65,10 +65,9 @@ up.flow = (->
|
|
65
65
|
u.createSelectorFromElement($(selectorOrElement))
|
66
66
|
|
67
67
|
if !up.browser.canPushState() && !u.castsToFalse(options.history)
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
68
|
+
up.browser.loadPage(url, u.only(options, 'method')) unless options.preload
|
69
|
+
return u.resolvedPromise()
|
70
|
+
|
72
71
|
request =
|
73
72
|
url: url
|
74
73
|
method: options.method
|
@@ -149,10 +149,19 @@ up.link = (->
|
|
149
149
|
options.history = u.option(options.history, $link.attr('up-history'))
|
150
150
|
options.scroll = u.option(options.scroll, $link.attr('up-scroll'), 'body')
|
151
151
|
options.cache = u.option(options.cache, $link.attr('up-cache'))
|
152
|
+
options.method = followMethod($link, options)
|
152
153
|
options = u.merge(options, up.motion.animateOptions(options, $link))
|
153
154
|
|
154
155
|
up.replace(selector, url, options)
|
155
156
|
|
157
|
+
###*
|
158
|
+
@protected
|
159
|
+
@method up.link.followMethod
|
160
|
+
###
|
161
|
+
followMethod = ($link, options) ->
|
162
|
+
options = u.options(options)
|
163
|
+
u.option(options.method, $link.attr('up-method'), $link.attr('data-method'), 'get').toUpperCase()
|
164
|
+
|
156
165
|
resolve = (element) ->
|
157
166
|
$element = $(element)
|
158
167
|
followAttr = $element.attr('up-follow')
|
@@ -288,7 +297,7 @@ up.link = (->
|
|
288
297
|
up.on 'mousedown', '[up-follow][up-instant]', (event, $link) ->
|
289
298
|
if activeInstantLink(event, $link)
|
290
299
|
event.preventDefault()
|
291
|
-
|
300
|
+
follow(resolve($link))
|
292
301
|
|
293
302
|
###*
|
294
303
|
Marks up the current link to be followed *as fast as possible*.
|
@@ -329,11 +338,13 @@ up.link = (->
|
|
329
338
|
newAttrs['up-target'] = target
|
330
339
|
u.setMissingAttrs($element, newAttrs)
|
331
340
|
$element.removeAttr('up-dash')
|
332
|
-
|
341
|
+
|
342
|
+
knife: eval(Knife?.point)
|
333
343
|
visit: visit
|
334
344
|
follow: follow
|
335
345
|
resolve: resolve
|
336
346
|
childClicked: childClicked
|
347
|
+
followMethod: followMethod
|
337
348
|
|
338
349
|
)()
|
339
350
|
|
@@ -71,11 +71,11 @@ up.proxy = (->
|
|
71
71
|
|
72
72
|
normalizeRequest = (request) ->
|
73
73
|
debugger unless u.isHash(request)
|
74
|
-
unless request.
|
74
|
+
unless request._normalized
|
75
75
|
request.method = u.normalizeMethod(request.method)
|
76
76
|
request.url = u.normalizeUrl(request.url) if request.url
|
77
77
|
request.selector ||= 'body'
|
78
|
-
request.
|
78
|
+
request._normalized = true
|
79
79
|
request
|
80
80
|
|
81
81
|
alias = (oldRequest, newRequest) ->
|
@@ -104,7 +104,7 @@ up.proxy = (->
|
|
104
104
|
forceCache = u.castsToTrue(options.cache)
|
105
105
|
ignoreCache = u.castsToFalse(options.cache)
|
106
106
|
|
107
|
-
request = u.only(options, 'url', 'method', 'selector')
|
107
|
+
request = u.only(options, 'url', 'method', 'selector', '_normalized')
|
108
108
|
|
109
109
|
# We don't cache non-GET responses unless `options.cache`
|
110
110
|
# is explicitly set to `true`.
|
@@ -134,6 +134,10 @@ up.proxy = (->
|
|
134
134
|
timeSinceTouch = timestamp() - promise.timestamp
|
135
135
|
timeSinceTouch < config.cacheExpiry
|
136
136
|
|
137
|
+
###*
|
138
|
+
@protected
|
139
|
+
@method up.proxy.get
|
140
|
+
###
|
137
141
|
get = (request) ->
|
138
142
|
key = cacheKey(request)
|
139
143
|
if promise = cache[key]
|
@@ -147,20 +151,31 @@ up.proxy = (->
|
|
147
151
|
promise
|
148
152
|
else
|
149
153
|
u.debug("Cache miss for %o (%o)", request.url, request)
|
150
|
-
# $('body').css('background-color': 'yellow')
|
151
154
|
undefined
|
152
|
-
|
155
|
+
|
156
|
+
###*
|
157
|
+
@protected
|
158
|
+
@method up.proxy.set
|
159
|
+
###
|
153
160
|
set = (request, promise) ->
|
154
161
|
trim()
|
155
162
|
key = cacheKey(request)
|
156
163
|
promise.timestamp = timestamp()
|
157
164
|
cache[key] = promise
|
158
165
|
promise
|
159
|
-
|
166
|
+
|
167
|
+
###*
|
168
|
+
@protected
|
169
|
+
@method up.proxy.remove
|
170
|
+
###
|
160
171
|
remove = (request) ->
|
161
172
|
key = cacheKey(request)
|
162
173
|
delete cache[key]
|
163
|
-
|
174
|
+
|
175
|
+
###*
|
176
|
+
@protected
|
177
|
+
@method up.proxy.clear
|
178
|
+
###
|
164
179
|
clear = ->
|
165
180
|
cache = {}
|
166
181
|
|
@@ -179,12 +194,24 @@ up.proxy = (->
|
|
179
194
|
clearTimeout(delayTimer)
|
180
195
|
delayTimer = null
|
181
196
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
197
|
+
###*
|
198
|
+
@protected
|
199
|
+
@method up.proxy.preload
|
200
|
+
@return
|
201
|
+
A promise that will be resolved when the request was loaded and cached
|
202
|
+
###
|
203
|
+
preload = (linkOrSelector, options) ->
|
204
|
+
$link = $(linkOrSelector)
|
205
|
+
options = u.options(options)
|
206
|
+
|
207
|
+
method = up.link.followMethod($link, options)
|
208
|
+
if isIdempotent(method: method)
|
209
|
+
u.debug("Preloading %o", $link)
|
210
|
+
options.preload = true
|
211
|
+
up.link.follow($link, options)
|
212
|
+
else
|
213
|
+
u.debug("Won't preload %o due to unsafe method %o", $link, method)
|
214
|
+
u.resolvedPromise()
|
188
215
|
|
189
216
|
reset = ->
|
190
217
|
cancelDelay()
|
@@ -200,7 +227,7 @@ up.proxy = (->
|
|
200
227
|
making the interaction feel instant.
|
201
228
|
|
202
229
|
@method [up-preload]
|
203
|
-
@param [
|
230
|
+
@param [up-delay=75]
|
204
231
|
The number of milliseconds to wait between hovering
|
205
232
|
and preloading. Increasing this will lower the load in your server,
|
206
233
|
but will also make the interaction feel less instant.
|
@@ -223,6 +223,9 @@ up.util = (->
|
|
223
223
|
each = (collection, block) ->
|
224
224
|
block(item, index) for item, index in collection
|
225
225
|
|
226
|
+
times = (count, block) ->
|
227
|
+
block(iteration) for iteration in [0..(count - 1)]
|
228
|
+
|
226
229
|
isNull = (object) ->
|
227
230
|
object == null
|
228
231
|
|
@@ -590,22 +593,6 @@ up.util = (->
|
|
590
593
|
includes: includes
|
591
594
|
includesAny: includesAny
|
592
595
|
|
593
|
-
# memoArray = ->
|
594
|
-
# array = []
|
595
|
-
# defaults = []
|
596
|
-
# array.snapshot = ->
|
597
|
-
# defaults = copy(array)
|
598
|
-
# array.reset = (destroyer) ->
|
599
|
-
# if destroyer
|
600
|
-
# for element in array
|
601
|
-
# unless contains(defaults, element)
|
602
|
-
# destroyer()
|
603
|
-
# replaceInPlace(array, defaults)
|
604
|
-
# array
|
605
|
-
#
|
606
|
-
# replaceInPlace = (array, replacement) ->
|
607
|
-
# array.splice(0, array.length, replacement...)
|
608
|
-
|
609
596
|
presentAttr: presentAttr
|
610
597
|
createElement: createElement
|
611
598
|
normalizeUrl: normalizeUrl
|
@@ -623,6 +610,7 @@ up.util = (->
|
|
623
610
|
error: error
|
624
611
|
debug: debug
|
625
612
|
each: each
|
613
|
+
times: times
|
626
614
|
detect: detect
|
627
615
|
select: select
|
628
616
|
last: last
|
data/lib/upjs/rails/version.rb
CHANGED
data/spec_app/Gemfile.lock
CHANGED
@@ -0,0 +1,71 @@
|
|
1
|
+
##
|
2
|
+
# Knife: Get, set or mock inaccessible variables in a Javascript closure
|
3
|
+
# ======================================================================
|
4
|
+
#
|
5
|
+
# Requires [Jasmine](http://jasmine.github.io/) 2+.
|
6
|
+
#
|
7
|
+
# Usage:
|
8
|
+
#
|
9
|
+
# klass = (->
|
10
|
+
#
|
11
|
+
# privateVariable = 0
|
12
|
+
#
|
13
|
+
# privateMethod = ->
|
14
|
+
# privateVariable += 1
|
15
|
+
#
|
16
|
+
# publicMethod = ->
|
17
|
+
# privateMethod()
|
18
|
+
#
|
19
|
+
# add: add
|
20
|
+
# knife: eval(Knife.point)
|
21
|
+
#
|
22
|
+
# )()
|
23
|
+
#
|
24
|
+
# klass.knife.get('privateVariable') => 0
|
25
|
+
# klass.knife.set('privateCounter', 5)
|
26
|
+
# klass.knife.get('privateCounter') => 5
|
27
|
+
# spy = klass.knife.mock('privateMethod').and.returnValue("mocked!")
|
28
|
+
# klass.publicMethod() # => 'mocked!'
|
29
|
+
# expect(spy).toHaveBeenCalled()
|
30
|
+
#
|
31
|
+
@Knife = (->
|
32
|
+
|
33
|
+
contextBleeder = ->
|
34
|
+
|
35
|
+
get = (symbol) ->
|
36
|
+
eval(symbol)
|
37
|
+
|
38
|
+
set = (symbol, value) ->
|
39
|
+
eval("#{symbol} = value")
|
40
|
+
|
41
|
+
mock = (symbol) ->
|
42
|
+
oldImpl = get(symbol)
|
43
|
+
spy = jasmine.createSpy(symbol)
|
44
|
+
set(symbol, spy)
|
45
|
+
cleaner = -> set(symbol, oldImpl)
|
46
|
+
Knife.cleaners.push(cleaner)
|
47
|
+
spy
|
48
|
+
|
49
|
+
get: get
|
50
|
+
set: set
|
51
|
+
mock: mock
|
52
|
+
|
53
|
+
reset = ->
|
54
|
+
for cleaner in Knife.cleaners
|
55
|
+
cleaner()
|
56
|
+
Knife.cleaners = []
|
57
|
+
|
58
|
+
me = {}
|
59
|
+
me.reset = reset
|
60
|
+
me.cleaners = []
|
61
|
+
|
62
|
+
if jasmine
|
63
|
+
me.point = "(#{contextBleeder.toString()})()"
|
64
|
+
# Jasmine defines afterEach on window
|
65
|
+
afterEach reset
|
66
|
+
else
|
67
|
+
me.point = "undefined"
|
68
|
+
|
69
|
+
me
|
70
|
+
|
71
|
+
)()
|
@@ -11,8 +11,6 @@ describe 'up.form', ->
|
|
11
11
|
if up.browser.canPushState()
|
12
12
|
|
13
13
|
beforeEach ->
|
14
|
-
jasmine.Ajax.install()
|
15
|
-
|
16
14
|
$form = affix('form[action="/path/to"][method="put"][up-target=".response"]')
|
17
15
|
$form.append('<input name="field1" value="value1">')
|
18
16
|
$form.append('<input name="field2" value="value2">')
|
@@ -7,8 +7,6 @@ describe 'up.link', ->
|
|
7
7
|
if up.browser.canPushState()
|
8
8
|
|
9
9
|
it 'loads the given link via AJAX and replaces the response in the given target', (done) ->
|
10
|
-
jasmine.Ajax.install()
|
11
|
-
|
12
10
|
affix('.before').text('old-before')
|
13
11
|
affix('.middle').text('old-middle')
|
14
12
|
affix('.after').text('old-after')
|
@@ -31,15 +29,27 @@ describe 'up.link', ->
|
|
31
29
|
expect($('.middle')).toHaveText('new-middle')
|
32
30
|
expect($('.after')).toHaveText('old-after')
|
33
31
|
done()
|
34
|
-
|
32
|
+
|
33
|
+
it 'uses the method from a data-method attribute', ->
|
34
|
+
$link = affix('a[href="/path"][data-method="PUT"]')
|
35
|
+
up.follow($link)
|
36
|
+
request = jasmine.Ajax.requests.mostRecent()
|
37
|
+
expect(request.method).toBe('PUT')
|
38
|
+
|
35
39
|
else
|
36
40
|
|
37
41
|
it 'follows the given link', ->
|
38
|
-
$link = affix('a[href="/path"]
|
42
|
+
$link = affix('a[href="/path"]')
|
39
43
|
spyOn(up.browser, 'loadPage')
|
40
44
|
up.follow($link)
|
41
45
|
expect(up.browser.loadPage).toHaveBeenCalledWith('/path', jasmine.anything())
|
42
|
-
|
46
|
+
|
47
|
+
it 'uses the method from a data-method attribute', ->
|
48
|
+
$link = affix('a[href="/path"][data-method="PUT"]')
|
49
|
+
spyOn(up.browser, 'loadPage')
|
50
|
+
up.follow($link)
|
51
|
+
expect(up.browser.loadPage).toHaveBeenCalledWith('/path', { method: 'PUT' })
|
52
|
+
|
43
53
|
|
44
54
|
describe 'up.visit', ->
|
45
55
|
|
@@ -56,40 +66,43 @@ describe 'up.link', ->
|
|
56
66
|
it 'should have tests'
|
57
67
|
|
58
68
|
describe '[up-instant]', ->
|
59
|
-
|
69
|
+
|
60
70
|
beforeEach ->
|
61
71
|
@$link = affix('a[href="/path"][up-follow][up-instant]')
|
62
|
-
|
63
|
-
|
72
|
+
@followSpy = up.link.knife.mock('follow')
|
73
|
+
|
74
|
+
afterEach ->
|
75
|
+
Knife.reset()
|
76
|
+
|
64
77
|
it 'follows an [up-follow] link on mousedown (instead of on click)', ->
|
65
78
|
Trigger.mousedown(@$link)
|
66
|
-
expect(
|
79
|
+
expect(@followSpy.calls.mostRecent().args[0]).toEqual(@$link)
|
67
80
|
|
68
81
|
it 'follows an [up-target] link on mousedown (instead of on click)', ->
|
69
82
|
Trigger.mousedown(@$link)
|
70
|
-
expect(
|
83
|
+
expect(@followSpy.calls.mostRecent().args[0]).toEqual(@$link)
|
71
84
|
|
72
85
|
it 'does nothing on mouseup', ->
|
73
86
|
Trigger.mouseup(@$link)
|
74
|
-
expect(
|
87
|
+
expect(@followSpy).not.toHaveBeenCalled()
|
75
88
|
|
76
89
|
it 'does nothing on click', ->
|
77
90
|
Trigger.click(@$link)
|
78
|
-
expect(
|
91
|
+
expect(@followSpy).not.toHaveBeenCalled()
|
79
92
|
|
80
93
|
it 'does nothing if the right mouse button is pressed down', ->
|
81
94
|
Trigger.mousedown(@$link, button: 2)
|
82
|
-
expect(
|
95
|
+
expect(@followSpy).not.toHaveBeenCalled()
|
83
96
|
|
84
97
|
it 'does nothing if shift is pressed during mousedown', ->
|
85
98
|
Trigger.mousedown(@$link, shiftKey: true)
|
86
|
-
expect(
|
99
|
+
expect(@followSpy).not.toHaveBeenCalled()
|
87
100
|
|
88
101
|
it 'does nothing if ctrl is pressed during mousedown', ->
|
89
102
|
Trigger.mousedown(@$link, ctrlKey: true)
|
90
|
-
expect(
|
103
|
+
expect(@followSpy).not.toHaveBeenCalled()
|
91
104
|
|
92
105
|
it 'does nothing if meta is pressed during mousedown', ->
|
93
106
|
Trigger.mousedown(@$link, metaKey: true)
|
94
|
-
expect(
|
107
|
+
expect(@followSpy).not.toHaveBeenCalled()
|
95
108
|
|
@@ -9,7 +9,6 @@ describe 'up.modal', ->
|
|
9
9
|
describe 'up.modal.open', ->
|
10
10
|
|
11
11
|
it "loads the given link's destination in a dialog window", (done) ->
|
12
|
-
jasmine.Ajax.install()
|
13
12
|
$link = affix('a[href="/path/to"][up-modal=".middle"]').text('link')
|
14
13
|
promise = up.modal.open($link)
|
15
14
|
request = jasmine.Ajax.requests.mostRecent()
|
@@ -14,7 +14,6 @@ describe 'up.navigation', ->
|
|
14
14
|
it 'marks a link as .up-current if it links to the current URL, but is missing a trailing slash', ->
|
15
15
|
$link = affix('a[href="/foo"][up-target=".main"]')
|
16
16
|
affix('.main')
|
17
|
-
jasmine.Ajax.install()
|
18
17
|
$link.click()
|
19
18
|
jasmine.Ajax.requests.mostRecent().respondWith
|
20
19
|
status: 200
|
@@ -26,7 +25,6 @@ describe 'up.navigation', ->
|
|
26
25
|
it 'marks a link as .up-current if it links to the current URL, but has an extra trailing slash', ->
|
27
26
|
$link = affix('a[href="/foo/"][up-target=".main"]')
|
28
27
|
affix('.main')
|
29
|
-
jasmine.Ajax.install()
|
30
28
|
$link.click()
|
31
29
|
jasmine.Ajax.requests.mostRecent().respondWith
|
32
30
|
status: 200
|
@@ -40,7 +38,6 @@ describe 'up.navigation', ->
|
|
40
38
|
it 'marks clicked links as .up-active until the request finishes', ->
|
41
39
|
$link = affix('a[href="/foo"][up-target=".main"]')
|
42
40
|
affix('.main')
|
43
|
-
jasmine.Ajax.install()
|
44
41
|
$link.click()
|
45
42
|
# console.log($link)
|
46
43
|
expect($link).toHaveClass('up-active')
|
@@ -54,7 +51,6 @@ describe 'up.navigation', ->
|
|
54
51
|
it 'marks links with [up-instant] on mousedown as .up-active until the request finishes', ->
|
55
52
|
$link = affix('a[href="/foo"][up-instant][up-target=".main"]')
|
56
53
|
affix('.main')
|
57
|
-
jasmine.Ajax.install()
|
58
54
|
Trigger.mousedown($link)
|
59
55
|
expect($link).toHaveClass('up-active')
|
60
56
|
jasmine.Ajax.requests.mostRecent().respondWith
|
@@ -68,7 +64,6 @@ describe 'up.navigation', ->
|
|
68
64
|
$area = affix('div[up-follow] a[href="/foo"][up-target=".main"]')
|
69
65
|
$link = $area.find('a')
|
70
66
|
affix('.main')
|
71
|
-
jasmine.Ajax.install()
|
72
67
|
$link.click()
|
73
68
|
expect($area).toHaveClass('up-active')
|
74
69
|
jasmine.Ajax.requests.mostRecent().respondWith
|
@@ -1,14 +1,103 @@
|
|
1
1
|
describe 'up.proxy', ->
|
2
2
|
|
3
|
+
u = up.util
|
4
|
+
|
3
5
|
describe 'Javascript functions', ->
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
|
7
|
+
beforeEach ->
|
8
|
+
jasmine.clock().install()
|
9
|
+
jasmine.clock().mockDate()
|
8
10
|
|
9
11
|
describe 'up.proxy.ajax', ->
|
10
12
|
|
11
|
-
it '
|
13
|
+
it 'caches server responses for 5 minutes', ->
|
14
|
+
responses = []
|
15
|
+
|
16
|
+
# Send the same request for the same path, 3 minutes apart
|
17
|
+
up.proxy.ajax(url: '/foo').then (data) -> responses.push(data)
|
18
|
+
jasmine.clock().tick(3 * 60 * 1000)
|
19
|
+
up.proxy.ajax(url: '/foo').then (data) -> responses.push(data)
|
20
|
+
|
21
|
+
# See that only a single network request was triggered
|
22
|
+
expect(jasmine.Ajax.requests.count()).toEqual(1)
|
23
|
+
expect(responses).toEqual([])
|
24
|
+
|
25
|
+
jasmine.Ajax.requests.mostRecent().respondWith
|
26
|
+
status: 200
|
27
|
+
contentType: 'text/html'
|
28
|
+
responseText: 'foo'
|
29
|
+
|
30
|
+
# See that both requests have been fulfilled by the same response
|
31
|
+
expect(responses).toEqual(['foo', 'foo'])
|
32
|
+
|
33
|
+
# Send another request after another 3 minutes
|
34
|
+
# The clock is now a total of 6 minutes after the first request,
|
35
|
+
# exceeding the cache's retention time of 5 minutes.
|
36
|
+
jasmine.clock().tick(3 * 60 * 1000)
|
37
|
+
up.proxy.ajax(url: '/foo').then (data) -> responses.push(data)
|
38
|
+
|
39
|
+
# See that we have triggered a second request
|
40
|
+
expect(jasmine.Ajax.requests.count()).toEqual(2)
|
41
|
+
|
42
|
+
jasmine.Ajax.requests.mostRecent().respondWith
|
43
|
+
status: 200
|
44
|
+
contentType: 'text/html'
|
45
|
+
responseText: 'bar'
|
46
|
+
|
47
|
+
expect(responses).toEqual(['foo', 'foo', 'bar'])
|
48
|
+
|
49
|
+
it "doesn't reuse responses for different paths", ->
|
50
|
+
responses = []
|
51
|
+
|
52
|
+
up.proxy.ajax(url: '/foo').then (data) -> responses.push(data)
|
53
|
+
up.proxy.ajax(url: '/bar').then (data) -> responses.push(data)
|
54
|
+
|
55
|
+
# See that only a single network request was triggered
|
56
|
+
expect(jasmine.Ajax.requests.count()).toEqual(2)
|
57
|
+
|
58
|
+
jasmine.Ajax.requests.at(0).respondWith
|
59
|
+
status: 200
|
60
|
+
contentType: 'text/html'
|
61
|
+
responseText: 'foo'
|
62
|
+
|
63
|
+
jasmine.Ajax.requests.at(1).respondWith
|
64
|
+
status: 200
|
65
|
+
contentType: 'text/html'
|
66
|
+
responseText: 'bar'
|
67
|
+
|
68
|
+
expect(responses).toEqual(['foo', 'bar'])
|
69
|
+
|
70
|
+
u.each ['GET', 'HEAD', 'OPTIONS'], (method) ->
|
71
|
+
|
72
|
+
it "caches #{method} requests", ->
|
73
|
+
u.times 2, -> up.proxy.ajax(url: '/foo', method: method)
|
74
|
+
expect(jasmine.Ajax.requests.count()).toEqual(1)
|
75
|
+
|
76
|
+
it "does not cache #{method} requests with cache: false option", ->
|
77
|
+
u.times 2, -> up.proxy.ajax(url: '/foo', method: method, cache: false)
|
78
|
+
expect(jasmine.Ajax.requests.count()).toEqual(2)
|
79
|
+
|
80
|
+
u.each ['POST', 'PUT', 'DELETE', 'DESTROY'], (method) ->
|
81
|
+
|
82
|
+
it "does not cache #{method} requests", ->
|
83
|
+
u.times 2, -> up.proxy.ajax(url: '/foo', method: method)
|
84
|
+
expect(jasmine.Ajax.requests.count()).toEqual(2)
|
85
|
+
|
86
|
+
it "caches #{method} requests with cache: true option", ->
|
87
|
+
u.times 2, -> up.proxy.ajax(url: '/foo', method: method, cache: true)
|
88
|
+
expect(jasmine.Ajax.requests.count()).toEqual(1)
|
89
|
+
|
90
|
+
describe 'up.proxy.preload', ->
|
91
|
+
|
92
|
+
it "loads and caches the given link's destination", ->
|
93
|
+
$link = affix('a[href="/path"]')
|
94
|
+
up.proxy.preload($link)
|
95
|
+
expect(u.isPromise(up.proxy.get(url: '/path'))).toBe(true)
|
96
|
+
|
97
|
+
it "does not load a link whose method has side-effects", ->
|
98
|
+
$link = affix('a[href="/path"][data-method="post"]')
|
99
|
+
up.proxy.preload($link)
|
100
|
+
expect(up.proxy.get(url: '/path')).toBeUndefined()
|
12
101
|
|
13
102
|
describe 'up.proxy.get', ->
|
14
103
|
|
@@ -20,8 +109,14 @@ describe 'up.proxy', ->
|
|
20
109
|
|
21
110
|
describe 'up.proxy.alias', ->
|
22
111
|
|
23
|
-
it '
|
112
|
+
it 'uses an existing cache entry for another request (used in case of redirects)'
|
24
113
|
|
25
114
|
describe 'up.proxy.clear', ->
|
26
115
|
|
27
|
-
it '
|
116
|
+
it 'removes all cache entries'
|
117
|
+
|
118
|
+
describe 'unobtrusive behavior', ->
|
119
|
+
|
120
|
+
describe '[up-preload]', ->
|
121
|
+
|
122
|
+
it 'preloads the link destination after a delay'
|
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.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henning Koch
|
@@ -188,6 +188,9 @@ files:
|
|
188
188
|
- spec_app/public/robots.txt
|
189
189
|
- spec_app/script/cucumber
|
190
190
|
- spec_app/spec/javascripts/helpers/index.js.coffee
|
191
|
+
- spec_app/spec/javascripts/helpers/knife.js.coffee
|
192
|
+
- spec_app/spec/javascripts/helpers/mock_ajax.js.coffee
|
193
|
+
- spec_app/spec/javascripts/helpers/mock_clock.js.coffee
|
191
194
|
- spec_app/spec/javascripts/helpers/reset_path.js.coffee
|
192
195
|
- spec_app/spec/javascripts/helpers/reset_up.js.coffee
|
193
196
|
- spec_app/spec/javascripts/helpers/set_timer.js.coffee
|