<!--html模块-->

  1. <header class="appoin-head">
  2. <ul>
  3. <li class="aa">
  4. <a href="#">
  5. <img src="img/banner1.png" alt="">
  6. </a>
  7. </li>
  8. <li>
  9. <a href="#">
  10. <img src="img/banner2.png" alt="">
  11. </a>
  12. </li>
  13. <li>
  14. <a href="#">
  15. <img src="img/banner3.png" alt="">
  16. </a>
  17. </li>
  18. <li>
  19. <a href="#">
  20. <img src="img/banner4.png" alt="">
  21. </a>
  22. </li>
  23. </ul>
  24. <ol></ol>
  25. </header>

<!--css样式-->

  1. .appoin-head ol,.appoin-head ul {
  2. list-style: none;
  3. margin:;
  4. padding:;
  5. }
  6.  
  7. .appoin-head ul li {
  8. float: left;
  9. }
  10.  
  11. .clear:after {
  12. content: '';
  13. clear: both;
  14. display: block;
  15. }
  16.  
  17. .clear {
  18. zoom:;
  19. }
  20.  
  21. .mob3d, .appoin-head, .appoin-head ul, .appoin-head ul li {
  22. transform: translate3d(0, 0, 0);
  23. -webkit-transform: translate3d(0, 0, 0);
  24. -o-transform: translate3d(0, 0, 0);
  25. -moz-transform: translate3d(0, 0, 0);
  26. }
  27.  
  28. .appoin-head {
  29. position: relative;
  30. width: 100%;
  31. overflow: hidden;
  32. }
  33.  
  34. .appoin-head ul {
  35. width: 900%;
  36. height: 100%;
  37. -webkit-transition: all 0.5s 0s ease-in-out;
  38. }
  39.  
  40. .appoin-head ul li a {
  41. display: block;
  42. width: 100%;
  43. }
  44.  
  45. .appoin-head ul li a img {
  46. max-width: 100%;
  47. max-height: 100%;
  48. }
  49.  
  50. .appoin-head ol {
  51. position: absolute;
  52. left: 50%;
  53. bottom: 0.7rem;
  54. }
  55.  
  56. .appoin-head ol li {
  57. width: 0.7rem;
  58. height: 0.7rem;
  59. background: #ffffff;
  60. display: inline-block;
  61. margin: 0 0.2rem;
  62. -webkit-border-radius: 100%;
  63. -moz-border-radius: 100%;
  64. -mz-border-radius: 100%;
  65. -o-border-radius: 100%;
  66. border-radius: 100%;
  67. }
  68.  
  69. .appoin-head ol li.active {
  70. background: #f897ae;
  71. }

<!--js部分-->

  1. $(function() {
  2. var length = $('.appoin-head ul li').length,
  3. now = 0;
  4. var $li = $('.appoin-head ul li');
  5. $li.width($(window).width());
  6. var wid = $li.width();
  7. $('.appoin-head ul').width(wid * length);
  8. for (var i = 0; i < length; i++) {
  9. var html = '<li></li>';
  10. $('.appoin-head ol').append(html);
  11. }
  12. var olwidth = ($('.appoin-head ol').width()) / 2;
  13. $('.appoin-head ol').css('marginLeft', -olwidth);
  14. $('.appoin-head ol li').eq(now).addClass('active').siblings('li').removeClass('active');
  15.  
  16. function silder() {
  17. $('.appoin-head ul').css("-webkit-transform", "translate3d(" + -wid * (now) + "px,0,0)");
  18. $('.appoin-head ol li').eq(now).addClass('active').siblings('li').removeClass('active');
  19. }
  20. $('.appoin-head ul li').swipeLeft(function(e) {
  21. now++;
  22. if (now > length - 1) now = 0;
  23. silder();
  24. })
  25. $('.appoin-head ul li').swipeRight(function(e) {
  26. now--;
  27. if (now < 0) now = length - 1;
  28. silder();
  29. })
  30. var time = setInterval(function() {
  31. now++;
  32. if (now > length - 1) now = 0;
  33. silder();
  34. }, 3000);
  35. $('.appoin-head ul li').on('touchstart', function() {
  36. clearInterval(time);
  37. })
  38. $('.appoin-head ul li').on('touchend', function() {
  39. time = setInterval(function() {
  40. now++;
  41. if (now > length - 1) now = 0;
  42. silder();
  43. }, 3000);
  44. })
  45. }());

// 上面是banner图切换,touch的js部分有改动,修复安卓qq浏览器中的失效

