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