turbolinks 2.5.3 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/{MIT-LICENSE → LICENSE} +1 -1
- data/README.md +0 -241
- data/lib/turbolinks/redirection.rb +42 -9
- data/lib/turbolinks/version.rb +1 -1
- data/lib/turbolinks.rb +16 -22
- metadata +12 -28
- data/lib/assets/javascripts/turbolinks.js.coffee +0 -558
- data/lib/turbolinks/cookies.rb +0 -15
- data/lib/turbolinks/x_domain_blocker.rb +0 -21
- data/lib/turbolinks/xhr_headers.rb +0 -46
- data/lib/turbolinks/xhr_url_for.rb +0 -15
- data/test/config.ru +0 -55
- data/test/dummy.gif +0 -0
- data/test/index.html +0 -51
- data/test/manifest.appcache +0 -10
- data/test/offline.html +0 -19
- data/test/other.html +0 -26
- data/test/redirect1.html +0 -15
- data/test/redirect2.html +0 -11
- data/test/reload.html +0 -18
- data/test/withoutextension +0 -26
data/test/config.ru
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'sprockets'
|
2
|
-
require 'coffee-script'
|
3
|
-
|
4
|
-
Root = File.expand_path("../..", __FILE__)
|
5
|
-
|
6
|
-
Assets = Sprockets::Environment.new do |env|
|
7
|
-
env.append_path File.join(Root, "lib", "assets", "javascripts")
|
8
|
-
end
|
9
|
-
|
10
|
-
class SlowResponse
|
11
|
-
CHUNKS = ['<html><body>', '.'*50, '.'*20, '<a href="/index.html">Home</a></body></html>']
|
12
|
-
|
13
|
-
def call(env)
|
14
|
-
[200, headers, self]
|
15
|
-
end
|
16
|
-
|
17
|
-
def each
|
18
|
-
CHUNKS.each do |part|
|
19
|
-
sleep rand(0.3..0.8)
|
20
|
-
yield part
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def length
|
25
|
-
CHUNKS.join.length
|
26
|
-
end
|
27
|
-
|
28
|
-
def headers
|
29
|
-
{ "Content-Length" => length.to_s, "Content-Type" => "text/html", "Cache-Control" => "no-cache, no-store, must-revalidate" }
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
map "/js" do
|
34
|
-
run Assets
|
35
|
-
end
|
36
|
-
|
37
|
-
map "/500" do
|
38
|
-
# throw Internal Server Error (500)
|
39
|
-
end
|
40
|
-
|
41
|
-
map "/withoutextension" do
|
42
|
-
run Rack::File.new(File.join(Root, "test", "withoutextension"), "Content-Type" => "text/html")
|
43
|
-
end
|
44
|
-
|
45
|
-
map "/slow-response" do
|
46
|
-
run SlowResponse.new
|
47
|
-
end
|
48
|
-
|
49
|
-
map "/bounce" do
|
50
|
-
run Proc.new{ [200, { "X-XHR-Redirected-To" => "redirect1.html", "Content-Type" => "text/html" }, File.open( File.join( Root, "test", "redirect1.html" ) ) ] }
|
51
|
-
end
|
52
|
-
|
53
|
-
map "/" do
|
54
|
-
run Rack::Directory.new(File.join(Root, "test"))
|
55
|
-
end
|
data/test/dummy.gif
DELETED
Binary file
|
data/test/index.html
DELETED
@@ -1,51 +0,0 @@
|
|
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
|
-
Turbolinks.enableProgressBar();
|
9
|
-
|
10
|
-
document.addEventListener("page:change", function() {
|
11
|
-
console.log("page changed");
|
12
|
-
});
|
13
|
-
|
14
|
-
document.addEventListener("page:update", function() {
|
15
|
-
console.log("page updated");
|
16
|
-
});
|
17
|
-
|
18
|
-
document.addEventListener("page:restore", function() {
|
19
|
-
console.log("page restored");
|
20
|
-
});
|
21
|
-
</script>
|
22
|
-
</head>
|
23
|
-
<body class="page-index">
|
24
|
-
<ul style="margin-top:20px;">
|
25
|
-
<li><a href="/other.html">Other page</a></li>
|
26
|
-
<li><a href="/slow-response">Slow loading page for progress bar</a></li>
|
27
|
-
<li><a href="/other.html"><span>Wrapped link</span></a></li>
|
28
|
-
<li><a href="/withoutextension">Without extension</a></li>
|
29
|
-
<li><a href="/withoutextension?sort=user.name">Without extension with query params</a></li>
|
30
|
-
<li><a href="http://www.google.com/">Cross origin</a></li>
|
31
|
-
<li><a href="/other.html" onclick="if(!confirm('follow link?')) { return false}">Confirm Fire Order</a></li>
|
32
|
-
<li><a href="/reload.html"><span>New assets track </span></a></li>
|
33
|
-
<li><a href="/dummy.gif?12345">Query Param Image Link</a></li>
|
34
|
-
<li><a href="/bounce">Redirect</a></li>
|
35
|
-
<li><a href="#">Hash link</a></li>
|
36
|
-
<li><a href="/reload.html#foo">New assets track with hash link</a></li>
|
37
|
-
<li><h5>If you stop the server or go into airplane/offline mode</h5></li>
|
38
|
-
<li><a href="/doesnotexist.html">A page with client error (4xx, rfc2616 sec. 10.4) should error out</a></li>
|
39
|
-
<li><a href="/500">Also server errors (5xx, rfc2616 sec. 10.5) should error out</a></li>
|
40
|
-
<li><a href="/fallback.html">A page that has a fallback in appcache should fallback</a></li>
|
41
|
-
</ul>
|
42
|
-
|
43
|
-
<div style="background:#ccc;height:5000px;width:200px;">
|
44
|
-
</div>
|
45
|
-
<iframe height='1' scrolling='no' src='/offline.html' style='display: none;' width='1'></iframe>
|
46
|
-
|
47
|
-
<script type="text/javascript" data-turbolinks-eval=false>
|
48
|
-
console.log("turbolinks-eval-false script fired. This should only happen on the initial page load.");
|
49
|
-
</script>
|
50
|
-
</body>
|
51
|
-
</html>
|
data/test/manifest.appcache
DELETED
data/test/offline.html
DELETED
@@ -1,19 +0,0 @@
|
|
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
DELETED
@@ -1,26 +0,0 @@
|
|
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/redirect1.html
DELETED
@@ -1,15 +0,0 @@
|
|
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
|
-
</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
|
-
</body>
|
15
|
-
</html>
|
data/test/redirect2.html
DELETED
@@ -1,11 +0,0 @@
|
|
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
|
-
</head>
|
8
|
-
<body class="page-other">
|
9
|
-
Hit back button twice. It should go back to home page.
|
10
|
-
</body>
|
11
|
-
</html>
|
data/test/reload.html
DELETED
@@ -1,18 +0,0 @@
|
|
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>
|
data/test/withoutextension
DELETED
@@ -1,26 +0,0 @@
|
|
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>
|