turbolinks-js 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/assets/javascripts/turbolinks.js +19 -26
- metadata +2 -2
@@ -1,6 +1,6 @@
|
|
1
1
|
// Generated by CoffeeScript 1.3.3
|
2
2
|
(function() {
|
3
|
-
var anchoredLink, assetsChanged, browserCompatibleDocumentParser, browserSupportsPushState, cacheCurrentPage, changePage, constrainPageCacheTo, createDocument, crossOriginLink, currentState, executeScriptTags, extractLink, extractTitleAndBody, extractTrackAssets, fetchHistory, fetchReplacement, handleClick, ignoreClick, initialized, installClickHandlerLast, intersection, noTurbolink, nonHtmlLink, nonStandardClick, pageCache, recallScrollPosition, referer, reflectNewUrl, reflectRedirectedUrl, rememberCurrentState,
|
3
|
+
var anchoredLink, assetsChanged, browserCompatibleDocumentParser, browserSupportsPushState, cacheCurrentPage, changePage, constrainPageCacheTo, createDocument, crossOriginLink, currentState, executeScriptTags, extractLink, extractTitleAndBody, extractTrackAssets, fetchHistory, fetchReplacement, handleClick, ignoreClick, initialized, installClickHandlerLast, intersection, loadedAssets, noTurbolink, nonHtmlLink, nonStandardClick, pageCache, recallScrollPosition, referer, reflectNewUrl, reflectRedirectedUrl, rememberCurrentState, rememberCurrentUrl, rememberInitialPage, resetScrollPosition, targetLink, triggerEvent, visit,
|
4
4
|
__hasProp = {}.hasOwnProperty,
|
5
5
|
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
6
6
|
|
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
referer = document.location.href;
|
12
12
|
|
13
|
-
|
13
|
+
loadedAssets = null;
|
14
14
|
|
15
15
|
pageCache = {};
|
16
16
|
|
@@ -102,27 +102,24 @@
|
|
102
102
|
};
|
103
103
|
|
104
104
|
executeScriptTags = function() {
|
105
|
-
var attr, copy,
|
105
|
+
var attr, copy, nextSibling, parentNode, script, _i, _j, _len, _len1, _ref, _ref1, _ref2, _results;
|
106
106
|
_ref = document.body.getElementsByTagName('script');
|
107
107
|
_results = [];
|
108
108
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
109
109
|
script = _ref[_i];
|
110
|
-
if ((_ref1 = script.type) === '' || _ref1 === 'text/javascript') {
|
111
|
-
|
112
|
-
copy = document.createElement('script');
|
113
|
-
_ref2 = script.attributes;
|
114
|
-
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
|
115
|
-
attr = _ref2[_j];
|
116
|
-
copy.setAttribute(attr.name, attr.value);
|
117
|
-
}
|
118
|
-
copy.setAttribute('data-turbolinks-evaluated', '');
|
119
|
-
parent = script.parentNode;
|
120
|
-
parent.removeChild(script);
|
121
|
-
_results.push(parent.insertBefore(copy, parent.childNodes[0]));
|
122
|
-
} else {
|
123
|
-
_results.push(window["eval"](script.innerHTML));
|
124
|
-
}
|
110
|
+
if (!((_ref1 = script.type) === '' || _ref1 === 'text/javascript')) {
|
111
|
+
continue;
|
125
112
|
}
|
113
|
+
copy = document.createElement('script');
|
114
|
+
_ref2 = script.attributes;
|
115
|
+
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
|
116
|
+
attr = _ref2[_j];
|
117
|
+
copy.setAttribute(attr.name, attr.value);
|
118
|
+
}
|
119
|
+
copy.appendChild(document.createTextNode(script.innerHTML));
|
120
|
+
parentNode = script.parentNode, nextSibling = script.nextSibling;
|
121
|
+
parentNode.removeChild(script);
|
122
|
+
_results.push(parentNode.insertBefore(copy, nextSibling));
|
126
123
|
}
|
127
124
|
return _results;
|
128
125
|
};
|
@@ -155,10 +152,6 @@
|
|
155
152
|
return currentState = window.history.state;
|
156
153
|
};
|
157
154
|
|
158
|
-
rememberCurrentTrackingAssets = function() {
|
159
|
-
return trackingAssets = extractTrackAssets(document);
|
160
|
-
};
|
161
|
-
|
162
155
|
rememberInitialPage = function() {
|
163
156
|
if (!initialized) {
|
164
157
|
rememberCurrentUrl();
|
@@ -197,9 +190,10 @@
|
|
197
190
|
};
|
198
191
|
|
199
192
|
assetsChanged = function(doc) {
|
200
|
-
var
|
201
|
-
|
202
|
-
|
193
|
+
var fetchedAssets;
|
194
|
+
loadedAssets || (loadedAssets = extractTrackAssets(document));
|
195
|
+
fetchedAssets = extractTrackAssets(doc);
|
196
|
+
return fetchedAssets.length !== loadedAssets.length || intersection(fetchedAssets, loadedAssets).length !== loadedAssets.length;
|
203
197
|
};
|
204
198
|
|
205
199
|
intersection = function(a, b) {
|
@@ -309,7 +303,6 @@
|
|
309
303
|
browserSupportsPushState = window.history && window.history.pushState && window.history.replaceState && window.history.state !== void 0;
|
310
304
|
|
311
305
|
if (browserSupportsPushState) {
|
312
|
-
rememberCurrentTrackingAssets();
|
313
306
|
document.addEventListener('click', installClickHandlerLast, true);
|
314
307
|
window.addEventListener('popstate', function(event) {
|
315
308
|
var _ref;
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbolinks-js
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-12-
|
13
|
+
date: 2012-12-05 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description:
|
16
16
|
email:
|