zepto-for-rails 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/zepto/for/rails/version.rb +1 -1
- data/vendor/assets/javascripts/zepto.js +95 -39
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9de766fb3ce9711a7b045646bd4ba296c549228
|
4
|
+
data.tar.gz: 568eaca2d72611a3009d58e3642d0893083134ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cb2d8e46ef6ddf88b0bf3cba4834f41748df3d8080121576e11a65539874e6045aee7543fd2a1b38059968ed38121d0c689f67fb77b9286b649da7e79ce4d5c
|
7
|
+
data.tar.gz: f95c13f34df273184e2b2903b4845c5ed1e4bc300a8904d40797f108627b6af96f3a2a231d0f82451995cede07e7b3a47097c3883f26707d94b4be7208b00a7f
|
@@ -1,6 +1,11 @@
|
|
1
|
-
/* Zepto
|
2
|
-
|
3
|
-
|
1
|
+
/* Zepto v1.2.0 - zepto event ajax form ie - zeptojs.com/license */
|
2
|
+
(function(global, factory) {
|
3
|
+
if (typeof define === 'function' && define.amd)
|
4
|
+
define(function() { return factory(global) })
|
5
|
+
else
|
6
|
+
factory(global)
|
7
|
+
}(this, function(window) {
|
8
|
+
var Zepto = (function() {
|
4
9
|
var undefined, key, $, classList, emptyArray = [], concat = emptyArray.concat, filter = emptyArray.filter, slice = emptyArray.slice,
|
5
10
|
document = window.document,
|
6
11
|
elementDisplay = {}, classCache = {},
|
@@ -49,8 +54,9 @@ var Zepto = (function() {
|
|
49
54
|
|
50
55
|
zepto.matches = function(element, selector) {
|
51
56
|
if (!selector || !element || element.nodeType !== 1) return false
|
52
|
-
var matchesSelector = element.
|
53
|
-
element.
|
57
|
+
var matchesSelector = element.matches || element.webkitMatchesSelector ||
|
58
|
+
element.mozMatchesSelector || element.oMatchesSelector ||
|
59
|
+
element.matchesSelector
|
54
60
|
if (matchesSelector) return matchesSelector.call(element, selector)
|
55
61
|
// fall back to performing a selector:
|
56
62
|
var match, parent = element.parentNode, temp = !parent
|
@@ -72,7 +78,16 @@ var Zepto = (function() {
|
|
72
78
|
function isPlainObject(obj) {
|
73
79
|
return isObject(obj) && !isWindow(obj) && Object.getPrototypeOf(obj) == Object.prototype
|
74
80
|
}
|
75
|
-
|
81
|
+
|
82
|
+
function likeArray(obj) {
|
83
|
+
var length = !!obj && 'length' in obj && obj.length,
|
84
|
+
type = $.type(obj)
|
85
|
+
|
86
|
+
return 'function' != type && !isWindow(obj) && (
|
87
|
+
'array' == type || length === 0 ||
|
88
|
+
(typeof length == 'number' && length > 0 && (length - 1) in obj)
|
89
|
+
)
|
90
|
+
}
|
76
91
|
|
77
92
|
function compact(array) { return filter.call(array, function(item){ return item != null }) }
|
78
93
|
function flatten(array) { return array.length > 0 ? $.fn.concat.apply([], array) : array }
|
@@ -331,6 +346,13 @@ var Zepto = (function() {
|
|
331
346
|
return true
|
332
347
|
}
|
333
348
|
|
349
|
+
$.isNumeric = function(val) {
|
350
|
+
var num = Number(val), type = typeof val
|
351
|
+
return val != null && type != 'boolean' &&
|
352
|
+
(type != 'string' || val.length) &&
|
353
|
+
!isNaN(num) && isFinite(num) || false
|
354
|
+
}
|
355
|
+
|
334
356
|
$.inArray = function(elem, array, i){
|
335
357
|
return emptyArray.indexOf.call(array, elem, i)
|
336
358
|
}
|
@@ -503,11 +525,13 @@ var Zepto = (function() {
|
|
503
525
|
return result
|
504
526
|
},
|
505
527
|
closest: function(selector, context){
|
506
|
-
var
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
528
|
+
var nodes = [], collection = typeof selector == 'object' && $(selector)
|
529
|
+
this.each(function(_, node){
|
530
|
+
while (node && !(collection ? collection.indexOf(node) >= 0 : zepto.matches(node, selector)))
|
531
|
+
node = node !== context && !isDocument(node) && node.parentNode
|
532
|
+
if (node && nodes.indexOf(node) < 0) nodes.push(node)
|
533
|
+
})
|
534
|
+
return $(nodes)
|
511
535
|
},
|
512
536
|
parents: function(selector){
|
513
537
|
var ancestors = [], nodes = this
|
@@ -621,9 +645,7 @@ var Zepto = (function() {
|
|
621
645
|
attr: function(name, value){
|
622
646
|
var result
|
623
647
|
return (typeof name == 'string' && !(1 in arguments)) ?
|
624
|
-
(
|
625
|
-
(!(result = this[0].getAttribute(name)) && name in this[0]) ? this[0][name] : result
|
626
|
-
) :
|
648
|
+
(0 in this && this[0].nodeType == 1 && (result = this[0].getAttribute(name)) != null ? result : undefined) :
|
627
649
|
this.each(function(idx){
|
628
650
|
if (this.nodeType !== 1) return
|
629
651
|
if (isObject(name)) for (key in name) setAttribute(this, key, name[key])
|
@@ -643,6 +665,10 @@ var Zepto = (function() {
|
|
643
665
|
}) :
|
644
666
|
(this[0] && this[0][name])
|
645
667
|
},
|
668
|
+
removeProp: function(name){
|
669
|
+
name = propMap[name] || name
|
670
|
+
return this.each(function(){ delete this[name] })
|
671
|
+
},
|
646
672
|
data: function(name, value){
|
647
673
|
var attrName = 'data-' + name.replace(capitalRE, '-$1').toLowerCase()
|
648
674
|
|
@@ -653,14 +679,16 @@ var Zepto = (function() {
|
|
653
679
|
return data !== null ? deserializeValue(data) : undefined
|
654
680
|
},
|
655
681
|
val: function(value){
|
656
|
-
|
657
|
-
|
682
|
+
if (0 in arguments) {
|
683
|
+
if (value == null) value = ""
|
684
|
+
return this.each(function(idx){
|
658
685
|
this.value = funcArg(this, value, idx, this.value)
|
659
|
-
})
|
660
|
-
|
686
|
+
})
|
687
|
+
} else {
|
688
|
+
return this[0] && (this[0].multiple ?
|
661
689
|
$(this[0]).find('option').filter(function(){ return this.selected }).pluck('value') :
|
662
690
|
this[0].value)
|
663
|
-
|
691
|
+
}
|
664
692
|
},
|
665
693
|
offset: function(coordinates){
|
666
694
|
if (coordinates) return this.each(function(index){
|
@@ -676,7 +704,7 @@ var Zepto = (function() {
|
|
676
704
|
$this.css(props)
|
677
705
|
})
|
678
706
|
if (!this.length) return null
|
679
|
-
if (!$.contains(document.documentElement, this[0]))
|
707
|
+
if (document.documentElement !== this[0] && !$.contains(document.documentElement, this[0]))
|
680
708
|
return {top: 0, left: 0}
|
681
709
|
var obj = this[0].getBoundingClientRect()
|
682
710
|
return {
|
@@ -688,13 +716,14 @@ var Zepto = (function() {
|
|
688
716
|
},
|
689
717
|
css: function(property, value){
|
690
718
|
if (arguments.length < 2) {
|
691
|
-
var
|
692
|
-
if(
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
719
|
+
var element = this[0]
|
720
|
+
if (typeof property == 'string') {
|
721
|
+
if (!element) return
|
722
|
+
return element.style[camelize(property)] || getComputedStyle(element, '').getPropertyValue(property)
|
723
|
+
} else if (isArray(property)) {
|
724
|
+
if (!element) return
|
697
725
|
var props = {}
|
726
|
+
var computedStyle = getComputedStyle(element, '')
|
698
727
|
$.each(property, function(_, prop){
|
699
728
|
props[prop] = (element.style[camelize(prop)] || computedStyle.getPropertyValue(prop))
|
700
729
|
})
|
@@ -846,8 +875,17 @@ var Zepto = (function() {
|
|
846
875
|
$.fn[operator] = function(){
|
847
876
|
// arguments can be nodes, arrays of nodes, Zepto objects and HTML strings
|
848
877
|
var argType, nodes = $.map(arguments, function(arg) {
|
878
|
+
var arr = []
|
849
879
|
argType = type(arg)
|
850
|
-
|
880
|
+
if (argType == "array") {
|
881
|
+
arg.forEach(function(el) {
|
882
|
+
if (el.nodeType !== undefined) return arr.push(el)
|
883
|
+
else if ($.zepto.isZ(el)) return arr = arr.concat(el.get())
|
884
|
+
arr = arr.concat(zepto.fragment(el))
|
885
|
+
})
|
886
|
+
return arr
|
887
|
+
}
|
888
|
+
return argType == "object" || arg == null ?
|
851
889
|
arg : zepto.fragment(arg)
|
852
890
|
}),
|
853
891
|
parent, copyByClone = this.length > 1
|
@@ -871,8 +909,10 @@ var Zepto = (function() {
|
|
871
909
|
parent.insertBefore(node, target)
|
872
910
|
if (parentInDocument) traverseNode(node, function(el){
|
873
911
|
if (el.nodeName != null && el.nodeName.toUpperCase() === 'SCRIPT' &&
|
874
|
-
(!el.type || el.type === 'text/javascript') && !el.src)
|
875
|
-
|
912
|
+
(!el.type || el.type === 'text/javascript') && !el.src){
|
913
|
+
var target = el.ownerDocument ? el.ownerDocument.defaultView : window
|
914
|
+
target['eval'].call(target, el.innerHTML)
|
915
|
+
}
|
876
916
|
})
|
877
917
|
})
|
878
918
|
})
|
@@ -1018,7 +1058,7 @@ window.$ === undefined && (window.$ = Zepto)
|
|
1018
1058
|
|
1019
1059
|
var returnTrue = function(){return true},
|
1020
1060
|
returnFalse = function(){return false},
|
1021
|
-
ignoreProperties = /^([A-Z]|returnValue$|layer[XY]$)/,
|
1061
|
+
ignoreProperties = /^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/,
|
1022
1062
|
eventMethods = {
|
1023
1063
|
preventDefault: 'isDefaultPrevented',
|
1024
1064
|
stopImmediatePropagation: 'isImmediatePropagationStopped',
|
@@ -1038,6 +1078,8 @@ window.$ === undefined && (window.$ = Zepto)
|
|
1038
1078
|
event[predicate] = returnFalse
|
1039
1079
|
})
|
1040
1080
|
|
1081
|
+
event.timeStamp || (event.timeStamp = Date.now())
|
1082
|
+
|
1041
1083
|
if (source.defaultPrevented !== undefined ? source.defaultPrevented :
|
1042
1084
|
'returnValue' in source ? source.returnValue === false :
|
1043
1085
|
source.getPreventDefault && source.getPreventDefault())
|
@@ -1172,7 +1214,7 @@ window.$ === undefined && (window.$ = Zepto)
|
|
1172
1214
|
})(Zepto)
|
1173
1215
|
|
1174
1216
|
;(function($){
|
1175
|
-
var jsonpID =
|
1217
|
+
var jsonpID = +new Date(),
|
1176
1218
|
document = window.document,
|
1177
1219
|
key,
|
1178
1220
|
name,
|
@@ -1240,6 +1282,12 @@ window.$ === undefined && (window.$ = Zepto)
|
|
1240
1282
|
ajaxStop(settings)
|
1241
1283
|
}
|
1242
1284
|
|
1285
|
+
function ajaxDataFilter(data, type, settings) {
|
1286
|
+
if (settings.dataFilter == empty) return data
|
1287
|
+
var context = settings.context
|
1288
|
+
return settings.dataFilter.call(context, data, type)
|
1289
|
+
}
|
1290
|
+
|
1243
1291
|
// Empty function, used as default callback
|
1244
1292
|
function empty() {}
|
1245
1293
|
|
@@ -1248,7 +1296,7 @@ window.$ === undefined && (window.$ = Zepto)
|
|
1248
1296
|
|
1249
1297
|
var _callbackName = options.jsonpCallback,
|
1250
1298
|
callbackName = ($.isFunction(_callbackName) ?
|
1251
|
-
_callbackName() : _callbackName) || ('
|
1299
|
+
_callbackName() : _callbackName) || ('Zepto' + (jsonpID++)),
|
1252
1300
|
script = document.createElement('script'),
|
1253
1301
|
originalCallback = window[callbackName],
|
1254
1302
|
responseData,
|
@@ -1330,7 +1378,11 @@ window.$ === undefined && (window.$ = Zepto)
|
|
1330
1378
|
// Whether data should be serialized to string
|
1331
1379
|
processData: true,
|
1332
1380
|
// Whether the browser should be allowed to cache GET responses
|
1333
|
-
cache: true
|
1381
|
+
cache: true,
|
1382
|
+
//Used to handle the raw response data of XMLHttpRequest.
|
1383
|
+
//This is a pre-filtering function to sanitize the response.
|
1384
|
+
//The sanitized response should be returned
|
1385
|
+
dataFilter: empty
|
1334
1386
|
}
|
1335
1387
|
|
1336
1388
|
function mimeToDataType(mime) {
|
@@ -1350,7 +1402,7 @@ window.$ === undefined && (window.$ = Zepto)
|
|
1350
1402
|
function serializeData(options) {
|
1351
1403
|
if (options.processData && options.data && $.type(options.data) != "string")
|
1352
1404
|
options.data = $.param(options.data, options.traditional)
|
1353
|
-
if (options.data && (!options.type || options.type.toUpperCase() == 'GET'))
|
1405
|
+
if (options.data && (!options.type || options.type.toUpperCase() == 'GET' || 'jsonp' == options.dataType))
|
1354
1406
|
options.url = appendQuery(options.url, options.data), options.data = undefined
|
1355
1407
|
}
|
1356
1408
|
|
@@ -1427,6 +1479,8 @@ window.$ === undefined && (window.$ = Zepto)
|
|
1427
1479
|
|
1428
1480
|
try {
|
1429
1481
|
// http://perfectionkills.com/global-eval-what-are-the-options/
|
1482
|
+
// sanitize response accordingly if data filter callback provided
|
1483
|
+
result = ajaxDataFilter(result, dataType, settings)
|
1430
1484
|
if (dataType == 'script') (1,eval)(result)
|
1431
1485
|
else if (dataType == 'xml') result = xhr.responseXML
|
1432
1486
|
else if (dataType == 'json') result = blankRE.test(result) ? null : $.parseJSON(result)
|
@@ -1448,11 +1502,11 @@ window.$ === undefined && (window.$ = Zepto)
|
|
1448
1502
|
return xhr
|
1449
1503
|
}
|
1450
1504
|
|
1451
|
-
if (settings.xhrFields) for (name in settings.xhrFields) xhr[name] = settings.xhrFields[name]
|
1452
|
-
|
1453
1505
|
var async = 'async' in settings ? settings.async : true
|
1454
1506
|
xhr.open(settings.type, settings.url, async, settings.username, settings.password)
|
1455
1507
|
|
1508
|
+
if (settings.xhrFields) for (name in settings.xhrFields) xhr[name] = settings.xhrFields[name]
|
1509
|
+
|
1456
1510
|
for (name in headers) nativeSetHeader.apply(xhr, headers[name])
|
1457
1511
|
|
1458
1512
|
if (settings.timeout > 0) abortTimeout = setTimeout(function(){
|
@@ -1582,13 +1636,15 @@ window.$ === undefined && (window.$ = Zepto)
|
|
1582
1636
|
try {
|
1583
1637
|
getComputedStyle(undefined)
|
1584
1638
|
} catch(e) {
|
1585
|
-
var nativeGetComputedStyle = getComputedStyle
|
1586
|
-
window.getComputedStyle = function(element){
|
1639
|
+
var nativeGetComputedStyle = getComputedStyle
|
1640
|
+
window.getComputedStyle = function(element, pseudoElement){
|
1587
1641
|
try {
|
1588
|
-
return nativeGetComputedStyle(element)
|
1642
|
+
return nativeGetComputedStyle(element, pseudoElement)
|
1589
1643
|
} catch(e) {
|
1590
1644
|
return null
|
1591
1645
|
}
|
1592
1646
|
}
|
1593
1647
|
}
|
1594
1648
|
})()
|
1649
|
+
return Zepto
|
1650
|
+
}))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zepto-for-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Vermaas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -61,8 +61,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
61
|
version: '0'
|
62
62
|
requirements: []
|
63
63
|
rubyforge_project:
|
64
|
-
rubygems_version: 2.
|
64
|
+
rubygems_version: 2.5.1
|
65
65
|
signing_key:
|
66
66
|
specification_version: 4
|
67
67
|
summary: Zepto.js for the rails asset pipeline
|
68
68
|
test_files: []
|
69
|
+
has_rdoc:
|