zepto.min.js 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212
  1. var Zepto = function() {
  2. function t(t) {
  3. return null == t ? String(t) : U[J.call(t)] || "object"
  4. }
  5. function e(e) {
  6. return "function" == t(e)
  7. }
  8. function n(t) {
  9. return null != t && t == t.window
  10. }
  11. function r(t) {
  12. return null != t && t.nodeType == t.DOCUMENT_NODE
  13. }
  14. function i(e) {
  15. return "object" == t(e)
  16. }
  17. function o(t) {
  18. return i(t) && !n(t) && Object.getPrototypeOf(t) == Object.prototype
  19. }
  20. function a(t) {
  21. return "number" == typeof t.length
  22. }
  23. function s(t) {
  24. return P.call(t,
  25. function(t) {
  26. return null != t
  27. })
  28. }
  29. function u(t) {
  30. return t.length > 0 ? j.fn.concat.apply([], t) : t
  31. }
  32. function c(t) {
  33. 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()
  34. }
  35. function l(t) {
  36. return t in Z ? Z[t] : Z[t] = new RegExp("(^|\\s)" + t + "(\\s|$)")
  37. }
  38. function f(t, e) {
  39. return "number" != typeof e || _[c(t)] ? e: e + "px"
  40. }
  41. function h(t) {
  42. var e, n;
  43. return L[t] || (e = A.createElement(t), A.body.appendChild(e), n = getComputedStyle(e, "").getPropertyValue("display"), e.parentNode.removeChild(e), "none" == n && (n = "block"), L[t] = n),
  44. L[t]
  45. }
  46. function p(t) {
  47. return "children" in t ? O.call(t.children) : j.map(t.childNodes,
  48. function(t) {
  49. return 1 == t.nodeType ? t: void 0
  50. })
  51. }
  52. function d(t, e, n) {
  53. for (E in e) n && (o(e[E]) || G(e[E])) ? (o(e[E]) && !o(t[E]) && (t[E] = {}), G(e[E]) && !G(t[E]) && (t[E] = []), d(t[E], e[E], n)) : e[E] !== w && (t[E] = e[E])
  54. }
  55. function m(t, e) {
  56. return null == e ? j(t) : j(t).filter(e)
  57. }
  58. function v(t, n, r, i) {
  59. return e(n) ? n.call(t, r, i) : n
  60. }
  61. function g(t, e, n) {
  62. null == n ? t.removeAttribute(e) : t.setAttribute(e, n)
  63. }
  64. function y(t, e) {
  65. var n = t.className || "",
  66. r = n && n.baseVal !== w;
  67. return e === w ? r ? n.baseVal: n: void(r ? n.baseVal = e: t.className = e)
  68. }
  69. function x(t) {
  70. try {
  71. return t ? "true" == t || "false" != t && ("null" == t ? null: +t + "" == t ? +t: /^[\[\{]/.test(t) ? j.parseJSON(t) : t) : t
  72. } catch(e) {
  73. return t
  74. }
  75. }
  76. function b(t, e) {
  77. e(t);
  78. for (var n = 0,
  79. r = t.childNodes.length; r > n; n++) b(t.childNodes[n], e)
  80. }
  81. var w, E, j, S, T, C, N = [],
  82. O = N.slice,
  83. P = N.filter,
  84. A = window.document,
  85. L = {},
  86. Z = {},
  87. _ = {
  88. "column-count": 1,
  89. columns: 1,
  90. "font-weight": 1,
  91. "line-height": 1,
  92. opacity: 1,
  93. "z-index": 1,
  94. zoom: 1
  95. },
  96. $ = /^\s*<(\w+|!)[^>]*>/,
  97. D = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
  98. M = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
  99. R = /^(?:body|html)$/i,
  100. k = /([A-Z])/g,
  101. z = ["val", "css", "html", "text", "data", "width", "height", "offset"],
  102. F = ["after", "prepend", "before", "append"],
  103. q = A.createElement("table"),
  104. H = A.createElement("tr"),
  105. I = {
  106. tr: A.createElement("tbody"),
  107. tbody: q,
  108. thead: q,
  109. tfoot: q,
  110. td: H,
  111. th: H,
  112. "*": A.createElement("div")
  113. },
  114. V = /complete|loaded|interactive/,
  115. B = /^[\w-]*$/,
  116. U = {},
  117. J = U.toString,
  118. X = {},
  119. W = A.createElement("div"),
  120. Y = {
  121. tabindex: "tabIndex",
  122. readonly: "readOnly",
  123. for: "htmlFor",
  124. class: "className",
  125. maxlength: "maxLength",
  126. cellspacing: "cellSpacing",
  127. cellpadding: "cellPadding",
  128. rowspan: "rowSpan",
  129. colspan: "colSpan",
  130. usemap: "useMap",
  131. frameborder: "frameBorder",
  132. contenteditable: "contentEditable"
  133. },
  134. G = Array.isArray ||
  135. function(t) {
  136. return t instanceof Array
  137. };
  138. return X.matches = function(t, e) {
  139. if (!e || !t || 1 !== t.nodeType) return ! 1;
  140. var n = t.webkitMatchesSelector || t.mozMatchesSelector || t.oMatchesSelector || t.matchesSelector;
  141. if (n) return n.call(t, e);
  142. var r, i = t.parentNode,
  143. o = !i;
  144. return o && (i = W).appendChild(t),
  145. r = ~X.qsa(i, e).indexOf(t),
  146. o && W.removeChild(t),
  147. r
  148. },
  149. T = function(t) {
  150. return t.replace(/-+(.)?/g,
  151. function(t, e) {
  152. return e ? e.toUpperCase() : ""
  153. })
  154. },
  155. C = function(t) {
  156. return P.call(t,
  157. function(e, n) {
  158. return t.indexOf(e) == n
  159. })
  160. },
  161. X.fragment = function(t, e, n) {
  162. var r, i, a;
  163. return D.test(t) && (r = j(A.createElement(RegExp.$1))),
  164. r || (t.replace && (t = t.replace(M, "<$1></$2>")), e === w && (e = $.test(t) && RegExp.$1), e in I || (e = "*"), a = I[e], a.innerHTML = "" + t, r = j.each(O.call(a.childNodes),
  165. function() {
  166. a.removeChild(this)
  167. })),
  168. o(n) && (i = j(r), j.each(n,
  169. function(t, e) {
  170. z.indexOf(t) > -1 ? i[t](e) : i.attr(t, e)
  171. })),
  172. r
  173. },
  174. X.Z = function(t, e) {
  175. return t = t || [],
  176. t.__proto__ = j.fn,
  177. t.selector = e || "",
  178. t
  179. },
  180. X.isZ = function(t) {
  181. return t instanceof X.Z
  182. },
  183. X.init = function(t, n) {
  184. var r;
  185. if (!t) return X.Z();
  186. if ("string" == typeof t) if (t = t.trim(), "<" == t[0] && $.test(t)) r = X.fragment(t, RegExp.$1, n),
  187. t = null;
  188. else {
  189. if (n !== w) return j(n).find(t);
  190. r = X.qsa(A, t)
  191. } else {
  192. if (e(t)) return j(A).ready(t);
  193. if (X.isZ(t)) return t;
  194. if (G(t)) r = s(t);
  195. else if (i(t)) r = [t],
  196. t = null;
  197. else if ($.test(t)) r = X.fragment(t.trim(), RegExp.$1, n),
  198. t = null;
  199. else {
  200. if (n !== w) return j(n).find(t);
  201. r = X.qsa(A, t)
  202. }
  203. }
  204. return X.Z(r, t)
  205. },
  206. j = function(t, e) {
  207. return X.init(t, e)
  208. },
  209. j.extend = function(t) {
  210. var e, n = O.call(arguments, 1);
  211. return "boolean" == typeof t && (e = t, t = n.shift()),
  212. n.forEach(function(n) {
  213. d(t, n, e)
  214. }),
  215. t
  216. },
  217. X.qsa = function(t, e) {
  218. var n, i = "#" == e[0],
  219. o = !i && "." == e[0],
  220. a = i || o ? e.slice(1) : e,
  221. s = B.test(a);
  222. return r(t) && s && i ? (n = t.getElementById(a)) ? [n] : [] : 1 !== t.nodeType && 9 !== t.nodeType ? [] : O.call(s && !i ? o ? t.getElementsByClassName(a) : t.getElementsByTagName(e) : t.querySelectorAll(e))
  223. },
  224. j.contains = A.documentElement.contains ?
  225. function(t, e) {
  226. return t !== e && t.contains(e)
  227. }: function(t, e) {
  228. for (; e && (e = e.parentNode);) if (e === t) return ! 0;
  229. return ! 1
  230. },
  231. j.type = t,
  232. j.isFunction = e,
  233. j.isWindow = n,
  234. j.isArray = G,
  235. j.isPlainObject = o,
  236. j.isEmptyObject = function(t) {
  237. var e;
  238. for (e in t) return ! 1;
  239. return ! 0
  240. },
  241. j.inArray = function(t, e, n) {
  242. return N.indexOf.call(e, t, n)
  243. },
  244. j.camelCase = T,
  245. j.trim = function(t) {
  246. return null == t ? "": String.prototype.trim.call(t)
  247. },
  248. j.uuid = 0,
  249. j.support = {},
  250. j.expr = {},
  251. j.map = function(t, e) {
  252. var n, r, i, o = [];
  253. if (a(t)) for (r = 0; r < t.length; r++) n = e(t[r], r),
  254. null != n && o.push(n);
  255. else for (i in t) n = e(t[i], i),
  256. null != n && o.push(n);
  257. return u(o)
  258. },
  259. j.each = function(t, e) {
  260. var n, r;
  261. if (a(t)) {
  262. for (n = 0; n < t.length; n++) if (e.call(t[n], n, t[n]) === !1) return t
  263. } else for (r in t) if (e.call(t[r], r, t[r]) === !1) return t;
  264. return t
  265. },
  266. j.grep = function(t, e) {
  267. return P.call(t, e)
  268. },
  269. window.JSON && (j.parseJSON = JSON.parse),
  270. j.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),
  271. function(t, e) {
  272. U["[object " + e + "]"] = e.toLowerCase()
  273. }),
  274. j.fn = {
  275. forEach: N.forEach,
  276. reduce: N.reduce,
  277. push: N.push,
  278. sort: N.sort,
  279. indexOf: N.indexOf,
  280. concat: N.concat,
  281. map: function(t) {
  282. return j(j.map(this,
  283. function(e, n) {
  284. return t.call(e, n, e)
  285. }))
  286. },
  287. slice: function() {
  288. return j(O.apply(this, arguments))
  289. },
  290. ready: function(t) {
  291. return V.test(A.readyState) && A.body ? t(j) : A.addEventListener("DOMContentLoaded",
  292. function() {
  293. t(j)
  294. },
  295. !1),
  296. this
  297. },
  298. get: function(t) {
  299. return t === w ? O.call(this) : this[t >= 0 ? t: t + this.length]
  300. },
  301. toArray: function() {
  302. return this.get()
  303. },
  304. size: function() {
  305. return this.length
  306. },
  307. remove: function() {
  308. return this.each(function() {
  309. null != this.parentNode && this.parentNode.removeChild(this)
  310. })
  311. },
  312. each: function(t) {
  313. return N.every.call(this,
  314. function(e, n) {
  315. return t.call(e, n, e) !== !1
  316. }),
  317. this
  318. },
  319. filter: function(t) {
  320. return e(t) ? this.not(this.not(t)) : j(P.call(this,
  321. function(e) {
  322. return X.matches(e, t)
  323. }))
  324. },
  325. add: function(t, e) {
  326. return j(C(this.concat(j(t, e))))
  327. },
  328. is: function(t) {
  329. return this.length > 0 && X.matches(this[0], t)
  330. },
  331. not: function(t) {
  332. var n = [];
  333. if (e(t) && t.call !== w) this.each(function(e) {
  334. t.call(this, e) || n.push(this)
  335. });
  336. else {
  337. var r = "string" == typeof t ? this.filter(t) : a(t) && e(t.item) ? O.call(t) : j(t);
  338. this.forEach(function(t) {
  339. r.indexOf(t) < 0 && n.push(t)
  340. })
  341. }
  342. return j(n)
  343. },
  344. has: function(t) {
  345. return this.filter(function() {
  346. return i(t) ? j.contains(this, t) : j(this).find(t).size()
  347. })
  348. },
  349. eq: function(t) {
  350. return - 1 === t ? this.slice(t) : this.slice(t, +t + 1)
  351. },
  352. first: function() {
  353. var t = this[0];
  354. return t && !i(t) ? t: j(t)
  355. },
  356. last: function() {
  357. var t = this[this.length - 1];
  358. return t && !i(t) ? t: j(t)
  359. },
  360. find: function(t) {
  361. var e, n = this;
  362. return e = t ? "object" == typeof t ? j(t).filter(function() {
  363. var t = this;
  364. return N.some.call(n,
  365. function(e) {
  366. return j.contains(e, t)
  367. })
  368. }) : 1 == this.length ? j(X.qsa(this[0], t)) : this.map(function() {
  369. return X.qsa(this, t)
  370. }) : j()
  371. },
  372. closest: function(t, e) {
  373. var n = this[0],
  374. i = !1;
  375. for ("object" == typeof t && (i = j(t)); n && !(i ? i.indexOf(n) >= 0 : X.matches(n, t));) n = n !== e && !r(n) && n.parentNode;
  376. return j(n)
  377. },
  378. parents: function(t) {
  379. for (var e = [], n = this; n.length > 0;) n = j.map(n,
  380. function(t) {
  381. return (t = t.parentNode) && !r(t) && e.indexOf(t) < 0 ? (e.push(t), t) : void 0
  382. });
  383. return m(e, t)
  384. },
  385. parent: function(t) {
  386. return m(C(this.pluck("parentNode")), t)
  387. },
  388. children: function(t) {
  389. return m(this.map(function() {
  390. return p(this)
  391. }), t)
  392. },
  393. contents: function() {
  394. return this.map(function() {
  395. return O.call(this.childNodes)
  396. })
  397. },
  398. siblings: function(t) {
  399. return m(this.map(function(t, e) {
  400. return P.call(p(e.parentNode),
  401. function(t) {
  402. return t !== e
  403. })
  404. }), t)
  405. },
  406. empty: function() {
  407. return this.each(function() {
  408. this.innerHTML = ""
  409. })
  410. },
  411. pluck: function(t) {
  412. return j.map(this,
  413. function(e) {
  414. return e[t]
  415. })
  416. },
  417. show: function() {
  418. return this.each(function() {
  419. "none" == this.style.display && (this.style.display = ""),
  420. "none" == getComputedStyle(this, "").getPropertyValue("display") && (this.style.display = h(this.nodeName))
  421. })
  422. },
  423. replaceWith: function(t) {
  424. return this.before(t).remove()
  425. },
  426. wrap: function(t) {
  427. var n = e(t);
  428. if (this[0] && !n) var r = j(t).get(0),
  429. i = r.parentNode || this.length > 1;
  430. return this.each(function(e) {
  431. j(this).wrapAll(n ? t.call(this, e) : i ? r.cloneNode(!0) : r)
  432. })
  433. },
  434. wrapAll: function(t) {
  435. if (this[0]) {
  436. j(this[0]).before(t = j(t));
  437. for (var e; (e = t.children()).length;) t = e.first();
  438. j(t).append(this)
  439. }
  440. return this
  441. },
  442. wrapInner: function(t) {
  443. var n = e(t);
  444. return this.each(function(e) {
  445. var r = j(this),
  446. i = r.contents(),
  447. o = n ? t.call(this, e) : t;
  448. i.length ? i.wrapAll(o) : r.append(o)
  449. })
  450. },
  451. unwrap: function() {
  452. return this.parent().each(function() {
  453. j(this).replaceWith(j(this).children())
  454. }),
  455. this
  456. },
  457. clone: function() {
  458. return this.map(function() {
  459. return this.cloneNode(!0)
  460. })
  461. },
  462. hide: function() {
  463. return this.css("display", "none")
  464. },
  465. toggle: function(t) {
  466. return this.each(function() {
  467. var e = j(this); (t === w ? "none" == e.css("display") : t) ? e.show() : e.hide()
  468. })
  469. },
  470. prev: function(t) {
  471. return j(this.pluck("previousElementSibling")).filter(t || "*")
  472. },
  473. next: function(t) {
  474. return j(this.pluck("nextElementSibling")).filter(t || "*")
  475. },
  476. html: function(t) {
  477. return 0 in arguments ? this.each(function(e) {
  478. var n = this.innerHTML;
  479. j(this).empty().append(v(this, t, e, n))
  480. }) : 0 in this ? this[0].innerHTML: null
  481. },
  482. text: function(t) {
  483. return 0 in arguments ? this.each(function(e) {
  484. var n = v(this, t, e, this.textContent);
  485. this.textContent = null == n ? "": "" + n
  486. }) : 0 in this ? this[0].textContent: null
  487. },
  488. attr: function(t, e) {
  489. var n;
  490. return "string" != typeof t || 1 in arguments ? this.each(function(n) {
  491. if (1 === this.nodeType) if (i(t)) for (E in t) g(this, E, t[E]);
  492. else g(this, t, v(this, e, n, this.getAttribute(t)))
  493. }) : this.length && 1 === this[0].nodeType ? !(n = this[0].getAttribute(t)) && t in this[0] ? this[0][t] : n: w
  494. },
  495. removeAttr: function(t) {
  496. return this.each(function() {
  497. 1 === this.nodeType && t.split(" ").forEach(function(t) {
  498. g(this, t)
  499. },
  500. this)
  501. })
  502. },
  503. prop: function(t, e) {
  504. return t = Y[t] || t,
  505. 1 in arguments ? this.each(function(n) {
  506. this[t] = v(this, e, n, this[t])
  507. }) : this[0] && this[0][t]
  508. },
  509. data: function(t, e) {
  510. var n = "data-" + t.replace(k, "-$1").toLowerCase(),
  511. r = 1 in arguments ? this.attr(n, e) : this.attr(n);
  512. return null !== r ? x(r) : w
  513. },
  514. val: function(t) {
  515. return 0 in arguments ? this.each(function(e) {
  516. this.value = v(this, t, e, this.value)
  517. }) : this[0] && (this[0].multiple ? j(this[0]).find("option").filter(function() {
  518. return this.selected
  519. }).pluck("value") : this[0].value)
  520. },
  521. offset: function(t) {
  522. if (t) return this.each(function(e) {
  523. var n = j(this),
  524. r = v(this, t, e, n.offset()),
  525. i = n.offsetParent().offset(),
  526. o = {
  527. top: r.top - i.top,
  528. left: r.left - i.left
  529. };
  530. "static" == n.css("position") && (o.position = "relative"),
  531. n.css(o)
  532. });
  533. if (!this.length) return null;
  534. var e = this[0].getBoundingClientRect();
  535. return {
  536. left: e.left + window.pageXOffset,
  537. top: e.top + window.pageYOffset,
  538. width: Math.round(e.width),
  539. height: Math.round(e.height)
  540. }
  541. },
  542. css: function(e, n) {
  543. if (arguments.length < 2) {
  544. var r, i = this[0];
  545. if (!i) return;
  546. if (r = getComputedStyle(i, ""), "string" == typeof e) return i.style[T(e)] || r.getPropertyValue(e);
  547. if (G(e)) {
  548. var o = {};
  549. return j.each(e,
  550. function(t, e) {
  551. o[e] = i.style[T(e)] || r.getPropertyValue(e)
  552. }),
  553. o
  554. }
  555. }
  556. var a = "";
  557. if ("string" == t(e)) n || 0 === n ? a = c(e) + ":" + f(e, n) : this.each(function() {
  558. this.style.removeProperty(c(e))
  559. });
  560. else for (E in e) e[E] || 0 === e[E] ? a += c(E) + ":" + f(E, e[E]) + ";": this.each(function() {
  561. this.style.removeProperty(c(E))
  562. });
  563. return this.each(function() {
  564. this.style.cssText += ";" + a
  565. })
  566. },
  567. index: function(t) {
  568. return t ? this.indexOf(j(t)[0]) : this.parent().children().indexOf(this[0])
  569. },
  570. hasClass: function(t) {
  571. return !! t && N.some.call(this,
  572. function(t) {
  573. return this.test(y(t))
  574. },
  575. l(t))
  576. },
  577. addClass: function(t) {
  578. return t ? this.each(function(e) {
  579. if ("className" in this) {
  580. S = [];
  581. var n = y(this),
  582. r = v(this, t, e, n);
  583. r.split(/\s+/g).forEach(function(t) {
  584. j(this).hasClass(t) || S.push(t)
  585. },
  586. this),
  587. S.length && y(this, n + (n ? " ": "") + S.join(" "))
  588. }
  589. }) : this
  590. },
  591. removeClass: function(t) {
  592. return this.each(function(e) {
  593. if ("className" in this) {
  594. if (t === w) return y(this, "");
  595. S = y(this),
  596. v(this, t, e, S).split(/\s+/g).forEach(function(t) {
  597. S = S.replace(l(t), " ")
  598. }),
  599. y(this, S.trim())
  600. }
  601. })
  602. },
  603. toggleClass: function(t, e) {
  604. return t ? this.each(function(n) {
  605. var r = j(this),
  606. i = v(this, t, n, y(this));
  607. i.split(/\s+/g).forEach(function(t) { (e === w ? !r.hasClass(t) : e) ? r.addClass(t) : r.removeClass(t)
  608. })
  609. }) : this
  610. },
  611. scrollTop: function(t) {
  612. if (this.length) {
  613. var e = "scrollTop" in this[0];
  614. return t === w ? e ? this[0].scrollTop: this[0].pageYOffset: this.each(e ?
  615. function() {
  616. this.scrollTop = t
  617. }: function() {
  618. this.scrollTo(this.scrollX, t)
  619. })
  620. }
  621. },
  622. scrollLeft: function(t) {
  623. if (this.length) {
  624. var e = "scrollLeft" in this[0];
  625. return t === w ? e ? this[0].scrollLeft: this[0].pageXOffset: this.each(e ?
  626. function() {
  627. this.scrollLeft = t
  628. }: function() {
  629. this.scrollTo(t, this.scrollY)
  630. })
  631. }
  632. },
  633. position: function() {
  634. if (this.length) {
  635. var t = this[0],
  636. e = this.offsetParent(),
  637. n = this.offset(),
  638. r = R.test(e[0].nodeName) ? {
  639. top: 0,
  640. left: 0
  641. }: e.offset();
  642. return n.top -= parseFloat(j(t).css("margin-top")) || 0,
  643. n.left -= parseFloat(j(t).css("margin-left")) || 0,
  644. r.top += parseFloat(j(e[0]).css("border-top-width")) || 0,
  645. r.left += parseFloat(j(e[0]).css("border-left-width")) || 0,
  646. {
  647. top: n.top - r.top,
  648. left: n.left - r.left
  649. }
  650. }
  651. },
  652. offsetParent: function() {
  653. return this.map(function() {
  654. for (var t = this.offsetParent || A.body; t && !R.test(t.nodeName) && "static" == j(t).css("position");) t = t.offsetParent;
  655. return t
  656. })
  657. }
  658. },
  659. j.fn.detach = j.fn.remove,
  660. ["width", "height"].forEach(function(t) {
  661. var e = t.replace(/./,
  662. function(t) {
  663. return t[0].toUpperCase()
  664. });
  665. j.fn[t] = function(i) {
  666. var o, a = this[0];
  667. return i === w ? n(a) ? a["inner" + e] : r(a) ? a.documentElement["scroll" + e] : (o = this.offset()) && o[t] : this.each(function(e) {
  668. a = j(this),
  669. a.css(t, v(this, i, e, a[t]()))
  670. })
  671. }
  672. }),
  673. F.forEach(function(e, n) {
  674. var r = n % 2;
  675. j.fn[e] = function() {
  676. var e, i, o = j.map(arguments,
  677. function(n) {
  678. return e = t(n),
  679. "object" == e || "array" == e || null == n ? n: X.fragment(n)
  680. }),
  681. a = this.length > 1;
  682. return o.length < 1 ? this: this.each(function(t, e) {
  683. i = r ? e: e.parentNode,
  684. e = 0 == n ? e.nextSibling: 1 == n ? e.firstChild: 2 == n ? e: null;
  685. var s = j.contains(A.documentElement, i);
  686. o.forEach(function(t) {
  687. if (a) t = t.cloneNode(!0);
  688. else if (!i) return j(t).remove();
  689. i.insertBefore(t, e),
  690. s && b(t,
  691. function(t) {
  692. null == t.nodeName || "SCRIPT" !== t.nodeName.toUpperCase() || t.type && "text/javascript" !== t.type || t.src || window.eval.call(window, t.innerHTML)
  693. })
  694. })
  695. })
  696. },
  697. j.fn[r ? e + "To": "insert" + (n ? "Before": "After")] = function(t) {
  698. return j(t)[e](this),
  699. this
  700. }
  701. }),
  702. X.Z.prototype = j.fn,
  703. X.uniq = C,
  704. X.deserializeValue = x,
  705. j.zepto = X,
  706. j
  707. } ();
  708. window.Zepto = Zepto,
  709. void 0 === window.$ && (window.$ = Zepto),
  710. function(t) {
  711. function e(t) {
  712. return t._zid || (t._zid = h++)
  713. }
  714. function n(t, n, o, a) {
  715. if (n = r(n), n.ns) var s = i(n.ns);
  716. return (v[e(t)] || []).filter(function(t) {
  717. return ! (!t || n.e && t.e != n.e || n.ns && !s.test(t.ns) || o && e(t.fn) !== e(o) || a && t.sel != a)
  718. })
  719. }
  720. function r(t) {
  721. var e = ("" + t).split(".");
  722. return {
  723. e: e[0],
  724. ns: e.slice(1).sort().join(" ")
  725. }
  726. }
  727. function i(t) {
  728. return new RegExp("(?:^| )" + t.replace(" ", " .* ?") + "(?: |$)")
  729. }
  730. function o(t, e) {
  731. return t.del && !y && t.e in x || !!e
  732. }
  733. function a(t) {
  734. return b[t] || y && x[t] || t
  735. }
  736. function s(n, i, s, u, l, h, p) {
  737. var d = e(n),
  738. m = v[d] || (v[d] = []);
  739. i.split(/\s/).forEach(function(e) {
  740. if ("ready" == e) return t(document).ready(s);
  741. var i = r(e);
  742. i.fn = s,
  743. i.sel = l,
  744. i.e in b && (s = function(e) {
  745. var n = e.relatedTarget;
  746. return ! n || n !== this && !t.contains(this, n) ? i.fn.apply(this, arguments) : void 0
  747. }),
  748. i.del = h;
  749. var d = h || s;
  750. i.proxy = function(t) {
  751. if (t = c(t), !t.isImmediatePropagationStopped()) {
  752. t.data = u;
  753. var e = d.apply(n, t._args == f ? [t] : [t].concat(t._args));
  754. return e === !1 && (t.preventDefault(), t.stopPropagation()),
  755. e
  756. }
  757. },
  758. i.i = m.length,
  759. m.push(i),
  760. "addEventListener" in n && n.addEventListener(a(i.e), i.proxy, o(i, p))
  761. })
  762. }
  763. function u(t, r, i, s, u) {
  764. var c = e(t); (r || "").split(/\s/).forEach(function(e) {
  765. n(t, e, i, s).forEach(function(e) {
  766. delete v[c][e.i],
  767. "removeEventListener" in t && t.removeEventListener(a(e.e), e.proxy, o(e, u))
  768. })
  769. })
  770. }
  771. function c(e, n) {
  772. return (n || !e.isDefaultPrevented) && (n || (n = e), t.each(S,
  773. function(t, r) {
  774. var i = n[t];
  775. e[t] = function() {
  776. return this[r] = w,
  777. i && i.apply(n, arguments)
  778. },
  779. e[r] = E
  780. }), (n.defaultPrevented !== f ? n.defaultPrevented: "returnValue" in n ? n.returnValue === !1 : n.getPreventDefault && n.getPreventDefault()) && (e.isDefaultPrevented = w)),
  781. e
  782. }
  783. function l(t) {
  784. var e, n = {
  785. originalEvent: t
  786. };
  787. for (e in t) j.test(e) || t[e] === f || (n[e] = t[e]);
  788. return c(n, t)
  789. }
  790. var f, h = 1,
  791. p = Array.prototype.slice,
  792. d = t.isFunction,
  793. m = function(t) {
  794. return "string" == typeof t
  795. },
  796. v = {},
  797. g = {},
  798. y = "onfocusin" in window,
  799. x = {
  800. focus: "focusin",
  801. blur: "focusout"
  802. },
  803. b = {
  804. mouseenter: "mouseover",
  805. mouseleave: "mouseout"
  806. };
  807. g.click = g.mousedown = g.mouseup = g.mousemove = "MouseEvents",
  808. t.event = {
  809. add: s,
  810. remove: u
  811. },
  812. t.proxy = function(n, r) {
  813. var i = 2 in arguments && p.call(arguments, 2);
  814. if (d(n)) {
  815. var o = function() {
  816. return n.apply(r, i ? i.concat(p.call(arguments)) : arguments)
  817. };
  818. return o._zid = e(n),
  819. o
  820. }
  821. if (m(r)) return i ? (i.unshift(n[r], n), t.proxy.apply(null, i)) : t.proxy(n[r], n);
  822. throw new TypeError("expected function")
  823. },
  824. t.fn.bind = function(t, e, n) {
  825. return this.on(t, e, n)
  826. },
  827. t.fn.unbind = function(t, e) {
  828. return this.off(t, e)
  829. },
  830. t.fn.one = function(t, e, n, r) {
  831. return this.on(t, e, n, r, 1)
  832. };
  833. var w = function() {
  834. return ! 0
  835. },
  836. E = function() {
  837. return ! 1
  838. },
  839. j = /^([A-Z]|returnValue$|layer[XY]$)/,
  840. S = {
  841. preventDefault: "isDefaultPrevented",
  842. stopImmediatePropagation: "isImmediatePropagationStopped",
  843. stopPropagation: "isPropagationStopped"
  844. };
  845. t.fn.delegate = function(t, e, n) {
  846. return this.on(e, t, n)
  847. },
  848. t.fn.undelegate = function(t, e, n) {
  849. return this.off(e, t, n)
  850. },
  851. t.fn.live = function(e, n) {
  852. return t(document.body).delegate(this.selector, e, n),
  853. this
  854. },
  855. t.fn.die = function(e, n) {
  856. return t(document.body).undelegate(this.selector, e, n),
  857. this
  858. },
  859. t.fn.on = function(e, n, r, i, o) {
  860. var a, c, h = this;
  861. return e && !m(e) ? (t.each(e,
  862. function(t, e) {
  863. h.on(t, n, r, e, o)
  864. }), h) : (m(n) || d(i) || i === !1 || (i = r, r = n, n = f), (d(r) || r === !1) && (i = r, r = f), i === !1 && (i = E), h.each(function(f, h) {
  865. o && (a = function(t) {
  866. return u(h, t.type, i),
  867. i.apply(this, arguments)
  868. }),
  869. n && (c = function(e) {
  870. var r, o = t(e.target).closest(n, h).get(0);
  871. return o && o !== h ? (r = t.extend(l(e), {
  872. currentTarget: o,
  873. liveFired: h
  874. }), (a || i).apply(o, [r].concat(p.call(arguments, 1)))) : void 0
  875. }),
  876. s(h, e, i, r, n, c || a)
  877. }))
  878. },
  879. t.fn.off = function(e, n, r) {
  880. var i = this;
  881. return e && !m(e) ? (t.each(e,
  882. function(t, e) {
  883. i.off(t, n, e)
  884. }), i) : (m(n) || d(r) || r === !1 || (r = n, n = f), r === !1 && (r = E), i.each(function() {
  885. u(this, e, r, n)
  886. }))
  887. },
  888. t.fn.trigger = function(e, n) {
  889. return e = m(e) || t.isPlainObject(e) ? t.Event(e) : c(e),
  890. e._args = n,
  891. this.each(function() {
  892. e.type in x && "function" == typeof this[e.type] ? this[e.type]() : "dispatchEvent" in this ? this.dispatchEvent(e) : t(this).triggerHandler(e, n)
  893. })
  894. },
  895. t.fn.triggerHandler = function(e, r) {
  896. var i, o;
  897. return this.each(function(a, s) {
  898. i = l(m(e) ? t.Event(e) : e),
  899. i._args = r,
  900. i.target = s,
  901. t.each(n(s, e.type || e),
  902. function(t, e) {
  903. return o = e.proxy(i),
  904. !i.isImmediatePropagationStopped() && void 0
  905. })
  906. }),
  907. o
  908. },
  909. "focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e) {
  910. t.fn[e] = function(t) {
  911. return 0 in arguments ? this.bind(e, t) : this.trigger(e)
  912. }
  913. }),
  914. t.Event = function(t, e) {
  915. m(t) || (e = t, t = e.type);
  916. var n = document.createEvent(g[t] || "Events"),
  917. r = !0;
  918. if (e) for (var i in e)"bubbles" == i ? r = !!e[i] : n[i] = e[i];
  919. return n.initEvent(t, r, !0),
  920. c(n)
  921. }
  922. } (Zepto),
  923. function(t) {
  924. function e(e, n, r) {
  925. var i = t.Event(n);
  926. return t(e).trigger(i, r),
  927. !i.isDefaultPrevented()
  928. }
  929. function n(t, n, r, i) {
  930. return t.global ? e(n || y, r, i) : void 0
  931. }
  932. function r(e) {
  933. e.global && 0 === t.active++&&n(e, null, "ajaxStart")
  934. }
  935. function i(e) {
  936. e.global && !--t.active && n(e, null, "ajaxStop")
  937. }
  938. function o(t, e) {
  939. var r = e.context;
  940. return e.beforeSend.call(r, t, e) !== !1 && n(e, r, "ajaxBeforeSend", [t, e]) !== !1 && void n(e, r, "ajaxSend", [t, e])
  941. }
  942. function a(t, e, r, i) {
  943. var o = r.context,
  944. a = "success";
  945. r.success.call(o, t, a, e),
  946. i && i.resolveWith(o, [t, a, e]),
  947. n(r, o, "ajaxSuccess", [e, r, t]),
  948. u(a, e, r)
  949. }
  950. function s(t, e, r, i, o) {
  951. var a = i.context;
  952. i.error.call(a, r, e, t),
  953. o && o.rejectWith(a, [r, e, t]),
  954. n(i, a, "ajaxError", [r, i, t || e]),
  955. u(e, r, i)
  956. }
  957. function u(t, e, r) {
  958. var o = r.context;
  959. r.complete.call(o, e, t),
  960. n(r, o, "ajaxComplete", [e, r]),
  961. i(r)
  962. }
  963. function c() {}
  964. function l(t) {
  965. return t && (t = t.split(";", 2)[0]),
  966. t && (t == j ? "html": t == E ? "json": b.test(t) ? "script": w.test(t) && "xml") || "text"
  967. }
  968. function f(t, e) {
  969. return "" == e ? t: (t + "&" + e).replace(/[&?]{1,2}/, "?")
  970. }
  971. function h(e) {
  972. e.processData && e.data && "string" != t.type(e.data) && (e.data = t.param(e.data, e.traditional)),
  973. !e.data || e.type && "GET" != e.type.toUpperCase() || (e.url = f(e.url, e.data), e.data = void 0)
  974. }
  975. function p(e, n, r, i) {
  976. return t.isFunction(n) && (i = r, r = n, n = void 0),
  977. t.isFunction(r) || (i = r, r = void 0),
  978. {
  979. url: e,
  980. data: n,
  981. success: r,
  982. dataType: i
  983. }
  984. }
  985. function d(e, n, r, i) {
  986. var o, a = t.isArray(n),
  987. s = t.isPlainObject(n);
  988. t.each(n,
  989. function(n, u) {
  990. o = t.type(u),
  991. i && (n = r ? i: i + "[" + (s || "object" == o || "array" == o ? n: "") + "]"),
  992. !i && a ? e.add(u.name, u.value) : "array" == o || !r && "object" == o ? d(e, u, r, n) : e.add(n, u)
  993. })
  994. }
  995. var m, v, g = 0,
  996. y = window.document,
  997. x = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
  998. b = /^(?:text|application)\/javascript/i,
  999. w = /^(?:text|application)\/xml/i,
  1000. E = "application/json",
  1001. j = "text/html",
  1002. S = /^\s*$/,
  1003. T = y.createElement("a");
  1004. T.href = window.location.href,
  1005. t.active = 0,
  1006. t.ajaxJSONP = function(e, n) {
  1007. if (! ("type" in e)) return t.ajax(e);
  1008. var r, i, u = e.jsonpCallback,
  1009. c = (t.isFunction(u) ? u() : u) || "jsonp" + ++g,
  1010. l = y.createElement("script"),
  1011. f = window[c],
  1012. h = function(e) {
  1013. t(l).triggerHandler("error", e || "abort")
  1014. },
  1015. p = {
  1016. abort: h
  1017. };
  1018. return n && n.promise(p),
  1019. t(l).on("load error",
  1020. function(o, u) {
  1021. clearTimeout(i),
  1022. t(l).off().remove(),
  1023. "error" != o.type && r ? a(r[0], p, e, n) : s(null, u || "error", p, e, n),
  1024. window[c] = f,
  1025. r && t.isFunction(f) && f(r[0]),
  1026. f = r = void 0
  1027. }),
  1028. o(p, e) === !1 ? (h("abort"), p) : (window[c] = function() {
  1029. r = arguments
  1030. },
  1031. l.src = e.url.replace(/\?(.+)=\?/, "?$1=" + c), y.head.appendChild(l), e.timeout > 0 && (i = setTimeout(function() {
  1032. h("timeout")
  1033. },
  1034. e.timeout)), p)
  1035. },
  1036. t.ajaxSettings = {
  1037. type: "GET",
  1038. beforeSend: c,
  1039. success: c,
  1040. error: c,
  1041. complete: c,
  1042. context: null,
  1043. global: !0,
  1044. xhr: function() {
  1045. return new window.XMLHttpRequest
  1046. },
  1047. accepts: {
  1048. script: "text/javascript, application/javascript, application/x-javascript",
  1049. json: E,
  1050. xml: "application/xml, text/xml",
  1051. html: j,
  1052. text: "text/plain"
  1053. },
  1054. crossDomain: !1,
  1055. timeout: 0,
  1056. processData: !0,
  1057. cache: !0
  1058. },
  1059. t.ajax = function(e) {
  1060. var n, i = t.extend({},
  1061. e || {}),
  1062. u = t.Deferred && t.Deferred();
  1063. for (m in t.ajaxSettings) void 0 === i[m] && (i[m] = t.ajaxSettings[m]);
  1064. r(i),
  1065. i.crossDomain || (n = y.createElement("a"), n.href = i.url, n.href = n.href, i.crossDomain = T.protocol + "//" + T.host != n.protocol + "//" + n.host),
  1066. i.url || (i.url = window.location.toString()),
  1067. h(i);
  1068. var p = i.dataType,
  1069. d = /\?.+=\?/.test(i.url);
  1070. if (d && (p = "jsonp"), i.cache !== !1 && (e && e.cache === !0 || "script" != p && "jsonp" != p) || (i.url = f(i.url, "_=" + Date.now())), "jsonp" == p) return d || (i.url = f(i.url, i.jsonp ? i.jsonp + "=?": i.jsonp === !1 ? "": "callback=?")),
  1071. t.ajaxJSONP(i, u);
  1072. var g, x = i.accepts[p],
  1073. b = {},
  1074. w = function(t, e) {
  1075. b[t.toLowerCase()] = [t, e]
  1076. },
  1077. E = /^([\w-]+:)\/\//.test(i.url) ? RegExp.$1: window.location.protocol,
  1078. j = i.xhr(),
  1079. C = j.setRequestHeader;
  1080. if (u && u.promise(j), i.crossDomain || w("X-Requested-With", "XMLHttpRequest"), w("Accept", x || "*/*"), (x = i.mimeType || x) && (x.indexOf(",") > -1 && (x = x.split(",", 2)[0]), j.overrideMimeType && j.overrideMimeType(x)), (i.contentType || i.contentType !== !1 && i.data && "GET" != i.type.toUpperCase()) && w("Content-Type", i.contentType || "application/x-www-form-urlencoded"), i.headers) for (v in i.headers) w(v, i.headers[v]);
  1081. if (j.setRequestHeader = w, j.onreadystatechange = function() {
  1082. if (4 == j.readyState) {
  1083. j.onreadystatechange = c,
  1084. clearTimeout(g);
  1085. var e, n = !1;
  1086. if (j.status >= 200 && j.status < 300 || 304 == j.status || 0 == j.status && "file:" == E) {
  1087. p = p || l(i.mimeType || j.getResponseHeader("content-type")),
  1088. e = j.responseText;
  1089. try {
  1090. "script" == p ? (0, eval)(e) : "xml" == p ? e = j.responseXML: "json" == p && (e = S.test(e) ? null: t.parseJSON(e))
  1091. } catch(t) {
  1092. n = t
  1093. }
  1094. n ? s(n, "parsererror", j, i, u) : a(e, j, i, u)
  1095. } else s(j.statusText || null, j.status ? "error": "abort", j, i, u)
  1096. }
  1097. },
  1098. o(j, i) === !1) return j.abort(),
  1099. s(null, "abort", j, i, u),
  1100. j;
  1101. if (i.xhrFields) for (v in i.xhrFields) j[v] = i.xhrFields[v];
  1102. var N = !("async" in i) || i.async;
  1103. j.open(i.type, i.url, N, i.username, i.password);
  1104. for (v in b) C.apply(j, b[v]);
  1105. return i.timeout > 0 && (g = setTimeout(function() {
  1106. j.onreadystatechange = c,
  1107. j.abort(),
  1108. s(null, "timeout", j, i, u)
  1109. },
  1110. i.timeout)),
  1111. j.send(i.data ? i.data: null),
  1112. j
  1113. },
  1114. t.get = function() {
  1115. return t.ajax(p.apply(null, arguments))
  1116. },
  1117. t.post = function() {
  1118. var e = p.apply(null, arguments);
  1119. return e.type = "POST",
  1120. t.ajax(e)
  1121. },
  1122. t.getJSON = function() {
  1123. var e = p.apply(null, arguments);
  1124. return e.dataType = "json",
  1125. t.ajax(e)
  1126. },
  1127. t.fn.load = function(e, n, r) {
  1128. if (!this.length) return this;
  1129. var i, o = this,
  1130. a = e.split(/\s/),
  1131. s = p(e, n, r),
  1132. u = s.success;
  1133. return a.length > 1 && (s.url = a[0], i = a[1]),
  1134. s.success = function(e) {
  1135. o.html(i ? t("<div>").html(e.replace(x, "")).find(i) : e),
  1136. u && u.apply(o, arguments)
  1137. },
  1138. t.ajax(s),
  1139. this
  1140. };
  1141. var C = encodeURIComponent;
  1142. t.param = function(e, n) {
  1143. var r = [];
  1144. return r.add = function(e, n) {
  1145. t.isFunction(n) && (n = n()),
  1146. null == n && (n = ""),
  1147. this.push(C(e) + "=" + C(n))
  1148. },
  1149. d(r, e, n),
  1150. r.join("&").replace(/%20/g, "+")
  1151. }
  1152. } (Zepto),
  1153. function(t) {
  1154. t.fn.serializeArray = function() {
  1155. var e, n, r = [],
  1156. i = function(t) {
  1157. return t.forEach ? t.forEach(i) : void r.push({
  1158. name: e,
  1159. value: t
  1160. })
  1161. };
  1162. return this[0] && t.each(this[0].elements,
  1163. function(r, o) {
  1164. n = o.type,
  1165. e = o.name,
  1166. e && "fieldset" != o.nodeName.toLowerCase() && !o.disabled && "submit" != n && "reset" != n && "button" != n && "file" != n && ("radio" != n && "checkbox" != n || o.checked) && i(t(o).val())
  1167. }),
  1168. r
  1169. },
  1170. t.fn.serialize = function() {
  1171. var t = [];
  1172. return this.serializeArray().forEach(function(e) {
  1173. t.push(encodeURIComponent(e.name) + "=" + encodeURIComponent(e.value))
  1174. }),
  1175. t.join("&")
  1176. },
  1177. t.fn.submit = function(e) {
  1178. if (0 in arguments) this.bind("submit", e);
  1179. else if (this.length) {
  1180. var n = t.Event("submit");
  1181. this.eq(0).trigger(n),
  1182. n.isDefaultPrevented() || this.get(0).submit()
  1183. }
  1184. return this
  1185. }
  1186. } (Zepto),
  1187. function(t) {
  1188. "__proto__" in {} || t.extend(t.zepto, {
  1189. Z: function(e, n) {
  1190. return e = e || [],
  1191. t.extend(e, t.fn),
  1192. e.selector = n || "",
  1193. e.__Z = !0,
  1194. e
  1195. },
  1196. isZ: function(e) {
  1197. return "array" === t.type(e) && "__Z" in e
  1198. }
  1199. });
  1200. try {
  1201. getComputedStyle(void 0)
  1202. } catch(t) {
  1203. var e = getComputedStyle;
  1204. window.getComputedStyle = function(t) {
  1205. try {
  1206. return e(t)
  1207. } catch(t) {
  1208. return null
  1209. }
  1210. }
  1211. }
  1212. } (Zepto);