jquery-turbolinks 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +1 -3
- data/README.md +3 -39
- data/lib/jquery-turbolinks/version.rb +1 -1
- data/package.json +1 -1
- data/spec/jquery.turbolinks_spec.coffee +18 -2
- data/src/jquery.turbolinks.coffee +5 -3
- data/vendor/assets/javascripts/jquery.turbolinks.js +4 -1
- data/vendor/assets/javascripts/jquery.turbolinks.min.js +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDE3OWQ1OGI0OWQ3N2UzMmIzZjZhZTQxMzAwZjYwMTQ0MDRhZjA3Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NmI2MDgxMjYxNzEzZmZlYTBhMDRmMGE5ZjA2MGQ0ZDAxM2FhOWE0NQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDlkZjA0ZDViMmFjMzkyZmVjNGZlMzNhMmI4ZjBmMjAwZWUwM2E2YzQ0YWU0
|
10
|
+
ZjMwNWE2NTk1NmQyOGM5Y2FjY2RlZjcyODc5ZTBkZDQwNmY3ZGFhYmQ2NGU4
|
11
|
+
MmYwNWQ3MmJjMzFiNDAzNDJhYTMxMDlkYzlmYzhkZWEzNmYwMjI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OGFmMmU2MGJhNTI1MDQwNDM3YzJlNjk1OTQzY2Q1MDBjYWU3NmViYzMzNjYz
|
14
|
+
NWJlY2U4MjI3ZDNmZWQxZmNiMjY0NmViM2IwNWJkYjlhNmIyZGRhNDkzYzUz
|
15
|
+
ZjVhMDFmZDI3MzBlYTllYTlmNWI4YzhjM2ZkZmY2Y2E5N2M5NDI=
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -14,8 +14,8 @@ This project is a member of the [OSS Manifesto](http://ossmanifesto.org/).
|
|
14
14
|
|
15
15
|
## Important
|
16
16
|
|
17
|
-
This readme points to the
|
18
|
-
older versions, see [v1.0.0rc2 README][oldreadme].
|
17
|
+
This readme points to the latest version (v2.x) of jQuery Turbolinks, which
|
18
|
+
features new 2.0 API. For older versions, see [v1.0.0rc2 README][oldreadme].
|
19
19
|
|
20
20
|
## Usage
|
21
21
|
|
@@ -78,43 +78,7 @@ $(document).on('click', 'button', function() { ... })
|
|
78
78
|
|
79
79
|
This project uses [Semantic Versioning](http://semver.org/) for release numbering.
|
80
80
|
|
81
|
-
|
82
|
-
|
83
|
-
* Rewritten, smaller, with a completely new API. This deprecates the old
|
84
|
-
`$.setFetchEvent` and `$.setReadyEvent` API.
|
85
|
-
|
86
|
-
### 1.0.0 (April 5, 2013)
|
87
|
-
|
88
|
-
* Add uglified version.
|
89
|
-
|
90
|
-
### 1.0.0-rc2 (January 31, 2013)
|
91
|
-
|
92
|
-
* Fix problem with 3rd-party libraries [#12](https://github.com/kossnocorp/jquery.turbolinks/issues/12), [#15](https://github.com/kossnocorp/jquery.turbolinks/issues/15) (kudos to [@rstacruz](https://github.com/rstacruz));
|
93
|
-
* Reopen [#8](https://github.com/kossnocorp/jquery.turbolinks/issues/8).
|
94
|
-
|
95
|
-
### 1.0.0-rc1 (November 28, 2012)
|
96
|
-
|
97
|
-
* Set $.isReady to false after `page:fetch` [#6](https://github.com/kossnocorp/jquery.turbolinks/issues/6);
|
98
|
-
* add `$.setFetchEvent` function;
|
99
|
-
* remove all delegated events after trigger fetch event [#8](https://github.com/kossnocorp/jquery.turbolinks/issues/8).
|
100
|
-
|
101
|
-
### 1.0.0-rc (November 8, 2012)
|
102
|
-
|
103
|
-
* Add turbolinks as dependency (kudos to [@gbchaosmaster](https://github.com/gbchaosmaster));
|
104
|
-
* run callback after adding to waiting list if `$.isReady` [#6](https://github.com/kossnocorp/jquery.turbolinks/issues/6).
|
105
|
-
|
106
|
-
### 0.2.1 (October 15, 2012)
|
107
|
-
|
108
|
-
* Pass jQuery object to each callback [#4](https://github.com/kossnocorp/jquery.turbolinks/issues/4)
|
109
|
-
|
110
|
-
### 0.2.0 (October 10, 2012)
|
111
|
-
|
112
|
-
* Change event: `page:change` -> `page:load` (kudos to [@davydotcom](https://github.com/davydotcom));
|
113
|
-
* added ability to change ready event via `$.setReadyEvent`
|
114
|
-
|
115
|
-
### 0.1.0 (October 3, 2012)
|
116
|
-
|
117
|
-
* First, initial release
|
81
|
+
For changelog notes, checkout [releases page](https://github.com/kossnocorp/jquery.turbolinks/releases).
|
118
82
|
|
119
83
|
## Contributors
|
120
84
|
|
data/package.json
CHANGED
@@ -21,11 +21,15 @@ describe '$ Turbolinks', ->
|
|
21
21
|
|
22
22
|
callback1 = callback2 = null
|
23
23
|
|
24
|
+
# Simulate a reset.
|
25
|
+
beforeEach ->
|
26
|
+
$.turbo.isReady = false
|
27
|
+
$.turbo.use 'page:load', 'page:fetch'
|
28
|
+
$(document).off('turbo:ready')
|
29
|
+
|
24
30
|
describe "DOM isn't ready", ->
|
25
31
|
|
26
32
|
beforeEach ->
|
27
|
-
$.turbo.isReady = false
|
28
|
-
|
29
33
|
$(callback1 = sinon.spy())
|
30
34
|
$(callback2 = sinon.spy())
|
31
35
|
|
@@ -39,6 +43,13 @@ describe '$ Turbolinks', ->
|
|
39
43
|
callback1.should.have.been.calledOnce
|
40
44
|
callback2.should.have.been.calledOnce
|
41
45
|
|
46
|
+
it 'should pass $ as the first argument to callbacks', (done) ->
|
47
|
+
$ ($$) ->
|
48
|
+
$$.fn.should.be.an.object
|
49
|
+
done()
|
50
|
+
|
51
|
+
$(document).trigger 'page:load'
|
52
|
+
|
42
53
|
describe '$.turbo.use', ->
|
43
54
|
beforeEach ->
|
44
55
|
$.turbo.use('page:load', 'page:fetch')
|
@@ -93,3 +104,8 @@ describe '$ Turbolinks', ->
|
|
93
104
|
$(document).trigger('page:load')
|
94
105
|
$(callback2 = sinon.spy())
|
95
106
|
callback2.should.have.been.calledOnce
|
107
|
+
|
108
|
+
it 'should pass $ as the first argument to callbacks', (done) ->
|
109
|
+
$ ($$) ->
|
110
|
+
$$.fn.should.be.an.object
|
111
|
+
done()
|
@@ -10,7 +10,7 @@ $ = window.jQuery or require?('jquery')
|
|
10
10
|
$document = $(document)
|
11
11
|
|
12
12
|
$.turbo =
|
13
|
-
version: '2.0.
|
13
|
+
version: '2.0.1'
|
14
14
|
|
15
15
|
isReady: false
|
16
16
|
|
@@ -22,8 +22,10 @@ $.turbo =
|
|
22
22
|
.on("#{fetch}.turbo", @onFetch)
|
23
23
|
|
24
24
|
addCallback: (callback) ->
|
25
|
-
|
26
|
-
|
25
|
+
if $.turbo.isReady
|
26
|
+
callback($)
|
27
|
+
else
|
28
|
+
$document.on 'turbo:ready', -> callback($)
|
27
29
|
|
28
30
|
onLoad: ->
|
29
31
|
$.turbo.isReady = true
|
@@ -22,9 +22,12 @@ Copyright (c) 2012-2013 Sasha Koss & Rico Sta. Cruz
|
|
22
22
|
return $document.off('.turbo').on("" + load + ".turbo", this.onLoad).on("" + fetch + ".turbo", this.onFetch);
|
23
23
|
},
|
24
24
|
addCallback: function(callback) {
|
25
|
-
$document.on('turbo:ready', callback);
|
26
25
|
if ($.turbo.isReady) {
|
27
26
|
return callback($);
|
27
|
+
} else {
|
28
|
+
return $document.on('turbo:ready', function() {
|
29
|
+
return callback($);
|
30
|
+
});
|
28
31
|
}
|
29
32
|
},
|
30
33
|
onLoad: function() {
|
@@ -1 +1 @@
|
|
1
|
-
!function(){var r,
|
1
|
+
!function(){var r,t;r=window.jQuery||("function"==typeof require?require("jquery"):void 0),t=r(document),r.turbo={version:"2.0.0",isReady:!1,use:function(r,o){return t.off(".turbo").on(""+r+".turbo",this.onLoad).on(""+o+".turbo",this.onFetch)},addCallback:function(o){return r.turbo.isReady?o(r):t.on("turbo:ready",function(){return o(r)})},onLoad:function(){return r.turbo.isReady=!0,t.trigger("turbo:ready")},onFetch:function(){return r.turbo.isReady=!1},register:function(){return r(this.onLoad),r.fn.ready=this.addCallback}},r.turbo.register(),r.turbo.use("page:load","page:fetch")}.call(this);
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jquery-turbolinks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sasha Koss
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
prerelease: false
|