下面是zepto改后的源码,

  1. // Zepto.js
  2. // (c) 2010-2016 Thomas Fuchs
  3. // Zepto.js may be freely distributed under the MIT license.
  4.  
  5. var Zepto = (function() {
  6. var undefined, key, $, classList, emptyArray = [], concat = emptyArray.concat, filter = emptyArray.filter, slice = emptyArray.slice,
  7. document = window.document,
  8. elementDisplay = {}, classCache = {},
  9. cssNumber = { 'column-count': 1, 'columns': 1, 'font-weight': 1, 'line-height': 1,'opacity': 1, 'z-index': 1, 'zoom': 1 },
  10. fragmentRE = /^\s*<(\w+|!)[^>]*>/,
  11. singleTagRE = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
  12. tagExpanderRE = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
  13. rootNodeRE = /^(?:body|html)$/i,
  14. capitalRE = /([A-Z])/g,
  15.  
  16. // special attributes that should be get/set via method calls
  17. methodAttributes = ['val', 'css', 'html', 'text', 'data', 'width', 'height', 'offset'],
  18.  
  19. adjacencyOperators = [ 'after', 'prepend', 'before', 'append' ],
  20. table = document.createElement('table'),
  21. tableRow = document.createElement('tr'),
  22. containers = {
  23. 'tr': document.createElement('tbody'),
  24. 'tbody': table, 'thead': table, 'tfoot': table,
  25. 'td': tableRow, 'th': tableRow,
  26. '*': document.createElement('div')
  27. },
  28. readyRE = /complete|loaded|interactive/,
  29. simpleSelectorRE = /^[\w-]*$/,
  30. class2type = {},
  31. toString = class2type.toString,
  32. zepto = {},
  33. camelize, uniq,
  34. tempParent = document.createElement('div'),
  35. propMap = {
  36. 'tabindex': 'tabIndex',
  37. 'readonly': 'readOnly',
  38. 'for': 'htmlFor',
  39. 'class': 'className',
  40. 'maxlength': 'maxLength',
  41. 'cellspacing': 'cellSpacing',
  42. 'cellpadding': 'cellPadding',
  43. 'rowspan': 'rowSpan',
  44. 'colspan': 'colSpan',
  45. 'usemap': 'useMap',
  46. 'frameborder': 'frameBorder',
  47. 'contenteditable': 'contentEditable'
  48. },
  49. isArray = Array.isArray ||
  50. function(object){ return object instanceof Array }
  51.  
  52. zepto.matches = function(element, selector) {
  53. if (!selector || !element || element.nodeType !== 1) return false
  54. var matchesSelector = element.webkitMatchesSelector || element.mozMatchesSelector ||
  55. element.oMatchesSelector || element.matchesSelector
  56. if (matchesSelector) return matchesSelector.call(element, selector)
  57. // fall back to performing a selector:
  58. var match, parent = element.parentNode, temp = !parent
  59. if (temp) (parent = tempParent).appendChild(element)
  60. match = ~zepto.qsa(parent, selector).indexOf(element)
  61. temp && tempParent.removeChild(element)
  62. return match
  63. }
  64.  
  65. function type(obj) {
  66. return obj == null ? String(obj) :
  67. class2type[toString.call(obj)] || "object"
  68. }
  69.  
  70. function isFunction(value) { return type(value) == "function" }
  71. function isWindow(obj) { return obj != null && obj == obj.window }
  72. function isDocument(obj) { return obj != null && obj.nodeType == obj.DOCUMENT_NODE }
  73. function isObject(obj) { return type(obj) == "object" }
  74. function isPlainObject(obj) {
  75. return isObject(obj) && !isWindow(obj) && Object.getPrototypeOf(obj) == Object.prototype
  76. }
  77. function likeArray(obj) { return typeof obj.length == 'number' }
  78.  
  79. function compact(array) { return filter.call(array, function(item){ return item != null }) }
  80. function flatten(array) { return array.length > 0 ? $.fn.concat.apply([], array) : array }
  81. camelize = function(str){ return str.replace(/-+(.)?/g, function(match, chr){ return chr ? chr.toUpperCase() : '' }) }
  82. function dasherize(str) {
  83. return str.replace(/::/g, '/')
  84. .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')
  85. .replace(/([a-z\d])([A-Z])/g, '$1_$2')
  86. .replace(/_/g, '-')
  87. .toLowerCase()
  88. }
  89. uniq = function(array){ return filter.call(array, function(item, idx){ return array.indexOf(item) == idx }) }
  90.  
  91. function classRE(name) {
  92. return name in classCache ?
  93. classCache[name] : (classCache[name] = new RegExp('(^|\\s)' + name + '(\\s|$)'))
  94. }
  95.  
  96. function maybeAddPx(name, value) {
  97. return (typeof value == "number" && !cssNumber[dasherize(name)]) ? value + "px" : value
  98. }
  99.  
  100. function defaultDisplay(nodeName) {
  101. var element, display
  102. if (!elementDisplay[nodeName]) {
  103. element = document.createElement(nodeName)
  104. document.body.appendChild(element)
  105. display = getComputedStyle(element, '').getPropertyValue("display")
  106. element.parentNode.removeChild(element)
  107. display == "none" && (display = "block")
  108. elementDisplay[nodeName] = display
  109. }
  110. return elementDisplay[nodeName]
  111. }
  112.  
  113. function children(element) {
  114. return 'children' in element ?
  115. slice.call(element.children) :
  116. $.map(element.childNodes, function(node){ if (node.nodeType == 1) return node })
  117. }
  118.  
  119. function Z(dom, selector) {
  120. var i, len = dom ? dom.length : 0
  121. for (i = 0; i < len; i++) this[i] = dom[i]
  122. this.length = len
  123. this.selector = selector || ''
  124. }
  125.  
  126. // `$.zepto.fragment` takes a html string and an optional tag name
  127. // to generate DOM nodes from the given html string.
  128. // The generated DOM nodes are returned as an array.
  129. // This function can be overridden in plugins for example to make
  130. // it compatible with browsers that don't support the DOM fully.
  131. zepto.fragment = function(html, name, properties) {
  132. var dom, nodes, container
  133.  
  134. // A special case optimization for a single tag
  135. if (singleTagRE.test(html)) dom = $(document.createElement(RegExp.$1))
  136.  
  137. if (!dom) {
  138. if (html.replace) html = html.replace(tagExpanderRE, "<$1></$2>")
  139. if (name === undefined) name = fragmentRE.test(html) && RegExp.$1
  140. if (!(name in containers)) name = '*'
  141.  
  142. container = containers[name]
  143. container.innerHTML = '' + html
  144. dom = $.each(slice.call(container.childNodes), function(){
  145. container.removeChild(this)
  146. })
  147. }
  148.  
  149. if (isPlainObject(properties)) {
  150. nodes = $(dom)
  151. $.each(properties, function(key, value) {
  152. if (methodAttributes.indexOf(key) > -1) nodes[key](value)
  153. else nodes.attr(key, value)
  154. })
  155. }
  156.  
  157. return dom
  158. }
  159.  
  160. // `$.zepto.Z` swaps out the prototype of the given `dom` array
  161. // of nodes with `$.fn` and thus supplying all the Zepto functions
  162. // to the array. This method can be overridden in plugins.
  163. zepto.Z = function(dom, selector) {
  164. return new Z(dom, selector)
  165. }
  166.  
  167. // `$.zepto.isZ` should return `true` if the given object is a Zepto
  168. // collection. This method can be overridden in plugins.
  169. zepto.isZ = function(object) {
  170. return object instanceof zepto.Z
  171. }
  172.  
  173. // `$.zepto.init` is Zepto's counterpart to jQuery's `$.fn.init` and
  174. // takes a CSS selector and an optional context (and handles various
  175. // special cases).
  176. // This method can be overridden in plugins.
  177. zepto.init = function(selector, context) {
  178. var dom
  179. // If nothing given, return an empty Zepto collection
  180. if (!selector) return zepto.Z()
  181. // Optimize for string selectors
  182. else if (typeof selector == 'string') {
  183. selector = selector.trim()
  184. // If it's a html fragment, create nodes from it
  185. // Note: In both Chrome 21 and Firefox 15, DOM error 12
  186. // is thrown if the fragment doesn't begin with <
  187. if (selector[0] == '<' && fragmentRE.test(selector))
  188. dom = zepto.fragment(selector, RegExp.$1, context), selector = null
  189. // If there's a context, create a collection on that context first, and select
  190. // nodes from there
  191. else if (context !== undefined) return $(context).find(selector)
  192. // If it's a CSS selector, use it to select nodes.
  193. else dom = zepto.qsa(document, selector)
  194. }
  195. // If a function is given, call it when the DOM is ready
  196. else if (isFunction(selector)) return $(document).ready(selector)
  197. // If a Zepto collection is given, just return it
  198. else if (zepto.isZ(selector)) return selector
  199. else {
  200. // normalize array if an array of nodes is given
  201. if (isArray(selector)) dom = compact(selector)
  202. // Wrap DOM nodes.
  203. else if (isObject(selector))
  204. dom = [selector], selector = null
  205. // If it's a html fragment, create nodes from it
  206. else if (fragmentRE.test(selector))
  207. dom = zepto.fragment(selector.trim(), RegExp.$1, context), selector = null
  208. // If there's a context, create a collection on that context first, and select
  209. // nodes from there
  210. else if (context !== undefined) return $(context).find(selector)
  211. // And last but no least, if it's a CSS selector, use it to select nodes.
  212. else dom = zepto.qsa(document, selector)
  213. }
  214. // create a new Zepto collection from the nodes found
  215. return zepto.Z(dom, selector)
  216. }
  217.  
  218. // `$` will be the base `Zepto` object. When calling this
  219. // function just call `$.zepto.init, which makes the implementation
  220. // details of selecting nodes and creating Zepto collections
  221. // patchable in plugins.
  222. $ = function(selector, context){
  223. return zepto.init(selector, context)
  224. }
  225.  
  226. function extend(target, source, deep) {
  227. for (key in source)
  228. if (deep && (isPlainObject(source[key]) || isArray(source[key]))) {
  229. if (isPlainObject(source[key]) && !isPlainObject(target[key]))
  230. target[key] = {}
  231. if (isArray(source[key]) && !isArray(target[key]))
  232. target[key] = []
  233. extend(target[key], source[key], deep)
  234. }
  235. else if (source[key] !== undefined) target[key] = source[key]
  236. }
  237.  
  238. // Copy all but undefined properties from one or more
  239. // objects to the `target` object.
  240. $.extend = function(target){
  241. var deep, args = slice.call(arguments, 1)
  242. if (typeof target == 'boolean') {
  243. deep = target
  244. target = args.shift()
  245. }
  246. args.forEach(function(arg){ extend(target, arg, deep) })
  247. return target
  248. }
  249.  
  250. // `$.zepto.qsa` is Zepto's CSS selector implementation which
  251. // uses `document.querySelectorAll` and optimizes for some special cases, like `#id`.
  252. // This method can be overridden in plugins.
  253. zepto.qsa = function(element, selector){
  254. var found,
  255. maybeID = selector[0] == '#',
  256. maybeClass = !maybeID && selector[0] == '.',
  257. nameOnly = maybeID || maybeClass ? selector.slice(1) : selector, // Ensure that a 1 char tag name still gets checked
  258. isSimple = simpleSelectorRE.test(nameOnly)
  259. return (element.getElementById && isSimple && maybeID) ? // Safari DocumentFragment doesn't have getElementById
  260. ( (found = element.getElementById(nameOnly)) ? [found] : [] ) :
  261. (element.nodeType !== 1 && element.nodeType !== 9 && element.nodeType !== 11) ? [] :
  262. slice.call(
  263. isSimple && !maybeID && element.getElementsByClassName ? // DocumentFragment doesn't have getElementsByClassName/TagName
  264. maybeClass ? element.getElementsByClassName(nameOnly) : // If it's simple, it could be a class
  265. element.getElementsByTagName(selector) : // Or a tag
  266. element.querySelectorAll(selector) // Or it's not simple, and we need to query all
  267. )
  268. }
  269.  
  270. function filtered(nodes, selector) {
  271. return selector == null ? $(nodes) : $(nodes).filter(selector)
  272. }
  273.  
  274. $.contains = document.documentElement.contains ?
  275. function(parent, node) {
  276. return parent !== node && parent.contains(node)
  277. } :
  278. function(parent, node) {
  279. while (node && (node = node.parentNode))
  280. if (node === parent) return true
  281. return false
  282. }
  283.  
  284. function funcArg(context, arg, idx, payload) {
  285. return isFunction(arg) ? arg.call(context, idx, payload) : arg
  286. }
  287.  
  288. function setAttribute(node, name, value) {
  289. value == null ? node.removeAttribute(name) : node.setAttribute(name, value)
  290. }
  291.  
  292. // access className property while respecting SVGAnimatedString
  293. function className(node, value){
  294. var klass = node.className || '',
  295. svg = klass && klass.baseVal !== undefined
  296.  
  297. if (value === undefined) return svg ? klass.baseVal : klass
  298. svg ? (klass.baseVal = value) : (node.className = value)
  299. }
  300.  
  301. // "true" => true
  302. // "false" => false
  303. // "null" => null
  304. // "42" => 42
  305. // "42.5" => 42.5
  306. // "08" => "08"
  307. // JSON => parse if valid
  308. // String => self
  309. function deserializeValue(value) {
  310. try {
  311. return value ?
  312. value == "true" ||
  313. ( value == "false" ? false :
  314. value == "null" ? null :
  315. +value + "" == value ? +value :
  316. /^[\[\{]/.test(value) ? $.parseJSON(value) :
  317. value )
  318. : value
  319. } catch(e) {
  320. return value
  321. }
  322. }
  323.  
  324. $.type = type
  325. $.isFunction = isFunction
  326. $.isWindow = isWindow
  327. $.isArray = isArray
  328. $.isPlainObject = isPlainObject
  329.  
  330. $.isEmptyObject = function(obj) {
  331. var name
  332. for (name in obj) return false
  333. return true
  334. }
  335.  
  336. $.inArray = function(elem, array, i){
  337. return emptyArray.indexOf.call(array, elem, i)
  338. }
  339.  
  340. $.camelCase = camelize
  341. $.trim = function(str) {
  342. return str == null ? "" : String.prototype.trim.call(str)
  343. }
  344.  
  345. // plugin compatibility
  346. $.uuid = 0
  347. $.support = { }
  348. $.expr = { }
  349. $.noop = function() {}
  350.  
  351. $.map = function(elements, callback){
  352. var value, values = [], i, key
  353. if (likeArray(elements))
  354. for (i = 0; i < elements.length; i++) {
  355. value = callback(elements[i], i)
  356. if (value != null) values.push(value)
  357. }
  358. else
  359. for (key in elements) {
  360. value = callback(elements[key], key)
  361. if (value != null) values.push(value)
  362. }
  363. return flatten(values)
  364. }
  365.  
  366. $.each = function(elements, callback){
  367. var i, key
  368. if (likeArray(elements)) {
  369. for (i = 0; i < elements.length; i++)
  370. if (callback.call(elements[i], i, elements[i]) === false) return elements
  371. } else {
  372. for (key in elements)
  373. if (callback.call(elements[key], key, elements[key]) === false) return elements
  374. }
  375.  
  376. return elements
  377. }
  378.  
  379. $.grep = function(elements, callback){
  380. return filter.call(elements, callback)
  381. }
  382.  
  383. if (window.JSON) $.parseJSON = JSON.parse
  384.  
  385. // Populate the class2type map
  386. $.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
  387. class2type[ "[object " + name + "]" ] = name.toLowerCase()
  388. })
  389.  
  390. // Define methods that will be available on all
  391. // Zepto collections
  392. $.fn = {
  393. constructor: zepto.Z,
  394. length: 0,
  395.  
  396. // Because a collection acts like an array
  397. // copy over these useful array functions.
  398. forEach: emptyArray.forEach,
  399. reduce: emptyArray.reduce,
  400. push: emptyArray.push,
  401. sort: emptyArray.sort,
  402. splice: emptyArray.splice,
  403. indexOf: emptyArray.indexOf,
  404. concat: function(){
  405. var i, value, args = []
  406. for (i = 0; i < arguments.length; i++) {
  407. value = arguments[i]
  408. args[i] = zepto.isZ(value) ? value.toArray() : value
  409. }
  410. return concat.apply(zepto.isZ(this) ? this.toArray() : this, args)
  411. },
  412.  
  413. // `map` and `slice` in the jQuery API work differently
  414. // from their array counterparts
  415. map: function(fn){
  416. return $($.map(this, function(el, i){ return fn.call(el, i, el) }))
  417. },
  418. slice: function(){
  419. return $(slice.apply(this, arguments))
  420. },
  421.  
  422. ready: function(callback){
  423. // need to check if document.body exists for IE as that browser reports
  424. // document ready when it hasn't yet created the body element
  425. if (readyRE.test(document.readyState) && document.body) callback($)
  426. else document.addEventListener('DOMContentLoaded', function(){ callback($) }, false)
  427. return this
  428. },
  429. get: function(idx){
  430. return idx === undefined ? slice.call(this) : this[idx >= 0 ? idx : idx + this.length]
  431. },
  432. toArray: function(){ return this.get() },
  433. size: function(){
  434. return this.length
  435. },
  436. remove: function(){
  437. return this.each(function(){
  438. if (this.parentNode != null)
  439. this.parentNode.removeChild(this)
  440. })
  441. },
  442. each: function(callback){
  443. emptyArray.every.call(this, function(el, idx){
  444. return callback.call(el, idx, el) !== false
  445. })
  446. return this
  447. },
  448. filter: function(selector){
  449. if (isFunction(selector)) return this.not(this.not(selector))
  450. return $(filter.call(this, function(element){
  451. return zepto.matches(element, selector)
  452. }))
  453. },
  454. add: function(selector,context){
  455. return $(uniq(this.concat($(selector,context))))
  456. },
  457. is: function(selector){
  458. return this.length > 0 && zepto.matches(this[0], selector)
  459. },
  460. not: function(selector){
  461. var nodes=[]
  462. if (isFunction(selector) && selector.call !== undefined)
  463. this.each(function(idx){
  464. if (!selector.call(this,idx)) nodes.push(this)
  465. })
  466. else {
  467. var excludes = typeof selector == 'string' ? this.filter(selector) :
  468. (likeArray(selector) && isFunction(selector.item)) ? slice.call(selector) : $(selector)
  469. this.forEach(function(el){
  470. if (excludes.indexOf(el) < 0) nodes.push(el)
  471. })
  472. }
  473. return $(nodes)
  474. },
  475. has: function(selector){
  476. return this.filter(function(){
  477. return isObject(selector) ?
  478. $.contains(this, selector) :
  479. $(this).find(selector).size()
  480. })
  481. },
  482. eq: function(idx){
  483. return idx === -1 ? this.slice(idx) : this.slice(idx, + idx + 1)
  484. },
  485. first: function(){
  486. var el = this[0]
  487. return el && !isObject(el) ? el : $(el)
  488. },
  489. last: function(){
  490. var el = this[this.length - 1]
  491. return el && !isObject(el) ? el : $(el)
  492. },
  493. find: function(selector){
  494. var result, $this = this
  495. if (!selector) result = $()
  496. else if (typeof selector == 'object')
  497. result = $(selector).filter(function(){
  498. var node = this
  499. return emptyArray.some.call($this, function(parent){
  500. return $.contains(parent, node)
  501. })
  502. })
  503. else if (this.length == 1) result = $(zepto.qsa(this[0], selector))
  504. else result = this.map(function(){ return zepto.qsa(this, selector) })
  505. return result
  506. },
  507. closest: function(selector, context){
  508. var node = this[0], collection = false
  509. if (typeof selector == 'object') collection = $(selector)
  510. while (node && !(collection ? collection.indexOf(node) >= 0 : zepto.matches(node, selector)))
  511. node = node !== context && !isDocument(node) && node.parentNode
  512. return $(node)
  513. },
  514. parents: function(selector){
  515. var ancestors = [], nodes = this
  516. while (nodes.length > 0)
  517. nodes = $.map(nodes, function(node){
  518. if ((node = node.parentNode) && !isDocument(node) && ancestors.indexOf(node) < 0) {
  519. ancestors.push(node)
  520. return node
  521. }
  522. })
  523. return filtered(ancestors, selector)
  524. },
  525. parent: function(selector){
  526. return filtered(uniq(this.pluck('parentNode')), selector)
  527. },
  528. children: function(selector){
  529. return filtered(this.map(function(){ return children(this) }), selector)
  530. },
  531. contents: function() {
  532. return this.map(function() { return this.contentDocument || slice.call(this.childNodes) })
  533. },
  534. siblings: function(selector){
  535. return filtered(this.map(function(i, el){
  536. return filter.call(children(el.parentNode), function(child){ return child!==el })
  537. }), selector)
  538. },
  539. empty: function(){
  540. return this.each(function(){ this.innerHTML = '' })
  541. },
  542. // `pluck` is borrowed from Prototype.js
  543. pluck: function(property){
  544. return $.map(this, function(el){ return el[property] })
  545. },
  546. show: function(){
  547. return this.each(function(){
  548. this.style.display == "none" && (this.style.display = '')
  549. if (getComputedStyle(this, '').getPropertyValue("display") == "none")
  550. this.style.display = defaultDisplay(this.nodeName)
  551. })
  552. },
  553. replaceWith: function(newContent){
  554. return this.before(newContent).remove()
  555. },
  556. wrap: function(structure){
  557. var func = isFunction(structure)
  558. if (this[0] && !func)
  559. var dom = $(structure).get(0),
  560. clone = dom.parentNode || this.length > 1
  561.  
  562. return this.each(function(index){
  563. $(this).wrapAll(
  564. func ? structure.call(this, index) :
  565. clone ? dom.cloneNode(true) : dom
  566. )
  567. })
  568. },
  569. wrapAll: function(structure){
  570. if (this[0]) {
  571. $(this[0]).before(structure = $(structure))
  572. var children
  573. // drill down to the inmost element
  574. while ((children = structure.children()).length) structure = children.first()
  575. $(structure).append(this)
  576. }
  577. return this
  578. },
  579. wrapInner: function(structure){
  580. var func = isFunction(structure)
  581. return this.each(function(index){
  582. var self = $(this), contents = self.contents(),
  583. dom = func ? structure.call(this, index) : structure
  584. contents.length ? contents.wrapAll(dom) : self.append(dom)
  585. })
  586. },
  587. unwrap: function(){
  588. this.parent().each(function(){
  589. $(this).replaceWith($(this).children())
  590. })
  591. return this
  592. },
  593. clone: function(){
  594. return this.map(function(){ return this.cloneNode(true) })
  595. },
  596. hide: function(){
  597. return this.css("display", "none")
  598. },
  599. toggle: function(setting){
  600. return this.each(function(){
  601. var el = $(this)
  602. ;(setting === undefined ? el.css("display") == "none" : setting) ? el.show() : el.hide()
  603. })
  604. },
  605. prev: function(selector){ return $(this.pluck('previousElementSibling')).filter(selector || '*') },
  606. next: function(selector){ return $(this.pluck('nextElementSibling')).filter(selector || '*') },
  607. html: function(html){
  608. return 0 in arguments ?
  609. this.each(function(idx){
  610. var originHtml = this.innerHTML
  611. $(this).empty().append( funcArg(this, html, idx, originHtml) )
  612. }) :
  613. (0 in this ? this[0].innerHTML : null)
  614. },
  615. text: function(text){
  616. return 0 in arguments ?
  617. this.each(function(idx){
  618. var newText = funcArg(this, text, idx, this.textContent)
  619. this.textContent = newText == null ? '' : ''+newText
  620. }) :
  621. (0 in this ? this.pluck('textContent').join("") : null)
  622. },
  623. attr: function(name, value){
  624. var result
  625. return (typeof name == 'string' && !(1 in arguments)) ?
  626. (!this.length || this[0].nodeType !== 1 ? undefined :
  627. (!(result = this[0].getAttribute(name)) && name in this[0]) ? this[0][name] : result
  628. ) :
  629. this.each(function(idx){
  630. if (this.nodeType !== 1) return
  631. if (isObject(name)) for (key in name) setAttribute(this, key, name[key])
  632. else setAttribute(this, name, funcArg(this, value, idx, this.getAttribute(name)))
  633. })
  634. },
  635. removeAttr: function(name){
  636. return this.each(function(){ this.nodeType === 1 && name.split(' ').forEach(function(attribute){
  637. setAttribute(this, attribute)
  638. }, this)})
  639. },
  640. prop: function(name, value){
  641. name = propMap[name] || name
  642. return (1 in arguments) ?
  643. this.each(function(idx){
  644. this[name] = funcArg(this, value, idx, this[name])
  645. }) :
  646. (this[0] && this[0][name])
  647. },
  648. data: function(name, value){
  649. var attrName = 'data-' + name.replace(capitalRE, '-$1').toLowerCase()
  650.  
  651. var data = (1 in arguments) ?
  652. this.attr(attrName, value) :
  653. this.attr(attrName)
  654.  
  655. return data !== null ? deserializeValue(data) : undefined
  656. },
  657. val: function(value){
  658. return 0 in arguments ?
  659. this.each(function(idx){
  660. this.value = funcArg(this, value, idx, this.value)
  661. }) :
  662. (this[0] && (this[0].multiple ?
  663. $(this[0]).find('option').filter(function(){ return this.selected }).pluck('value') :
  664. this[0].value)
  665. )
  666. },
  667. offset: function(coordinates){
  668. if (coordinates) return this.each(function(index){
  669. var $this = $(this),
  670. coords = funcArg(this, coordinates, index, $this.offset()),
  671. parentOffset = $this.offsetParent().offset(),
  672. props = {
  673. top: coords.top - parentOffset.top,
  674. left: coords.left - parentOffset.left
  675. }
  676.  
  677. if ($this.css('position') == 'static') props['position'] = 'relative'
  678. $this.css(props)
  679. })
  680. if (!this.length) return null
  681. if (!$.contains(document.documentElement, this[0]))
  682. return {top: 0, left: 0}
  683. var obj = this[0].getBoundingClientRect()
  684. return {
  685. left: obj.left + window.pageXOffset,
  686. top: obj.top + window.pageYOffset,
  687. width: Math.round(obj.width),
  688. height: Math.round(obj.height)
  689. }
  690. },
  691. css: function(property, value){
  692. if (arguments.length < 2) {
  693. var computedStyle, element = this[0]
  694. if(!element) return
  695. computedStyle = getComputedStyle(element, '')
  696. if (typeof property == 'string')
  697. return element.style[camelize(property)] || computedStyle.getPropertyValue(property)
  698. else if (isArray(property)) {
  699. var props = {}
  700. $.each(property, function(_, prop){
  701. props[prop] = (element.style[camelize(prop)] || computedStyle.getPropertyValue(prop))
  702. })
  703. return props
  704. }
  705. }
  706.  
  707. var css = ''
  708. if (type(property) == 'string') {
  709. if (!value && value !== 0)
  710. this.each(function(){ this.style.removeProperty(dasherize(property)) })
  711. else
  712. css = dasherize(property) + ":" + maybeAddPx(property, value)
  713. } else {
  714. for (key in property)
  715. if (!property[key] && property[key] !== 0)
  716. this.each(function(){ this.style.removeProperty(dasherize(key)) })
  717. else
  718. css += dasherize(key) + ':' + maybeAddPx(key, property[key]) + ';'
  719. }
  720.  
  721. return this.each(function(){ this.style.cssText += ';' + css })
  722. },
  723. index: function(element){
  724. return element ? this.indexOf($(element)[0]) : this.parent().children().indexOf(this[0])
  725. },
  726. hasClass: function(name){
  727. if (!name) return false
  728. return emptyArray.some.call(this, function(el){
  729. return this.test(className(el))
  730. }, classRE(name))
  731. },
  732. addClass: function(name){
  733. if (!name) return this
  734. return this.each(function(idx){
  735. if (!('className' in this)) return
  736. classList = []
  737. var cls = className(this), newName = funcArg(this, name, idx, cls)
  738. newName.split(/\s+/g).forEach(function(klass){
  739. if (!$(this).hasClass(klass)) classList.push(klass)
  740. }, this)
  741. classList.length && className(this, cls + (cls ? " " : "") + classList.join(" "))
  742. })
  743. },
  744. removeClass: function(name){
  745. return this.each(function(idx){
  746. if (!('className' in this)) return
  747. if (name === undefined) return className(this, '')
  748. classList = className(this)
  749. funcArg(this, name, idx, classList).split(/\s+/g).forEach(function(klass){
  750. classList = classList.replace(classRE(klass), " ")
  751. })
  752. className(this, classList.trim())
  753. })
  754. },
  755. toggleClass: function(name, when){
  756. if (!name) return this
  757. return this.each(function(idx){
  758. var $this = $(this), names = funcArg(this, name, idx, className(this))
  759. names.split(/\s+/g).forEach(function(klass){
  760. (when === undefined ? !$this.hasClass(klass) : when) ?
  761. $this.addClass(klass) : $this.removeClass(klass)
  762. })
  763. })
  764. },
  765. scrollTop: function(value){
  766. if (!this.length) return
  767. var hasScrollTop = 'scrollTop' in this[0]
  768. if (value === undefined) return hasScrollTop ? this[0].scrollTop : this[0].pageYOffset
  769. return this.each(hasScrollTop ?
  770. function(){ this.scrollTop = value } :
  771. function(){ this.scrollTo(this.scrollX, value) })
  772. },
  773. scrollLeft: function(value){
  774. if (!this.length) return
  775. var hasScrollLeft = 'scrollLeft' in this[0]
  776. if (value === undefined) return hasScrollLeft ? this[0].scrollLeft : this[0].pageXOffset
  777. return this.each(hasScrollLeft ?
  778. function(){ this.scrollLeft = value } :
  779. function(){ this.scrollTo(value, this.scrollY) })
  780. },
  781. position: function() {
  782. if (!this.length) return
  783.  
  784. var elem = this[0],
  785. // Get *real* offsetParent
  786. offsetParent = this.offsetParent(),
  787. // Get correct offsets
  788. offset = this.offset(),
  789. parentOffset = rootNodeRE.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset()
  790.  
  791. // Subtract element margins
  792. // note: when an element has margin: auto the offsetLeft and marginLeft
  793. // are the same in Safari causing offset.left to incorrectly be 0
  794. offset.top -= parseFloat( $(elem).css('margin-top') ) || 0
  795. offset.left -= parseFloat( $(elem).css('margin-left') ) || 0
  796.  
  797. // Add offsetParent borders
  798. parentOffset.top += parseFloat( $(offsetParent[0]).css('border-top-width') ) || 0
  799. parentOffset.left += parseFloat( $(offsetParent[0]).css('border-left-width') ) || 0
  800.  
  801. // Subtract the two offsets
  802. return {
  803. top: offset.top - parentOffset.top,
  804. left: offset.left - parentOffset.left
  805. }
  806. },
  807. offsetParent: function() {
  808. return this.map(function(){
  809. var parent = this.offsetParent || document.body
  810. while (parent && !rootNodeRE.test(parent.nodeName) && $(parent).css("position") == "static")
  811. parent = parent.offsetParent
  812. return parent
  813. })
  814. }
  815. }
  816.  
  817. // for now
  818. $.fn.detach = $.fn.remove
  819.  
  820. // Generate the `width` and `height` functions
  821. ;['width', 'height'].forEach(function(dimension){
  822. var dimensionProperty =
  823. dimension.replace(/./, function(m){ return m[0].toUpperCase() })
  824.  
  825. $.fn[dimension] = function(value){
  826. var offset, el = this[0]
  827. if (value === undefined) return isWindow(el) ? el['inner' + dimensionProperty] :
  828. isDocument(el) ? el.documentElement['scroll' + dimensionProperty] :
  829. (offset = this.offset()) && offset[dimension]
  830. else return this.each(function(idx){
  831. el = $(this)
  832. el.css(dimension, funcArg(this, value, idx, el[dimension]()))
  833. })
  834. }
  835. })
  836.  
  837. function traverseNode(node, fun) {
  838. fun(node)
  839. for (var i = 0, len = node.childNodes.length; i < len; i++)
  840. traverseNode(node.childNodes[i], fun)
  841. }
  842.  
  843. // Generate the `after`, `prepend`, `before`, `append`,
  844. // `insertAfter`, `insertBefore`, `appendTo`, and `prependTo` methods.
  845. adjacencyOperators.forEach(function(operator, operatorIndex) {
  846. var inside = operatorIndex % 2 //=> prepend, append
  847.  
  848. $.fn[operator] = function(){
  849. // arguments can be nodes, arrays of nodes, Zepto objects and HTML strings
  850. var argType, nodes = $.map(arguments, function(arg) {
  851. argType = type(arg)
  852. return argType == "object" || argType == "array" || arg == null ?
  853. arg : zepto.fragment(arg)
  854. }),
  855. parent, copyByClone = this.length > 1
  856. if (nodes.length < 1) return this
  857.  
  858. return this.each(function(_, target){
  859. parent = inside ? target : target.parentNode
  860.  
  861. // convert all methods to a "before" operation
  862. target = operatorIndex == 0 ? target.nextSibling :
  863. operatorIndex == 1 ? target.firstChild :
  864. operatorIndex == 2 ? target :
  865. null
  866.  
  867. var parentInDocument = $.contains(document.documentElement, parent)
  868.  
  869. nodes.forEach(function(node){
  870. if (copyByClone) node = node.cloneNode(true)
  871. else if (!parent) return $(node).remove()
  872.  
  873. parent.insertBefore(node, target)
  874. if (parentInDocument) traverseNode(node, function(el){
  875. if (el.nodeName != null && el.nodeName.toUpperCase() === 'SCRIPT' &&
  876. (!el.type || el.type === 'text/javascript') && !el.src)
  877. window['eval'].call(window, el.innerHTML)
  878. })
  879. })
  880. })
  881. }
  882.  
  883. // after => insertAfter
  884. // prepend => prependTo
  885. // before => insertBefore
  886. // append => appendTo
  887. $.fn[inside ? operator+'To' : 'insert'+(operatorIndex ? 'Before' : 'After')] = function(html){
  888. $(html)[operator](this)
  889. return this
  890. }
  891. })
  892.  
  893. zepto.Z.prototype = Z.prototype = $.fn
  894.  
  895. // Export internal API functions in the `$.zepto` namespace
  896. zepto.uniq = uniq
  897. zepto.deserializeValue = deserializeValue
  898. $.zepto = zepto
  899.  
  900. return $
  901. })()
  902.  
  903. // If `$` is not yet defined, point it to `Zepto`
  904. window.Zepto = Zepto
  905. window.$ === undefined && (window.$ = Zepto)
  906.  
  907. // Zepto.js
  908. // (c) 2010-2016 Thomas Fuchs
  909. // Zepto.js may be freely distributed under the MIT license.
  910.  
  911. ;(function($){
  912. var jsonpID = 0,
  913. document = window.document,
  914. key,
  915. name,
  916. rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
  917. scriptTypeRE = /^(?:text|application)\/javascript/i,
  918. xmlTypeRE = /^(?:text|application)\/xml/i,
  919. jsonType = 'application/json',
  920. htmlType = 'text/html',
  921. blankRE = /^\s*$/,
  922. originAnchor = document.createElement('a')
  923.  
  924. originAnchor.href = window.location.href
  925.  
  926. // trigger a custom event and return false if it was cancelled
  927. function triggerAndReturn(context, eventName, data) {
  928. var event = $.Event(eventName)
  929. $(context).trigger(event, data)
  930. return !event.isDefaultPrevented()
  931. }
  932.  
  933. // trigger an Ajax "global" event
  934. function triggerGlobal(settings, context, eventName, data) {
  935. if (settings.global) return triggerAndReturn(context || document, eventName, data)
  936. }
  937.  
  938. // Number of active Ajax requests
  939. $.active = 0
  940.  
  941. function ajaxStart(settings) {
  942. if (settings.global && $.active++ === 0) triggerGlobal(settings, null, 'ajaxStart')
  943. }
  944. function ajaxStop(settings) {
  945. if (settings.global && !(--$.active)) triggerGlobal(settings, null, 'ajaxStop')
  946. }
  947.  
  948. // triggers an extra global event "ajaxBeforeSend" that's like "ajaxSend" but cancelable
  949. function ajaxBeforeSend(xhr, settings) {
  950. var context = settings.context
  951. if (settings.beforeSend.call(context, xhr, settings) === false ||
  952. triggerGlobal(settings, context, 'ajaxBeforeSend', [xhr, settings]) === false)
  953. return false
  954.  
  955. triggerGlobal(settings, context, 'ajaxSend', [xhr, settings])
  956. }
  957. function ajaxSuccess(data, xhr, settings, deferred) {
  958. var context = settings.context, status = 'success'
  959. settings.success.call(context, data, status, xhr)
  960. if (deferred) deferred.resolveWith(context, [data, status, xhr])
  961. triggerGlobal(settings, context, 'ajaxSuccess', [xhr, settings, data])
  962. ajaxComplete(status, xhr, settings)
  963. }
  964. // type: "timeout", "error", "abort", "parsererror"
  965. function ajaxError(error, type, xhr, settings, deferred) {
  966. var context = settings.context
  967. settings.error.call(context, xhr, type, error)
  968. if (deferred) deferred.rejectWith(context, [xhr, type, error])
  969. triggerGlobal(settings, context, 'ajaxError', [xhr, settings, error || type])
  970. ajaxComplete(type, xhr, settings)
  971. }
  972. // status: "success", "notmodified", "error", "timeout", "abort", "parsererror"
  973. function ajaxComplete(status, xhr, settings) {
  974. var context = settings.context
  975. settings.complete.call(context, xhr, status)
  976. triggerGlobal(settings, context, 'ajaxComplete', [xhr, settings])
  977. ajaxStop(settings)
  978. }
  979.  
  980. // Empty function, used as default callback
  981. function empty() {}
  982.  
  983. $.ajaxJSONP = function(options, deferred){
  984. if (!('type' in options)) return $.ajax(options)
  985.  
  986. var _callbackName = options.jsonpCallback,
  987. callbackName = ($.isFunction(_callbackName) ?
  988. _callbackName() : _callbackName) || ('jsonp' + (++jsonpID)),
  989. script = document.createElement('script'),
  990. originalCallback = window[callbackName],
  991. responseData,
  992. abort = function(errorType) {
  993. $(script).triggerHandler('error', errorType || 'abort')
  994. },
  995. xhr = { abort: abort }, abortTimeout
  996.  
  997. if (deferred) deferred.promise(xhr)
  998.  
  999. $(script).on('load error', function(e, errorType){
  1000. clearTimeout(abortTimeout)
  1001. $(script).off().remove()
  1002.  
  1003. if (e.type == 'error' || !responseData) {
  1004. ajaxError(null, errorType || 'error', xhr, options, deferred)
  1005. } else {
  1006. ajaxSuccess(responseData[0], xhr, options, deferred)
  1007. }
  1008.  
  1009. window[callbackName] = originalCallback
  1010. if (responseData && $.isFunction(originalCallback))
  1011. originalCallback(responseData[0])
  1012.  
  1013. originalCallback = responseData = undefined
  1014. })
  1015.  
  1016. if (ajaxBeforeSend(xhr, options) === false) {
  1017. abort('abort')
  1018. return xhr
  1019. }
  1020.  
  1021. window[callbackName] = function(){
  1022. responseData = arguments
  1023. }
  1024.  
  1025. script.src = options.url.replace(/\?(.+)=\?/, '?$1=' + callbackName)
  1026. document.head.appendChild(script)
  1027.  
  1028. if (options.timeout > 0) abortTimeout = setTimeout(function(){
  1029. abort('timeout')
  1030. }, options.timeout)
  1031.  
  1032. return xhr
  1033. }
  1034.  
  1035. $.ajaxSettings = {
  1036. // Default type of request
  1037. type: 'GET',
  1038. // Callback that is executed before request
  1039. beforeSend: empty,
  1040. // Callback that is executed if the request succeeds
  1041. success: empty,
  1042. // Callback that is executed the the server drops error
  1043. error: empty,
  1044. // Callback that is executed on request complete (both: error and success)
  1045. complete: empty,
  1046. // The context for the callbacks
  1047. context: null,
  1048. // Whether to trigger "global" Ajax events
  1049. global: true,
  1050. // Transport
  1051. xhr: function () {
  1052. return new window.XMLHttpRequest()
  1053. },
  1054. // MIME types mapping
  1055. // IIS returns Javascript as "application/x-javascript"
  1056. accepts: {
  1057. script: 'text/javascript, application/javascript, application/x-javascript',
  1058. json: jsonType,
  1059. xml: 'application/xml, text/xml',
  1060. html: htmlType,
  1061. text: 'text/plain'
  1062. },
  1063. // Whether the request is to another domain
  1064. crossDomain: false,
  1065. // Default timeout
  1066. timeout: 0,
  1067. // Whether data should be serialized to string
  1068. processData: true,
  1069. // Whether the browser should be allowed to cache GET responses
  1070. cache: true
  1071. }
  1072.  
  1073. function mimeToDataType(mime) {
  1074. if (mime) mime = mime.split(';', 2)[0]
  1075. return mime && ( mime == htmlType ? 'html' :
  1076. mime == jsonType ? 'json' :
  1077. scriptTypeRE.test(mime) ? 'script' :
  1078. xmlTypeRE.test(mime) && 'xml' ) || 'text'
  1079. }
  1080.  
  1081. function appendQuery(url, query) {
  1082. if (query == '') return url
  1083. return (url + '&' + query).replace(/[&?]{1,2}/, '?')
  1084. }
  1085.  
  1086. // serialize payload and append it to the URL for GET requests
  1087. function serializeData(options) {
  1088. if (options.processData && options.data && $.type(options.data) != "string")
  1089. options.data = $.param(options.data, options.traditional)
  1090. if (options.data && (!options.type || options.type.toUpperCase() == 'GET'))
  1091. options.url = appendQuery(options.url, options.data), options.data = undefined
  1092. }
  1093.  
  1094. $.ajax = function(options){
  1095. var settings = $.extend({}, options || {}),
  1096. deferred = $.Deferred && $.Deferred(),
  1097. urlAnchor, hashIndex
  1098. for (key in $.ajaxSettings) if (settings[key] === undefined) settings[key] = $.ajaxSettings[key]
  1099.  
  1100. ajaxStart(settings)
  1101.  
  1102. if (!settings.crossDomain) {
  1103. urlAnchor = document.createElement('a')
  1104. urlAnchor.href = settings.url
  1105. // cleans up URL for .href (IE only), see https://github.com/madrobby/zepto/pull/1049
  1106. urlAnchor.href = urlAnchor.href
  1107. settings.crossDomain = (originAnchor.protocol + '//' + originAnchor.host) !== (urlAnchor.protocol + '//' + urlAnchor.host)
  1108. }
  1109.  
  1110. if (!settings.url) settings.url = window.location.toString()
  1111. if ((hashIndex = settings.url.indexOf('#')) > -1) settings.url = settings.url.slice(0, hashIndex)
  1112. serializeData(settings)
  1113.  
  1114. var dataType = settings.dataType, hasPlaceholder = /\?.+=\?/.test(settings.url)
  1115. if (hasPlaceholder) dataType = 'jsonp'
  1116.  
  1117. if (settings.cache === false || (
  1118. (!options || options.cache !== true) &&
  1119. ('script' == dataType || 'jsonp' == dataType)
  1120. ))
  1121. settings.url = appendQuery(settings.url, '_=' + Date.now())
  1122.  
  1123. if ('jsonp' == dataType) {
  1124. if (!hasPlaceholder)
  1125. settings.url = appendQuery(settings.url,
  1126. settings.jsonp ? (settings.jsonp + '=?') : settings.jsonp === false ? '' : 'callback=?')
  1127. return $.ajaxJSONP(settings, deferred)
  1128. }
  1129.  
  1130. var mime = settings.accepts[dataType],
  1131. headers = { },
  1132. setHeader = function(name, value) { headers[name.toLowerCase()] = [name, value] },
  1133. protocol = /^([\w-]+:)\/\//.test(settings.url) ? RegExp.$1 : window.location.protocol,
  1134. xhr = settings.xhr(),
  1135. nativeSetHeader = xhr.setRequestHeader,
  1136. abortTimeout
  1137.  
  1138. if (deferred) deferred.promise(xhr)
  1139.  
  1140. if (!settings.crossDomain) setHeader('X-Requested-With', 'XMLHttpRequest')
  1141. setHeader('Accept', mime || '*/*')
  1142. if (mime = settings.mimeType || mime) {
  1143. if (mime.indexOf(',') > -1) mime = mime.split(',', 2)[0]
  1144. xhr.overrideMimeType && xhr.overrideMimeType(mime)
  1145. }
  1146. if (settings.contentType || (settings.contentType !== false && settings.data && settings.type.toUpperCase() != 'GET'))
  1147. setHeader('Content-Type', settings.contentType || 'application/x-www-form-urlencoded')
  1148.  
  1149. if (settings.headers) for (name in settings.headers) setHeader(name, settings.headers[name])
  1150. xhr.setRequestHeader = setHeader
  1151.  
  1152. xhr.onreadystatechange = function(){
  1153. if (xhr.readyState == 4) {
  1154. xhr.onreadystatechange = empty
  1155. clearTimeout(abortTimeout)
  1156. var result, error = false
  1157. if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304 || (xhr.status == 0 && protocol == 'file:')) {
  1158. dataType = dataType || mimeToDataType(settings.mimeType || xhr.getResponseHeader('content-type'))
  1159.  
  1160. if (xhr.responseType == 'arraybuffer' || xhr.responseType == 'blob')
  1161. result = xhr.response
  1162. else {
  1163. result = xhr.responseText
  1164.  
  1165. try {
  1166. // http://perfectionkills.com/global-eval-what-are-the-options/
  1167. if (dataType == 'script') (1,eval)(result)
  1168. else if (dataType == 'xml') result = xhr.responseXML
  1169. else if (dataType == 'json') result = blankRE.test(result) ? null : $.parseJSON(result)
  1170. } catch (e) { error = e }
  1171.  
  1172. if (error) return ajaxError(error, 'parsererror', xhr, settings, deferred)
  1173. }
  1174.  
  1175. ajaxSuccess(result, xhr, settings, deferred)
  1176. } else {
  1177. ajaxError(xhr.statusText || null, xhr.status ? 'error' : 'abort', xhr, settings, deferred)
  1178. }
  1179. }
  1180. }
  1181.  
  1182. if (ajaxBeforeSend(xhr, settings) === false) {
  1183. xhr.abort()
  1184. ajaxError(null, 'abort', xhr, settings, deferred)
  1185. return xhr
  1186. }
  1187.  
  1188. if (settings.xhrFields) for (name in settings.xhrFields) xhr[name] = settings.xhrFields[name]
  1189.  
  1190. var async = 'async' in settings ? settings.async : true
  1191. xhr.open(settings.type, settings.url, async, settings.username, settings.password)
  1192.  
  1193. for (name in headers) nativeSetHeader.apply(xhr, headers[name])
  1194.  
  1195. if (settings.timeout > 0) abortTimeout = setTimeout(function(){
  1196. xhr.onreadystatechange = empty
  1197. xhr.abort()
  1198. ajaxError(null, 'timeout', xhr, settings, deferred)
  1199. }, settings.timeout)
  1200.  
  1201. // avoid sending empty string (#319)
  1202. xhr.send(settings.data ? settings.data : null)
  1203. return xhr
  1204. }
  1205.  
  1206. // handle optional data/success arguments
  1207. function parseArguments(url, data, success, dataType) {
  1208. if ($.isFunction(data)) dataType = success, success = data, data = undefined
  1209. if (!$.isFunction(success)) dataType = success, success = undefined
  1210. return {
  1211. url: url
  1212. , data: data
  1213. , success: success
  1214. , dataType: dataType
  1215. }
  1216. }
  1217.  
  1218. $.get = function(/* url, data, success, dataType */){
  1219. return $.ajax(parseArguments.apply(null, arguments))
  1220. }
  1221.  
  1222. $.post = function(/* url, data, success, dataType */){
  1223. var options = parseArguments.apply(null, arguments)
  1224. options.type = 'POST'
  1225. return $.ajax(options)
  1226. }
  1227.  
  1228. $.getJSON = function(/* url, data, success */){
  1229. var options = parseArguments.apply(null, arguments)
  1230. options.dataType = 'json'
  1231. return $.ajax(options)
  1232. }
  1233.  
  1234. $.fn.load = function(url, data, success){
  1235. if (!this.length) return this
  1236. var self = this, parts = url.split(/\s/), selector,
  1237. options = parseArguments(url, data, success),
  1238. callback = options.success
  1239. if (parts.length > 1) options.url = parts[0], selector = parts[1]
  1240. options.success = function(response){
  1241. self.html(selector ?
  1242. $('<div>').html(response.replace(rscript, "")).find(selector)
  1243. : response)
  1244. callback && callback.apply(self, arguments)
  1245. }
  1246. $.ajax(options)
  1247. return this
  1248. }
  1249.  
  1250. var escape = encodeURIComponent
  1251.  
  1252. function serialize(params, obj, traditional, scope){
  1253. var type, array = $.isArray(obj), hash = $.isPlainObject(obj)
  1254. $.each(obj, function(key, value) {
  1255. type = $.type(value)
  1256. if (scope) key = traditional ? scope :
  1257. scope + '[' + (hash || type == 'object' || type == 'array' ? key : '') + ']'
  1258. // handle data in serializeArray() format
  1259. if (!scope && array) params.add(value.name, value.value)
  1260. // recurse into nested objects
  1261. else if (type == "array" || (!traditional && type == "object"))
  1262. serialize(params, value, traditional, key)
  1263. else params.add(key, value)
  1264. })
  1265. }
  1266.  
  1267. $.param = function(obj, traditional){
  1268. var params = []
  1269. params.add = function(key, value) {
  1270. if ($.isFunction(value)) value = value()
  1271. if (value == null) value = ""
  1272. this.push(escape(key) + '=' + escape(value))
  1273. }
  1274. serialize(params, obj, traditional)
  1275. return params.join('&').replace(/%20/g, '+')
  1276. }
  1277. })(Zepto)
  1278.  
  1279. // Zepto.js
  1280. // (c) 2010-2016 Thomas Fuchs
  1281. // Zepto.js may be freely distributed under the MIT license.
  1282.  
  1283. ;(function($){
  1284. var cache = [], timeout
  1285.  
  1286. $.fn.remove = function(){
  1287. return this.each(function(){
  1288. if(this.parentNode){
  1289. if(this.tagName === 'IMG'){
  1290. cache.push(this)
  1291. this.src = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='
  1292. if (timeout) clearTimeout(timeout)
  1293. timeout = setTimeout(function(){ cache = [] }, 60000)
  1294. }
  1295. this.parentNode.removeChild(this)
  1296. }
  1297. })
  1298. }
  1299. })(Zepto)
  1300.  
  1301. // Zepto.js
  1302. // (c) 2010-2016 Thomas Fuchs
  1303. // Zepto.js may be freely distributed under the MIT license.
  1304.  
  1305. ;(function($){
  1306. // Create a collection of callbacks to be fired in a sequence, with configurable behaviour
  1307. // Option flags:
  1308. // - once: Callbacks fired at most one time.
  1309. // - memory: Remember the most recent context and arguments
  1310. // - stopOnFalse: Cease iterating over callback list
  1311. // - unique: Permit adding at most one instance of the same callback
  1312. $.Callbacks = function(options) {
  1313. options = $.extend({}, options)
  1314.  
  1315. var memory, // Last fire value (for non-forgettable lists)
  1316. fired, // Flag to know if list was already fired
  1317. firing, // Flag to know if list is currently firing
  1318. firingStart, // First callback to fire (used internally by add and fireWith)
  1319. firingLength, // End of the loop when firing
  1320. firingIndex, // Index of currently firing callback (modified by remove if needed)
  1321. list = [], // Actual callback list
  1322. stack = !options.once && [], // Stack of fire calls for repeatable lists
  1323. fire = function(data) {
  1324. memory = options.memory && data
  1325. fired = true
  1326. firingIndex = firingStart || 0
  1327. firingStart = 0
  1328. firingLength = list.length
  1329. firing = true
  1330. for ( ; list && firingIndex < firingLength ; ++firingIndex ) {
  1331. if (list[firingIndex].apply(data[0], data[1]) === false && options.stopOnFalse) {
  1332. memory = false
  1333. break
  1334. }
  1335. }
  1336. firing = false
  1337. if (list) {
  1338. if (stack) stack.length && fire(stack.shift())
  1339. else if (memory) list.length = 0
  1340. else Callbacks.disable()
  1341. }
  1342. },
  1343.  
  1344. Callbacks = {
  1345. add: function() {
  1346. if (list) {
  1347. var start = list.length,
  1348. add = function(args) {
  1349. $.each(args, function(_, arg){
  1350. if (typeof arg === "function") {
  1351. if (!options.unique || !Callbacks.has(arg)) list.push(arg)
  1352. }
  1353. else if (arg && arg.length && typeof arg !== 'string') add(arg)
  1354. })
  1355. }
  1356. add(arguments)
  1357. if (firing) firingLength = list.length
  1358. else if (memory) {
  1359. firingStart = start
  1360. fire(memory)
  1361. }
  1362. }
  1363. return this
  1364. },
  1365. remove: function() {
  1366. if (list) {
  1367. $.each(arguments, function(_, arg){
  1368. var index
  1369. while ((index = $.inArray(arg, list, index)) > -1) {
  1370. list.splice(index, 1)
  1371. // Handle firing indexes
  1372. if (firing) {
  1373. if (index <= firingLength) --firingLength
  1374. if (index <= firingIndex) --firingIndex
  1375. }
  1376. }
  1377. })
  1378. }
  1379. return this
  1380. },
  1381. has: function(fn) {
  1382. return !!(list && (fn ? $.inArray(fn, list) > -1 : list.length))
  1383. },
  1384. empty: function() {
  1385. firingLength = list.length = 0
  1386. return this
  1387. },
  1388. disable: function() {
  1389. list = stack = memory = undefined
  1390. return this
  1391. },
  1392. disabled: function() {
  1393. return !list
  1394. },
  1395. lock: function() {
  1396. stack = undefined;
  1397. if (!memory) Callbacks.disable()
  1398. return this
  1399. },
  1400. locked: function() {
  1401. return !stack
  1402. },
  1403. fireWith: function(context, args) {
  1404. if (list && (!fired || stack)) {
  1405. args = args || []
  1406. args = [context, args.slice ? args.slice() : args]
  1407. if (firing) stack.push(args)
  1408. else fire(args)
  1409. }
  1410. return this
  1411. },
  1412. fire: function() {
  1413. return Callbacks.fireWith(this, arguments)
  1414. },
  1415. fired: function() {
  1416. return !!fired
  1417. }
  1418. }
  1419.  
  1420. return Callbacks
  1421. }
  1422. })(Zepto)
  1423.  
  1424. // Zepto.js
  1425. // (c) 2010-2016 Thomas Fuchs
  1426. // Zepto.js may be freely distributed under the MIT license.
  1427.  
  1428. // The following code is heavily inspired by jQuery's $.fn.data()
  1429.  
  1430. ;(function($){
  1431. var data = {}, dataAttr = $.fn.data, camelize = $.camelCase,
  1432. exp = $.expando = 'Zepto' + (+new Date()), emptyArray = []
  1433.  
  1434. // Get value from node:
  1435. // 1. first try key as given,
  1436. // 2. then try camelized key,
  1437. // 3. fall back to reading "data-*" attribute.
  1438. function getData(node, name) {
  1439. var id = node[exp], store = id && data[id]
  1440. if (name === undefined) return store || setData(node)
  1441. else {
  1442. if (store) {
  1443. if (name in store) return store[name]
  1444. var camelName = camelize(name)
  1445. if (camelName in store) return store[camelName]
  1446. }
  1447. return dataAttr.call($(node), name)
  1448. }
  1449. }
  1450.  
  1451. // Store value under camelized key on node
  1452. function setData(node, name, value) {
  1453. var id = node[exp] || (node[exp] = ++$.uuid),
  1454. store = data[id] || (data[id] = attributeData(node))
  1455. if (name !== undefined) store[camelize(name)] = value
  1456. return store
  1457. }
  1458.  
  1459. // Read all "data-*" attributes from a node
  1460. function attributeData(node) {
  1461. var store = {}
  1462. $.each(node.attributes || emptyArray, function(i, attr){
  1463. if (attr.name.indexOf('data-') == 0)
  1464. store[camelize(attr.name.replace('data-', ''))] =
  1465. $.zepto.deserializeValue(attr.value)
  1466. })
  1467. return store
  1468. }
  1469.  
  1470. $.fn.data = function(name, value) {
  1471. return value === undefined ?
  1472. // set multiple values via object
  1473. $.isPlainObject(name) ?
  1474. this.each(function(i, node){
  1475. $.each(name, function(key, value){ setData(node, key, value) })
  1476. }) :
  1477. // get value from first element
  1478. (0 in this ? getData(this[0], name) : undefined) :
  1479. // set value on all elements
  1480. this.each(function(){ setData(this, name, value) })
  1481. }
  1482.  
  1483. $.fn.removeData = function(names) {
  1484. if (typeof names == 'string') names = names.split(/\s+/)
  1485. return this.each(function(){
  1486. var id = this[exp], store = id && data[id]
  1487. if (store) $.each(names || store, function(key){
  1488. delete store[names ? camelize(this) : key]
  1489. })
  1490. })
  1491. }
  1492.  
  1493. // Generate extended `remove` and `empty` functions
  1494. ;['remove', 'empty'].forEach(function(methodName){
  1495. var origFn = $.fn[methodName]
  1496. $.fn[methodName] = function() {
  1497. var elements = this.find('*')
  1498. if (methodName === 'remove') elements = elements.add(this)
  1499. elements.removeData()
  1500. return origFn.call(this)
  1501. }
  1502. })
  1503. })(Zepto)
  1504.  
  1505. // Zepto.js
  1506. // (c) 2010-2016 Thomas Fuchs
  1507. // Zepto.js may be freely distributed under the MIT license.
  1508. //
  1509. // Some code (c) 2005, 2013 jQuery Foundation, Inc. and other contributors
  1510.  
  1511. ;(function($){
  1512. var slice = Array.prototype.slice
  1513.  
  1514. function Deferred(func) {
  1515. var tuples = [
  1516. // action, add listener, listener list, final state
  1517. [ "resolve", "done", $.Callbacks({once:1, memory:1}), "resolved" ],
  1518. [ "reject", "fail", $.Callbacks({once:1, memory:1}), "rejected" ],
  1519. [ "notify", "progress", $.Callbacks({memory:1}) ]
  1520. ],
  1521. state = "pending",
  1522. promise = {
  1523. state: function() {
  1524. return state
  1525. },
  1526. always: function() {
  1527. deferred.done(arguments).fail(arguments)
  1528. return this
  1529. },
  1530. then: function(/* fnDone [, fnFailed [, fnProgress]] */) {
  1531. var fns = arguments
  1532. return Deferred(function(defer){
  1533. $.each(tuples, function(i, tuple){
  1534. var fn = $.isFunction(fns[i]) && fns[i]
  1535. deferred[tuple[1]](function(){
  1536. var returned = fn && fn.apply(this, arguments)
  1537. if (returned && $.isFunction(returned.promise)) {
  1538. returned.promise()
  1539. .done(defer.resolve)
  1540. .fail(defer.reject)
  1541. .progress(defer.notify)
  1542. } else {
  1543. var context = this === promise ? defer.promise() : this,
  1544. values = fn ? [returned] : arguments
  1545. defer[tuple[0] + "With"](context, values)
  1546. }
  1547. })
  1548. })
  1549. fns = null
  1550. }).promise()
  1551. },
  1552.  
  1553. promise: function(obj) {
  1554. return obj != null ? $.extend( obj, promise ) : promise
  1555. }
  1556. },
  1557. deferred = {}
  1558.  
  1559. $.each(tuples, function(i, tuple){
  1560. var list = tuple[2],
  1561. stateString = tuple[3]
  1562.  
  1563. promise[tuple[1]] = list.add
  1564.  
  1565. if (stateString) {
  1566. list.add(function(){
  1567. state = stateString
  1568. }, tuples[i^1][2].disable, tuples[2][2].lock)
  1569. }
  1570.  
  1571. deferred[tuple[0]] = function(){
  1572. deferred[tuple[0] + "With"](this === deferred ? promise : this, arguments)
  1573. return this
  1574. }
  1575. deferred[tuple[0] + "With"] = list.fireWith
  1576. })
  1577.  
  1578. promise.promise(deferred)
  1579. if (func) func.call(deferred, deferred)
  1580. return deferred
  1581. }
  1582.  
  1583. $.when = function(sub) {
  1584. var resolveValues = slice.call(arguments),
  1585. len = resolveValues.length,
  1586. i = 0,
  1587. remain = len !== 1 || (sub && $.isFunction(sub.promise)) ? len : 0,
  1588. deferred = remain === 1 ? sub : Deferred(),
  1589. progressValues, progressContexts, resolveContexts,
  1590. updateFn = function(i, ctx, val){
  1591. return function(value){
  1592. ctx[i] = this
  1593. val[i] = arguments.length > 1 ? slice.call(arguments) : value
  1594. if (val === progressValues) {
  1595. deferred.notifyWith(ctx, val)
  1596. } else if (!(--remain)) {
  1597. deferred.resolveWith(ctx, val)
  1598. }
  1599. }
  1600. }
  1601.  
  1602. if (len > 1) {
  1603. progressValues = new Array(len)
  1604. progressContexts = new Array(len)
  1605. resolveContexts = new Array(len)
  1606. for ( ; i < len; ++i ) {
  1607. if (resolveValues[i] && $.isFunction(resolveValues[i].promise)) {
  1608. resolveValues[i].promise()
  1609. .done(updateFn(i, resolveContexts, resolveValues))
  1610. .fail(deferred.reject)
  1611. .progress(updateFn(i, progressContexts, progressValues))
  1612. } else {
  1613. --remain
  1614. }
  1615. }
  1616. }
  1617. if (!remain) deferred.resolveWith(resolveContexts, resolveValues)
  1618. return deferred.promise()
  1619. }
  1620.  
  1621. $.Deferred = Deferred
  1622. })(Zepto)
  1623.  
  1624. // Zepto.js
  1625. // (c) 2010-2016 Thomas Fuchs
  1626. // Zepto.js may be freely distributed under the MIT license.
  1627.  
  1628. ;(function($){
  1629. function detect(ua, platform){
  1630. var os = this.os = {}, browser = this.browser = {},
  1631. webkit = ua.match(/Web[kK]it[\/]{0,1}([\d.]+)/),
  1632. android = ua.match(/(Android);?[\s\/]+([\d.]+)?/),
  1633. osx = !!ua.match(/\(Macintosh\; Intel /),
  1634. ipad = ua.match(/(iPad).*OS\s([\d_]+)/),
  1635. ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/),
  1636. iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/),
  1637. webos = ua.match(/(webOS|hpwOS)[\s\/]([\d.]+)/),
  1638. win = /Win\d{2}|Windows/.test(platform),
  1639. wp = ua.match(/Windows Phone ([\d.]+)/),
  1640. touchpad = webos && ua.match(/TouchPad/),
  1641. kindle = ua.match(/Kindle\/([\d.]+)/),
  1642. silk = ua.match(/Silk\/([\d._]+)/),
  1643. blackberry = ua.match(/(BlackBerry).*Version\/([\d.]+)/),
  1644. bb10 = ua.match(/(BB10).*Version\/([\d.]+)/),
  1645. rimtabletos = ua.match(/(RIM\sTablet\sOS)\s([\d.]+)/),
  1646. playbook = ua.match(/PlayBook/),
  1647. chrome = ua.match(/Chrome\/([\d.]+)/) || ua.match(/CriOS\/([\d.]+)/),
  1648. firefox = ua.match(/Firefox\/([\d.]+)/),
  1649. firefoxos = ua.match(/\((?:Mobile|Tablet); rv:([\d.]+)\).*Firefox\/[\d.]+/),
  1650. ie = ua.match(/MSIE\s([\d.]+)/) || ua.match(/Trident\/[\d](?=[^\?]+).*rv:([0-9.].)/),
  1651. webview = !chrome && ua.match(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/),
  1652. safari = webview || ua.match(/Version\/([\d.]+)([^S](Safari)|[^M]*(Mobile)[^S]*(Safari))/)
  1653.  
  1654. // Todo: clean this up with a better OS/browser seperation:
  1655. // - discern (more) between multiple browsers on android
  1656. // - decide if kindle fire in silk mode is android or not
  1657. // - Firefox on Android doesn't specify the Android version
  1658. // - possibly devide in os, device and browser hashes
  1659.  
  1660. if (browser.webkit = !!webkit) browser.version = webkit[1]
  1661.  
  1662. if (android) os.android = true, os.version = android[2]
  1663. if (iphone && !ipod) os.ios = os.iphone = true, os.version = iphone[2].replace(/_/g, '.')
  1664. if (ipad) os.ios = os.ipad = true, os.version = ipad[2].replace(/_/g, '.')
  1665. if (ipod) os.ios = os.ipod = true, os.version = ipod[3] ? ipod[3].replace(/_/g, '.') : null
  1666. if (wp) os.wp = true, os.version = wp[1]
  1667. if (webos) os.webos = true, os.version = webos[2]
  1668. if (touchpad) os.touchpad = true
  1669. if (blackberry) os.blackberry = true, os.version = blackberry[2]
  1670. if (bb10) os.bb10 = true, os.version = bb10[2]
  1671. if (rimtabletos) os.rimtabletos = true, os.version = rimtabletos[2]
  1672. if (playbook) browser.playbook = true
  1673. if (kindle) os.kindle = true, os.version = kindle[1]
  1674. if (silk) browser.silk = true, browser.version = silk[1]
  1675. if (!silk && os.android && ua.match(/Kindle Fire/)) browser.silk = true
  1676. if (chrome) browser.chrome = true, browser.version = chrome[1]
  1677. if (firefox) browser.firefox = true, browser.version = firefox[1]
  1678. if (firefoxos) os.firefoxos = true, os.version = firefoxos[1]
  1679. if (ie) browser.ie = true, browser.version = ie[1]
  1680. if (safari && (osx || os.ios || win)) {
  1681. browser.safari = true
  1682. if (!os.ios) browser.version = safari[1]
  1683. }
  1684. if (webview) browser.webview = true
  1685.  
  1686. os.tablet = !!(ipad || playbook || (android && !ua.match(/Mobile/)) ||
  1687. (firefox && ua.match(/Tablet/)) || (ie && !ua.match(/Phone/) && ua.match(/Touch/)))
  1688. os.phone = !!(!os.tablet && !os.ipod && (android || iphone || webos || blackberry || bb10 ||
  1689. (chrome && ua.match(/Android/)) || (chrome && ua.match(/CriOS\/([\d.]+)/)) ||
  1690. (firefox && ua.match(/Mobile/)) || (ie && ua.match(/Touch/))))
  1691. }
  1692.  
  1693. detect.call($, navigator.userAgent, navigator.platform)
  1694. // make available to unit tests
  1695. $.__detect = detect
  1696.  
  1697. })(Zepto)
  1698.  
  1699. // Zepto.js
  1700. // (c) 2010-2016 Thomas Fuchs
  1701. // Zepto.js may be freely distributed under the MIT license.
  1702.  
  1703. ;(function($){
  1704. var _zid = 1, undefined,
  1705. slice = Array.prototype.slice,
  1706. isFunction = $.isFunction,
  1707. isString = function(obj){ return typeof obj == 'string' },
  1708. handlers = {},
  1709. specialEvents={},
  1710. focusinSupported = 'onfocusin' in window,
  1711. focus = { focus: 'focusin', blur: 'focusout' },
  1712. hover = { mouseenter: 'mouseover', mouseleave: 'mouseout' }
  1713.  
  1714. specialEvents.click = specialEvents.mousedown = specialEvents.mouseup = specialEvents.mousemove = 'MouseEvents'
  1715.  
  1716. function zid(element) {
  1717. return element._zid || (element._zid = _zid++)
  1718. }
  1719. function findHandlers(element, event, fn, selector) {
  1720. event = parse(event)
  1721. if (event.ns) var matcher = matcherFor(event.ns)
  1722. return (handlers[zid(element)] || []).filter(function(handler) {
  1723. return handler
  1724. && (!event.e || handler.e == event.e)
  1725. && (!event.ns || matcher.test(handler.ns))
  1726. && (!fn || zid(handler.fn) === zid(fn))
  1727. && (!selector || handler.sel == selector)
  1728. })
  1729. }
  1730. function parse(event) {
  1731. var parts = ('' + event).split('.')
  1732. return {e: parts[0], ns: parts.slice(1).sort().join(' ')}
  1733. }
  1734. function matcherFor(ns) {
  1735. return new RegExp('(?:^| )' + ns.replace(' ', ' .* ?') + '(?: |$)')
  1736. }
  1737.  
  1738. function eventCapture(handler, captureSetting) {
  1739. return handler.del &&
  1740. (!focusinSupported && (handler.e in focus)) ||
  1741. !!captureSetting
  1742. }
  1743.  
  1744. function realEvent(type) {
  1745. return hover[type] || (focusinSupported && focus[type]) || type
  1746. }
  1747.  
  1748. function add(element, events, fn, data, selector, delegator, capture){
  1749. var id = zid(element), set = (handlers[id] || (handlers[id] = []))
  1750. events.split(/\s/).forEach(function(event){
  1751. if (event == 'ready') return $(document).ready(fn)
  1752. var handler = parse(event)
  1753. handler.fn = fn
  1754. handler.sel = selector
  1755. // emulate mouseenter, mouseleave
  1756. if (handler.e in hover) fn = function(e){
  1757. var related = e.relatedTarget
  1758. if (!related || (related !== this && !$.contains(this, related)))
  1759. return handler.fn.apply(this, arguments)
  1760. }
  1761. handler.del = delegator
  1762. var callback = delegator || fn
  1763. handler.proxy = function(e){
  1764. e = compatible(e)
  1765. if (e.isImmediatePropagationStopped()) return
  1766. e.data = data
  1767. var result = callback.apply(element, e._args == undefined ? [e] : [e].concat(e._args))
  1768. if (result === false) e.preventDefault(), e.stopPropagation()
  1769. return result
  1770. }
  1771. handler.i = set.length
  1772. set.push(handler)
  1773. if ('addEventListener' in element)
  1774. element.addEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture))
  1775. })
  1776. }
  1777. function remove(element, events, fn, selector, capture){
  1778. var id = zid(element)
  1779. ;(events || '').split(/\s/).forEach(function(event){
  1780. findHandlers(element, event, fn, selector).forEach(function(handler){
  1781. delete handlers[id][handler.i]
  1782. if ('removeEventListener' in element)
  1783. element.removeEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture))
  1784. })
  1785. })
  1786. }
  1787.  
  1788. $.event = { add: add, remove: remove }
  1789.  
  1790. $.proxy = function(fn, context) {
  1791. var args = (2 in arguments) && slice.call(arguments, 2)
  1792. if (isFunction(fn)) {
  1793. var proxyFn = function(){ return fn.apply(context, args ? args.concat(slice.call(arguments)) : arguments) }
  1794. proxyFn._zid = zid(fn)
  1795. return proxyFn
  1796. } else if (isString(context)) {
  1797. if (args) {
  1798. args.unshift(fn[context], fn)
  1799. return $.proxy.apply(null, args)
  1800. } else {
  1801. return $.proxy(fn[context], fn)
  1802. }
  1803. } else {
  1804. throw new TypeError("expected function")
  1805. }
  1806. }
  1807.  
  1808. $.fn.bind = function(event, data, callback){
  1809. return this.on(event, data, callback)
  1810. }
  1811. $.fn.unbind = function(event, callback){
  1812. return this.off(event, callback)
  1813. }
  1814. $.fn.one = function(event, selector, data, callback){
  1815. return this.on(event, selector, data, callback, 1)
  1816. }
  1817.  
  1818. var returnTrue = function(){return true},
  1819. returnFalse = function(){return false},
  1820. ignoreProperties = /^([A-Z]|returnValue$|layer[XY]$)/,
  1821. eventMethods = {
  1822. preventDefault: 'isDefaultPrevented',
  1823. stopImmediatePropagation: 'isImmediatePropagationStopped',
  1824. stopPropagation: 'isPropagationStopped'
  1825. }
  1826.  
  1827. function compatible(event, source) {
  1828. if (source || !event.isDefaultPrevented) {
  1829. source || (source = event)
  1830.  
  1831. $.each(eventMethods, function(name, predicate) {
  1832. var sourceMethod = source[name]
  1833. event[name] = function(){
  1834. this[predicate] = returnTrue
  1835. return sourceMethod && sourceMethod.apply(source, arguments)
  1836. }
  1837. event[predicate] = returnFalse
  1838. })
  1839.  
  1840. if (source.defaultPrevented !== undefined ? source.defaultPrevented :
  1841. 'returnValue' in source ? source.returnValue === false :
  1842. source.getPreventDefault && source.getPreventDefault())
  1843. event.isDefaultPrevented = returnTrue
  1844. }
  1845. return event
  1846. }
  1847.  
  1848. function createProxy(event) {
  1849. var key, proxy = { originalEvent: event }
  1850. for (key in event)
  1851. if (!ignoreProperties.test(key) && event[key] !== undefined) proxy[key] = event[key]
  1852.  
  1853. return compatible(proxy, event)
  1854. }
  1855.  
  1856. $.fn.delegate = function(selector, event, callback){
  1857. return this.on(event, selector, callback)
  1858. }
  1859. $.fn.undelegate = function(selector, event, callback){
  1860. return this.off(event, selector, callback)
  1861. }
  1862.  
  1863. $.fn.live = function(event, callback){
  1864. $(document.body).delegate(this.selector, event, callback)
  1865. return this
  1866. }
  1867. $.fn.die = function(event, callback){
  1868. $(document.body).undelegate(this.selector, event, callback)
  1869. return this
  1870. }
  1871.  
  1872. $.fn.on = function(event, selector, data, callback, one){
  1873. var autoRemove, delegator, $this = this
  1874. if (event && !isString(event)) {
  1875. $.each(event, function(type, fn){
  1876. $this.on(type, selector, data, fn, one)
  1877. })
  1878. return $this
  1879. }
  1880.  
  1881. if (!isString(selector) && !isFunction(callback) && callback !== false)
  1882. callback = data, data = selector, selector = undefined
  1883. if (callback === undefined || data === false)
  1884. callback = data, data = undefined
  1885.  
  1886. if (callback === false) callback = returnFalse
  1887.  
  1888. return $this.each(function(_, element){
  1889. if (one) autoRemove = function(e){
  1890. remove(element, e.type, callback)
  1891. return callback.apply(this, arguments)
  1892. }
  1893.  
  1894. if (selector) delegator = function(e){
  1895. var evt, match = $(e.target).closest(selector, element).get(0)
  1896. if (match && match !== element) {
  1897. evt = $.extend(createProxy(e), {currentTarget: match, liveFired: element})
  1898. return (autoRemove || callback).apply(match, [evt].concat(slice.call(arguments, 1)))
  1899. }
  1900. }
  1901.  
  1902. add(element, event, callback, data, selector, delegator || autoRemove)
  1903. })
  1904. }
  1905. $.fn.off = function(event, selector, callback){
  1906. var $this = this
  1907. if (event && !isString(event)) {
  1908. $.each(event, function(type, fn){
  1909. $this.off(type, selector, fn)
  1910. })
  1911. return $this
  1912. }
  1913.  
  1914. if (!isString(selector) && !isFunction(callback) && callback !== false)
  1915. callback = selector, selector = undefined
  1916.  
  1917. if (callback === false) callback = returnFalse
  1918.  
  1919. return $this.each(function(){
  1920. remove(this, event, callback, selector)
  1921. })
  1922. }
  1923.  
  1924. $.fn.trigger = function(event, args){
  1925. event = (isString(event) || $.isPlainObject(event)) ? $.Event(event) : compatible(event)
  1926. event._args = args
  1927. return this.each(function(){
  1928. // handle focus(), blur() by calling them directly
  1929. if (event.type in focus && typeof this[event.type] == "function") this[event.type]()
  1930. // items in the collection might not be DOM elements
  1931. else if ('dispatchEvent' in this) this.dispatchEvent(event)
  1932. else $(this).triggerHandler(event, args)
  1933. })
  1934. }
  1935.  
  1936. // triggers event handlers on current element just as if an event occurred,
  1937. // doesn't trigger an actual event, doesn't bubble
  1938. $.fn.triggerHandler = function(event, args){
  1939. var e, result
  1940. this.each(function(i, element){
  1941. e = createProxy(isString(event) ? $.Event(event) : event)
  1942. e._args = args
  1943. e.target = element
  1944. $.each(findHandlers(element, event.type || event), function(i, handler){
  1945. result = handler.proxy(e)
  1946. if (e.isImmediatePropagationStopped()) return false
  1947. })
  1948. })
  1949. return result
  1950. }
  1951.  
  1952. // shortcut methods for `.bind(event, fn)` for each event type
  1953. ;('focusin focusout focus blur load resize scroll unload click dblclick '+
  1954. 'mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave '+
  1955. 'change select keydown keypress keyup error').split(' ').forEach(function(event) {
  1956. $.fn[event] = function(callback) {
  1957. return (0 in arguments) ?
  1958. this.bind(event, callback) :
  1959. this.trigger(event)
  1960. }
  1961. })
  1962.  
  1963. $.Event = function(type, props) {
  1964. if (!isString(type)) props = type, type = props.type
  1965. var event = document.createEvent(specialEvents[type] || 'Events'), bubbles = true
  1966. if (props) for (var name in props) (name == 'bubbles') ? (bubbles = !!props[name]) : (event[name] = props[name])
  1967. event.initEvent(type, bubbles, true)
  1968. return compatible(event)
  1969. }
  1970.  
  1971. })(Zepto)
  1972.  
  1973. // Zepto.js
  1974. // (c) 2010-2016 Thomas Fuchs
  1975. // Zepto.js may be freely distributed under the MIT license.
  1976.  
  1977. ;(function($){
  1978. $.fn.serializeArray = function() {
  1979. var name, type, result = [],
  1980. add = function(value) {
  1981. if (value.forEach) return value.forEach(add)
  1982. result.push({ name: name, value: value })
  1983. }
  1984. if (this[0]) $.each(this[0].elements, function(_, field){
  1985. type = field.type, name = field.name
  1986. if (name && field.nodeName.toLowerCase() != 'fieldset' &&
  1987. !field.disabled && type != 'submit' && type != 'reset' && type != 'button' && type != 'file' &&
  1988. ((type != 'radio' && type != 'checkbox') || field.checked))
  1989. add($(field).val())
  1990. })
  1991. return result
  1992. }
  1993.  
  1994. $.fn.serialize = function(){
  1995. var result = []
  1996. this.serializeArray().forEach(function(elm){
  1997. result.push(encodeURIComponent(elm.name) + '=' + encodeURIComponent(elm.value))
  1998. })
  1999. return result.join('&')
  2000. }
  2001.  
  2002. $.fn.submit = function(callback) {
  2003. if (0 in arguments) this.bind('submit', callback)
  2004. else if (this.length) {
  2005. var event = $.Event('submit')
  2006. this.eq(0).trigger(event)
  2007. if (!event.isDefaultPrevented()) this.get(0).submit()
  2008. }
  2009. return this
  2010. }
  2011.  
  2012. })(Zepto)
  2013.  
  2014. // Zepto.js
  2015. // (c) 2010-2016 Thomas Fuchs
  2016. // Zepto.js may be freely distributed under the MIT license.
  2017.  
  2018. ;(function($, undefined){
  2019. var prefix = '', eventPrefix,
  2020. vendors = { Webkit: 'webkit', Moz: '', O: 'o' },
  2021. testEl = document.createElement('div'),
  2022. supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i,
  2023. transform,
  2024. transitionProperty, transitionDuration, transitionTiming, transitionDelay,
  2025. animationName, animationDuration, animationTiming, animationDelay,
  2026. cssReset = {}
  2027.  
  2028. function dasherize(str) { return str.replace(/([a-z])([A-Z])/, '$1-$2').toLowerCase() }
  2029. function normalizeEvent(name) { return eventPrefix ? eventPrefix + name : name.toLowerCase() }
  2030.  
  2031. $.each(vendors, function(vendor, event){
  2032. if (testEl.style[vendor + 'TransitionProperty'] !== undefined) {
  2033. prefix = '-' + vendor.toLowerCase() + '-'
  2034. eventPrefix = event
  2035. return false
  2036. }
  2037. })
  2038.  
  2039. transform = prefix + 'transform'
  2040. cssReset[transitionProperty = prefix + 'transition-property'] =
  2041. cssReset[transitionDuration = prefix + 'transition-duration'] =
  2042. cssReset[transitionDelay = prefix + 'transition-delay'] =
  2043. cssReset[transitionTiming = prefix + 'transition-timing-function'] =
  2044. cssReset[animationName = prefix + 'animation-name'] =
  2045. cssReset[animationDuration = prefix + 'animation-duration'] =
  2046. cssReset[animationDelay = prefix + 'animation-delay'] =
  2047. cssReset[animationTiming = prefix + 'animation-timing-function'] = ''
  2048.  
  2049. $.fx = {
  2050. off: (eventPrefix === undefined && testEl.style.transitionProperty === undefined),
  2051. speeds: { _default: 400, fast: 200, slow: 600 },
  2052. cssPrefix: prefix,
  2053. transitionEnd: normalizeEvent('TransitionEnd'),
  2054. animationEnd: normalizeEvent('AnimationEnd')
  2055. }
  2056.  
  2057. $.fn.animate = function(properties, duration, ease, callback, delay){
  2058. if ($.isFunction(duration))
  2059. callback = duration, ease = undefined, duration = undefined
  2060. if ($.isFunction(ease))
  2061. callback = ease, ease = undefined
  2062. if ($.isPlainObject(duration))
  2063. ease = duration.easing, callback = duration.complete, delay = duration.delay, duration = duration.duration
  2064. if (duration) duration = (typeof duration == 'number' ? duration :
  2065. ($.fx.speeds[duration] || $.fx.speeds._default)) / 1000
  2066. if (delay) delay = parseFloat(delay) / 1000
  2067. return this.anim(properties, duration, ease, callback, delay)
  2068. }
  2069.  
  2070. $.fn.anim = function(properties, duration, ease, callback, delay){
  2071. var key, cssValues = {}, cssProperties, transforms = '',
  2072. that = this, wrappedCallback, endEvent = $.fx.transitionEnd,
  2073. fired = false
  2074.  
  2075. if (duration === undefined) duration = $.fx.speeds._default / 1000
  2076. if (delay === undefined) delay = 0
  2077. if ($.fx.off) duration = 0
  2078.  
  2079. if (typeof properties == 'string') {
  2080. // keyframe animation
  2081. cssValues[animationName] = properties
  2082. cssValues[animationDuration] = duration + 's'
  2083. cssValues[animationDelay] = delay + 's'
  2084. cssValues[animationTiming] = (ease || 'linear')
  2085. endEvent = $.fx.animationEnd
  2086. } else {
  2087. cssProperties = []
  2088. // CSS transitions
  2089. for (key in properties)
  2090. if (supportedTransforms.test(key)) transforms += key + '(' + properties[key] + ') '
  2091. else cssValues[key] = properties[key], cssProperties.push(dasherize(key))
  2092.  
  2093. if (transforms) cssValues[transform] = transforms, cssProperties.push(transform)
  2094. if (duration > 0 && typeof properties === 'object') {
  2095. cssValues[transitionProperty] = cssProperties.join(', ')
  2096. cssValues[transitionDuration] = duration + 's'
  2097. cssValues[transitionDelay] = delay + 's'
  2098. cssValues[transitionTiming] = (ease || 'linear')
  2099. }
  2100. }
  2101.  
  2102. wrappedCallback = function(event){
  2103. if (typeof event !== 'undefined') {
  2104. if (event.target !== event.currentTarget) return // makes sure the event didn't bubble from "below"
  2105. $(event.target).unbind(endEvent, wrappedCallback)
  2106. } else
  2107. $(this).unbind(endEvent, wrappedCallback) // triggered by setTimeout
  2108.  
  2109. fired = true
  2110. $(this).css(cssReset)
  2111. callback && callback.call(this)
  2112. }
  2113. if (duration > 0){
  2114. this.bind(endEvent, wrappedCallback)
  2115. // transitionEnd is not always firing on older Android phones
  2116. // so make sure it gets fired
  2117. setTimeout(function(){
  2118. if (fired) return
  2119. wrappedCallback.call(that)
  2120. }, ((duration + delay) * 1000) + 25)
  2121. }
  2122.  
  2123. // trigger page reflow so new elements can animate
  2124. this.size() && this.get(0).clientLeft
  2125.  
  2126. this.css(cssValues)
  2127.  
  2128. if (duration <= 0) setTimeout(function() {
  2129. that.each(function(){ wrappedCallback.call(this) })
  2130. }, 0)
  2131.  
  2132. return this
  2133. }
  2134.  
  2135. testEl = null
  2136. })(Zepto)
  2137.  
  2138. // Zepto.js
  2139. // (c) 2010-2016 Thomas Fuchs
  2140. // Zepto.js may be freely distributed under the MIT license.
  2141.  
  2142. ;(function($, undefined){
  2143. var document = window.document, docElem = document.documentElement,
  2144. origShow = $.fn.show, origHide = $.fn.hide, origToggle = $.fn.toggle
  2145.  
  2146. function anim(el, speed, opacity, scale, callback) {
  2147. if (typeof speed == 'function' && !callback) callback = speed, speed = undefined
  2148. var props = { opacity: opacity }
  2149. if (scale) {
  2150. props.scale = scale
  2151. el.css($.fx.cssPrefix + 'transform-origin', '0 0')
  2152. }
  2153. return el.animate(props, speed, null, callback)
  2154. }
  2155.  
  2156. function hide(el, speed, scale, callback) {
  2157. return anim(el, speed, 0, scale, function(){
  2158. origHide.call($(this))
  2159. callback && callback.call(this)
  2160. })
  2161. }
  2162.  
  2163. $.fn.show = function(speed, callback) {
  2164. origShow.call(this)
  2165. if (speed === undefined) speed = 0
  2166. else this.css('opacity', 0)
  2167. return anim(this, speed, 1, '1,1', callback)
  2168. }
  2169.  
  2170. $.fn.hide = function(speed, callback) {
  2171. if (speed === undefined) return origHide.call(this)
  2172. else return hide(this, speed, '0,0', callback)
  2173. }
  2174.  
  2175. $.fn.toggle = function(speed, callback) {
  2176. if (speed === undefined || typeof speed == 'boolean')
  2177. return origToggle.call(this, speed)
  2178. else return this.each(function(){
  2179. var el = $(this)
  2180. el[el.css('display') == 'none' ? 'show' : 'hide'](speed, callback)
  2181. })
  2182. }
  2183.  
  2184. $.fn.fadeTo = function(speed, opacity, callback) {
  2185. return anim(this, speed, opacity, null, callback)
  2186. }
  2187.  
  2188. $.fn.fadeIn = function(speed, callback) {
  2189. var target = this.css('opacity')
  2190. if (target > 0) this.css('opacity', 0)
  2191. else target = 1
  2192. return origShow.call(this).fadeTo(speed, target, callback)
  2193. }
  2194.  
  2195. $.fn.fadeOut = function(speed, callback) {
  2196. return hide(this, speed, null, callback)
  2197. }
  2198.  
  2199. $.fn.fadeToggle = function(speed, callback) {
  2200. return this.each(function(){
  2201. var el = $(this)
  2202. el[
  2203. (el.css('opacity') == 0 || el.css('display') == 'none') ? 'fadeIn' : 'fadeOut'
  2204. ](speed, callback)
  2205. })
  2206. }
  2207.  
  2208. })(Zepto)
  2209.  
  2210. // Zepto.js
  2211. // (c) 2010-2016 Thomas Fuchs
  2212. // Zepto.js may be freely distributed under the MIT license.
  2213.  
  2214. ;(function($){
  2215. if ($.os.ios) {
  2216. var gesture = {}, gestureTimeout
  2217.  
  2218. function parentIfText(node){
  2219. return 'tagName' in node ? node : node.parentNode
  2220. }
  2221.  
  2222. $(document).bind('gesturestart', function(e){
  2223. var now = Date.now(), delta = now - (gesture.last || now)
  2224. gesture.target = parentIfText(e.target)
  2225. gestureTimeout && clearTimeout(gestureTimeout)
  2226. gesture.e1 = e.scale
  2227. gesture.last = now
  2228. }).bind('gesturechange', function(e){
  2229. gesture.e2 = e.scale
  2230. }).bind('gestureend', function(e){
  2231. if (gesture.e2 > 0) {
  2232. Math.abs(gesture.e1 - gesture.e2) != 0 && $(gesture.target).trigger('pinch') &&
  2233. $(gesture.target).trigger('pinch' + (gesture.e1 - gesture.e2 > 0 ? 'In' : 'Out'))
  2234. gesture.e1 = gesture.e2 = gesture.last = 0
  2235. } else if ('last' in gesture) {
  2236. gesture = {}
  2237. }
  2238. })
  2239.  
  2240. ;['pinch', 'pinchIn', 'pinchOut'].forEach(function(m){
  2241. $.fn[m] = function(callback){ return this.bind(m, callback) }
  2242. })
  2243. }
  2244. })(Zepto)
  2245.  
  2246. // Zepto.js
  2247. // (c) 2010-2016 Thomas Fuchs
  2248. // Zepto.js may be freely distributed under the MIT license.
  2249.  
  2250. ;(function(){
  2251. // getComputedStyle shouldn't freak out when called
  2252. // without a valid element as argument
  2253. try {
  2254. getComputedStyle(undefined)
  2255. } catch(e) {
  2256. var nativeGetComputedStyle = getComputedStyle;
  2257. window.getComputedStyle = function(element){
  2258. try {
  2259. return nativeGetComputedStyle(element)
  2260. } catch(e) {
  2261. return null
  2262. }
  2263. }
  2264. }
  2265. })()
  2266.  
  2267. // Zepto.js
  2268. // (c) 2010-2016 Thomas Fuchs
  2269. // Zepto.js may be freely distributed under the MIT license.
  2270.  
  2271. ;(function(undefined){
  2272. if (String.prototype.trim === undefined) // fix for iOS 3.2
  2273. String.prototype.trim = function(){ return this.replace(/^\s+|\s+$/g, '') }
  2274.  
  2275. // For iOS 3.x
  2276. // from https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/reduce
  2277. if (Array.prototype.reduce === undefined)
  2278. Array.prototype.reduce = function(fun){
  2279. if(this === void 0 || this === null) throw new TypeError()
  2280. var t = Object(this), len = t.length >>> 0, k = 0, accumulator
  2281. if(typeof fun != 'function') throw new TypeError()
  2282. if(len == 0 && arguments.length == 1) throw new TypeError()
  2283.  
  2284. if(arguments.length >= 2)
  2285. accumulator = arguments[1]
  2286. else
  2287. do{
  2288. if(k in t){
  2289. accumulator = t[k++]
  2290. break
  2291. }
  2292. if(++k >= len) throw new TypeError()
  2293. } while (true)
  2294.  
  2295. while (k < len){
  2296. if(k in t) accumulator = fun.call(undefined, accumulator, t[k], k, t)
  2297. k++
  2298. }
  2299. return accumulator
  2300. }
  2301.  
  2302. })()
  2303.  
  2304. // Zepto.js
  2305. // (c) 2010-2016 Thomas Fuchs
  2306. // Zepto.js may be freely distributed under the MIT license.
  2307.  
  2308. ;(function($){
  2309. var zepto = $.zepto, oldQsa = zepto.qsa, oldMatches = zepto.matches
  2310.  
  2311. function visible(elem){
  2312. elem = $(elem)
  2313. return !!(elem.width() || elem.height()) && elem.css("display") !== "none"
  2314. }
  2315.  
  2316. // Implements a subset from:
  2317. // http://api.jquery.com/category/selectors/jquery-selector-extensions/
  2318. //
  2319. // Each filter function receives the current index, all nodes in the
  2320. // considered set, and a value if there were parentheses. The value
  2321. // of `this` is the node currently being considered. The function returns the
  2322. // resulting node(s), null, or undefined.
  2323. //
  2324. // Complex selectors are not supported:
  2325. // li:has(label:contains("foo")) + li:has(label:contains("bar"))
  2326. // ul.inner:first > li
  2327. var filters = $.expr[':'] = {
  2328. visible: function(){ if (visible(this)) return this },
  2329. hidden: function(){ if (!visible(this)) return this },
  2330. selected: function(){ if (this.selected) return this },
  2331. checked: function(){ if (this.checked) return this },
  2332. parent: function(){ return this.parentNode },
  2333. first: function(idx){ if (idx === 0) return this },
  2334. last: function(idx, nodes){ if (idx === nodes.length - 1) return this },
  2335. eq: function(idx, _, value){ if (idx === value) return this },
  2336. contains: function(idx, _, text){ if ($(this).text().indexOf(text) > -1) return this },
  2337. has: function(idx, _, sel){ if (zepto.qsa(this, sel).length) return this }
  2338. }
  2339.  
  2340. var filterRe = new RegExp('(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*'),
  2341. childRe = /^\s*>/,
  2342. classTag = 'Zepto' + (+new Date())
  2343.  
  2344. function process(sel, fn) {
  2345. // quote the hash in `a[href^=#]` expression
  2346. sel = sel.replace(/=#\]/g, '="#"]')
  2347. var filter, arg, match = filterRe.exec(sel)
  2348. if (match && match[2] in filters) {
  2349. filter = filters[match[2]], arg = match[3]
  2350. sel = match[1]
  2351. if (arg) {
  2352. var num = Number(arg)
  2353. if (isNaN(num)) arg = arg.replace(/^["']|["']$/g, '')
  2354. else arg = num
  2355. }
  2356. }
  2357. return fn(sel, filter, arg)
  2358. }
  2359.  
  2360. zepto.qsa = function(node, selector) {
  2361. return process(selector, function(sel, filter, arg){
  2362. try {
  2363. var taggedParent
  2364. if (!sel && filter) sel = '*'
  2365. else if (childRe.test(sel))
  2366. // support "> *" child queries by tagging the parent node with a
  2367. // unique class and prepending that classname onto the selector
  2368. taggedParent = $(node).addClass(classTag), sel = '.'+classTag+' '+sel
  2369.  
  2370. var nodes = oldQsa(node, sel)
  2371. } catch(e) {
  2372. console.error('error performing selector: %o', selector)
  2373. throw e
  2374. } finally {
  2375. if (taggedParent) taggedParent.removeClass(classTag)
  2376. }
  2377. return !filter ? nodes :
  2378. zepto.uniq($.map(nodes, function(n, i){ return filter.call(n, i, nodes, arg) }))
  2379. })
  2380. }
  2381.  
  2382. zepto.matches = function(node, selector){
  2383. return process(selector, function(sel, filter, arg){
  2384. return (!sel || oldMatches(node, sel)) &&
  2385. (!filter || filter.call(node, null, arg) === node)
  2386. })
  2387. }
  2388. })(Zepto)
  2389.  
  2390. // Zepto.js
  2391. // (c) 2010-2016 Thomas Fuchs
  2392. // Zepto.js may be freely distributed under the MIT license.
  2393.  
  2394. ;(function($){
  2395. $.fn.end = function(){
  2396. return this.prevObject || $()
  2397. }
  2398.  
  2399. $.fn.andSelf = function(){
  2400. return this.add(this.prevObject || $())
  2401. }
  2402.  
  2403. 'filter,add,not,eq,first,last,find,closest,parents,parent,children,siblings'.split(',').forEach(function(property){
  2404. var fn = $.fn[property]
  2405. $.fn[property] = function(){
  2406. var ret = fn.apply(this, arguments)
  2407. ret.prevObject = this
  2408. return ret
  2409. }
  2410. })
  2411. })(Zepto)
  2412.  
  2413. // Zepto.js
  2414. // (c) 2010-2016 Thomas Fuchs
  2415. // Zepto.js may be freely distributed under the MIT license.
  2416.  
  2417. ;(function($){
  2418. var touch = {},
  2419. touchTimeout, tapTimeout, swipeTimeout, longTapTimeout,
  2420. longTapDelay = 750,
  2421. gesture
  2422.  
  2423. function swipeDirection(x1, x2, y1, y2) {
  2424. return Math.abs(x1 - x2) >=
  2425. Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down')
  2426. }
  2427.  
  2428. function longTap() {
  2429. longTapTimeout = null
  2430. if (touch.last) {
  2431. touch.el.trigger('longTap')
  2432. touch = {}
  2433. }
  2434. }
  2435.  
  2436. function cancelLongTap() {
  2437. if (longTapTimeout) clearTimeout(longTapTimeout)
  2438. longTapTimeout = null
  2439. }
  2440.  
  2441. function cancelAll() {
  2442. if (touchTimeout) clearTimeout(touchTimeout)
  2443. if (tapTimeout) clearTimeout(tapTimeout)
  2444. if (swipeTimeout) clearTimeout(swipeTimeout)
  2445. if (longTapTimeout) clearTimeout(longTapTimeout)
  2446. touchTimeout = tapTimeout = swipeTimeout = longTapTimeout = null
  2447. touch = {}
  2448. }
  2449.  
  2450. function isPrimaryTouch(event){
  2451. return (event.pointerType == 'touch' ||
  2452. event.pointerType == event.MSPOINTER_TYPE_TOUCH)
  2453. && event.isPrimary
  2454. }
  2455.  
  2456. function isPointerEventType(e, type){
  2457. return (e.type == 'pointer'+type ||
  2458. e.type.toLowerCase() == 'mspointer'+type)
  2459. }
  2460.  
  2461. $(document).ready(function(){
  2462. var now, delta, deltaX = 0, deltaY = 0, firstTouch, _isPointerType
  2463.  
  2464. if ('MSGesture' in window) {
  2465. gesture = new MSGesture()
  2466. gesture.target = document.body
  2467. }
  2468.  
  2469. $(document)
  2470. .bind('MSGestureEnd', function(e){
  2471. var swipeDirectionFromVelocity =
  2472. e.velocityX > 1 ? 'Right' : e.velocityX < -1 ? 'Left' : e.velocityY > 1 ? 'Down' : e.velocityY < -1 ? 'Up' : null;
  2473. if (swipeDirectionFromVelocity) {
  2474. touch.el.trigger('swipe')
  2475. touch.el.trigger('swipe'+ swipeDirectionFromVelocity)
  2476. }
  2477. })
  2478. .on('touchstart MSPointerDown pointerdown', function(e){
  2479. if((_isPointerType = isPointerEventType(e, 'down')) &&
  2480. !isPrimaryTouch(e)) return
  2481. firstTouch = _isPointerType ? e : e.touches[0]
  2482. if (e.touches && e.touches.length === 1 && touch.x2) {
  2483. // Clear out touch movement data if we have it sticking around
  2484. // This can occur if touchcancel doesn't fire due to preventDefault, etc.
  2485. touch.x2 = undefined
  2486. touch.y2 = undefined
  2487. }
  2488. now = Date.now()
  2489. delta = now - (touch.last || now)
  2490. touch.el = $('tagName' in firstTouch.target ?
  2491. firstTouch.target : firstTouch.target.parentNode)
  2492. touchTimeout && clearTimeout(touchTimeout)
  2493. touch.x1 = firstTouch.pageX
  2494. touch.y1 = firstTouch.pageY
  2495. if (delta > 0 && delta <= 250) touch.isDoubleTap = true
  2496. touch.last = now
  2497. longTapTimeout = setTimeout(longTap, longTapDelay)
  2498. // adds the current touch contact for IE gesture recognition
  2499. if (gesture && _isPointerType) gesture.addPointer(e.pointerId);
  2500. })
  2501. .on('touchmove MSPointerMove pointermove', function(e){
  2502. if((_isPointerType = isPointerEventType(e, 'move')) &&
  2503. !isPrimaryTouch(e)) return
  2504. firstTouch = _isPointerType ? e : e.touches[0]
  2505. cancelLongTap()
  2506. touch.x2 = firstTouch.pageX
  2507. touch.y2 = firstTouch.pageY
  2508.  
  2509. deltaX += Math.abs(touch.x1 - touch.x2)
  2510. deltaY += Math.abs(touch.y1 - touch.y2)
  2511. if (touch.x2 && Math.abs(touch.x1 - touch.x2) > 10)
  2512. e.preventDefault();
  2513. })
  2514. .on('touchend MSPointerUp pointerup', function(e){
  2515. if((_isPointerType = isPointerEventType(e, 'up')) &&
  2516. !isPrimaryTouch(e)) return
  2517. cancelLongTap()
  2518.  
  2519. // swipe
  2520. if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > 30) ||
  2521. (touch.y2 && Math.abs(touch.y1 - touch.y2) > 30))
  2522.  
  2523. swipeTimeout = setTimeout(function() {
  2524. touch.el.trigger('swipe')
  2525. touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2)))
  2526. touch = {}
  2527. }, 0)
  2528.  
  2529. // normal tap
  2530. else if ('last' in touch)
  2531. // don't fire tap when delta position changed by more than 30 pixels,
  2532. // for instance when moving to a point and back to origin
  2533. if (deltaX < 30 && deltaY < 30) {
  2534. // delay by one tick so we can cancel the 'tap' event if 'scroll' fires
  2535. // ('tap' fires before 'scroll')
  2536. tapTimeout = setTimeout(function() {
  2537.  
  2538. // trigger universal 'tap' with the option to cancelTouch()
  2539. // (cancelTouch cancels processing of single vs double taps for faster 'tap' response)
  2540. var event = $.Event('tap')
  2541. event.cancelTouch = cancelAll
  2542. touch.el.trigger(event)
  2543.  
  2544. // trigger double tap immediately
  2545. if (touch.isDoubleTap) {
  2546. if (touch.el) touch.el.trigger('doubleTap')
  2547. touch = {}
  2548. }
  2549.  
  2550. // trigger single tap after 250ms of inactivity
  2551. else {
  2552. touchTimeout = setTimeout(function(){
  2553. touchTimeout = null
  2554. if (touch.el) touch.el.trigger('singleTap')
  2555. touch = {}
  2556. }, 250)
  2557. }
  2558. }, 0)
  2559. } else {
  2560. touch = {}
  2561. }
  2562. deltaX = deltaY = 0
  2563.  
  2564. })
  2565. // when the browser window loses focus,
  2566. // for example when a modal dialog is shown,
  2567. // cancel all ongoing events
  2568. .on('touchcancel MSPointerCancel pointercancel', cancelAll)
  2569.  
  2570. // scrolling the window indicates intention of the user
  2571. // to scroll, not tap or swipe, so cancel all ongoing events
  2572. $(window).on('scroll', cancelAll)
  2573. })
  2574.  
  2575. ;['swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown',
  2576. 'doubleTap', 'tap', 'singleTap', 'longTap'].forEach(function(eventName){
  2577. $.fn[eventName] = function(callback){ return this.on(eventName, callback) }
  2578. })
  2579. })(Zepto)

