zepto.min.js 26.2 KB
(function(t){String.prototype.trim===t&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),Array.prototype.reduce===t&&(Array.prototype.reduce=function(n){if(this===void 0||this===null)throw new TypeError;var e=Object(this),i=e.length>>>0,r=0,o;if(typeof n!="function")throw new TypeError;if(i==0&&arguments.length==1)throw new TypeError;if(arguments.length>=2)o=arguments[1];else do{if(r in e){o=e[r++];break}if(++r>=i)throw new TypeError}while(!0);while(r<i)r in e&&(o=n.call(t,o,e[r],r,e)),r++;return o})})();var Zepto=function(){function t(t){return t==null?String(t):V[J.call(t)]||"object"}function n(n){return t(n)=="function"}function e(t){return t!=null&&t==t.window}function i(t){return t!=null&&t.nodeType==t.DOCUMENT_NODE}function r(n){return t(n)=="object"}function o(t){return r(t)&&!e(t)&&t.__proto__==Object.prototype}function a(t){return t instanceof Array}function s(t){return typeof t.length=="number"}function u(t){return C.call(t,function(t){return t!=null})}function c(t){return t.length>0?j.fn.concat.apply([],t):t}function l(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function f(t){return t in k?k[t]:k[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function h(t,n){return typeof n=="number"&&!_[l(t)]?n+"px":n}function p(t){var n,e;return A[t]||(n=P.createElement(t),P.body.appendChild(n),e=$(n,"").getPropertyValue("display"),n.parentNode.removeChild(n),e=="none"&&(e="block"),A[t]=e),A[t]}function d(t){return"children"in t?O.call(t.children):j.map(t.childNodes,function(t){if(t.nodeType==1)return t})}function m(t,n,e){for(T in n)e&&(o(n[T])||a(n[T]))?(o(n[T])&&!o(t[T])&&(t[T]={}),a(n[T])&&!a(t[T])&&(t[T]=[]),m(t[T],n[T],e)):n[T]!==E&&(t[T]=n[T])}function v(t,n){return n===E?j(t):j(t).filter(n)}function g(t,e,i,r){return n(e)?e.call(t,i,r):e}function y(t,n,e){e==null?t.removeAttribute(n):t.setAttribute(n,e)}function b(t,n){var e=t.className,i=e&&e.baseVal!==E;if(n===E)return i?e.baseVal:e;i?e.baseVal=n:t.className=n}function w(t){var n;try{return t?t=="true"||(t=="false"?!1:t=="null"?null:isNaN(n=Number(t))?/^[\[\{]/.test(t)?j.parseJSON(t):t:n):t}catch(n){return t}}function x(t,n){n(t);for(var e in t.childNodes)x(t.childNodes[e],n)}var E,T,j,S,N=[],O=N.slice,C=N.filter,P=window.document,A={},k={},$=P.defaultView.getComputedStyle,_={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},M=/^\s*<(\w+|!)[^>]*>/,Z=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,z=/^(?:body|html)$/i,R=["val","css","html","text","data","width","height","offset"],D=["after","prepend","before","append"],L=P.createElement("table"),q=P.createElement("tr"),F={tr:P.createElement("tbody"),tbody:L,thead:L,tfoot:L,td:q,th:q,"*":P.createElement("div")},B=/complete|loaded|interactive/,I=/^\.([\w-]+)$/,H=/^#([\w-]*)$/,U=/^[\w-]+$/,V={},J=V.toString,X={},W,Y,G=P.createElement("div");return X.matches=function(t,n){if(!t||t.nodeType!==1)return!1;var e=t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(e)return e.call(t,n);var i,r=t.parentNode,o=!r;return o&&(r=G).appendChild(t),i=~X.qsa(r,n).indexOf(t),o&&G.removeChild(t),i},W=function(t){return t.replace(/-+(.)?/g,function(t,n){return n?n.toUpperCase():""})},Y=function(t){return C.call(t,function(n,e){return t.indexOf(n)==e})},X.fragment=function(t,n,e){t.replace&&(t=t.replace(Z,"<$1></$2>")),n===E&&(n=M.test(t)&&RegExp.$1),n in F||(n="*");var i,r,a=F[n];return a.innerHTML=""+t,r=j.each(O.call(a.childNodes),function(){a.removeChild(this)}),o(e)&&(i=j(r),j.each(e,function(t,n){R.indexOf(t)>-1?i[t](n):i.attr(t,n)})),r},X.Z=function(t,n){return t=t||[],t.__proto__=j.fn,t.selector=n||"",t},X.isZ=function(t){return t instanceof X.Z},X.init=function(t,e){if(!t)return X.Z();if(n(t))return j(P).ready(t);if(X.isZ(t))return t;var i;if(a(t))i=u(t);else if(r(t))i=[o(t)?j.extend({},t):t],t=null;else if(M.test(t))i=X.fragment(t.trim(),RegExp.$1,e),t=null;else{if(e!==E)return j(e).find(t);i=X.qsa(P,t)}return X.Z(i,t)},j=function(t,n){return X.init(t,n)},j.extend=function(t){var n,e=O.call(arguments,1);return typeof t=="boolean"&&(n=t,t=e.shift()),e.forEach(function(e){m(t,e,n)}),t},X.qsa=function(t,n){var e;return i(t)&&H.test(n)?(e=t.getElementById(RegExp.$1))?[e]:[]:t.nodeType!==1&&t.nodeType!==9?[]:O.call(I.test(n)?t.getElementsByClassName(RegExp.$1):U.test(n)?t.getElementsByTagName(n):t.querySelectorAll(n))},j.contains=function(t,n){return t!==n&&t.contains(n)},j.type=t,j.isFunction=n,j.isWindow=e,j.isArray=a,j.isPlainObject=o,j.isEmptyObject=function(t){var n;for(n in t)return!1;return!0},j.inArray=function(t,n,e){return N.indexOf.call(n,t,e)},j.camelCase=W,j.trim=function(t){return t.trim()},j.uuid=0,j.support={},j.expr={},j.map=function(t,n){var e,i=[],r,o;if(s(t))for(r=0;r<t.length;r++)e=n(t[r],r),e!=null&&i.push(e);else for(o in t)e=n(t[o],o),e!=null&&i.push(e);return c(i)},j.each=function(t,n){var e,i;if(s(t)){for(e=0;e<t.length;e++)if(n.call(t[e],e,t[e])===!1)return t}else for(i in t)if(n.call(t[i],i,t[i])===!1)return t;return t},j.grep=function(t,n){return C.call(t,n)},window.JSON&&(j.parseJSON=JSON.parse),j.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(t,n){V["[object "+n+"]"]=n.toLowerCase()}),j.fn={forEach:N.forEach,reduce:N.reduce,push:N.push,sort:N.sort,indexOf:N.indexOf,concat:N.concat,map:function(t){return j(j.map(this,function(n,e){return t.call(n,e,n)}))},slice:function(){return j(O.apply(this,arguments))},ready:function(t){return B.test(P.readyState)?t(j):P.addEventListener("DOMContentLoaded",function(){t(j)},!1),this},get:function(t){return t===E?O.call(this):this[t>=0?t:t+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){this.parentNode!=null&&this.parentNode.removeChild(this)})},each:function(t){return N.every.call(this,function(n,e){return t.call(n,e,n)!==!1}),this},filter:function(t){return n(t)?this.not(this.not(t)):j(C.call(this,function(n){return X.matches(n,t)}))},add:function(t,n){return j(Y(this.concat(j(t,n))))},is:function(t){return this.length>0&&X.matches(this[0],t)},not:function(t){var e=[];if(n(t)&&t.call!==E)this.each(function(n){t.call(this,n)||e.push(this)});else{var i=typeof t=="string"?this.filter(t):s(t)&&n(t.item)?O.call(t):j(t);this.forEach(function(t){i.indexOf(t)<0&&e.push(t)})}return j(e)},has:function(t){return this.filter(function(){return r(t)?j.contains(this,t):j(this).find(t).size()})},eq:function(t){return t===-1?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!r(t)?t:j(t)},last:function(){var t=this[this.length-1];return t&&!r(t)?t:j(t)},find:function(t){var n,e=this;return typeof t=="object"?n=j(t).filter(function(){var t=this;return N.some.call(e,function(n){return j.contains(n,t)})}):this.length==1?n=j(X.qsa(this[0],t)):n=this.map(function(){return X.qsa(this,t)}),n},closest:function(t,n){var e=this[0],r=!1;typeof t=="object"&&(r=j(t));while(e&&!(r?r.indexOf(e)>=0:X.matches(e,t)))e=e!==n&&!i(e)&&e.parentNode;return j(e)},parents:function(t){var n=[],e=this;while(e.length>0)e=j.map(e,function(t){if((t=t.parentNode)&&!i(t)&&n.indexOf(t)<0)return n.push(t),t});return v(n,t)},parent:function(t){return v(Y(this.pluck("parentNode")),t)},children:function(t){return v(this.map(function(){return d(this)}),t)},contents:function(){return this.map(function(){return O.call(this.childNodes)})},siblings:function(t){return v(this.map(function(t,n){return C.call(d(n.parentNode),function(t){return t!==n})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return j.map(this,function(n){return n[t]})},show:function(){return this.each(function(){this.style.display=="none"&&(this.style.display=null),$(this,"").getPropertyValue("display")=="none"&&(this.style.display=p(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var e=n(t);if(this[0]&&!e)var i=j(t).get(0),r=i.parentNode||this.length>1;return this.each(function(n){j(this).wrapAll(e?t.call(this,n):r?i.cloneNode(!0):i)})},wrapAll:function(t){if(this[0]){j(this[0]).before(t=j(t));var n;while((n=t.children()).length)t=n.first();j(t).append(this)}return this},wrapInner:function(t){var e=n(t);return this.each(function(n){var i=j(this),r=i.contents(),o=e?t.call(this,n):t;r.length?r.wrapAll(o):i.append(o)})},unwrap:function(){return this.parent().each(function(){j(this).replaceWith(j(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(t){return this.each(function(){var n=j(this);(t===E?n.css("display")=="none":t)?n.show():n.hide()})},prev:function(t){return j(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return j(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return t===E?this.length>0?this[0].innerHTML:null:this.each(function(n){var e=this.innerHTML;j(this).empty().append(g(this,t,n,e))})},text:function(t){return t===E?this.length>0?this[0].textContent:null:this.each(function(){this.textContent=t})},attr:function(t,n){var e;return typeof t=="string"&&n===E?this.length==0||this[0].nodeType!==1?E:t=="value"&&this[0].nodeName=="INPUT"?this.val():!(e=this[0].getAttribute(t))&&t in this[0]?this[0][t]:e:this.each(function(e){if(this.nodeType!==1)return;if(r(t))for(T in t)y(this,T,t[T]);else y(this,t,g(this,n,e,this.getAttribute(t)))})},removeAttr:function(t){return this.each(function(){this.nodeType===1&&y(this,t)})},prop:function(t,n){return n===E?this[0]&&this[0][t]:this.each(function(e){this[t]=g(this,n,e,this[t])})},data:function(t,n){var e=this.attr("data-"+l(t),n);return e!==null?w(e):E},val:function(t){return t===E?this[0]&&(this[0].multiple?j(this[0]).find("option").filter(function(t){return this.selected}).pluck("value"):this[0].value):this.each(function(n){this.value=g(this,t,n,this.value)})},offset:function(t){if(t)return this.each(function(n){var e=j(this),i=g(this,t,n,e.offset()),r=e.offsetParent().offset(),o={top:i.top-r.top,left:i.left-r.left};e.css("position")=="static"&&(o.position="relative"),e.css(o)});if(this.length==0)return null;var n=this[0].getBoundingClientRect();return{left:n.left+window.pageXOffset,top:n.top+window.pageYOffset,width:Math.round(n.width),height:Math.round(n.height)}},css:function(n,e){if(arguments.length<2&&typeof n=="string")return this[0]&&(this[0].style[W(n)]||$(this[0],"").getPropertyValue(n));var i="";if(t(n)=="string")!e&&e!==0?this.each(function(){this.style.removeProperty(l(n))}):i=l(n)+":"+h(n,e);else for(T in n)!n[T]&&n[T]!==0?this.each(function(){this.style.removeProperty(l(T))}):i+=l(T)+":"+h(T,n[T])+";";return this.each(function(){this.style.cssText+=";"+i})},index:function(t){return t?this.indexOf(j(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return N.some.call(this,function(t){return this.test(b(t))},f(t))},addClass:function(t){return this.each(function(n){S=[];var e=b(this),i=g(this,t,n,e);i.split(/\s+/g).forEach(function(t){j(this).hasClass(t)||S.push(t)},this),S.length&&b(this,e+(e?" ":"")+S.join(" "))})},removeClass:function(t){return this.each(function(n){if(t===E)return b(this,"");S=b(this),g(this,t,n,S).split(/\s+/g).forEach(function(t){S=S.replace(f(t)," ")}),b(this,S.trim())})},toggleClass:function(t,n){return this.each(function(e){var i=j(this),r=g(this,t,e,b(this));r.split(/\s+/g).forEach(function(t){(n===E?!i.hasClass(t):n)?i.addClass(t):i.removeClass(t)})})},scrollTop:function(){if(!this.length)return;return"scrollTop"in this[0]?this[0].scrollTop:this[0].scrollY},position:function(){if(!this.length)return;var t=this[0],n=this.offsetParent(),e=this.offset(),i=z.test(n[0].nodeName)?{top:0,left:0}:n.offset();return e.top-=parseFloat(j(t).css("margin-top"))||0,e.left-=parseFloat(j(t).css("margin-left"))||0,i.top+=parseFloat(j(n[0]).css("border-top-width"))||0,i.left+=parseFloat(j(n[0]).css("border-left-width"))||0,{top:e.top-i.top,left:e.left-i.left}},offsetParent:function(){return this.map(function(){var t=this.offsetParent||P.body;while(t&&!z.test(t.nodeName)&&j(t).css("position")=="static")t=t.offsetParent;return t})}},j.fn.detach=j.fn.remove,["width","height"].forEach(function(t){j.fn[t]=function(n){var r,o=this[0],a=t.replace(/./,function(t){return t[0].toUpperCase()});return n===E?e(o)?o["inner"+a]:i(o)?o.documentElement["offset"+a]:(r=this.offset())&&r[t]:this.each(function(e){o=j(this),o.css(t,g(this,n,e,o[t]()))})}}),D.forEach(function(n,e){var i=e%2;j.fn[n]=function(){var n,r=j.map(arguments,function(e){return n=t(e),n=="object"||n=="array"||e==null?e:X.fragment(e)}),o,a=this.length>1;return r.length<1?this:this.each(function(t,n){o=i?n:n.parentNode,n=e==0?n.nextSibling:e==1?n.firstChild:e==2?n:null,r.forEach(function(t){if(a)t=t.cloneNode(!0);else if(!o)return j(t).remove();x(o.insertBefore(t,n),function(t){t.nodeName!=null&&t.nodeName.toUpperCase()==="SCRIPT"&&(!t.type||t.type==="text/javascript")&&!t.src&&window.eval.call(window,t.innerHTML)})})})},j.fn[i?n+"To":"insert"+(e?"Before":"After")]=function(t){return j(t)[n](this),this}}),X.Z.prototype=j.fn,X.uniq=Y,X.deserializeValue=w,j.zepto=X,j}();window.Zepto=Zepto,"$"in window||(window.$=Zepto),function(t){function n(t){var n=this.os={},e=this.browser={},i=t.match(/WebKit\/([\d.]+)/),r=t.match(/(Android)\s+([\d.]+)/),o=t.match(/(iPad).*OS\s([\d_]+)/),a=!o&&t.match(/(iPhone\sOS)\s([\d_]+)/),s=t.match(/(webOS|hpwOS)[\s\/]([\d.]+)/),u=s&&t.match(/TouchPad/),c=t.match(/Kindle\/([\d.]+)/),l=t.match(/Silk\/([\d._]+)/),f=t.match(/(BlackBerry).*Version\/([\d.]+)/),h=t.match(/(BB10).*Version\/([\d.]+)/),p=t.match(/(RIM\sTablet\sOS)\s([\d.]+)/),d=t.match(/PlayBook/),m=t.match(/Chrome\/([\d.]+)/)||t.match(/CriOS\/([\d.]+)/),v=t.match(/Firefox\/([\d.]+)/);if(e.webkit=!!i)e.version=i[1];r&&(n.android=!0,n.version=r[2]),a&&(n.ios=n.iphone=!0,n.version=a[2].replace(/_/g,".")),o&&(n.ios=n.ipad=!0,n.version=o[2].replace(/_/g,".")),s&&(n.webos=!0,n.version=s[2]),u&&(n.touchpad=!0),f&&(n.blackberry=!0,n.version=f[2]),h&&(n.bb10=!0,n.version=h[2]),p&&(n.rimtabletos=!0,n.version=p[2]),d&&(e.playbook=!0),c&&(n.kindle=!0,n.version=c[1]),l&&(e.silk=!0,e.version=l[1]),!l&&n.android&&t.match(/Kindle Fire/)&&(e.silk=!0),m&&(e.chrome=!0,e.version=m[1]),v&&(e.firefox=!0,e.version=v[1]),n.tablet=!!(o||d||r&&!t.match(/Mobile/)||v&&t.match(/Tablet/)),n.phone=!n.tablet&&!!(r||a||s||f||h||m&&t.match(/Android/)||m&&t.match(/CriOS\/([\d.]+)/)||v&&t.match(/Mobile/))}n.call(t,navigator.userAgent),t.__detect=n}(Zepto),function(t){function n(t){return t._zid||(t._zid=d++)}function e(t,e,o,a){e=i(e);if(e.ns)var s=r(e.ns);return(p[n(t)]||[]).filter(function(t){return t&&(!e.e||t.e==e.e)&&(!e.ns||s.test(t.ns))&&(!o||n(t.fn)===n(o))&&(!a||t.sel==a)})}function i(t){var n=(""+t).split(".");return{e:n[0],ns:n.slice(1).sort().join(" ")}}function r(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function o(n,e,i){t.type(n)!="string"?t.each(n,i):n.split(/\s/).forEach(function(t){i(t,e)})}function a(t,n){return t.del&&(t.e=="focus"||t.e=="blur")||!!n}function s(t){return v[t]||t}function u(e,r,u,c,l,f){var h=n(e),d=p[h]||(p[h]=[]);o(r,u,function(n,r){var o=i(n);o.fn=r,o.sel=c,o.e in v&&(r=function(n){var e=n.relatedTarget;if(!e||e!==this&&!t.contains(this,e))return o.fn.apply(this,arguments)}),o.del=l&&l(r,n);var u=o.del||r;o.proxy=function(t){var n=u.apply(e,[t].concat(t.data));return n===!1&&(t.preventDefault(),t.stopPropagation()),n},o.i=d.length,d.push(o),e.addEventListener(s(o.e),o.proxy,a(o,f))})}function c(t,i,r,u,c){var l=n(t);o(i||"",r,function(n,i){e(t,n,i,u).forEach(function(n){delete p[l][n.i],t.removeEventListener(s(n.e),n.proxy,a(n,c))})})}function l(n){var e,i={originalEvent:n};for(e in n)!b.test(e)&&n[e]!==undefined&&(i[e]=n[e]);return t.each(w,function(t,e){i[t]=function(){return this[e]=g,n[t].apply(n,arguments)},i[e]=y}),i}function f(t){if(!("defaultPrevented"in t)){t.defaultPrevented=!1;var n=t.preventDefault;t.preventDefault=function(){this.defaultPrevented=!0,n.call(this)}}}var h=t.zepto.qsa,p={},d=1,m={},v={mouseenter:"mouseover",mouseleave:"mouseout"};m.click=m.mousedown=m.mouseup=m.mousemove="MouseEvents",t.event={add:u,remove:c},t.proxy=function(e,i){if(t.isFunction(e)){var r=function(){return e.apply(i,arguments)};return r._zid=n(e),r}if(typeof i=="string")return t.proxy(e[i],e);throw new TypeError("expected function")},t.fn.bind=function(t,n){return this.each(function(){u(this,t,n)})},t.fn.unbind=function(t,n){return this.each(function(){c(this,t,n)})},t.fn.one=function(t,n){return this.each(function(e,i){u(this,t,n,null,function(t,n){return function(){var e=t.apply(i,arguments);return c(i,n,t),e}})})};var g=function(){return!0},y=function(){return!1},b=/^([A-Z]|layer[XY]$)/,w={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(n,e,i){return this.each(function(r,o){u(o,e,i,n,function(e){return function(i){var r,a=t(i.target).closest(n,o).get(0);if(a)return r=t.extend(l(i),{currentTarget:a,liveFired:o}),e.apply(a,[r].concat([].slice.call(arguments,1)))}})})},t.fn.undelegate=function(t,n,e){return this.each(function(){c(this,n,e,t)})},t.fn.live=function(n,e){return t(document.body).delegate(this.selector,n,e),this},t.fn.die=function(n,e){return t(document.body).undelegate(this.selector,n,e),this},t.fn.on=function(n,e,i){return!e||t.isFunction(e)?this.bind(n,e||i):this.delegate(e,n,i)},t.fn.off=function(n,e,i){return!e||t.isFunction(e)?this.unbind(n,e||i):this.undelegate(e,n,i)},t.fn.trigger=function(n,e){if(typeof n=="string"||t.isPlainObject(n))n=t.Event(n);return f(n),n.data=e,this.each(function(){"dispatchEvent"in this&&this.dispatchEvent(n)})},t.fn.triggerHandler=function(n,i){var r,o;return this.each(function(a,s){r=l(typeof n=="string"?t.Event(n):n),r.data=i,r.target=s,t.each(e(s,n.type||n),function(t,n){o=n.proxy(r);if(r.isImmediatePropagationStopped())return!1})}),o},"focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(n){t.fn[n]=function(t){return t?this.bind(n,t):this.trigger(n)}}),["focus","blur"].forEach(function(n){t.fn[n]=function(t){return t?this.bind(n,t):this.each(function(){try{this[n]()}catch(t){}}),this}}),t.Event=function(t,n){typeof t!="string"&&(n=t,t=n.type);var e=document.createEvent(m[t]||"Events"),i=!0;if(n)for(var r in n)r=="bubbles"?i=!!n[r]:e[r]=n[r];return e.initEvent(t,i,!0,null,null,null,null,null,null,null,null,null,null,null,null),e.isDefaultPrevented=function(){return this.defaultPrevented},e}}(Zepto),function(t){function n(n,e,i){var r=t.Event(e);return t(n).trigger(r,i),!r.defaultPrevented}function e(t,e,i,r){if(t.global)return n(e||v,i,r)}function i(n){n.global&&t.active++===0&&e(n,null,"ajaxStart")}function r(n){n.global&&!--t.active&&e(n,null,"ajaxStop")}function o(t,n){var i=n.context;if(n.beforeSend.call(i,t,n)===!1||e(n,i,"ajaxBeforeSend",[t,n])===!1)return!1;e(n,i,"ajaxSend",[t,n])}function a(t,n,i){var r=i.context,o="success";i.success.call(r,t,o,n),e(i,r,"ajaxSuccess",[n,i,t]),u(o,n,i)}function s(t,n,i,r){var o=r.context;r.error.call(o,i,n,t),e(r,o,"ajaxError",[i,r,t]),u(n,i,r)}function u(t,n,i){var o=i.context;i.complete.call(o,n,t),e(i,o,"ajaxComplete",[n,i]),r(i)}function c(){}function l(t){return t&&(t=t.split(";",2)[0]),t&&(t==T?"html":t==E?"json":w.test(t)?"script":x.test(t)&&"xml")||"text"}function f(t,n){return(t+"&"+n).replace(/[&?]{1,2}/,"?")}function h(n){n.processData&&n.data&&t.type(n.data)!="string"&&(n.data=t.param(n.data,n.traditional)),n.data&&(!n.type||n.type.toUpperCase()=="GET")&&(n.url=f(n.url,n.data))}function p(n,e,i,r){var o=!t.isFunction(e);return{url:n,data:o?e:undefined,success:o?t.isFunction(i)?i:undefined:e,dataType:o?r||i:i}}function d(n,e,i,r){var o,a=t.isArray(e);t.each(e,function(e,s){o=t.type(s),r&&(e=i?r:r+"["+(a?"":e)+"]"),!r&&a?n.add(s.name,s.value):o=="array"||!i&&o=="object"?d(n,s,i,e):n.add(e,s)})}var m=0,v=window.document,g,y,b=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,w=/^(?:text|application)\/javascript/i,x=/^(?:text|application)\/xml/i,E="application/json",T="text/html",j=/^\s*$/;t.active=0,t.ajaxJSONP=function(n){if("type"in n){var e="jsonp"+ ++m,i=v.createElement("script"),r=function(){clearTimeout(f),t(i).remove(),delete window[e]},u=function(t){r();if(!t||t=="timeout")window[e]=c;s(null,t||"abort",l,n)},l={abort:u},f;return o(l,n)===!1?(u("abort"),!1):(window[e]=function(t){r(),a(t,l,n)},i.onerror=function(){u("error")},i.src=n.url.replace(/=\?/,"="+e),t("head").append(i),n.timeout>0&&(f=setTimeout(function(){u("timeout")},n.timeout)),l)}return t.ajax(n)},t.ajaxSettings={type:"GET",beforeSend:c,success:c,error:c,complete:c,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript",json:E,xml:"application/xml, text/xml",html:T,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},t.ajax=function(n){var e=t.extend({},n||{});for(g in t.ajaxSettings)e[g]===undefined&&(e[g]=t.ajaxSettings[g]);i(e),e.crossDomain||(e.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(e.url)&&RegExp.$2!=window.location.host),e.url||(e.url=window.location.toString()),h(e),e.cache===!1&&(e.url=f(e.url,"_="+Date.now()));var r=e.dataType,u=/=\?/.test(e.url);if(r=="jsonp"||u)return u||(e.url=f(e.url,"callback=?")),t.ajaxJSONP(e);var p=e.accepts[r],d={},m=/^([\w-]+:)\/\//.test(e.url)?RegExp.$1:window.location.protocol,v=e.xhr(),b;e.crossDomain||(d["X-Requested-With"]="XMLHttpRequest"),p&&(d.Accept=p,p.indexOf(",")>-1&&(p=p.split(",",2)[0]),v.overrideMimeType&&v.overrideMimeType(p));if(e.contentType||e.contentType!==!1&&e.data&&e.type.toUpperCase()!="GET")d["Content-Type"]=e.contentType||"application/x-www-form-urlencoded";e.headers=t.extend(d,e.headers||{}),v.onreadystatechange=function(){if(v.readyState==4){v.onreadystatechange=c,clearTimeout(b);var n,i=!1;if(v.status>=200&&v.status<300||v.status==304||v.status==0&&m=="file:"){r=r||l(v.getResponseHeader("content-type")),n=v.responseText;try{r=="script"?(1,eval)(n):r=="xml"?n=v.responseXML:r=="json"&&(n=j.test(n)?null:t.parseJSON(n))}catch(t){i=t}i?s(i,"parsererror",v,e):a(n,v,e)}else s(null,v.status?"error":"abort",v,e)}};var w="async"in e?e.async:!0;v.open(e.type,e.url,w);for(y in e.headers)v.setRequestHeader(y,e.headers[y]);return o(v,e)===!1?(v.abort(),!1):(e.timeout>0&&(b=setTimeout(function(){v.onreadystatechange=c,v.abort(),s(null,"timeout",v,e)},e.timeout)),v.send(e.data?e.data:null),v)},t.get=function(n,e,i,r){return t.ajax(p.apply(null,arguments))},t.post=function(n,e,i,r){var o=p.apply(null,arguments);return o.type="POST",t.ajax(o)},t.getJSON=function(n,e,i){var r=p.apply(null,arguments);return r.dataType="json",t.ajax(r)},t.fn.load=function(n,e,i){if(!this.length)return this;var r=this,o=n.split(/\s/),a,s=p(n,e,i),u=s.success;return o.length>1&&(s.url=o[0],a=o[1]),s.success=function(n){r.html(a?t("<div>").html(n.replace(b,"")).find(a):n),u&&u.apply(r,arguments)},t.ajax(s),this};var S=encodeURIComponent;t.param=function(t,n){var e=[];return e.add=function(t,n){this.push(S(t)+"="+S(n))},d(e,t,n),e.join("&").replace(/%20/g,"+")}}(Zepto),function(t){t.fn.serializeArray=function(){var n=[],e;return t(Array.prototype.slice.call(this.get(0).elements)).each(function(){e=t(this);var i=e.attr("type");this.nodeName.toLowerCase()!="fieldset"&&!this.disabled&&i!="submit"&&i!="reset"&&i!="button"&&(i!="radio"&&i!="checkbox"||this.checked)&&n.push({name:e.attr("name"),value:e.val()})}),n},t.fn.serialize=function(){var t=[];return this.serializeArray().forEach(function(n){t.push(encodeURIComponent(n.name)+"="+encodeURIComponent(n.value))}),t.join("&")},t.fn.submit=function(n){if(n)this.bind("submit",n);else if(this.length){var e=t.Event("submit");this.eq(0).trigger(e),e.defaultPrevented||this.get(0).submit()}return this}}(Zepto),function(t,n){function e(t){return i(t.replace(/([a-z])([A-Z])/,"$1-$2"))}function i(t){return t.toLowerCase()}function r(t){return a?a+t:i(t)}var o="",a,s,u,c={Webkit:"webkit",Moz:"",O:"o",ms:"MS"},l=window.document,f=l.createElement("div"),h=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i,p,d,m,v,g,y,b,w={};t.each(c,function(t,e){if(f.style[t+"TransitionProperty"]!==n)return o="-"+i(t)+"-",a=e,!1}),p=o+"transform",w[d=o+"transition-property"]=w[m=o+"transition-duration"]=w[v=o+"transition-timing-function"]=w[g=o+"animation-name"]=w[y=o+"animation-duration"]=w[b=o+"animation-timing-function"]="",t.fx={off:a===n&&f.style.transitionProperty===n,speeds:{_default:400,fast:200,slow:600},cssPrefix:o,transitionEnd:r("TransitionEnd"),animationEnd:r("AnimationEnd")},t.fn.animate=function(n,e,i,r){return t.isPlainObject(e)&&(i=e.easing,r=e.complete,e=e.duration),e&&(e=(typeof e=="number"?e:t.fx.speeds[e]||t.fx.speeds._default)/1e3),this.anim(n,e,i,r)},t.fn.anim=function(i,r,o,a){var s,u={},c,l="",f=this,x,E=t.fx.transitionEnd;r===n&&(r=.4),t.fx.off&&(r=0);if(typeof i=="string")u[g]=i,u[y]=r+"s",u[b]=o||"linear",E=t.fx.animationEnd;else{c=[];for(s in i)h.test(s)?l+=s+"("+i[s]+") ":(u[s]=i[s],c.push(e(s)));l&&(u[p]=l,c.push(p)),r>0&&typeof i=="object"&&(u[d]=c.join(", "),u[m]=r+"s",u[v]=o||"linear")}return x=function(n){if(typeof n!="undefined"){if(n.target!==n.currentTarget)return;t(n.target).unbind(E,x)}t(this).css(w),a&&a.call(this)},r>0&&this.bind(E,x),this.size()&&this.get(0).clientLeft,this.css(u),r<=0&&setTimeout(function(){f.each(function(){x.call(this)})},0),this},f=null}(Zepto),function(t,n){function e(e,i,r,o,a){typeof i=="function"&&!a&&(a=i,i=n);var s={opacity:r};return o&&(s.scale=o,e.css(t.fx.cssPrefix+"transform-origin","0 0")),e.animate(s,i,null,a)}function i(n,i,r,o){return e(n,i,0,r,function(){s.call(t(this)),o&&o.call(this)})}var r=window.document,o=r.documentElement,a=t.fn.show,s=t.fn.hide,u=t.fn.toggle;t.fn.show=function(t,i){return a.call(this),t===n?t=0:this.css("opacity",0),e(this,t,1,"1,1",i)},t.fn.hide=function(t,e){return t===n?s.call(this):i(this,t,"0,0",e)},t.fn.toggle=function(e,i){return e===n||typeof e=="boolean"?u.call(this,e):this.each(function(){var n=t(this);n[n.css("display")=="none"?"show":"hide"](e,i)})},t.fn.fadeTo=function(t,n,i){return e(this,t,n,null,i)},t.fn.fadeIn=function(t,n){var e=this.css("opacity");return e>0?this.css("opacity",0):e=1,a.call(this).fadeTo(t,e,n)},t.fn.fadeOut=function(t,n){return i(this,t,null,n)},t.fn.fadeToggle=function(n,e){return this.each(function(){var i=t(this);i[i.css("opacity")==0||i.css("display")=="none"?"fadeIn":"fadeOut"](n,e)})}}(Zepto);