rstacruz-turbolinks 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +537 -0
- data/lib/assets/javascripts/turbolinks.coffee +733 -0
- data/lib/turbolinks.rb +64 -0
- data/lib/turbolinks/cookies.rb +15 -0
- data/lib/turbolinks/redirection.rb +77 -0
- data/lib/turbolinks/version.rb +3 -0
- data/lib/turbolinks/x_domain_blocker.rb +22 -0
- data/lib/turbolinks/xhr_headers.rb +44 -0
- data/lib/turbolinks/xhr_redirect.rb +30 -0
- data/lib/turbolinks/xhr_url_for.rb +23 -0
- data/test/attachment.html +5 -0
- data/test/config.ru +65 -0
- data/test/dummy.gif +0 -0
- data/test/form.html +17 -0
- data/test/index.html +53 -0
- data/test/manifest.appcache +10 -0
- data/test/offline.html +19 -0
- data/test/other.html +26 -0
- data/test/partial1.html +34 -0
- data/test/partial2.html +26 -0
- data/test/partial3.html +28 -0
- data/test/redirect1.html +16 -0
- data/test/redirect2.html +13 -0
- data/test/reload.html +18 -0
- data/test/withoutextension +26 -0
- metadata +113 -0
data/test/offline.html
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en" manifest="/manifest.appcache">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Home</title>
|
6
|
+
<script type="text/javascript" src="/js/turbolinks.js"></script>
|
7
|
+
<script type="text/javascript">
|
8
|
+
document.addEventListener("page:change", function() {
|
9
|
+
console.log("page changed");
|
10
|
+
});
|
11
|
+
</script>
|
12
|
+
</head>
|
13
|
+
<body class="page-offline">
|
14
|
+
<h1>Offline Mode Fallback</h1>
|
15
|
+
<ul>
|
16
|
+
<li><a href="/index.html">Home</a></li>
|
17
|
+
</ul>
|
18
|
+
</body>
|
19
|
+
</html>
|
data/test/other.html
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Home</title>
|
6
|
+
<script type="text/javascript" src="/js/turbolinks.js"></script>
|
7
|
+
<script type="text/javascript">
|
8
|
+
document.addEventListener("page:change", function() {
|
9
|
+
console.log("page changed");
|
10
|
+
});
|
11
|
+
|
12
|
+
document.addEventListener("page:update", function() {
|
13
|
+
console.log("page updated");
|
14
|
+
});
|
15
|
+
|
16
|
+
document.addEventListener("page:restore", function() {
|
17
|
+
console.log("page restored");
|
18
|
+
});
|
19
|
+
</script>
|
20
|
+
</head>
|
21
|
+
<body class="page-other">
|
22
|
+
<ul>
|
23
|
+
<li><a href="/index.html">Home</a></li>
|
24
|
+
</ul>
|
25
|
+
</body>
|
26
|
+
</html>
|
data/test/partial1.html
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Partial updates</title>
|
6
|
+
<script type="text/javascript" src="/js/turbolinks.js"></script>
|
7
|
+
<script>
|
8
|
+
setTimeout(function(){
|
9
|
+
window.originalDocument = document.implementation.createDocument ('http://www.w3.org/1999/xhtml', 'html', null);
|
10
|
+
window.originalDocument.documentElement.appendChild(document.body.cloneNode(true));
|
11
|
+
}, 0)
|
12
|
+
</script>
|
13
|
+
<style>a {text-decoration: underline; cursor: pointer; color: blue;}</style>
|
14
|
+
</head>
|
15
|
+
<body class="page-other">
|
16
|
+
<nav id="navbar" data-turbolinks-permanent>
|
17
|
+
<a href="/index.html">Index</a>
|
18
|
+
</nav>
|
19
|
+
<h2 id="flash" data-turbolinks-temporary>
|
20
|
+
<a onclick="this.innerHTML = 'changed'">Change me</a>
|
21
|
+
</h2>
|
22
|
+
<h3 id="comments:header">You have 1 comment!</h3>
|
23
|
+
<ul id="comments:list">
|
24
|
+
<li>Author: Turbo. Comment: This is comment 1</li>
|
25
|
+
<li><a onclick="Turbolinks.visit('/partial2.html', {change: ['comments']});">Fetch another comment</a></li>
|
26
|
+
</ul>
|
27
|
+
|
28
|
+
<ul id="revert" data-turbolinks-permanent>
|
29
|
+
<li><a onclick="Turbolinks.replace(window.originalDocument.documentElement.innerHTML, {title: 'Back to the original'})">Replace with original doc</a></li>
|
30
|
+
<li><a onclick="Turbolinks.replace(window.originalDocument.documentElement.innerHTML, {change: ['comments:header'], title: 'Changed the count'})">Replace the original count</a></li>
|
31
|
+
<li><a onclick="Turbolinks.replace(window.originalDocument.documentElement.innerHTML, {keep: ['comments:header'], title: 'Replaced all but the count'})">Replace everything but the current count</a></li>
|
32
|
+
</ul>
|
33
|
+
</body>
|
34
|
+
</html>
|
data/test/partial2.html
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Partial update 2</title>
|
6
|
+
<script type="text/javascript" src="/js/turbolinks.js"></script>
|
7
|
+
<style>a {text-decoration: underline; cursor: pointer; color: blue;}</style>
|
8
|
+
</head>
|
9
|
+
<body class="page-other">
|
10
|
+
<nav id="navbar" data-turbolinks-permanent>
|
11
|
+
<h1>I shouldn't change</h1>
|
12
|
+
</nav>
|
13
|
+
<h2 id="flash" data-turbolinks-temporary>
|
14
|
+
<a onclick="this.innerHTML = 'changed'">Change me</a>
|
15
|
+
</h2>
|
16
|
+
<h3 id="comments:header">You have 2 comments!</h3>
|
17
|
+
<ul id="comments:list">
|
18
|
+
<li>Author: Turbo. Comment: This is comment 1</li>
|
19
|
+
<li>Author: Turbo2. Comment: This is comment 2</li>
|
20
|
+
<li><a onclick="Turbolinks.visit('/partial3.html');">Fetch another comment</a></li>
|
21
|
+
</ul>
|
22
|
+
<ul id="revert" data-turbolinks-permanent>
|
23
|
+
<h1>I shouldn't change</h1>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
data/test/partial3.html
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Partial update 3</title>
|
6
|
+
<script type="text/javascript" src="/js/turbolinks.js"></script>
|
7
|
+
<style>a {text-decoration: underline; cursor: pointer; color: blue;}</style>
|
8
|
+
</head>
|
9
|
+
<body class="page-other">
|
10
|
+
<nav id="navbar" data-turbolinks-permanent>
|
11
|
+
FLUSHED
|
12
|
+
<a href="/index.html">Index</a>
|
13
|
+
</nav>
|
14
|
+
<h2 id="flash" data-turbolinks-temporary>
|
15
|
+
<a onclick="this.innerHTML = 'changed'">Change me</a>
|
16
|
+
</h2>
|
17
|
+
<h3 id="comments:header">You have 3 comments!</h3>
|
18
|
+
<ul id="comments:list">
|
19
|
+
<li>Author: Turbo. Comment: This is comment 1</li>
|
20
|
+
<li>Author: Turbo2. Comment: This is comment 2</li>
|
21
|
+
<li>Author: Turbo3. Comment: This is comment 3</li>
|
22
|
+
</ul>
|
23
|
+
<div id="revert" data-turbolinks-permanent>
|
24
|
+
FLUSHED
|
25
|
+
</div>
|
26
|
+
<a onclick="Turbolinks.visit('/partial3.html', {flush: true})">FLUSH EVERYTHING</a>
|
27
|
+
</body>
|
28
|
+
</html>
|
data/test/redirect1.html
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Redirect 1</title>
|
6
|
+
<script type="text/javascript" src="/js/turbolinks.js"></script>
|
7
|
+
</head>
|
8
|
+
<body class="page-other">
|
9
|
+
Should show /redirect1.html as path
|
10
|
+
<ul>
|
11
|
+
<li>Click <a href="/redirect2.html">Redirect 2</a></li>
|
12
|
+
</ul>
|
13
|
+
|
14
|
+
<div id="footer" data-turbolinks-permanent>First redirect page footer</div>
|
15
|
+
</body>
|
16
|
+
</html>
|
data/test/redirect2.html
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Redirect 2</title>
|
6
|
+
<script type="text/javascript" src="/js/turbolinks.js"></script>
|
7
|
+
</head>
|
8
|
+
<body class="page-other">
|
9
|
+
Hit back button twice. It should go back to home page.
|
10
|
+
|
11
|
+
<div id="footer" data-turbolinks-permanent>second redirect page footer shouldn't change</div>
|
12
|
+
</body>
|
13
|
+
</html>
|
data/test/reload.html
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Home</title>
|
6
|
+
<script type="text/javascript" src="/js/turbolinks.js?1" data-turbolinks-track='true'></script>
|
7
|
+
<script type="text/javascript">
|
8
|
+
document.addEventListener("page:change", function() {
|
9
|
+
console.log("page changed");
|
10
|
+
});
|
11
|
+
</script>
|
12
|
+
</head>
|
13
|
+
<body class="page-reload">
|
14
|
+
<ul>
|
15
|
+
<li><a href="/index.html">Home</a></li>
|
16
|
+
</ul>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Home</title>
|
6
|
+
<script type="text/javascript" src="/js/turbolinks.js"></script>
|
7
|
+
<script type="text/javascript">
|
8
|
+
document.addEventListener("page:change", function() {
|
9
|
+
console.log("page changed");
|
10
|
+
});
|
11
|
+
|
12
|
+
document.addEventListener("page:update", function() {
|
13
|
+
console.log("page updated");
|
14
|
+
});
|
15
|
+
|
16
|
+
document.addEventListener("page:restore", function() {
|
17
|
+
console.log("page restored");
|
18
|
+
});
|
19
|
+
</script>
|
20
|
+
</head>
|
21
|
+
<body class="page-other">
|
22
|
+
<ul>
|
23
|
+
<li><a href="/index.html">Home</a></li>
|
24
|
+
</ul>
|
25
|
+
</body>
|
26
|
+
</html>
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rstacruz-turbolinks
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Heinemeier Hansson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: coffee-rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description:
|
42
|
+
email: david@loudthinking.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- MIT-LICENSE
|
48
|
+
- README.md
|
49
|
+
- lib/assets/javascripts/turbolinks.coffee
|
50
|
+
- lib/turbolinks.rb
|
51
|
+
- lib/turbolinks/cookies.rb
|
52
|
+
- lib/turbolinks/redirection.rb
|
53
|
+
- lib/turbolinks/version.rb
|
54
|
+
- lib/turbolinks/x_domain_blocker.rb
|
55
|
+
- lib/turbolinks/xhr_headers.rb
|
56
|
+
- lib/turbolinks/xhr_redirect.rb
|
57
|
+
- lib/turbolinks/xhr_url_for.rb
|
58
|
+
- test/attachment.html
|
59
|
+
- test/config.ru
|
60
|
+
- test/dummy.gif
|
61
|
+
- test/form.html
|
62
|
+
- test/index.html
|
63
|
+
- test/manifest.appcache
|
64
|
+
- test/offline.html
|
65
|
+
- test/other.html
|
66
|
+
- test/partial1.html
|
67
|
+
- test/partial2.html
|
68
|
+
- test/partial3.html
|
69
|
+
- test/redirect1.html
|
70
|
+
- test/redirect2.html
|
71
|
+
- test/reload.html
|
72
|
+
- test/withoutextension
|
73
|
+
homepage: https://github.com/rstacruz/turbolinks/
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.2.2
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: Turbolinks makes following links in your web application faster (use with
|
97
|
+
Rails Asset Pipeline)
|
98
|
+
test_files:
|
99
|
+
- test/attachment.html
|
100
|
+
- test/config.ru
|
101
|
+
- test/dummy.gif
|
102
|
+
- test/form.html
|
103
|
+
- test/index.html
|
104
|
+
- test/manifest.appcache
|
105
|
+
- test/offline.html
|
106
|
+
- test/other.html
|
107
|
+
- test/partial1.html
|
108
|
+
- test/partial2.html
|
109
|
+
- test/partial3.html
|
110
|
+
- test/redirect1.html
|
111
|
+
- test/redirect2.html
|
112
|
+
- test/reload.html
|
113
|
+
- test/withoutextension
|