sprockets_zeptojs 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sprockets_zeptojs/version.rb +1 -1
- data/vendor/assets/javascripts/zepto/ajax.js +314 -0
- data/vendor/assets/javascripts/zepto/assets.js +21 -0
- data/vendor/assets/javascripts/zepto/data.js +67 -0
- data/vendor/assets/javascripts/zepto/detect.js +55 -0
- data/vendor/assets/javascripts/zepto/event.js +248 -0
- data/vendor/assets/javascripts/zepto/form.js +40 -0
- data/vendor/assets/javascripts/zepto/fx.js +102 -0
- data/vendor/assets/javascripts/zepto/fx_methods.js +71 -0
- data/vendor/assets/javascripts/zepto/gesture.js +35 -0
- data/vendor/assets/javascripts/zepto/index.js +6 -0
- data/vendor/assets/javascripts/zepto/polyfill.js +36 -0
- data/vendor/assets/javascripts/zepto/selector.js +81 -0
- data/vendor/assets/javascripts/zepto/stack.js +22 -0
- data/vendor/assets/javascripts/zepto/touch.js +115 -0
- data/vendor/assets/javascripts/zepto/zepto.js +790 -0
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 583b118f3c05e980ecc007a60f4bc33cd3c07c46
|
4
|
+
data.tar.gz: 0c3f07068801001a676e31a22c8e3bdf881d06e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d899bdac06e60a72a1ea42c4b679b8c2d2e164e15958f72c7cd75ed77def77d62936a0d037af939d9db565fae74351e0d79d9d25bacaa31d74940189aef6b791
|
7
|
+
data.tar.gz: 13e88316dcc966bc8ed395f6dd48973cfac8647f8f5dab589c733838679222db8a3b2cb245b18f9c7af5b79e3563fce8df305c3d9756e3c93a3c1ed1de5232c3
|
@@ -0,0 +1,314 @@
|
|
1
|
+
// Zepto.js
|
2
|
+
// (c) 2010-2012 Thomas Fuchs
|
3
|
+
// Zepto.js may be freely distributed under the MIT license.
|
4
|
+
|
5
|
+
;(function($){
|
6
|
+
var jsonpID = 0,
|
7
|
+
document = window.document,
|
8
|
+
key,
|
9
|
+
name,
|
10
|
+
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
|
11
|
+
scriptTypeRE = /^(?:text|application)\/javascript/i,
|
12
|
+
xmlTypeRE = /^(?:text|application)\/xml/i,
|
13
|
+
jsonType = 'application/json',
|
14
|
+
htmlType = 'text/html',
|
15
|
+
blankRE = /^\s*$/
|
16
|
+
|
17
|
+
// trigger a custom event and return false if it was cancelled
|
18
|
+
function triggerAndReturn(context, eventName, data) {
|
19
|
+
var event = $.Event(eventName)
|
20
|
+
$(context).trigger(event, data)
|
21
|
+
return !event.defaultPrevented
|
22
|
+
}
|
23
|
+
|
24
|
+
// trigger an Ajax "global" event
|
25
|
+
function triggerGlobal(settings, context, eventName, data) {
|
26
|
+
if (settings.global) return triggerAndReturn(context || document, eventName, data)
|
27
|
+
}
|
28
|
+
|
29
|
+
// Number of active Ajax requests
|
30
|
+
$.active = 0
|
31
|
+
|
32
|
+
function ajaxStart(settings) {
|
33
|
+
if (settings.global && $.active++ === 0) triggerGlobal(settings, null, 'ajaxStart')
|
34
|
+
}
|
35
|
+
function ajaxStop(settings) {
|
36
|
+
if (settings.global && !(--$.active)) triggerGlobal(settings, null, 'ajaxStop')
|
37
|
+
}
|
38
|
+
|
39
|
+
// triggers an extra global event "ajaxBeforeSend" that's like "ajaxSend" but cancelable
|
40
|
+
function ajaxBeforeSend(xhr, settings) {
|
41
|
+
var context = settings.context
|
42
|
+
if (settings.beforeSend.call(context, xhr, settings) === false ||
|
43
|
+
triggerGlobal(settings, context, 'ajaxBeforeSend', [xhr, settings]) === false)
|
44
|
+
return false
|
45
|
+
|
46
|
+
triggerGlobal(settings, context, 'ajaxSend', [xhr, settings])
|
47
|
+
}
|
48
|
+
function ajaxSuccess(data, xhr, settings) {
|
49
|
+
var context = settings.context, status = 'success'
|
50
|
+
settings.success.call(context, data, status, xhr)
|
51
|
+
triggerGlobal(settings, context, 'ajaxSuccess', [xhr, settings, data])
|
52
|
+
ajaxComplete(status, xhr, settings)
|
53
|
+
}
|
54
|
+
// type: "timeout", "error", "abort", "parsererror"
|
55
|
+
function ajaxError(error, type, xhr, settings) {
|
56
|
+
var context = settings.context
|
57
|
+
settings.error.call(context, xhr, type, error)
|
58
|
+
triggerGlobal(settings, context, 'ajaxError', [xhr, settings, error])
|
59
|
+
ajaxComplete(type, xhr, settings)
|
60
|
+
}
|
61
|
+
// status: "success", "notmodified", "error", "timeout", "abort", "parsererror"
|
62
|
+
function ajaxComplete(status, xhr, settings) {
|
63
|
+
var context = settings.context
|
64
|
+
settings.complete.call(context, xhr, status)
|
65
|
+
triggerGlobal(settings, context, 'ajaxComplete', [xhr, settings])
|
66
|
+
ajaxStop(settings)
|
67
|
+
}
|
68
|
+
|
69
|
+
// Empty function, used as default callback
|
70
|
+
function empty() {}
|
71
|
+
|
72
|
+
$.ajaxJSONP = function(options){
|
73
|
+
if (!('type' in options)) return $.ajax(options)
|
74
|
+
|
75
|
+
var callbackName = 'jsonp' + (++jsonpID),
|
76
|
+
script = document.createElement('script'),
|
77
|
+
cleanup = function() {
|
78
|
+
clearTimeout(abortTimeout)
|
79
|
+
$(script).remove()
|
80
|
+
delete window[callbackName]
|
81
|
+
},
|
82
|
+
abort = function(type){
|
83
|
+
cleanup()
|
84
|
+
// In case of manual abort or timeout, keep an empty function as callback
|
85
|
+
// so that the SCRIPT tag that eventually loads won't result in an error.
|
86
|
+
if (!type || type == 'timeout') window[callbackName] = empty
|
87
|
+
ajaxError(null, type || 'abort', xhr, options)
|
88
|
+
},
|
89
|
+
xhr = { abort: abort }, abortTimeout
|
90
|
+
|
91
|
+
if (ajaxBeforeSend(xhr, options) === false) {
|
92
|
+
abort('abort')
|
93
|
+
return false
|
94
|
+
}
|
95
|
+
|
96
|
+
window[callbackName] = function(data){
|
97
|
+
cleanup()
|
98
|
+
ajaxSuccess(data, xhr, options)
|
99
|
+
}
|
100
|
+
|
101
|
+
script.onerror = function() { abort('error') }
|
102
|
+
|
103
|
+
script.src = options.url.replace(/=\?/, '=' + callbackName)
|
104
|
+
$('head').append(script)
|
105
|
+
|
106
|
+
if (options.timeout > 0) abortTimeout = setTimeout(function(){
|
107
|
+
abort('timeout')
|
108
|
+
}, options.timeout)
|
109
|
+
|
110
|
+
return xhr
|
111
|
+
}
|
112
|
+
|
113
|
+
$.ajaxSettings = {
|
114
|
+
// Default type of request
|
115
|
+
type: 'GET',
|
116
|
+
// Callback that is executed before request
|
117
|
+
beforeSend: empty,
|
118
|
+
// Callback that is executed if the request succeeds
|
119
|
+
success: empty,
|
120
|
+
// Callback that is executed the the server drops error
|
121
|
+
error: empty,
|
122
|
+
// Callback that is executed on request complete (both: error and success)
|
123
|
+
complete: empty,
|
124
|
+
// The context for the callbacks
|
125
|
+
context: null,
|
126
|
+
// Whether to trigger "global" Ajax events
|
127
|
+
global: true,
|
128
|
+
// Transport
|
129
|
+
xhr: function () {
|
130
|
+
return new window.XMLHttpRequest()
|
131
|
+
},
|
132
|
+
// MIME types mapping
|
133
|
+
accepts: {
|
134
|
+
script: 'text/javascript, application/javascript',
|
135
|
+
json: jsonType,
|
136
|
+
xml: 'application/xml, text/xml',
|
137
|
+
html: htmlType,
|
138
|
+
text: 'text/plain'
|
139
|
+
},
|
140
|
+
// Whether the request is to another domain
|
141
|
+
crossDomain: false,
|
142
|
+
// Default timeout
|
143
|
+
timeout: 0,
|
144
|
+
// Whether data should be serialized to string
|
145
|
+
processData: true,
|
146
|
+
// Whether the browser should be allowed to cache GET responses
|
147
|
+
cache: true,
|
148
|
+
}
|
149
|
+
|
150
|
+
function mimeToDataType(mime) {
|
151
|
+
if (mime) mime = mime.split(';', 2)[0]
|
152
|
+
return mime && ( mime == htmlType ? 'html' :
|
153
|
+
mime == jsonType ? 'json' :
|
154
|
+
scriptTypeRE.test(mime) ? 'script' :
|
155
|
+
xmlTypeRE.test(mime) && 'xml' ) || 'text'
|
156
|
+
}
|
157
|
+
|
158
|
+
function appendQuery(url, query) {
|
159
|
+
return (url + '&' + query).replace(/[&?]{1,2}/, '?')
|
160
|
+
}
|
161
|
+
|
162
|
+
// serialize payload and append it to the URL for GET requests
|
163
|
+
function serializeData(options) {
|
164
|
+
if (options.processData && options.data && $.type(options.data) != "string")
|
165
|
+
options.data = $.param(options.data, options.traditional)
|
166
|
+
if (options.data && (!options.type || options.type.toUpperCase() == 'GET'))
|
167
|
+
options.url = appendQuery(options.url, options.data)
|
168
|
+
}
|
169
|
+
|
170
|
+
$.ajax = function(options){
|
171
|
+
var settings = $.extend({}, options || {})
|
172
|
+
for (key in $.ajaxSettings) if (settings[key] === undefined) settings[key] = $.ajaxSettings[key]
|
173
|
+
|
174
|
+
ajaxStart(settings)
|
175
|
+
|
176
|
+
if (!settings.crossDomain) settings.crossDomain = /^([\w-]+:)?\/\/([^\/]+)/.test(settings.url) &&
|
177
|
+
RegExp.$2 != window.location.host
|
178
|
+
|
179
|
+
if (!settings.url) settings.url = window.location.toString()
|
180
|
+
serializeData(settings)
|
181
|
+
if (settings.cache === false) settings.url = appendQuery(settings.url, '_=' + Date.now())
|
182
|
+
|
183
|
+
var dataType = settings.dataType, hasPlaceholder = /=\?/.test(settings.url)
|
184
|
+
if (dataType == 'jsonp' || hasPlaceholder) {
|
185
|
+
if (!hasPlaceholder) settings.url = appendQuery(settings.url, 'callback=?')
|
186
|
+
return $.ajaxJSONP(settings)
|
187
|
+
}
|
188
|
+
|
189
|
+
var mime = settings.accepts[dataType],
|
190
|
+
baseHeaders = { },
|
191
|
+
protocol = /^([\w-]+:)\/\//.test(settings.url) ? RegExp.$1 : window.location.protocol,
|
192
|
+
xhr = settings.xhr(), abortTimeout
|
193
|
+
|
194
|
+
if (!settings.crossDomain) baseHeaders['X-Requested-With'] = 'XMLHttpRequest'
|
195
|
+
if (mime) {
|
196
|
+
baseHeaders['Accept'] = mime
|
197
|
+
if (mime.indexOf(',') > -1) mime = mime.split(',', 2)[0]
|
198
|
+
xhr.overrideMimeType && xhr.overrideMimeType(mime)
|
199
|
+
}
|
200
|
+
if (settings.contentType || (settings.contentType !== false && settings.data && settings.type.toUpperCase() != 'GET'))
|
201
|
+
baseHeaders['Content-Type'] = (settings.contentType || 'application/x-www-form-urlencoded')
|
202
|
+
settings.headers = $.extend(baseHeaders, settings.headers || {})
|
203
|
+
|
204
|
+
xhr.onreadystatechange = function(){
|
205
|
+
if (xhr.readyState == 4) {
|
206
|
+
xhr.onreadystatechange = empty;
|
207
|
+
clearTimeout(abortTimeout)
|
208
|
+
var result, error = false
|
209
|
+
if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304 || (xhr.status == 0 && protocol == 'file:')) {
|
210
|
+
dataType = dataType || mimeToDataType(xhr.getResponseHeader('content-type'))
|
211
|
+
result = xhr.responseText
|
212
|
+
|
213
|
+
try {
|
214
|
+
// http://perfectionkills.com/global-eval-what-are-the-options/
|
215
|
+
if (dataType == 'script') (1,eval)(result)
|
216
|
+
else if (dataType == 'xml') result = xhr.responseXML
|
217
|
+
else if (dataType == 'json') result = blankRE.test(result) ? null : $.parseJSON(result)
|
218
|
+
} catch (e) { error = e }
|
219
|
+
|
220
|
+
if (error) ajaxError(error, 'parsererror', xhr, settings)
|
221
|
+
else ajaxSuccess(result, xhr, settings)
|
222
|
+
} else {
|
223
|
+
ajaxError(null, xhr.status ? 'error' : 'abort', xhr, settings)
|
224
|
+
}
|
225
|
+
}
|
226
|
+
}
|
227
|
+
|
228
|
+
var async = 'async' in settings ? settings.async : true
|
229
|
+
xhr.open(settings.type, settings.url, async)
|
230
|
+
|
231
|
+
for (name in settings.headers) xhr.setRequestHeader(name, settings.headers[name])
|
232
|
+
|
233
|
+
if (ajaxBeforeSend(xhr, settings) === false) {
|
234
|
+
xhr.abort()
|
235
|
+
return false
|
236
|
+
}
|
237
|
+
|
238
|
+
if (settings.timeout > 0) abortTimeout = setTimeout(function(){
|
239
|
+
xhr.onreadystatechange = empty
|
240
|
+
xhr.abort()
|
241
|
+
ajaxError(null, 'timeout', xhr, settings)
|
242
|
+
}, settings.timeout)
|
243
|
+
|
244
|
+
// avoid sending empty string (#319)
|
245
|
+
xhr.send(settings.data ? settings.data : null)
|
246
|
+
return xhr
|
247
|
+
}
|
248
|
+
|
249
|
+
// handle optional data/success arguments
|
250
|
+
function parseArguments(url, data, success, dataType) {
|
251
|
+
var hasData = !$.isFunction(data)
|
252
|
+
return {
|
253
|
+
url: url,
|
254
|
+
data: hasData ? data : undefined,
|
255
|
+
success: !hasData ? data : $.isFunction(success) ? success : undefined,
|
256
|
+
dataType: hasData ? dataType || success : success
|
257
|
+
}
|
258
|
+
}
|
259
|
+
|
260
|
+
$.get = function(url, data, success, dataType){
|
261
|
+
return $.ajax(parseArguments.apply(null, arguments))
|
262
|
+
}
|
263
|
+
|
264
|
+
$.post = function(url, data, success, dataType){
|
265
|
+
var options = parseArguments.apply(null, arguments)
|
266
|
+
options.type = 'POST'
|
267
|
+
return $.ajax(options)
|
268
|
+
}
|
269
|
+
|
270
|
+
$.getJSON = function(url, data, success){
|
271
|
+
var options = parseArguments.apply(null, arguments)
|
272
|
+
options.dataType = 'json'
|
273
|
+
return $.ajax(options)
|
274
|
+
}
|
275
|
+
|
276
|
+
$.fn.load = function(url, data, success){
|
277
|
+
if (!this.length) return this
|
278
|
+
var self = this, parts = url.split(/\s/), selector,
|
279
|
+
options = parseArguments(url, data, success),
|
280
|
+
callback = options.success
|
281
|
+
if (parts.length > 1) options.url = parts[0], selector = parts[1]
|
282
|
+
options.success = function(response){
|
283
|
+
self.html(selector ?
|
284
|
+
$('<div>').html(response.replace(rscript, "")).find(selector)
|
285
|
+
: response)
|
286
|
+
callback && callback.apply(self, arguments)
|
287
|
+
}
|
288
|
+
$.ajax(options)
|
289
|
+
return this
|
290
|
+
}
|
291
|
+
|
292
|
+
var escape = encodeURIComponent
|
293
|
+
|
294
|
+
function serialize(params, obj, traditional, scope){
|
295
|
+
var type, array = $.isArray(obj)
|
296
|
+
$.each(obj, function(key, value) {
|
297
|
+
type = $.type(value)
|
298
|
+
if (scope) key = traditional ? scope : scope + '[' + (array ? '' : key) + ']'
|
299
|
+
// handle data in serializeArray() format
|
300
|
+
if (!scope && array) params.add(value.name, value.value)
|
301
|
+
// recurse into nested objects
|
302
|
+
else if (type == "array" || (!traditional && type == "object"))
|
303
|
+
serialize(params, value, traditional, key)
|
304
|
+
else params.add(key, value)
|
305
|
+
})
|
306
|
+
}
|
307
|
+
|
308
|
+
$.param = function(obj, traditional){
|
309
|
+
var params = []
|
310
|
+
params.add = function(k, v){ this.push(escape(k) + '=' + escape(v)) }
|
311
|
+
serialize(params, obj, traditional)
|
312
|
+
return params.join('&').replace(/%20/g, '+')
|
313
|
+
}
|
314
|
+
})(Zepto)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
// Zepto.js
|
2
|
+
// (c) 2010-2012 Thomas Fuchs
|
3
|
+
// Zepto.js may be freely distributed under the MIT license.
|
4
|
+
|
5
|
+
;(function($){
|
6
|
+
var cache = [], timeout
|
7
|
+
|
8
|
+
$.fn.remove = function(){
|
9
|
+
return this.each(function(){
|
10
|
+
if(this.parentNode){
|
11
|
+
if(this.tagName === 'IMG'){
|
12
|
+
cache.push(this)
|
13
|
+
this.src = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='
|
14
|
+
if (timeout) clearTimeout(timeout)
|
15
|
+
timeout = setTimeout(function(){ cache = [] }, 60000)
|
16
|
+
}
|
17
|
+
this.parentNode.removeChild(this)
|
18
|
+
}
|
19
|
+
})
|
20
|
+
}
|
21
|
+
})(Zepto)
|
@@ -0,0 +1,67 @@
|
|
1
|
+
// Zepto.js
|
2
|
+
// (c) 2010-2012 Thomas Fuchs
|
3
|
+
// Zepto.js may be freely distributed under the MIT license.
|
4
|
+
|
5
|
+
// The following code is heavily inspired by jQuery's $.fn.data()
|
6
|
+
|
7
|
+
;(function($) {
|
8
|
+
var data = {}, dataAttr = $.fn.data, camelize = $.camelCase,
|
9
|
+
exp = $.expando = 'Zepto' + (+new Date())
|
10
|
+
|
11
|
+
// Get value from node:
|
12
|
+
// 1. first try key as given,
|
13
|
+
// 2. then try camelized key,
|
14
|
+
// 3. fall back to reading "data-*" attribute.
|
15
|
+
function getData(node, name) {
|
16
|
+
var id = node[exp], store = id && data[id]
|
17
|
+
if (name === undefined) return store || setData(node)
|
18
|
+
else {
|
19
|
+
if (store) {
|
20
|
+
if (name in store) return store[name]
|
21
|
+
var camelName = camelize(name)
|
22
|
+
if (camelName in store) return store[camelName]
|
23
|
+
}
|
24
|
+
return dataAttr.call($(node), name)
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
// Store value under camelized key on node
|
29
|
+
function setData(node, name, value) {
|
30
|
+
var id = node[exp] || (node[exp] = ++$.uuid),
|
31
|
+
store = data[id] || (data[id] = attributeData(node))
|
32
|
+
if (name !== undefined) store[camelize(name)] = value
|
33
|
+
return store
|
34
|
+
}
|
35
|
+
|
36
|
+
// Read all "data-*" attributes from a node
|
37
|
+
function attributeData(node) {
|
38
|
+
var store = {}
|
39
|
+
$.each(node.attributes, function(i, attr){
|
40
|
+
if (attr.name.indexOf('data-') == 0)
|
41
|
+
store[camelize(attr.name.replace('data-', ''))] =
|
42
|
+
$.zepto.deserializeValue(attr.value)
|
43
|
+
})
|
44
|
+
return store
|
45
|
+
}
|
46
|
+
|
47
|
+
$.fn.data = function(name, value) {
|
48
|
+
return value === undefined ?
|
49
|
+
// set multiple values via object
|
50
|
+
$.isPlainObject(name) ?
|
51
|
+
this.each(function(i, node){
|
52
|
+
$.each(name, function(key, value){ setData(node, key, value) })
|
53
|
+
}) :
|
54
|
+
// get value from first element
|
55
|
+
this.length == 0 ? undefined : getData(this[0], name) :
|
56
|
+
// set value on all elements
|
57
|
+
this.each(function(){ setData(this, name, value) })
|
58
|
+
}
|
59
|
+
|
60
|
+
$.fn.removeData = function(names) {
|
61
|
+
if (typeof names == 'string') names = names.split(/\s+/)
|
62
|
+
return this.each(function(){
|
63
|
+
var id = this[exp], store = id && data[id]
|
64
|
+
if (store) $.each(names, function(){ delete store[camelize(this)] })
|
65
|
+
})
|
66
|
+
}
|
67
|
+
})(Zepto)
|
@@ -0,0 +1,55 @@
|
|
1
|
+
// Zepto.js
|
2
|
+
// (c) 2010-2012 Thomas Fuchs
|
3
|
+
// Zepto.js may be freely distributed under the MIT license.
|
4
|
+
|
5
|
+
;(function($){
|
6
|
+
function detect(ua){
|
7
|
+
var os = this.os = {}, browser = this.browser = {},
|
8
|
+
webkit = ua.match(/WebKit\/([\d.]+)/),
|
9
|
+
android = ua.match(/(Android)\s+([\d.]+)/),
|
10
|
+
ipad = ua.match(/(iPad).*OS\s([\d_]+)/),
|
11
|
+
iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/),
|
12
|
+
webos = ua.match(/(webOS|hpwOS)[\s\/]([\d.]+)/),
|
13
|
+
touchpad = webos && ua.match(/TouchPad/),
|
14
|
+
kindle = ua.match(/Kindle\/([\d.]+)/),
|
15
|
+
silk = ua.match(/Silk\/([\d._]+)/),
|
16
|
+
blackberry = ua.match(/(BlackBerry).*Version\/([\d.]+)/),
|
17
|
+
bb10 = ua.match(/(BB10).*Version\/([\d.]+)/),
|
18
|
+
rimtabletos = ua.match(/(RIM\sTablet\sOS)\s([\d.]+)/),
|
19
|
+
playbook = ua.match(/PlayBook/),
|
20
|
+
chrome = ua.match(/Chrome\/([\d.]+)/) || ua.match(/CriOS\/([\d.]+)/),
|
21
|
+
firefox = ua.match(/Firefox\/([\d.]+)/)
|
22
|
+
|
23
|
+
// Todo: clean this up with a better OS/browser seperation:
|
24
|
+
// - discern (more) between multiple browsers on android
|
25
|
+
// - decide if kindle fire in silk mode is android or not
|
26
|
+
// - Firefox on Android doesn't specify the Android version
|
27
|
+
// - possibly devide in os, device and browser hashes
|
28
|
+
|
29
|
+
if (browser.webkit = !!webkit) browser.version = webkit[1]
|
30
|
+
|
31
|
+
if (android) os.android = true, os.version = android[2]
|
32
|
+
if (iphone) os.ios = os.iphone = true, os.version = iphone[2].replace(/_/g, '.')
|
33
|
+
if (ipad) os.ios = os.ipad = true, os.version = ipad[2].replace(/_/g, '.')
|
34
|
+
if (webos) os.webos = true, os.version = webos[2]
|
35
|
+
if (touchpad) os.touchpad = true
|
36
|
+
if (blackberry) os.blackberry = true, os.version = blackberry[2]
|
37
|
+
if (bb10) os.bb10 = true, os.version = bb10[2]
|
38
|
+
if (rimtabletos) os.rimtabletos = true, os.version = rimtabletos[2]
|
39
|
+
if (playbook) browser.playbook = true
|
40
|
+
if (kindle) os.kindle = true, os.version = kindle[1]
|
41
|
+
if (silk) browser.silk = true, browser.version = silk[1]
|
42
|
+
if (!silk && os.android && ua.match(/Kindle Fire/)) browser.silk = true
|
43
|
+
if (chrome) browser.chrome = true, browser.version = chrome[1]
|
44
|
+
if (firefox) browser.firefox = true, browser.version = firefox[1]
|
45
|
+
|
46
|
+
os.tablet = !!(ipad || playbook || (android && !ua.match(/Mobile/)) || (firefox && ua.match(/Tablet/)))
|
47
|
+
os.phone = !!(!os.tablet && (android || iphone || webos || blackberry || bb10 ||
|
48
|
+
(chrome && ua.match(/Android/)) || (chrome && ua.match(/CriOS\/([\d.]+)/)) || (firefox && ua.match(/Mobile/))))
|
49
|
+
}
|
50
|
+
|
51
|
+
detect.call($, navigator.userAgent)
|
52
|
+
// make available to unit tests
|
53
|
+
$.__detect = detect
|
54
|
+
|
55
|
+
})(Zepto)
|