移动端的silder,未封装,基于zepto的touch模块,有参照修改过touch的bug的更多相关文章

  1. 基于zepto的插件之移动端无缝向上滚动并上下触摸滑动

    该插件乃本博客作者所写,目的在于提升作者的js能力,也给一些js菜鸟在使用插件时提供一些便利,老鸟就悠然地飞过吧. 公司的移动端项目是基于zepto的,有一个页面要求文字能够无缝地不停向上滚动,但查了 ...

  2. 基于zepto的H5/移动端tab切换触摸拖动加载更多数据

    以前实现移动端的滑动加载更多实现的方法是当滚动条快到页面底部时就自动加载更多的数据,在这方面很多人都用的是"西门的后花园"写的一个叫dropload的插件,这个插件用起来也很好,很 ...

  3. 基于zepto的移动端日期和时间选择控件

    前段时间给大家分享过一个基于jQuery Mobile的移动端日期时间拾取器,大家反应其由于加载过大的插件导致影响调用速度.那么今天我把从网络上搜集到的两个适合移动端应用的日期和时间选择插件分享给大家 ...

  4. 基于zepto的移动端轻量级日期插件

    前言 做过移动Web开发的同学都知道,移动端日期选择是很常见的需求.在PC端,我们有很丰富的选择,比较出名的就有Mobiscroll和jQuery UI Datepicker.个人看来,这些插件存在的 ...

  5. 基于Zepto移动端下拉加载(刷新),上拉加载插件开发

    写在前面:本人水平有限,有什么分析不到位的还请各路大神指出,谢谢. 这次要写的东西是类似于<今日头条>的效果,下拉加载上啦加载,这次做的效果是简单的模拟,没有多少内容,下面是今日头条的移动 ...

  6. 基于zepto判断mobile的横竖屏状态

    借用jquery mobile中的代码,删除了一些多余的部分,简单的基于zepto的模块 var CheckOrientation = (function(){ var win = $( window ...

  7. 基于zepto的手机焦点图touchstart touchmove

    基于zepto的手机焦点图,查看地址:demo (建议使用手机浏览器查看)代码如下: <!DOCTYPE HTML> <html> <head> <title ...

  8. react封装基于axios的API请求

    一.最近做的一个后台管理项目,基于antd-pro做的,需要封装基于axios请求,便于开发,直接上代码. import axios from 'axios'; export const Method ...

  9. .NetCore简单封装基于IHttpClientFactory的HttpClient请求

    IHttpClientFactory是什么?为什么出现了IHttpClientFactory 一.IHttpClientFactory是什么? IHttpClientFactory是.netcore2 ...

随机推荐

  1. 使用requireJS

    什么是require? require是AMD模块化规范的具体实现. 目前,通行的js模块化规范有两种,CommonJS和AMD. CommonJS和AMD有什么不同呢? CommonJS主要用于服务 ...

  2. a元素的两个重要功能和表格布局

    ⦁ 发送邮件:<a href="mailto:231455557@qq.com">联系我们</a> ⦁ 锚点两个重要应用:查看目录    提供菜单功能回到顶 ...

  3. 【Tools】ubuntu16.04安装搜狗输入法

    Ubuntu16,04 安装搜狗输入法 1.下载搜狗输入法的安装包 下载地址为:http://pinyin.sogou.com/linux/ 2.按键Ctr+Alt+T打开终端,输入以下命令切换到下载 ...

  4. linux下利用shell脚本实现添加crontab任务

    本来直接用crontab -e 就可以打开vim,输入要执行的任务保存退出就可以添加任务直接启动运行了.但是今天组长说能不能写个shell不用打开vi就能添加到crontab的. 最先想到的是怎么在s ...

  5. Java中的双重检查锁(double checked locking)

    最初的代码 在最近的项目中,写出了这样的一段代码 private static SomeClass instance; public SomeClass getInstance() { if (nul ...

  6. 编译安装python3.6后pip3无法安装模块问题处理

    编译安装python3.6之后,使用pip3命令安装第三方库效果如图所示: pip is configured with locations that require TLS/SSL, however ...

  7. Java注释用处

    1.Java注释: import cn.lonecloud.Doc; /** * Created by lonecloud on 2017/8/17. * 测试注释类型 {@link Doc#test ...

  8. jsp中的开头的作用

    <%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1&q ...

  9. nyoj358 取石子(五) 斐波那契博弈

    我写代码找的规律:如果这个n是斐波那契数,那么它是P态,如2,3,5,8..... 找规律的代码: #include <cstdio> #include <cmath> #in ...

  10. shell脚本中 杀死可能成为僵尸进程的方法

    交互式 Bash Shell 获取进程 pid 在已知进程名(name)的前提下,交互式 Shell 获取进程 pid 有很多种方法,典型的通过 grep 获取 pid 的方法为(这里添加 -v gr ...