You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

7 jaren geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884
  1. /* Zepto v1.0-1-ga3cab6c - polyfill zepto detect event ajax form fx - zeptojs.com/license */
  2. ;(function(undefined){
  3. if (String.prototype.trim === undefined) // fix for iOS 3.2
  4. String.prototype.trim = function(){ return this.replace(/^\s+|\s+$/g, '') }
  5. // For iOS 3.x
  6. // from https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/reduce
  7. if (Array.prototype.reduce === undefined)
  8. Array.prototype.reduce = function(fun){
  9. if(this === void 0 || this === null) throw new TypeError()
  10. var t = Object(this), len = t.length >>> 0, k = 0, accumulator
  11. if(typeof fun != 'function') throw new TypeError()
  12. if(len == 0 && arguments.length == 1) throw new TypeError()
  13. if(arguments.length >= 2)
  14. accumulator = arguments[1]
  15. else
  16. do{
  17. if(k in t){
  18. accumulator = t[k++]
  19. break
  20. }
  21. if(++k >= len) throw new TypeError()
  22. } while (true)
  23. while (k < len){
  24. if(k in t) accumulator = fun.call(undefined, accumulator, t[k], k, t)
  25. k++
  26. }
  27. return accumulator
  28. }
  29. })()
  30. var Zepto = (function() {
  31. var undefined, key, $, classList, emptyArray = [], slice = emptyArray.slice, filter = emptyArray.filter,
  32. document = window.document,
  33. elementDisplay = {}, classCache = {},
  34. getComputedStyle = document.defaultView.getComputedStyle,
  35. cssNumber = { 'column-count': 1, 'columns': 1, 'font-weight': 1, 'line-height': 1,'opacity': 1, 'z-index': 1, 'zoom': 1 },
  36. fragmentRE = /^\s*<(\w+|!)[^>]*>/,
  37. tagExpanderRE = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
  38. rootNodeRE = /^(?:body|html)$/i,
  39. // special attributes that should be get/set via method calls
  40. methodAttributes = ['val', 'css', 'html', 'text', 'data', 'width', 'height', 'offset'],
  41. adjacencyOperators = [ 'after', 'prepend', 'before', 'append' ],
  42. table = document.createElement('table'),
  43. tableRow = document.createElement('tr'),
  44. containers = {
  45. 'tr': document.createElement('tbody'),
  46. 'tbody': table, 'thead': table, 'tfoot': table,
  47. 'td': tableRow, 'th': tableRow,
  48. '*': document.createElement('div')
  49. },
  50. readyRE = /complete|loaded|interactive/,
  51. classSelectorRE = /^\.([\w-]+)$/,
  52. idSelectorRE = /^#([\w-]*)$/,
  53. tagSelectorRE = /^[\w-]+$/,
  54. class2type = {},
  55. toString = class2type.toString,
  56. zepto = {},
  57. camelize, uniq,
  58. tempParent = document.createElement('div')
  59. zepto.matches = function(element, selector) {
  60. if (!element || element.nodeType !== 1) return false
  61. var matchesSelector = element.webkitMatchesSelector || element.mozMatchesSelector ||
  62. element.oMatchesSelector || element.matchesSelector
  63. if (matchesSelector) return matchesSelector.call(element, selector)
  64. // fall back to performing a selector:
  65. var match, parent = element.parentNode, temp = !parent
  66. if (temp) (parent = tempParent).appendChild(element)
  67. match = ~zepto.qsa(parent, selector).indexOf(element)
  68. temp && tempParent.removeChild(element)
  69. return match
  70. }
  71. function type(obj) {
  72. return obj == null ? String(obj) :
  73. class2type[toString.call(obj)] || "object"
  74. }
  75. function isFunction(value) { return type(value) == "function" }
  76. function isWindow(obj) { return obj != null && obj == obj.window }
  77. function isDocument(obj) { return obj != null && obj.nodeType == obj.DOCUMENT_NODE }
  78. function isObject(obj) { return type(obj) == "object" }
  79. function isPlainObject(obj) {
  80. return isObject(obj) && !isWindow(obj) && obj.__proto__ == Object.prototype
  81. }
  82. function isArray(value) { return value instanceof Array }
  83. function likeArray(obj) { return typeof obj.length == 'number' }
  84. function compact(array) { return filter.call(array, function(item){ return item != null }) }
  85. function flatten(array) { return array.length > 0 ? $.fn.concat.apply([], array) : array }
  86. camelize = function(str){ return str.replace(/-+(.)?/g, function(match, chr){ return chr ? chr.toUpperCase() : '' }) }
  87. function dasherize(str) {
  88. return str.replace(/::/g, '/')
  89. .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')
  90. .replace(/([a-z\d])([A-Z])/g, '$1_$2')
  91. .replace(/_/g, '-')
  92. .toLowerCase()
  93. }
  94. uniq = function(array){ return filter.call(array, function(item, idx){ return array.indexOf(item) == idx }) }
  95. function classRE(name) {
  96. return name in classCache ?
  97. classCache[name] : (classCache[name] = new RegExp('(^|\\s)' + name + '(\\s|$)'))
  98. }
  99. function maybeAddPx(name, value) {
  100. return (typeof value == "number" && !cssNumber[dasherize(name)]) ? value + "px" : value
  101. }
  102. function defaultDisplay(nodeName) {
  103. var element, display
  104. if (!elementDisplay[nodeName]) {
  105. element = document.createElement(nodeName)
  106. document.body.appendChild(element)
  107. display = getComputedStyle(element, '').getPropertyValue("display")
  108. element.parentNode.removeChild(element)
  109. display == "none" && (display = "block")
  110. elementDisplay[nodeName] = display
  111. }
  112. return elementDisplay[nodeName]
  113. }
  114. function children(element) {
  115. return 'children' in element ?
  116. slice.call(element.children) :
  117. $.map(element.childNodes, function(node){ if (node.nodeType == 1) return node })
  118. }
  119. // `$.zepto.fragment` takes a html string and an optional tag name
  120. // to generate DOM nodes nodes from the given html string.
  121. // The generated DOM nodes are returned as an array.
  122. // This function can be overriden in plugins for example to make
  123. // it compatible with browsers that don't support the DOM fully.
  124. zepto.fragment = function(html, name, properties) {
  125. if (html.replace) html = html.replace(tagExpanderRE, "<$1></$2>")
  126. if (name === undefined) name = fragmentRE.test(html) && RegExp.$1
  127. if (!(name in containers)) name = '*'
  128. var nodes, dom, container = containers[name]
  129. container.innerHTML = '' + html
  130. dom = $.each(slice.call(container.childNodes), function(){
  131. container.removeChild(this)
  132. })
  133. if (isPlainObject(properties)) {
  134. nodes = $(dom)
  135. $.each(properties, function(key, value) {
  136. if (methodAttributes.indexOf(key) > -1) nodes[key](value)
  137. else nodes.attr(key, value)
  138. })
  139. }
  140. return dom
  141. }
  142. // `$.zepto.Z` swaps out the prototype of the given `dom` array
  143. // of nodes with `$.fn` and thus supplying all the Zepto functions
  144. // to the array. Note that `__proto__` is not supported on Internet
  145. // Explorer. This method can be overriden in plugins.
  146. zepto.Z = function(dom, selector) {
  147. dom = dom || []
  148. dom.__proto__ = $.fn
  149. dom.selector = selector || ''
  150. return dom
  151. }
  152. // `$.zepto.isZ` should return `true` if the given object is a Zepto
  153. // collection. This method can be overriden in plugins.
  154. zepto.isZ = function(object) {
  155. return object instanceof zepto.Z
  156. }
  157. // `$.zepto.init` is Zepto's counterpart to jQuery's `$.fn.init` and
  158. // takes a CSS selector and an optional context (and handles various
  159. // special cases).
  160. // This method can be overriden in plugins.
  161. zepto.init = function(selector, context) {
  162. // If nothing given, return an empty Zepto collection
  163. if (!selector) return zepto.Z()
  164. // If a function is given, call it when the DOM is ready
  165. else if (isFunction(selector)) return $(document).ready(selector)
  166. // If a Zepto collection is given, juts return it
  167. else if (zepto.isZ(selector)) return selector
  168. else {
  169. var dom
  170. // normalize array if an array of nodes is given
  171. if (isArray(selector)) dom = compact(selector)
  172. // Wrap DOM nodes. If a plain object is given, duplicate it.
  173. else if (isObject(selector))
  174. dom = [isPlainObject(selector) ? $.extend({}, selector) : selector], selector = null
  175. // If it's a html fragment, create nodes from it
  176. else if (fragmentRE.test(selector))
  177. dom = zepto.fragment(selector.trim(), RegExp.$1, context), selector = null
  178. // If there's a context, create a collection on that context first, and select
  179. // nodes from there
  180. else if (context !== undefined) return $(context).find(selector)
  181. // And last but no least, if it's a CSS selector, use it to select nodes.
  182. else dom = zepto.qsa(document, selector)
  183. // create a new Zepto collection from the nodes found
  184. return zepto.Z(dom, selector)
  185. }
  186. }
  187. // `$` will be the base `Zepto` object. When calling this
  188. // function just call `$.zepto.init, which makes the implementation
  189. // details of selecting nodes and creating Zepto collections
  190. // patchable in plugins.
  191. $ = function(selector, context){
  192. return zepto.init(selector, context)
  193. }
  194. function extend(target, source, deep) {
  195. for (key in source)
  196. if (deep && (isPlainObject(source[key]) || isArray(source[key]))) {
  197. if (isPlainObject(source[key]) && !isPlainObject(target[key]))
  198. target[key] = {}
  199. if (isArray(source[key]) && !isArray(target[key]))
  200. target[key] = []
  201. extend(target[key], source[key], deep)
  202. }
  203. else if (source[key] !== undefined) target[key] = source[key]
  204. }
  205. // Copy all but undefined properties from one or more
  206. // objects to the `target` object.
  207. $.extend = function(target){
  208. var deep, args = slice.call(arguments, 1)
  209. if (typeof target == 'boolean') {
  210. deep = target
  211. target = args.shift()
  212. }
  213. args.forEach(function(arg){ extend(target, arg, deep) })
  214. return target
  215. }
  216. // `$.zepto.qsa` is Zepto's CSS selector implementation which
  217. // uses `document.querySelectorAll` and optimizes for some special cases, like `#id`.
  218. // This method can be overriden in plugins.
  219. zepto.qsa = function(element, selector){
  220. var found
  221. return (isDocument(element) && idSelectorRE.test(selector)) ?
  222. ( (found = element.getElementById(RegExp.$1)) ? [found] : [] ) :
  223. (element.nodeType !== 1 && element.nodeType !== 9) ? [] :
  224. slice.call(
  225. classSelectorRE.test(selector) ? element.getElementsByClassName(RegExp.$1) :
  226. tagSelectorRE.test(selector) ? element.getElementsByTagName(selector) :
  227. element.querySelectorAll(selector)
  228. )
  229. }
  230. function filtered(nodes, selector) {
  231. return selector === undefined ? $(nodes) : $(nodes).filter(selector)
  232. }
  233. $.contains = function(parent, node) {
  234. return parent !== node && parent.contains(node)
  235. }
  236. function funcArg(context, arg, idx, payload) {
  237. return isFunction(arg) ? arg.call(context, idx, payload) : arg
  238. }
  239. function setAttribute(node, name, value) {
  240. value == null ? node.removeAttribute(name) : node.setAttribute(name, value)
  241. }
  242. // access className property while respecting SVGAnimatedString
  243. function className(node, value){
  244. var klass = node.className,
  245. svg = klass && klass.baseVal !== undefined
  246. if (value === undefined) return svg ? klass.baseVal : klass
  247. svg ? (klass.baseVal = value) : (node.className = value)
  248. }
  249. // "true" => true
  250. // "false" => false
  251. // "null" => null
  252. // "42" => 42
  253. // "42.5" => 42.5
  254. // JSON => parse if valid
  255. // String => self
  256. function deserializeValue(value) {
  257. var num
  258. try {
  259. return value ?
  260. value == "true" ||
  261. ( value == "false" ? false :
  262. value == "null" ? null :
  263. !isNaN(num = Number(value)) ? num :
  264. /^[\[\{]/.test(value) ? $.parseJSON(value) :
  265. value )
  266. : value
  267. } catch(e) {
  268. return value
  269. }
  270. }
  271. $.type = type
  272. $.isFunction = isFunction
  273. $.isWindow = isWindow
  274. $.isArray = isArray
  275. $.isPlainObject = isPlainObject
  276. $.isEmptyObject = function(obj) {
  277. var name
  278. for (name in obj) return false
  279. return true
  280. }
  281. $.inArray = function(elem, array, i){
  282. return emptyArray.indexOf.call(array, elem, i)
  283. }
  284. $.camelCase = camelize
  285. $.trim = function(str) { return str.trim() }
  286. // plugin compatibility
  287. $.uuid = 0
  288. $.support = { }
  289. $.expr = { }
  290. $.map = function(elements, callback){
  291. var value, values = [], i, key
  292. if (likeArray(elements))
  293. for (i = 0; i < elements.length; i++) {
  294. value = callback(elements[i], i)
  295. if (value != null) values.push(value)
  296. }
  297. else
  298. for (key in elements) {
  299. value = callback(elements[key], key)
  300. if (value != null) values.push(value)
  301. }
  302. return flatten(values)
  303. }
  304. $.each = function(elements, callback){
  305. var i, key
  306. if (likeArray(elements)) {
  307. for (i = 0; i < elements.length; i++)
  308. if (callback.call(elements[i], i, elements[i]) === false) return elements
  309. } else {
  310. for (key in elements)
  311. if (callback.call(elements[key], key, elements[key]) === false) return elements
  312. }
  313. return elements
  314. }
  315. $.grep = function(elements, callback){
  316. return filter.call(elements, callback)
  317. }
  318. if (window.JSON) $.parseJSON = JSON.parse
  319. // Populate the class2type map
  320. $.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
  321. class2type[ "[object " + name + "]" ] = name.toLowerCase()
  322. })
  323. // Define methods that will be available on all
  324. // Zepto collections
  325. $.fn = {
  326. // Because a collection acts like an array
  327. // copy over these useful array functions.
  328. forEach: emptyArray.forEach,
  329. reduce: emptyArray.reduce,
  330. push: emptyArray.push,
  331. sort: emptyArray.sort,
  332. indexOf: emptyArray.indexOf,
  333. concat: emptyArray.concat,
  334. // `map` and `slice` in the jQuery API work differently
  335. // from their array counterparts
  336. map: function(fn){
  337. return $($.map(this, function(el, i){ return fn.call(el, i, el) }))
  338. },
  339. slice: function(){
  340. return $(slice.apply(this, arguments))
  341. },
  342. ready: function(callback){
  343. if (readyRE.test(document.readyState)) callback($)
  344. else document.addEventListener('DOMContentLoaded', function(){ callback($) }, false)
  345. return this
  346. },
  347. get: function(idx){
  348. return idx === undefined ? slice.call(this) : this[idx >= 0 ? idx : idx + this.length]
  349. },
  350. toArray: function(){ return this.get() },
  351. size: function(){
  352. return this.length
  353. },
  354. remove: function(){
  355. return this.each(function(){
  356. if (this.parentNode != null)
  357. this.parentNode.removeChild(this)
  358. })
  359. },
  360. each: function(callback){
  361. emptyArray.every.call(this, function(el, idx){
  362. return callback.call(el, idx, el) !== false
  363. })
  364. return this
  365. },
  366. filter: function(selector){
  367. if (isFunction(selector)) return this.not(this.not(selector))
  368. return $(filter.call(this, function(element){
  369. return zepto.matches(element, selector)
  370. }))
  371. },
  372. add: function(selector,context){
  373. return $(uniq(this.concat($(selector,context))))
  374. },
  375. is: function(selector){
  376. return this.length > 0 && zepto.matches(this[0], selector)
  377. },
  378. not: function(selector){
  379. var nodes=[]
  380. if (isFunction(selector) && selector.call !== undefined)
  381. this.each(function(idx){
  382. if (!selector.call(this,idx)) nodes.push(this)
  383. })
  384. else {
  385. var excludes = typeof selector == 'string' ? this.filter(selector) :
  386. (likeArray(selector) && isFunction(selector.item)) ? slice.call(selector) : $(selector)
  387. this.forEach(function(el){
  388. if (excludes.indexOf(el) < 0) nodes.push(el)
  389. })
  390. }
  391. return $(nodes)
  392. },
  393. has: function(selector){
  394. return this.filter(function(){
  395. return isObject(selector) ?
  396. $.contains(this, selector) :
  397. $(this).find(selector).size()
  398. })
  399. },
  400. eq: function(idx){
  401. return idx === -1 ? this.slice(idx) : this.slice(idx, + idx + 1)
  402. },
  403. first: function(){
  404. var el = this[0]
  405. return el && !isObject(el) ? el : $(el)
  406. },
  407. last: function(){
  408. var el = this[this.length - 1]
  409. return el && !isObject(el) ? el : $(el)
  410. },
  411. find: function(selector){
  412. var result, $this = this
  413. if (typeof selector == 'object')
  414. result = $(selector).filter(function(){
  415. var node = this
  416. return emptyArray.some.call($this, function(parent){
  417. return $.contains(parent, node)
  418. })
  419. })
  420. else if (this.length == 1) result = $(zepto.qsa(this[0], selector))
  421. else result = this.map(function(){ return zepto.qsa(this, selector) })
  422. return result
  423. },
  424. closest: function(selector, context){
  425. var node = this[0], collection = false
  426. if (typeof selector == 'object') collection = $(selector)
  427. while (node && !(collection ? collection.indexOf(node) >= 0 : zepto.matches(node, selector)))
  428. node = node !== context && !isDocument(node) && node.parentNode
  429. return $(node)
  430. },
  431. parents: function(selector){
  432. var ancestors = [], nodes = this
  433. while (nodes.length > 0)
  434. nodes = $.map(nodes, function(node){
  435. if ((node = node.parentNode) && !isDocument(node) && ancestors.indexOf(node) < 0) {
  436. ancestors.push(node)
  437. return node
  438. }
  439. })
  440. return filtered(ancestors, selector)
  441. },
  442. parent: function(selector){
  443. return filtered(uniq(this.pluck('parentNode')), selector)
  444. },
  445. children: function(selector){
  446. return filtered(this.map(function(){ return children(this) }), selector)
  447. },
  448. contents: function() {
  449. return this.map(function() { return slice.call(this.childNodes) })
  450. },
  451. siblings: function(selector){
  452. return filtered(this.map(function(i, el){
  453. return filter.call(children(el.parentNode), function(child){ return child!==el })
  454. }), selector)
  455. },
  456. empty: function(){
  457. return this.each(function(){ this.innerHTML = '' })
  458. },
  459. // `pluck` is borrowed from Prototype.js
  460. pluck: function(property){
  461. return $.map(this, function(el){ return el[property] })
  462. },
  463. show: function(){
  464. return this.each(function(){
  465. this.style.display == "none" && (this.style.display = null)
  466. if (getComputedStyle(this, '').getPropertyValue("display") == "none")
  467. this.style.display = defaultDisplay(this.nodeName)
  468. })
  469. },
  470. replaceWith: function(newContent){
  471. return this.before(newContent).remove()
  472. },
  473. wrap: function(structure){
  474. var func = isFunction(structure)
  475. if (this[0] && !func)
  476. var dom = $(structure).get(0),
  477. clone = dom.parentNode || this.length > 1
  478. return this.each(function(index){
  479. $(this).wrapAll(
  480. func ? structure.call(this, index) :
  481. clone ? dom.cloneNode(true) : dom
  482. )
  483. })
  484. },
  485. wrapAll: function(structure){
  486. if (this[0]) {
  487. $(this[0]).before(structure = $(structure))
  488. var children
  489. // drill down to the inmost element
  490. while ((children = structure.children()).length) structure = children.first()
  491. $(structure).append(this)
  492. }
  493. return this
  494. },
  495. wrapInner: function(structure){
  496. var func = isFunction(structure)
  497. return this.each(function(index){
  498. var self = $(this), contents = self.contents(),
  499. dom = func ? structure.call(this, index) : structure
  500. contents.length ? contents.wrapAll(dom) : self.append(dom)
  501. })
  502. },
  503. unwrap: function(){
  504. this.parent().each(function(){
  505. $(this).replaceWith($(this).children())
  506. })
  507. return this
  508. },
  509. clone: function(){
  510. return this.map(function(){ return this.cloneNode(true) })
  511. },
  512. hide: function(){
  513. return this.css("display", "none")
  514. },
  515. toggle: function(setting){
  516. return this.each(function(){
  517. var el = $(this)
  518. ;(setting === undefined ? el.css("display") == "none" : setting) ? el.show() : el.hide()
  519. })
  520. },
  521. prev: function(selector){ return $(this.pluck('previousElementSibling')).filter(selector || '*') },
  522. next: function(selector){ return $(this.pluck('nextElementSibling')).filter(selector || '*') },
  523. html: function(html){
  524. return html === undefined ?
  525. (this.length > 0 ? this[0].innerHTML : null) :
  526. this.each(function(idx){
  527. var originHtml = this.innerHTML
  528. $(this).empty().append( funcArg(this, html, idx, originHtml) )
  529. })
  530. },
  531. text: function(text){
  532. return text === undefined ?
  533. (this.length > 0 ? this[0].textContent : null) :
  534. this.each(function(){ this.textContent = text })
  535. },
  536. attr: function(name, value){
  537. var result
  538. return (typeof name == 'string' && value === undefined) ?
  539. (this.length == 0 || this[0].nodeType !== 1 ? undefined :
  540. (name == 'value' && this[0].nodeName == 'INPUT') ? this.val() :
  541. (!(result = this[0].getAttribute(name)) && name in this[0]) ? this[0][name] : result
  542. ) :
  543. this.each(function(idx){
  544. if (this.nodeType !== 1) return
  545. if (isObject(name)) for (key in name) setAttribute(this, key, name[key])
  546. else setAttribute(this, name, funcArg(this, value, idx, this.getAttribute(name)))
  547. })
  548. },
  549. removeAttr: function(name){
  550. return this.each(function(){ this.nodeType === 1 && setAttribute(this, name) })
  551. },
  552. prop: function(name, value){
  553. return (value === undefined) ?
  554. (this[0] && this[0][name]) :
  555. this.each(function(idx){
  556. this[name] = funcArg(this, value, idx, this[name])
  557. })
  558. },
  559. data: function(name, value){
  560. var data = this.attr('data-' + dasherize(name), value)
  561. return data !== null ? deserializeValue(data) : undefined
  562. },
  563. val: function(value){
  564. return (value === undefined) ?
  565. (this[0] && (this[0].multiple ?
  566. $(this[0]).find('option').filter(function(o){ return this.selected }).pluck('value') :
  567. this[0].value)
  568. ) :
  569. this.each(function(idx){
  570. this.value = funcArg(this, value, idx, this.value)
  571. })
  572. },
  573. offset: function(coordinates){
  574. if (coordinates) return this.each(function(index){
  575. var $this = $(this),
  576. coords = funcArg(this, coordinates, index, $this.offset()),
  577. parentOffset = $this.offsetParent().offset(),
  578. props = {
  579. top: coords.top - parentOffset.top,
  580. left: coords.left - parentOffset.left
  581. }
  582. if ($this.css('position') == 'static') props['position'] = 'relative'
  583. $this.css(props)
  584. })
  585. if (this.length==0) return null
  586. var obj = this[0].getBoundingClientRect()
  587. return {
  588. left: obj.left + window.pageXOffset,
  589. top: obj.top + window.pageYOffset,
  590. width: Math.round(obj.width),
  591. height: Math.round(obj.height)
  592. }
  593. },
  594. css: function(property, value){
  595. if (arguments.length < 2 && typeof property == 'string')
  596. return this[0] && (this[0].style[camelize(property)] || getComputedStyle(this[0], '').getPropertyValue(property))
  597. var css = ''
  598. if (type(property) == 'string') {
  599. if (!value && value !== 0)
  600. this.each(function(){ this.style.removeProperty(dasherize(property)) })
  601. else
  602. css = dasherize(property) + ":" + maybeAddPx(property, value)
  603. } else {
  604. for (key in property)
  605. if (!property[key] && property[key] !== 0)
  606. this.each(function(){ this.style.removeProperty(dasherize(key)) })
  607. else
  608. css += dasherize(key) + ':' + maybeAddPx(key, property[key]) + ';'
  609. }
  610. return this.each(function(){ this.style.cssText += ';' + css })
  611. },
  612. index: function(element){
  613. return element ? this.indexOf($(element)[0]) : this.parent().children().indexOf(this[0])
  614. },
  615. hasClass: function(name){
  616. return emptyArray.some.call(this, function(el){
  617. return this.test(className(el))
  618. }, classRE(name))
  619. },
  620. addClass: function(name){
  621. return this.each(function(idx){
  622. classList = []
  623. var cls = className(this), newName = funcArg(this, name, idx, cls)
  624. newName.split(/\s+/g).forEach(function(klass){
  625. if (!$(this).hasClass(klass)) classList.push(klass)
  626. }, this)
  627. classList.length && className(this, cls + (cls ? " " : "") + classList.join(" "))
  628. })
  629. },
  630. removeClass: function(name){
  631. return this.each(function(idx){
  632. if (name === undefined) return className(this, '')
  633. classList = className(this)
  634. funcArg(this, name, idx, classList).split(/\s+/g).forEach(function(klass){
  635. classList = classList.replace(classRE(klass), " ")
  636. })
  637. className(this, classList.trim())
  638. })
  639. },
  640. toggleClass: function(name, when){
  641. return this.each(function(idx){
  642. var $this = $(this), names = funcArg(this, name, idx, className(this))
  643. names.split(/\s+/g).forEach(function(klass){
  644. (when === undefined ? !$this.hasClass(klass) : when) ?
  645. $this.addClass(klass) : $this.removeClass(klass)
  646. })
  647. })
  648. },
  649. scrollTop: function(){
  650. if (!this.length) return
  651. return ('scrollTop' in this[0]) ? this[0].scrollTop : this[0].scrollY
  652. },
  653. position: function() {
  654. if (!this.length) return
  655. var elem = this[0],
  656. // Get *real* offsetParent
  657. offsetParent = this.offsetParent(),
  658. // Get correct offsets
  659. offset = this.offset(),
  660. parentOffset = rootNodeRE.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset()
  661. // Subtract element margins
  662. // note: when an element has margin: auto the offsetLeft and marginLeft
  663. // are the same in Safari causing offset.left to incorrectly be 0
  664. offset.top -= parseFloat( $(elem).css('margin-top') ) || 0
  665. offset.left -= parseFloat( $(elem).css('margin-left') ) || 0
  666. // Add offsetParent borders
  667. parentOffset.top += parseFloat( $(offsetParent[0]).css('border-top-width') ) || 0
  668. parentOffset.left += parseFloat( $(offsetParent[0]).css('border-left-width') ) || 0
  669. // Subtract the two offsets
  670. return {
  671. top: offset.top - parentOffset.top,
  672. left: offset.left - parentOffset.left
  673. }
  674. },
  675. offsetParent: function() {
  676. return this.map(function(){
  677. var parent = this.offsetParent || document.body
  678. while (parent && !rootNodeRE.test(parent.nodeName) && $(parent).css("position") == "static")
  679. parent = parent.offsetParent
  680. return parent
  681. })
  682. }
  683. }
  684. // for now
  685. $.fn.detach = $.fn.remove
  686. // Generate the `width` and `height` functions
  687. ;['width', 'height'].forEach(function(dimension){
  688. $.fn[dimension] = function(value){
  689. var offset, el = this[0],
  690. Dimension = dimension.replace(/./, function(m){ return m[0].toUpperCase() })
  691. if (value === undefined) return isWindow(el) ? el['inner' + Dimension] :
  692. isDocument(el) ? el.documentElement['offset' + Dimension] :
  693. (offset = this.offset()) && offset[dimension]
  694. else return this.each(function(idx){
  695. el = $(this)
  696. el.css(dimension, funcArg(this, value, idx, el[dimension]()))
  697. })
  698. }
  699. })
  700. function traverseNode(node, fun) {
  701. fun(node)
  702. for (var key in node.childNodes) traverseNode(node.childNodes[key], fun)
  703. }
  704. // Generate the `after`, `prepend`, `before`, `append`,
  705. // `insertAfter`, `insertBefore`, `appendTo`, and `prependTo` methods.
  706. adjacencyOperators.forEach(function(operator, operatorIndex) {
  707. var inside = operatorIndex % 2 //=> prepend, append
  708. $.fn[operator] = function(){
  709. // arguments can be nodes, arrays of nodes, Zepto objects and HTML strings
  710. var argType, nodes = $.map(arguments, function(arg) {
  711. argType = type(arg)
  712. return argType == "object" || argType == "array" || arg == null ?
  713. arg : zepto.fragment(arg)
  714. }),
  715. parent, copyByClone = this.length > 1
  716. if (nodes.length < 1) return this
  717. return this.each(function(_, target){
  718. parent = inside ? target : target.parentNode
  719. // convert all methods to a "before" operation
  720. target = operatorIndex == 0 ? target.nextSibling :
  721. operatorIndex == 1 ? target.firstChild :
  722. operatorIndex == 2 ? target :
  723. null
  724. nodes.forEach(function(node){
  725. if (copyByClone) node = node.cloneNode(true)
  726. else if (!parent) return $(node).remove()
  727. traverseNode(parent.insertBefore(node, target), function(el){
  728. if (el.nodeName != null && el.nodeName.toUpperCase() === 'SCRIPT' &&
  729. (!el.type || el.type === 'text/javascript') && !el.src)
  730. window['eval'].call(window, el.innerHTML)
  731. })
  732. })
  733. })
  734. }
  735. // after => insertAfter
  736. // prepend => prependTo
  737. // before => insertBefore
  738. // append => appendTo
  739. $.fn[inside ? operator+'To' : 'insert'+(operatorIndex ? 'Before' : 'After')] = function(html){
  740. $(html)[operator](this)
  741. return this
  742. }
  743. })
  744. zepto.Z.prototype = $.fn
  745. // Export internal API functions in the `$.zepto` namespace
  746. zepto.uniq = uniq
  747. zepto.deserializeValue = deserializeValue
  748. $.zepto = zepto
  749. return $
  750. })()
  751. window.Zepto = Zepto
  752. '$' in window || (window.$ = Zepto)
  753. ;(function($){
  754. function detect(ua){
  755. var os = this.os = {}, browser = this.browser = {},
  756. webkit = ua.match(/WebKit\/([\d.]+)/),
  757. android = ua.match(/(Android)\s+([\d.]+)/),
  758. ipad = ua.match(/(iPad).*OS\s([\d_]+)/),
  759. iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/),
  760. webos = ua.match(/(webOS|hpwOS)[\s\/]([\d.]+)/),
  761. touchpad = webos && ua.match(/TouchPad/),
  762. kindle = ua.match(/Kindle\/([\d.]+)/),
  763. silk = ua.match(/Silk\/([\d._]+)/),
  764. blackberry = ua.match(/(BlackBerry).*Version\/([\d.]+)/),
  765. bb10 = ua.match(/(BB10).*Version\/([\d.]+)/),
  766. rimtabletos = ua.match(/(RIM\sTablet\sOS)\s([\d.]+)/),
  767. playbook = ua.match(/PlayBook/),
  768. chrome = ua.match(/Chrome\/([\d.]+)/) || ua.match(/CriOS\/([\d.]+)/),
  769. firefox = ua.match(/Firefox\/([\d.]+)/)
  770. // Todo: clean this up with a better OS/browser seperation:
  771. // - discern (more) between multiple browsers on android
  772. // - decide if kindle fire in silk mode is android or not
  773. // - Firefox on Android doesn't specify the Android version
  774. // - possibly devide in os, device and browser hashes
  775. if (browser.webkit = !!webkit) browser.version = webkit[1]
  776. if (android) os.android = true, os.version = android[2]
  777. if (iphone) os.ios = os.iphone = true, os.version = iphone[2].replace(/_/g, '.')
  778. if (ipad) os.ios = os.ipad = true, os.version = ipad[2].replace(/_/g, '.')
  779. if (webos) os.webos = true, os.version = webos[2]
  780. if (touchpad) os.touchpad = true
  781. if (blackberry) os.blackberry = true, os.version = blackberry[2]
  782. if (bb10) os.bb10 = true, os.version = bb10[2]
  783. if (rimtabletos) os.rimtabletos = true, os.version = rimtabletos[2]
  784. if (playbook) browser.playbook = true
  785. if (kindle) os.kindle = true, os.version = kindle[1]
  786. if (silk) browser.silk = true, browser.version = silk[1]
  787. if (!silk && os.android && ua.match(/Kindle Fire/)) browser.silk = true
  788. if (chrome) browser.chrome = true, browser.version = chrome[1]
  789. if (firefox) browser.firefox = true, browser.version = firefox[1]
  790. os.tablet = !!(ipad || playbook || (android && !ua.match(/Mobile/)) || (firefox && ua.match(/Tablet/)))
  791. os.phone = !!(!os.tablet && (android || iphone || webos || blackberry || bb10 ||
  792. (chrome && ua.match(/Android/)) || (chrome && ua.match(/CriOS\/([\d.]+)/)) || (firefox && ua.match(/Mobile/))))
  793. }
  794. detect.call($, navigator.userAgent)
  795. // make available to unit tests
  796. $.__detect = detect
  797. })(Zepto)
  798. ;(function($){
  799. var $$ = $.zepto.qsa, handlers = {}, _zid = 1, specialEvents={},
  800. hover = { mouseenter: 'mouseover', mouseleave: 'mouseout' }
  801. specialEvents.click = specialEvents.mousedown = specialEvents.mouseup = specialEvents.mousemove = 'MouseEvents'
  802. function zid(element) {
  803. return element._zid || (element._zid = _zid++)
  804. }
  805. function findHandlers(element, event, fn, selector) {
  806. event = parse(event)
  807. if (event.ns) var matcher = matcherFor(event.ns)
  808. return (handlers[zid(element)] || []).filter(function(handler) {
  809. return handler
  810. && (!event.e || handler.e == event.e)
  811. && (!event.ns || matcher.test(handler.ns))
  812. && (!fn || zid(handler.fn) === zid(fn))
  813. && (!selector || handler.sel == selector)
  814. })
  815. }
  816. function parse(event) {
  817. var parts = ('' + event).split('.')
  818. return {e: parts[0], ns: parts.slice(1).sort().join(' ')}
  819. }
  820. function matcherFor(ns) {
  821. return new RegExp('(?:^| )' + ns.replace(' ', ' .* ?') + '(?: |$)')
  822. }
  823. function eachEvent(events, fn, iterator){
  824. if ($.type(events) != "string") $.each(events, iterator)
  825. else events.split(/\s/).forEach(function(type){ iterator(type, fn) })
  826. }
  827. function eventCapture(handler, captureSetting) {
  828. return handler.del &&
  829. (handler.e == 'focus' || handler.e == 'blur') ||
  830. !!captureSetting
  831. }
  832. function realEvent(type) {
  833. return hover[type] || type
  834. }
  835. function add(element, events, fn, selector, getDelegate, capture){
  836. var id = zid(element), set = (handlers[id] || (handlers[id] = []))
  837. eachEvent(events, fn, function(event, fn){
  838. var handler = parse(event)
  839. handler.fn = fn
  840. handler.sel = selector
  841. // emulate mouseenter, mouseleave
  842. if (handler.e in hover) fn = function(e){
  843. var related = e.relatedTarget
  844. if (!related || (related !== this && !$.contains(this, related)))
  845. return handler.fn.apply(this, arguments)
  846. }
  847. handler.del = getDelegate && getDelegate(fn, event)
  848. var callback = handler.del || fn
  849. handler.proxy = function (e) {
  850. var result = callback.apply(element, [e].concat(e.data))
  851. if (result === false) e.preventDefault(), e.stopPropagation()
  852. return result
  853. }
  854. handler.i = set.length
  855. set.push(handler)
  856. element.addEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture))
  857. })
  858. }
  859. function remove(element, events, fn, selector, capture){
  860. var id = zid(element)
  861. eachEvent(events || '', fn, function(event, fn){
  862. findHandlers(element, event, fn, selector).forEach(function(handler){
  863. delete handlers[id][handler.i]
  864. element.removeEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture))
  865. })
  866. })
  867. }
  868. $.event = { add: add, remove: remove }
  869. $.proxy = function(fn, context) {
  870. if ($.isFunction(fn)) {
  871. var proxyFn = function(){ return fn.apply(context, arguments) }
  872. proxyFn._zid = zid(fn)
  873. return proxyFn
  874. } else if (typeof context == 'string') {
  875. return $.proxy(fn[context], fn)
  876. } else {
  877. throw new TypeError("expected function")
  878. }
  879. }
  880. $.fn.bind = function(event, callback){
  881. return this.each(function(){
  882. add(this, event, callback)
  883. })
  884. }
  885. $.fn.unbind = function(event, callback){
  886. return this.each(function(){
  887. remove(this, event, callback)
  888. })
  889. }
  890. $.fn.one = function(event, callback){
  891. return this.each(function(i, element){
  892. add(this, event, callback, null, function(fn, type){
  893. return function(){
  894. var result = fn.apply(element, arguments)
  895. remove(element, type, fn)
  896. return result
  897. }
  898. })
  899. })
  900. }
  901. var returnTrue = function(){return true},
  902. returnFalse = function(){return false},
  903. ignoreProperties = /^([A-Z]|layer[XY]$)/,
  904. eventMethods = {
  905. preventDefault: 'isDefaultPrevented',
  906. stopImmediatePropagation: 'isImmediatePropagationStopped',
  907. stopPropagation: 'isPropagationStopped'
  908. }
  909. function createProxy(event) {
  910. var key, proxy = { originalEvent: event }
  911. for (key in event)
  912. if (!ignoreProperties.test(key) && event[key] !== undefined) proxy[key] = event[key]
  913. $.each(eventMethods, function(name, predicate) {
  914. proxy[name] = function(){
  915. this[predicate] = returnTrue
  916. return event[name].apply(event, arguments)
  917. }
  918. proxy[predicate] = returnFalse
  919. })
  920. return proxy
  921. }
  922. // emulates the 'defaultPrevented' property for browsers that have none
  923. function fix(event) {
  924. if (!('defaultPrevented' in event)) {
  925. event.defaultPrevented = false
  926. var prevent = event.preventDefault
  927. event.preventDefault = function() {
  928. this.defaultPrevented = true
  929. prevent.call(this)
  930. }
  931. }
  932. }
  933. $.fn.delegate = function(selector, event, callback){
  934. return this.each(function(i, element){
  935. add(element, event, callback, selector, function(fn){
  936. return function(e){
  937. var evt, match = $(e.target).closest(selector, element).get(0)
  938. if (match) {
  939. evt = $.extend(createProxy(e), {currentTarget: match, liveFired: element})
  940. return fn.apply(match, [evt].concat([].slice.call(arguments, 1)))
  941. }
  942. }
  943. })
  944. })
  945. }
  946. $.fn.undelegate = function(selector, event, callback){
  947. return this.each(function(){
  948. remove(this, event, callback, selector)
  949. })
  950. }
  951. $.fn.live = function(event, callback){
  952. $(document.body).delegate(this.selector, event, callback)
  953. return this
  954. }
  955. $.fn.die = function(event, callback){
  956. $(document.body).undelegate(this.selector, event, callback)
  957. return this
  958. }
  959. $.fn.on = function(event, selector, callback){
  960. return !selector || $.isFunction(selector) ?
  961. this.bind(event, selector || callback) : this.delegate(selector, event, callback)
  962. }
  963. $.fn.off = function(event, selector, callback){
  964. return !selector || $.isFunction(selector) ?
  965. this.unbind(event, selector || callback) : this.undelegate(selector, event, callback)
  966. }
  967. $.fn.trigger = function(event, data){
  968. if (typeof event == 'string' || $.isPlainObject(event)) event = $.Event(event)
  969. fix(event)
  970. event.data = data
  971. return this.each(function(){
  972. // items in the collection might not be DOM elements
  973. // (todo: possibly support events on plain old objects)
  974. if('dispatchEvent' in this) this.dispatchEvent(event)
  975. })
  976. }
  977. // triggers event handlers on current element just as if an event occurred,
  978. // doesn't trigger an actual event, doesn't bubble
  979. $.fn.triggerHandler = function(event, data){
  980. var e, result
  981. this.each(function(i, element){
  982. e = createProxy(typeof event == 'string' ? $.Event(event) : event)
  983. e.data = data
  984. e.target = element
  985. $.each(findHandlers(element, event.type || event), function(i, handler){
  986. result = handler.proxy(e)
  987. if (e.isImmediatePropagationStopped()) return false
  988. })
  989. })
  990. return result
  991. }
  992. // shortcut methods for `.bind(event, fn)` for each event type
  993. ;('focusin focusout load resize scroll unload click dblclick '+
  994. 'mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave '+
  995. 'change select keydown keypress keyup error').split(' ').forEach(function(event) {
  996. $.fn[event] = function(callback) {
  997. return callback ?
  998. this.bind(event, callback) :
  999. this.trigger(event)
  1000. }
  1001. })
  1002. ;['focus', 'blur'].forEach(function(name) {
  1003. $.fn[name] = function(callback) {
  1004. if (callback) this.bind(name, callback)
  1005. else this.each(function(){
  1006. try { this[name]() }
  1007. catch(e) {}
  1008. })
  1009. return this
  1010. }
  1011. })
  1012. $.Event = function(type, props) {
  1013. if (typeof type != 'string') props = type, type = props.type
  1014. var event = document.createEvent(specialEvents[type] || 'Events'), bubbles = true
  1015. if (props) for (var name in props) (name == 'bubbles') ? (bubbles = !!props[name]) : (event[name] = props[name])
  1016. event.initEvent(type, bubbles, true, null, null, null, null, null, null, null, null, null, null, null, null)
  1017. event.isDefaultPrevented = function(){ return this.defaultPrevented }
  1018. return event
  1019. }
  1020. })(Zepto)
  1021. ;(function($){
  1022. var jsonpID = 0,
  1023. document = window.document,
  1024. key,
  1025. name,
  1026. rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
  1027. scriptTypeRE = /^(?:text|application)\/javascript/i,
  1028. xmlTypeRE = /^(?:text|application)\/xml/i,
  1029. jsonType = 'application/json',
  1030. htmlType = 'text/html',
  1031. blankRE = /^\s*$/
  1032. // trigger a custom event and return false if it was cancelled
  1033. function triggerAndReturn(context, eventName, data) {
  1034. var event = $.Event(eventName)
  1035. $(context).trigger(event, data)
  1036. return !event.defaultPrevented
  1037. }
  1038. // trigger an Ajax "global" event
  1039. function triggerGlobal(settings, context, eventName, data) {
  1040. if (settings.global) return triggerAndReturn(context || document, eventName, data)
  1041. }
  1042. // Number of active Ajax requests
  1043. $.active = 0
  1044. function ajaxStart(settings) {
  1045. if (settings.global && $.active++ === 0) triggerGlobal(settings, null, 'ajaxStart')
  1046. }
  1047. function ajaxStop(settings) {
  1048. if (settings.global && !(--$.active)) triggerGlobal(settings, null, 'ajaxStop')
  1049. }
  1050. // triggers an extra global event "ajaxBeforeSend" that's like "ajaxSend" but cancelable
  1051. function ajaxBeforeSend(xhr, settings) {
  1052. var context = settings.context
  1053. if (settings.beforeSend.call(context, xhr, settings) === false ||
  1054. triggerGlobal(settings, context, 'ajaxBeforeSend', [xhr, settings]) === false)
  1055. return false
  1056. triggerGlobal(settings, context, 'ajaxSend', [xhr, settings])
  1057. }
  1058. function ajaxSuccess(data, xhr, settings) {
  1059. var context = settings.context, status = 'success'
  1060. settings.success.call(context, data, status, xhr)
  1061. triggerGlobal(settings, context, 'ajaxSuccess', [xhr, settings, data])
  1062. ajaxComplete(status, xhr, settings)
  1063. }
  1064. // type: "timeout", "error", "abort", "parsererror"
  1065. function ajaxError(error, type, xhr, settings) {
  1066. var context = settings.context
  1067. settings.error.call(context, xhr, type, error)
  1068. triggerGlobal(settings, context, 'ajaxError', [xhr, settings, error])
  1069. ajaxComplete(type, xhr, settings)
  1070. }
  1071. // status: "success", "notmodified", "error", "timeout", "abort", "parsererror"
  1072. function ajaxComplete(status, xhr, settings) {
  1073. var context = settings.context
  1074. settings.complete.call(context, xhr, status)
  1075. triggerGlobal(settings, context, 'ajaxComplete', [xhr, settings])
  1076. ajaxStop(settings)
  1077. }
  1078. // Empty function, used as default callback
  1079. function empty() {}
  1080. $.ajaxJSONP = function(options){
  1081. if (!('type' in options)) return $.ajax(options)
  1082. var callbackName = 'jsonp' + (++jsonpID),
  1083. script = document.createElement('script'),
  1084. cleanup = function() {
  1085. clearTimeout(abortTimeout)
  1086. $(script).remove()
  1087. delete window[callbackName]
  1088. },
  1089. abort = function(type){
  1090. cleanup()
  1091. // In case of manual abort or timeout, keep an empty function as callback
  1092. // so that the SCRIPT tag that eventually loads won't result in an error.
  1093. if (!type || type == 'timeout') window[callbackName] = empty
  1094. ajaxError(null, type || 'abort', xhr, options)
  1095. },
  1096. xhr = { abort: abort }, abortTimeout
  1097. if (ajaxBeforeSend(xhr, options) === false) {
  1098. abort('abort')
  1099. return false
  1100. }
  1101. window[callbackName] = function(data){
  1102. cleanup()
  1103. ajaxSuccess(data, xhr, options)
  1104. }
  1105. script.onerror = function() { abort('error') }
  1106. script.src = options.url.replace(/=\?/, '=' + callbackName)
  1107. $('head').append(script)
  1108. if (options.timeout > 0) abortTimeout = setTimeout(function(){
  1109. abort('timeout')
  1110. }, options.timeout)
  1111. return xhr
  1112. }
  1113. $.ajaxSettings = {
  1114. // Default type of request
  1115. type: 'GET',
  1116. // Callback that is executed before request
  1117. beforeSend: empty,
  1118. // Callback that is executed if the request succeeds
  1119. success: empty,
  1120. // Callback that is executed the the server drops error
  1121. error: empty,
  1122. // Callback that is executed on request complete (both: error and success)
  1123. complete: empty,
  1124. // The context for the callbacks
  1125. context: null,
  1126. // Whether to trigger "global" Ajax events
  1127. global: true,
  1128. // Transport
  1129. xhr: function () {
  1130. return new window.XMLHttpRequest()
  1131. },
  1132. // MIME types mapping
  1133. accepts: {
  1134. script: 'text/javascript, application/javascript',
  1135. json: jsonType,
  1136. xml: 'application/xml, text/xml',
  1137. html: htmlType,
  1138. text: 'text/plain'
  1139. },
  1140. // Whether the request is to another domain
  1141. crossDomain: false,
  1142. // Default timeout
  1143. timeout: 0,
  1144. // Whether data should be serialized to string
  1145. processData: true,
  1146. // Whether the browser should be allowed to cache GET responses
  1147. cache: true,
  1148. }
  1149. function mimeToDataType(mime) {
  1150. if (mime) mime = mime.split(';', 2)[0]
  1151. return mime && ( mime == htmlType ? 'html' :
  1152. mime == jsonType ? 'json' :
  1153. scriptTypeRE.test(mime) ? 'script' :
  1154. xmlTypeRE.test(mime) && 'xml' ) || 'text'
  1155. }
  1156. function appendQuery(url, query) {
  1157. return (url + '&' + query).replace(/[&?]{1,2}/, '?')
  1158. }
  1159. // serialize payload and append it to the URL for GET requests
  1160. function serializeData(options) {
  1161. if (options.processData && options.data && $.type(options.data) != "string")
  1162. options.data = $.param(options.data, options.traditional)
  1163. if (options.data && (!options.type || options.type.toUpperCase() == 'GET'))
  1164. options.url = appendQuery(options.url, options.data)
  1165. }
  1166. $.ajax = function(options){
  1167. var settings = $.extend({}, options || {})
  1168. for (key in $.ajaxSettings) if (settings[key] === undefined) settings[key] = $.ajaxSettings[key]
  1169. ajaxStart(settings)
  1170. if (!settings.crossDomain) settings.crossDomain = /^([\w-]+:)?\/\/([^\/]+)/.test(settings.url) &&
  1171. RegExp.$2 != window.location.host
  1172. if (!settings.url) settings.url = window.location.toString()
  1173. serializeData(settings)
  1174. if (settings.cache === false) settings.url = appendQuery(settings.url, '_=' + Date.now())
  1175. var dataType = settings.dataType, hasPlaceholder = /=\?/.test(settings.url)
  1176. if (dataType == 'jsonp' || hasPlaceholder) {
  1177. if (!hasPlaceholder) settings.url = appendQuery(settings.url, 'callback=?')
  1178. return $.ajaxJSONP(settings)
  1179. }
  1180. var mime = settings.accepts[dataType],
  1181. baseHeaders = { },
  1182. protocol = /^([\w-]+:)\/\//.test(settings.url) ? RegExp.$1 : window.location.protocol,
  1183. xhr = settings.xhr(), abortTimeout
  1184. if (!settings.crossDomain) baseHeaders['X-Requested-With'] = 'XMLHttpRequest'
  1185. if (mime) {
  1186. baseHeaders['Accept'] = mime
  1187. if (mime.indexOf(',') > -1) mime = mime.split(',', 2)[0]
  1188. xhr.overrideMimeType && xhr.overrideMimeType(mime)
  1189. }
  1190. if (settings.contentType || (settings.contentType !== false && settings.data && settings.type.toUpperCase() != 'GET'))
  1191. baseHeaders['Content-Type'] = (settings.contentType || 'application/x-www-form-urlencoded')
  1192. settings.headers = $.extend(baseHeaders, settings.headers || {})
  1193. xhr.onreadystatechange = function(){
  1194. if (xhr.readyState == 4) {
  1195. xhr.onreadystatechange = empty;
  1196. clearTimeout(abortTimeout)
  1197. var result, error = false
  1198. if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304 || (xhr.status == 0 && protocol == 'file:')) {
  1199. dataType = dataType || mimeToDataType(xhr.getResponseHeader('content-type'))
  1200. result = xhr.responseText
  1201. try {
  1202. // http://perfectionkills.com/global-eval-what-are-the-options/
  1203. if (dataType == 'script') (1,eval)(result)
  1204. else if (dataType == 'xml') result = xhr.responseXML
  1205. else if (dataType == 'json') result = blankRE.test(result) ? null : $.parseJSON(result)
  1206. } catch (e) { error = e }
  1207. if (error) ajaxError(error, 'parsererror', xhr, settings)
  1208. else ajaxSuccess(result, xhr, settings)
  1209. } else {
  1210. ajaxError(null, xhr.status ? 'error' : 'abort', xhr, settings)
  1211. }
  1212. }
  1213. }
  1214. var async = 'async' in settings ? settings.async : true
  1215. xhr.open(settings.type, settings.url, async)
  1216. for (name in settings.headers) xhr.setRequestHeader(name, settings.headers[name])
  1217. if (ajaxBeforeSend(xhr, settings) === false) {
  1218. xhr.abort()
  1219. return false
  1220. }
  1221. if (settings.timeout > 0) abortTimeout = setTimeout(function(){
  1222. xhr.onreadystatechange = empty
  1223. xhr.abort()
  1224. ajaxError(null, 'timeout', xhr, settings)
  1225. }, settings.timeout)
  1226. // avoid sending empty string (#319)
  1227. xhr.send(settings.data ? settings.data : null)
  1228. return xhr
  1229. }
  1230. // handle optional data/success arguments
  1231. function parseArguments(url, data, success, dataType) {
  1232. var hasData = !$.isFunction(data)
  1233. return {
  1234. url: url,
  1235. data: hasData ? data : undefined,
  1236. success: !hasData ? data : $.isFunction(success) ? success : undefined,
  1237. dataType: hasData ? dataType || success : success
  1238. }
  1239. }
  1240. $.get = function(url, data, success, dataType){
  1241. return $.ajax(parseArguments.apply(null, arguments))
  1242. }
  1243. $.post = function(url, data, success, dataType){
  1244. var options = parseArguments.apply(null, arguments)
  1245. options.type = 'POST'
  1246. return $.ajax(options)
  1247. }
  1248. $.getJSON = function(url, data, success){
  1249. var options = parseArguments.apply(null, arguments)
  1250. options.dataType = 'json'
  1251. return $.ajax(options)
  1252. }
  1253. $.fn.load = function(url, data, success){
  1254. if (!this.length) return this
  1255. var self = this, parts = url.split(/\s/), selector,
  1256. options = parseArguments(url, data, success),
  1257. callback = options.success
  1258. if (parts.length > 1) options.url = parts[0], selector = parts[1]
  1259. options.success = function(response){
  1260. self.html(selector ?
  1261. $('<div>').html(response.replace(rscript, "")).find(selector)
  1262. : response)
  1263. callback && callback.apply(self, arguments)
  1264. }
  1265. $.ajax(options)
  1266. return this
  1267. }
  1268. var escape = encodeURIComponent
  1269. function serialize(params, obj, traditional, scope){
  1270. var type, array = $.isArray(obj)
  1271. $.each(obj, function(key, value) {
  1272. type = $.type(value)
  1273. if (scope) key = traditional ? scope : scope + '[' + (array ? '' : key) + ']'
  1274. // handle data in serializeArray() format
  1275. if (!scope && array) params.add(value.name, value.value)
  1276. // recurse into nested objects
  1277. else if (type == "array" || (!traditional && type == "object"))
  1278. serialize(params, value, traditional, key)
  1279. else params.add(key, value)
  1280. })
  1281. }
  1282. $.param = function(obj, traditional){
  1283. var params = []
  1284. params.add = function(k, v){ this.push(escape(k) + '=' + escape(v)) }
  1285. serialize(params, obj, traditional)
  1286. return params.join('&').replace(/%20/g, '+')
  1287. }
  1288. })(Zepto)
  1289. ;(function ($) {
  1290. $.fn.serializeArray = function () {
  1291. var result = [], el
  1292. $( Array.prototype.slice.call(this.get(0).elements) ).each(function () {
  1293. el = $(this)
  1294. var type = el.attr('type')
  1295. if (this.nodeName.toLowerCase() != 'fieldset' &&
  1296. !this.disabled && type != 'submit' && type != 'reset' && type != 'button' &&
  1297. ((type != 'radio' && type != 'checkbox') || this.checked))
  1298. result.push({
  1299. name: el.attr('name'),
  1300. value: el.val()
  1301. })
  1302. })
  1303. return result
  1304. }
  1305. $.fn.serialize = function () {
  1306. var result = []
  1307. this.serializeArray().forEach(function (elm) {
  1308. result.push( encodeURIComponent(elm.name) + '=' + encodeURIComponent(elm.value) )
  1309. })
  1310. return result.join('&')
  1311. }
  1312. $.fn.submit = function (callback) {
  1313. if (callback) this.bind('submit', callback)
  1314. else if (this.length) {
  1315. var event = $.Event('submit')
  1316. this.eq(0).trigger(event)
  1317. if (!event.defaultPrevented) this.get(0).submit()
  1318. }
  1319. return this
  1320. }
  1321. })(Zepto)
  1322. ;(function($, undefined){
  1323. var prefix = '', eventPrefix, endEventName, endAnimationName,
  1324. vendors = { Webkit: 'webkit', Moz: '', O: 'o', ms: 'MS' },
  1325. document = window.document, testEl = document.createElement('div'),
  1326. supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i,
  1327. transform,
  1328. transitionProperty, transitionDuration, transitionTiming,
  1329. animationName, animationDuration, animationTiming,
  1330. cssReset = {}
  1331. function dasherize(str) { return downcase(str.replace(/([a-z])([A-Z])/, '$1-$2')) }
  1332. function downcase(str) { return str.toLowerCase() }
  1333. function normalizeEvent(name) { return eventPrefix ? eventPrefix + name : downcase(name) }
  1334. $.each(vendors, function(vendor, event){
  1335. if (testEl.style[vendor + 'TransitionProperty'] !== undefined) {
  1336. prefix = '-' + downcase(vendor) + '-'
  1337. eventPrefix = event
  1338. return false
  1339. }
  1340. })
  1341. transform = prefix + 'transform'
  1342. cssReset[transitionProperty = prefix + 'transition-property'] =
  1343. cssReset[transitionDuration = prefix + 'transition-duration'] =
  1344. cssReset[transitionTiming = prefix + 'transition-timing-function'] =
  1345. cssReset[animationName = prefix + 'animation-name'] =
  1346. cssReset[animationDuration = prefix + 'animation-duration'] =
  1347. cssReset[animationTiming = prefix + 'animation-timing-function'] = ''
  1348. $.fx = {
  1349. off: (eventPrefix === undefined && testEl.style.transitionProperty === undefined),
  1350. speeds: { _default: 400, fast: 200, slow: 600 },
  1351. cssPrefix: prefix,
  1352. transitionEnd: normalizeEvent('TransitionEnd'),
  1353. animationEnd: normalizeEvent('AnimationEnd')
  1354. }
  1355. $.fn.animate = function(properties, duration, ease, callback){
  1356. if ($.isPlainObject(duration))
  1357. ease = duration.easing, callback = duration.complete, duration = duration.duration
  1358. if (duration) duration = (typeof duration == 'number' ? duration :
  1359. ($.fx.speeds[duration] || $.fx.speeds._default)) / 1000
  1360. return this.anim(properties, duration, ease, callback)
  1361. }
  1362. $.fn.anim = function(properties, duration, ease, callback){
  1363. var key, cssValues = {}, cssProperties, transforms = '',
  1364. that = this, wrappedCallback, endEvent = $.fx.transitionEnd
  1365. if (duration === undefined) duration = 0.4
  1366. if ($.fx.off) duration = 0
  1367. if (typeof properties == 'string') {
  1368. // keyframe animation
  1369. cssValues[animationName] = properties
  1370. cssValues[animationDuration] = duration + 's'
  1371. cssValues[animationTiming] = (ease || 'linear')
  1372. endEvent = $.fx.animationEnd
  1373. } else {
  1374. cssProperties = []
  1375. // CSS transitions
  1376. for (key in properties)
  1377. if (supportedTransforms.test(key)) transforms += key + '(' + properties[key] + ') '
  1378. else cssValues[key] = properties[key], cssProperties.push(dasherize(key))
  1379. if (transforms) cssValues[transform] = transforms, cssProperties.push(transform)
  1380. if (duration > 0 && typeof properties === 'object') {
  1381. cssValues[transitionProperty] = cssProperties.join(', ')
  1382. cssValues[transitionDuration] = duration + 's'
  1383. cssValues[transitionTiming] = (ease || 'linear')
  1384. }
  1385. }
  1386. wrappedCallback = function(event){
  1387. if (typeof event !== 'undefined') {
  1388. if (event.target !== event.currentTarget) return // makes sure the event didn't bubble from "below"
  1389. $(event.target).unbind(endEvent, wrappedCallback)
  1390. }
  1391. $(this).css(cssReset)
  1392. callback && callback.call(this)
  1393. }
  1394. if (duration > 0) this.bind(endEvent, wrappedCallback)
  1395. // trigger page reflow so new elements can animate
  1396. this.size() && this.get(0).clientLeft
  1397. this.css(cssValues)
  1398. if (duration <= 0) setTimeout(function() {
  1399. that.each(function(){ wrappedCallback.call(this) })
  1400. }, 0)
  1401. return this
  1402. }
  1403. testEl = null
  1404. })(Zepto)
  1405. // Zepto.js
  1406. // (c) 2010-2012 Thomas Fuchs
  1407. // Zepto.js may be freely distributed under the MIT license.
  1408. ;(function($, undefined){
  1409. var document = window.document, docElem = document.documentElement,
  1410. origShow = $.fn.show, origHide = $.fn.hide, origToggle = $.fn.toggle
  1411. function anim(el, speed, opacity, scale, callback) {
  1412. if (typeof speed == 'function' && !callback) callback = speed, speed = undefined
  1413. var props = { opacity: opacity }
  1414. if (scale) {
  1415. props.scale = scale
  1416. el.css($.fx.cssPrefix + 'transform-origin', '0 0')
  1417. }
  1418. return el.animate(props, speed, null, callback)
  1419. }
  1420. function hide(el, speed, scale, callback) {
  1421. return anim(el, speed, 0, scale, function(){
  1422. origHide.call($(this))
  1423. callback && callback.call(this)
  1424. })
  1425. }
  1426. $.fn.show = function(speed, callback) {
  1427. origShow.call(this)
  1428. if (speed === undefined) speed = 0
  1429. else this.css('opacity', 0)
  1430. return anim(this, speed, 1, '1,1', callback)
  1431. }
  1432. $.fn.hide = function(speed, callback) {
  1433. if (speed === undefined) return origHide.call(this)
  1434. else return hide(this, speed, '0,0', callback)
  1435. }
  1436. $.fn.toggle = function(speed, callback) {
  1437. if (speed === undefined || typeof speed == 'boolean')
  1438. return origToggle.call(this, speed)
  1439. else return this.each(function(){
  1440. var el = $(this)
  1441. el[el.css('display') == 'none' ? 'show' : 'hide'](speed, callback)
  1442. })
  1443. }
  1444. $.fn.fadeTo = function(speed, opacity, callback) {
  1445. return anim(this, speed, opacity, null, callback)
  1446. }
  1447. $.fn.fadeIn = function(speed, callback) {
  1448. var target = this.css('opacity')
  1449. if (target > 0) this.css('opacity', 0)
  1450. else target = 1
  1451. return origShow.call(this).fadeTo(speed, target, callback)
  1452. }
  1453. $.fn.fadeOut = function(speed, callback) {
  1454. return hide(this, speed, null, callback)
  1455. }
  1456. $.fn.fadeToggle = function(speed, callback) {
  1457. return this.each(function(){
  1458. var el = $(this)
  1459. el[
  1460. (el.css('opacity') == 0 || el.css('display') == 'none') ? 'fadeIn' : 'fadeOut'
  1461. ](speed, callback)
  1462. })
  1463. }
  1464. })(Zepto)
  1465. // Zepto.js
  1466. // (c) 2010-2012 Thomas Fuchs
  1467. // Zepto.js may be freely distributed under the MIT license.
  1468. ;(function($){
  1469. var cache = [], timeout
  1470. $.fn.remove = function(){
  1471. return this.each(function(){
  1472. if(this.parentNode){
  1473. if(this.tagName === 'IMG'){
  1474. cache.push(this)
  1475. this.src = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='
  1476. if (timeout) clearTimeout(timeout)
  1477. timeout = setTimeout(function(){ cache = [] }, 60000)
  1478. }
  1479. this.parentNode.removeChild(this)
  1480. }
  1481. })
  1482. }
  1483. })(Zepto)
  1484. // Zepto.js
  1485. // (c) 2010-2012 Thomas Fuchs
  1486. // Zepto.js may be freely distributed under the MIT license.
  1487. // The following code is heavily inspired by jQuery's $.fn.data()
  1488. ;(function($) {
  1489. var data = {}, dataAttr = $.fn.data, camelize = $.camelCase,
  1490. exp = $.expando = 'Zepto' + (+new Date())
  1491. // Get value from node:
  1492. // 1. first try key as given,
  1493. // 2. then try camelized key,
  1494. // 3. fall back to reading "data-*" attribute.
  1495. function getData(node, name) {
  1496. var id = node[exp], store = id && data[id]
  1497. if (name === undefined) return store || setData(node)
  1498. else {
  1499. if (store) {
  1500. if (name in store) return store[name]
  1501. var camelName = camelize(name)
  1502. if (camelName in store) return store[camelName]
  1503. }
  1504. return dataAttr.call($(node), name)
  1505. }
  1506. }
  1507. // Store value under camelized key on node
  1508. function setData(node, name, value) {
  1509. var id = node[exp] || (node[exp] = ++$.uuid),
  1510. store = data[id] || (data[id] = attributeData(node))
  1511. if (name !== undefined) store[camelize(name)] = value
  1512. return store
  1513. }
  1514. // Read all "data-*" attributes from a node
  1515. function attributeData(node) {
  1516. var store = {}
  1517. $.each(node.attributes, function(i, attr){
  1518. if (attr.name.indexOf('data-') == 0)
  1519. store[camelize(attr.name.replace('data-', ''))] =
  1520. $.zepto.deserializeValue(attr.value)
  1521. })
  1522. return store
  1523. }
  1524. $.fn.data = function(name, value) {
  1525. return value === undefined ?
  1526. // set multiple values via object
  1527. $.isPlainObject(name) ?
  1528. this.each(function(i, node){
  1529. $.each(name, function(key, value){ setData(node, key, value) })
  1530. }) :
  1531. // get value from first element
  1532. this.length == 0 ? undefined : getData(this[0], name) :
  1533. // set value on all elements
  1534. this.each(function(){ setData(this, name, value) })
  1535. }
  1536. $.fn.removeData = function(names) {
  1537. if (typeof names == 'string') names = names.split(/\s+/)
  1538. return this.each(function(){
  1539. var id = this[exp], store = id && data[id]
  1540. if (store) $.each(names, function(){ delete store[camelize(this)] })
  1541. })
  1542. }
  1543. })(Zepto)
  1544. ;(function($){
  1545. var zepto = $.zepto, oldQsa = zepto.qsa, oldMatches = zepto.matches
  1546. function visible(elem){
  1547. elem = $(elem)
  1548. return !!(elem.width() || elem.height()) && elem.css("display") !== "none"
  1549. }
  1550. // Implements a subset from:
  1551. // http://api.jquery.com/category/selectors/jquery-selector-extensions/
  1552. //
  1553. // Each filter function receives the current index, all nodes in the
  1554. // considered set, and a value if there were parentheses. The value
  1555. // of `this` is the node currently being considered. The function returns the
  1556. // resulting node(s), null, or undefined.
  1557. //
  1558. // Complex selectors are not supported:
  1559. // li:has(label:contains("foo")) + li:has(label:contains("bar"))
  1560. // ul.inner:first > li
  1561. var filters = $.expr[':'] = {
  1562. visible: function(){ if (visible(this)) return this },
  1563. hidden: function(){ if (!visible(this)) return this },
  1564. selected: function(){ if (this.selected) return this },
  1565. checked: function(){ if (this.checked) return this },
  1566. parent: function(){ return this.parentNode },
  1567. first: function(idx){ if (idx === 0) return this },
  1568. last: function(idx, nodes){ if (idx === nodes.length - 1) return this },
  1569. eq: function(idx, _, value){ if (idx === value) return this },
  1570. contains: function(idx, _, text){ if ($(this).text().indexOf(text) > -1) return this },
  1571. has: function(idx, _, sel){ if (zepto.qsa(this, sel).length) return this }
  1572. }
  1573. var filterRe = new RegExp('(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*'),
  1574. childRe = /^\s*>/,
  1575. classTag = 'Zepto' + (+new Date())
  1576. function process(sel, fn) {
  1577. // quote the hash in `a[href^=#]` expression
  1578. sel = sel.replace(/=#\]/g, '="#"]')
  1579. var filter, arg, match = filterRe.exec(sel)
  1580. if (match && match[2] in filters) {
  1581. filter = filters[match[2]], arg = match[3]
  1582. sel = match[1]
  1583. if (arg) {
  1584. var num = Number(arg)
  1585. if (isNaN(num)) arg = arg.replace(/^["']|["']$/g, '')
  1586. else arg = num
  1587. }
  1588. }
  1589. return fn(sel, filter, arg)
  1590. }
  1591. zepto.qsa = function(node, selector) {
  1592. return process(selector, function(sel, filter, arg){
  1593. try {
  1594. var taggedParent
  1595. if (!sel && filter) sel = '*'
  1596. else if (childRe.test(sel))
  1597. // support "> *" child queries by tagging the parent node with a
  1598. // unique class and prepending that classname onto the selector
  1599. taggedParent = $(node).addClass(classTag), sel = '.'+classTag+' '+sel
  1600. var nodes = oldQsa(node, sel)
  1601. } catch(e) {
  1602. console.error('error performing selector: %o', selector)
  1603. throw e
  1604. } finally {
  1605. if (taggedParent) taggedParent.removeClass(classTag)
  1606. }
  1607. return !filter ? nodes :
  1608. zepto.uniq($.map(nodes, function(n, i){ return filter.call(n, i, nodes, arg) }))
  1609. })
  1610. }
  1611. zepto.matches = function(node, selector){
  1612. return process(selector, function(sel, filter, arg){
  1613. return (!sel || oldMatches(node, sel)) &&
  1614. (!filter || filter.call(node, null, arg) === node)
  1615. })
  1616. }
  1617. })(Zepto)
  1618. // Zepto.js
  1619. // (c) 2010-2012 Thomas Fuchs
  1620. // Zepto.js may be freely distributed under the MIT license.
  1621. ;(function($){
  1622. $.fn.end = function(){
  1623. return this.prevObject || $()
  1624. }
  1625. $.fn.andSelf = function(){
  1626. return this.add(this.prevObject || $())
  1627. }
  1628. 'filter,add,not,eq,first,last,find,closest,parents,parent,children,siblings'.split(',').forEach(function(property){
  1629. var fn = $.fn[property]
  1630. $.fn[property] = function(){
  1631. var ret = fn.apply(this, arguments)
  1632. ret.prevObject = this
  1633. return ret
  1634. }
  1635. })
  1636. })(Zepto)
  1637. // outer and inner height/width support
  1638. if (this.Zepto) {
  1639. (function($) {
  1640. var ioDim, _base;
  1641. ioDim = function(elem, Dimension, dimension, includeBorder, includeMargin) {
  1642. var sides, size;
  1643. if (elem) {
  1644. size = elem[dimension]();
  1645. sides = {
  1646. width: ["left", "right"],
  1647. height: ["top", "bottom"]
  1648. };
  1649. sides[dimension].forEach(function(side) {
  1650. size += parseInt(elem.css("padding-" + side), 10);
  1651. if (includeBorder) {
  1652. size += parseInt(elem.css("border-" + side + "-width"), 10);
  1653. }
  1654. if (includeMargin) {
  1655. return size += parseInt(elem.css("margin-" + side), 10);
  1656. }
  1657. });
  1658. return size;
  1659. } else {
  1660. return null;
  1661. }
  1662. };
  1663. ["width", "height"].forEach(function(dimension) {
  1664. var Dimension, _base, _base1, _name, _name1;
  1665. Dimension = dimension.replace(/./, function(m) {
  1666. return m[0].toUpperCase();
  1667. });
  1668. (_base = $.fn)[_name = "inner" + Dimension] || (_base[_name] = function(includeMargin) {
  1669. return ioDim(this, Dimension, dimension, false, includeMargin);
  1670. });
  1671. return (_base1 = $.fn)[_name1 = "outer" + Dimension] || (_base1[_name1] = function(includeMargin) {
  1672. return ioDim(this, Dimension, dimension, true, includeMargin);
  1673. });
  1674. });
  1675. return (_base = $.fn).detach || (_base.detach = function(selector) {
  1676. var cloned, set;
  1677. set = this;
  1678. if (selector != null) {
  1679. set = set.filter(selector);
  1680. }
  1681. cloned = set.clone(true);
  1682. set.remove();
  1683. return cloned;
  1684. });
  1685. })(Zepto);
  1686. }