zepto-for-rails 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -4
- data/README.md +3 -6
- data/Rakefile +1 -1
- data/lib/zepto/rails/engine.rb +1 -1
- data/lib/zepto/rails/version.rb +1 -1
- data/lib/zepto/rails.rb +1 -1
- data/vendor/assets/javascripts/zepto.js +41 -37
- data/zepto-for-rails.gemspec +10 -10
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e75d4cd33cf8e2adb3da52ff54b075f43c301f80
|
4
|
+
data.tar.gz: 8172bd92adfc7d88566c577335bd8f41473a54a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac5006327ce3c965f879bc7819af64039e899ab53b7ef7f9ad4a6cf305fba534e2328928b52f9a1b6cb1dfdfa17b26c884391453f65923aeac4da7769b127ef4
|
7
|
+
data.tar.gz: 6bd564b6daa0d52b0a9fa4330b9a111a5c45177857ce4ca929923a68657a4eb23401aa60b2a1132c2f78eb458f771bfaaa78aaeb168f741f43456e5ab6b0cf6d
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source
|
1
|
+
source 'http://rubygems.org'
|
2
2
|
|
3
3
|
# Declare your gem's dependencies in zepto-rails.gemspec.
|
4
4
|
# Bundler will treat runtime dependencies like base dependencies, and
|
@@ -9,6 +9,3 @@ gemspec
|
|
9
9
|
# your gemspec. These might include edge Rails or gems from your path or
|
10
10
|
# Git. Remember to move these dependencies to your gemspec before releasing
|
11
11
|
# your gem to rubygems.org.
|
12
|
-
|
13
|
-
# To use debugger
|
14
|
-
# gem 'ruby-debug19', :require => 'ruby-debug'
|
data/README.md
CHANGED
@@ -1,8 +1,5 @@
|
|
1
|
-
# zepto-rails [![Gem Version](https://badge.fury.io/rb/zepto-for-rails.png)](http://badge.fury.io/rb/zepto-for-rails)
|
2
|
-
Zepto for the Rails asset pipeline. This gem provides Zepto 1.1.
|
3
|
-
|
4
|
-
|
5
|
-
All credits for [https://github.com/packetman](packetman) for creating this gem in the first place.
|
1
|
+
# zepto-for-rails [![Gem Version](https://badge.fury.io/rb/zepto-for-rails.png)](http://badge.fury.io/rb/zepto-for-rails)
|
2
|
+
Zepto for the Rails asset pipeline. This gem provides Zepto 1.1.5
|
6
3
|
|
7
4
|
## Installation
|
8
5
|
Add zepto-for-rails to the Gemfile.
|
@@ -11,7 +8,7 @@ Add zepto-for-rails to the Gemfile.
|
|
11
8
|
gem 'zepto-for-rails'
|
12
9
|
```
|
13
10
|
|
14
|
-
And run `bundle install`. Then add this
|
11
|
+
And run `bundle install`. Then add this line to your `app/assets/javascripts/application.js`:
|
15
12
|
|
16
13
|
```
|
17
14
|
//= require zepto
|
data/Rakefile
CHANGED
data/lib/zepto/rails/engine.rb
CHANGED
data/lib/zepto/rails/version.rb
CHANGED
data/lib/zepto/rails.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
require 'zepto/rails/engine'
|
2
|
-
require 'zepto/rails/version'
|
2
|
+
require 'zepto/rails/version'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/* Zepto v1.1.
|
1
|
+
/* Zepto v1.1.5 - zepto event ajax form ie - zeptojs.com/license */
|
2
2
|
|
3
3
|
var Zepto = (function() {
|
4
4
|
var undefined, key, $, classList, emptyArray = [], slice = emptyArray.slice, filter = emptyArray.filter,
|
@@ -286,7 +286,7 @@ var Zepto = (function() {
|
|
286
286
|
|
287
287
|
// access className property while respecting SVGAnimatedString
|
288
288
|
function className(node, value){
|
289
|
-
var klass = node.className,
|
289
|
+
var klass = node.className || '',
|
290
290
|
svg = klass && klass.baseVal !== undefined
|
291
291
|
|
292
292
|
if (value === undefined) return svg ? klass.baseVal : klass
|
@@ -308,7 +308,7 @@ var Zepto = (function() {
|
|
308
308
|
value == "true" ||
|
309
309
|
( value == "false" ? false :
|
310
310
|
value == "null" ? null :
|
311
|
-
|
311
|
+
+value + "" == value ? +value :
|
312
312
|
/^[\[\{]/.test(value) ? $.parseJSON(value) :
|
313
313
|
value )
|
314
314
|
: value
|
@@ -476,7 +476,7 @@ var Zepto = (function() {
|
|
476
476
|
},
|
477
477
|
find: function(selector){
|
478
478
|
var result, $this = this
|
479
|
-
if (!selector) result =
|
479
|
+
if (!selector) result = $()
|
480
480
|
else if (typeof selector == 'object')
|
481
481
|
result = $(selector).filter(function(){
|
482
482
|
var node = this
|
@@ -617,7 +617,9 @@ var Zepto = (function() {
|
|
617
617
|
})
|
618
618
|
},
|
619
619
|
removeAttr: function(name){
|
620
|
-
return this.each(function(){ this.nodeType === 1 &&
|
620
|
+
return this.each(function(){ this.nodeType === 1 && name.split(' ').forEach(function(attribute){
|
621
|
+
setAttribute(this, attribute)
|
622
|
+
}, this)})
|
621
623
|
},
|
622
624
|
prop: function(name, value){
|
623
625
|
name = propMap[name] || name
|
@@ -670,13 +672,14 @@ var Zepto = (function() {
|
|
670
672
|
},
|
671
673
|
css: function(property, value){
|
672
674
|
if (arguments.length < 2) {
|
673
|
-
var element = this[0]
|
675
|
+
var computedStyle, element = this[0]
|
674
676
|
if(!element) return
|
677
|
+
computedStyle = getComputedStyle(element, '')
|
675
678
|
if (typeof property == 'string')
|
676
679
|
return element.style[camelize(property)] || computedStyle.getPropertyValue(property)
|
677
680
|
else if (isArray(property)) {
|
678
681
|
var props = {}
|
679
|
-
$.each(
|
682
|
+
$.each(property, function(_, prop){
|
680
683
|
props[prop] = (element.style[camelize(prop)] || computedStyle.getPropertyValue(prop))
|
681
684
|
})
|
682
685
|
return props
|
@@ -711,6 +714,7 @@ var Zepto = (function() {
|
|
711
714
|
addClass: function(name){
|
712
715
|
if (!name) return this
|
713
716
|
return this.each(function(idx){
|
717
|
+
if (!('className' in this)) return
|
714
718
|
classList = []
|
715
719
|
var cls = className(this), newName = funcArg(this, name, idx, cls)
|
716
720
|
newName.split(/\s+/g).forEach(function(klass){
|
@@ -721,6 +725,7 @@ var Zepto = (function() {
|
|
721
725
|
},
|
722
726
|
removeClass: function(name){
|
723
727
|
return this.each(function(idx){
|
728
|
+
if (!('className' in this)) return
|
724
729
|
if (name === undefined) return className(this, '')
|
725
730
|
classList = className(this)
|
726
731
|
funcArg(this, name, idx, classList).split(/\s+/g).forEach(function(klass){
|
@@ -1105,8 +1110,10 @@ window.$ === undefined && (window.$ = Zepto)
|
|
1105
1110
|
event = (isString(event) || $.isPlainObject(event)) ? $.Event(event) : compatible(event)
|
1106
1111
|
event._args = args
|
1107
1112
|
return this.each(function(){
|
1113
|
+
// handle focus(), blur() by calling them directly
|
1114
|
+
if (event.type in focus && typeof this[event.type] == "function") this[event.type]()
|
1108
1115
|
// items in the collection might not be DOM elements
|
1109
|
-
if('dispatchEvent' in this) this.dispatchEvent(event)
|
1116
|
+
else if ('dispatchEvent' in this) this.dispatchEvent(event)
|
1110
1117
|
else $(this).triggerHandler(event, args)
|
1111
1118
|
})
|
1112
1119
|
}
|
@@ -1128,27 +1135,16 @@ window.$ === undefined && (window.$ = Zepto)
|
|
1128
1135
|
}
|
1129
1136
|
|
1130
1137
|
// shortcut methods for `.bind(event, fn)` for each event type
|
1131
|
-
;('focusin focusout load resize scroll unload click dblclick '+
|
1138
|
+
;('focusin focusout focus blur load resize scroll unload click dblclick '+
|
1132
1139
|
'mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave '+
|
1133
1140
|
'change select keydown keypress keyup error').split(' ').forEach(function(event) {
|
1134
1141
|
$.fn[event] = function(callback) {
|
1135
|
-
return
|
1142
|
+
return (0 in arguments) ?
|
1136
1143
|
this.bind(event, callback) :
|
1137
1144
|
this.trigger(event)
|
1138
1145
|
}
|
1139
1146
|
})
|
1140
1147
|
|
1141
|
-
;['focus', 'blur'].forEach(function(name) {
|
1142
|
-
$.fn[name] = function(callback) {
|
1143
|
-
if (callback) this.bind(name, callback)
|
1144
|
-
else this.each(function(){
|
1145
|
-
try { this[name]() }
|
1146
|
-
catch(e) {}
|
1147
|
-
})
|
1148
|
-
return this
|
1149
|
-
}
|
1150
|
-
})
|
1151
|
-
|
1152
1148
|
$.Event = function(type, props) {
|
1153
1149
|
if (!isString(type)) props = type, type = props.type
|
1154
1150
|
var event = document.createEvent(specialEvents[type] || 'Events'), bubbles = true
|
@@ -1341,13 +1337,17 @@ window.$ === undefined && (window.$ = Zepto)
|
|
1341
1337
|
|
1342
1338
|
$.ajax = function(options){
|
1343
1339
|
var settings = $.extend({}, options || {}),
|
1344
|
-
deferred = $.Deferred && $.Deferred()
|
1340
|
+
deferred = $.Deferred && $.Deferred(),
|
1341
|
+
urlAnchor
|
1345
1342
|
for (key in $.ajaxSettings) if (settings[key] === undefined) settings[key] = $.ajaxSettings[key]
|
1346
1343
|
|
1347
1344
|
ajaxStart(settings)
|
1348
1345
|
|
1349
|
-
if (!settings.crossDomain)
|
1350
|
-
|
1346
|
+
if (!settings.crossDomain) {
|
1347
|
+
urlAnchor = document.createElement('a')
|
1348
|
+
urlAnchor.href = settings.url
|
1349
|
+
settings.crossDomain = (window.location.protocol + '//' + window.location.host) !== (urlAnchor.protocol + '//' + urlAnchor.host)
|
1350
|
+
}
|
1351
1351
|
|
1352
1352
|
if (!settings.url) settings.url = window.location.toString()
|
1353
1353
|
serializeData(settings)
|
@@ -1501,7 +1501,11 @@ window.$ === undefined && (window.$ = Zepto)
|
|
1501
1501
|
|
1502
1502
|
$.param = function(obj, traditional){
|
1503
1503
|
var params = []
|
1504
|
-
params.add = function(
|
1504
|
+
params.add = function(key, value) {
|
1505
|
+
if ($.isFunction(value)) value = value()
|
1506
|
+
if (value == null) value = ""
|
1507
|
+
this.push(escape(key) + '=' + escape(value))
|
1508
|
+
}
|
1505
1509
|
serialize(params, obj, traditional)
|
1506
1510
|
return params.join('&').replace(/%20/g, '+')
|
1507
1511
|
}
|
@@ -1509,17 +1513,17 @@ window.$ === undefined && (window.$ = Zepto)
|
|
1509
1513
|
|
1510
1514
|
;(function($){
|
1511
1515
|
$.fn.serializeArray = function() {
|
1512
|
-
var result = [],
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1516
|
+
var el, name, type, result = [],
|
1517
|
+
add = function(value) {
|
1518
|
+
if (value.forEach) return value.forEach(add)
|
1519
|
+
result.push({ name: name, value: value })
|
1520
|
+
}
|
1521
|
+
if (this[0]) $.each(this[0].elements, function(_, field){
|
1522
|
+
type = field.type, name = field.name
|
1523
|
+
if (name && field.nodeName.toLowerCase() != 'fieldset' &&
|
1524
|
+
!field.disabled && type != 'submit' && type != 'reset' && type != 'button' && type != 'file' &&
|
1525
|
+
((type != 'radio' && type != 'checkbox') || field.checked))
|
1526
|
+
add($(field).val())
|
1523
1527
|
})
|
1524
1528
|
return result
|
1525
1529
|
}
|
@@ -1533,7 +1537,7 @@ window.$ === undefined && (window.$ = Zepto)
|
|
1533
1537
|
}
|
1534
1538
|
|
1535
1539
|
$.fn.submit = function(callback) {
|
1536
|
-
if (
|
1540
|
+
if (0 in arguments) this.bind('submit', callback)
|
1537
1541
|
else if (this.length) {
|
1538
1542
|
var event = $.Event('submit')
|
1539
1543
|
this.eq(0).trigger(event)
|
data/zepto-for-rails.gemspec
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
$:.push File.expand_path(
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
2
2
|
|
3
|
-
# Maintain your gem
|
4
|
-
require
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require 'zepto/rails/version'
|
5
5
|
|
6
6
|
# Describe your gem and declare its dependencies:
|
7
7
|
Gem::Specification.new do |s|
|
8
|
-
s.name =
|
8
|
+
s.name = 'zepto-for-rails'
|
9
9
|
s.version = Zepto::Rails::VERSION
|
10
|
-
s.authors = [
|
11
|
-
s.email = [
|
12
|
-
s.homepage =
|
13
|
-
s.summary =
|
14
|
-
s.description =
|
10
|
+
s.authors = ['Stefan Vermaas']
|
11
|
+
s.email = ['stefanvermaas1991@gmail.com']
|
12
|
+
s.homepage = 'https://github.com/stefanvermaas/zepto-for-rails'
|
13
|
+
s.summary = 'Zepto.js for the rails asset pipeline'
|
14
|
+
s.description = 'Provides a the zepto.js for the rails asset pipeline'
|
15
15
|
s.licenses = ['MIT']
|
16
16
|
|
17
17
|
s.add_runtime_dependency 'rails', '~> 3.1'
|
18
18
|
|
19
19
|
s.files = `git ls-files`.split("\n")
|
20
20
|
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
21
|
-
s.require_path =
|
21
|
+
s.require_path = 'lib'
|
22
22
|
end
|
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.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Vermaas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
version: '3.1'
|
27
27
|
description: Provides a the zepto.js for the rails asset pipeline
|
28
28
|
email:
|
29
|
-
-
|
29
|
+
- stefanvermaas1991@gmail.com
|
30
30
|
executables: []
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
@@ -42,7 +42,7 @@ files:
|
|
42
42
|
- lib/zepto/rails/version.rb
|
43
43
|
- vendor/assets/javascripts/zepto.js
|
44
44
|
- zepto-for-rails.gemspec
|
45
|
-
homepage: https://github.com/stefanvermaas/zepto-rails
|
45
|
+
homepage: https://github.com/stefanvermaas/zepto-for-rails
|
46
46
|
licenses:
|
47
47
|
- MIT
|
48
48
|
metadata: {}
|