{I" class:ETI"ProcessedAsset;FI"logical_path;TI"turbolinks.js;FI" pathname;TI"n/Users/benoit/.rvm/gems/ruby-2.0.0-p247/gems/turbolinks-2.4.0/lib/assets/javascripts/turbolinks.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+‰v;TI" length;Ti¼WI" digest;TI"%56a91ffbe0dcdd8b3ea2e7376ccff8f6;FI" source;TI"¼W(function() { var CSRFToken, Click, ComponentUrl, EVENTS, Link, browserCompatibleDocumentParser, browserIsntBuggy, browserSupportsCustomEvents, browserSupportsPushState, browserSupportsTurbolinks, bypassOnLoadPopstate, cacheCurrentPage, cacheSize, changePage, clone, constrainPageCacheTo, createDocument, currentState, enableTransitionCache, executeScriptTags, extractTitleAndBody, fetch, fetchHistory, fetchReplacement, historyStateIsDefined, initializeTurbolinks, installDocumentReadyPageEventTriggers, installHistoryChangeHandler, installJqueryAjaxSuccessPageUpdateTrigger, loadedAssets, manuallyTriggerHashChangeForFirefox, pageCache, pageChangePrevented, pagesCached, popCookie, processResponse, recallScrollPosition, referer, reflectNewUrl, reflectRedirectedUrl, rememberCurrentState, rememberCurrentUrl, rememberReferer, removeNoscriptTags, requestMethodIsSafe, resetScrollPosition, setAutofocusElement, transitionCacheEnabled, transitionCacheFor, triggerEvent, visit, xhr, _ref, __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; }, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, __slice = [].slice; pageCache = {}; cacheSize = 10; transitionCacheEnabled = false; currentState = null; loadedAssets = null; referer = null; createDocument = null; xhr = null; EVENTS = { BEFORE_CHANGE: 'page:before-change', FETCH: 'page:fetch', RECEIVE: 'page:receive', CHANGE: 'page:change', UPDATE: 'page:update', LOAD: 'page:load', RESTORE: 'page:restore', BEFORE_UNLOAD: 'page:before-unload', EXPIRE: 'page:expire' }; fetch = function(url) { var cachedPage; url = new ComponentUrl(url); rememberReferer(); cacheCurrentPage(); if (transitionCacheEnabled && (cachedPage = transitionCacheFor(url.absolute))) { fetchHistory(cachedPage); return fetchReplacement(url); } else { return fetchReplacement(url, resetScrollPosition); } }; transitionCacheFor = function(url) { var cachedPage; cachedPage = pageCache[url]; if (cachedPage && !cachedPage.transitionCacheDisabled) { return cachedPage; } }; enableTransitionCache = function(enable) { if (enable == null) { enable = true; } return transitionCacheEnabled = enable; }; fetchReplacement = function(url, onLoadFunction) { if (onLoadFunction == null) { onLoadFunction = (function(_this) { return function() {}; })(this); } triggerEvent(EVENTS.FETCH, { url: url.absolute }); if (xhr != null) { xhr.abort(); } xhr = new XMLHttpRequest; xhr.open('GET', url.withoutHashForIE10compatibility(), true); xhr.setRequestHeader('Accept', 'text/html, application/xhtml+xml, application/xml'); xhr.setRequestHeader('X-XHR-Referer', referer); xhr.onload = function() { var doc; triggerEvent(EVENTS.RECEIVE, { url: url.absolute }); if (doc = processResponse()) { reflectNewUrl(url); changePage.apply(null, extractTitleAndBody(doc)); manuallyTriggerHashChangeForFirefox(); reflectRedirectedUrl(); onLoadFunction(); return triggerEvent(EVENTS.LOAD); } else { return document.location.href = url.absolute; } }; xhr.onloadend = function() { return xhr = null; }; xhr.onerror = function() { return document.location.href = url.absolute; }; return xhr.send(); }; fetchHistory = function(cachedPage) { if (xhr != null) { xhr.abort(); } changePage(cachedPage.title, cachedPage.body); recallScrollPosition(cachedPage); return triggerEvent(EVENTS.RESTORE); }; cacheCurrentPage = function() { var currentStateUrl; currentStateUrl = new ComponentUrl(currentState.url); pageCache[currentStateUrl.absolute] = { url: currentStateUrl.relative, body: document.body, title: document.title, positionY: window.pageYOffset, positionX: window.pageXOffset, cachedAt: new Date().getTime(), transitionCacheDisabled: document.querySelector('[data-no-transition-cache]') != null }; return constrainPageCacheTo(cacheSize); }; pagesCached = function(size) { if (size == null) { size = cacheSize; } if (/^[\d]+$/.test(size)) { return cacheSize = parseInt(size); } }; constrainPageCacheTo = function(limit) { var cacheTimesRecentFirst, key, pageCacheKeys, _i, _len, _results; pageCacheKeys = Object.keys(pageCache); cacheTimesRecentFirst = pageCacheKeys.map(function(url) { return pageCache[url].cachedAt; }).sort(function(a, b) { return b - a; }); _results = []; for (_i = 0, _len = pageCacheKeys.length; _i < _len; _i++) { key = pageCacheKeys[_i]; if (!(pageCache[key].cachedAt <= cacheTimesRecentFirst[limit])) { continue; } triggerEvent(EVENTS.EXPIRE, pageCache[key]); _results.push(delete pageCache[key]); } return _results; }; changePage = function(title, body, csrfToken, runScripts) { triggerEvent(EVENTS.BEFORE_UNLOAD); document.title = title; document.documentElement.replaceChild(body, document.body); if (csrfToken != null) { CSRFToken.update(csrfToken); } setAutofocusElement(); if (runScripts) { executeScriptTags(); } currentState = window.history.state; triggerEvent(EVENTS.CHANGE); return triggerEvent(EVENTS.UPDATE); }; executeScriptTags = function() { var attr, copy, nextSibling, parentNode, script, scripts, _i, _j, _len, _len1, _ref, _ref1; scripts = Array.prototype.slice.call(document.body.querySelectorAll('script:not([data-turbolinks-eval="false"])')); for (_i = 0, _len = scripts.length; _i < _len; _i++) { script = scripts[_i]; if (!((_ref = script.type) === '' || _ref === 'text/javascript')) { continue; } copy = document.createElement('script'); _ref1 = script.attributes; for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { attr = _ref1[_j]; copy.setAttribute(attr.name, attr.value); } if (!script.hasAttribute('async')) { copy.async = false; } copy.appendChild(document.createTextNode(script.innerHTML)); parentNode = script.parentNode, nextSibling = script.nextSibling; parentNode.removeChild(script); parentNode.insertBefore(copy, nextSibling); } }; removeNoscriptTags = function(node) { node.innerHTML = node.innerHTML.replace(//ig, ''); return node; }; setAutofocusElement = function() { var autofocusElement, list; autofocusElement = (list = document.querySelectorAll('input[autofocus], textarea[autofocus]'))[list.length - 1]; if (autofocusElement && document.activeElement !== autofocusElement) { return autofocusElement.focus(); } }; reflectNewUrl = function(url) { if ((url = new ComponentUrl(url)).absolute !== referer) { return window.history.pushState({ turbolinks: true, url: url.absolute }, '', url.absolute); } }; reflectRedirectedUrl = function() { var location, preservedHash; if (location = xhr.getResponseHeader('X-XHR-Redirected-To')) { location = new ComponentUrl(location); preservedHash = location.hasNoHash() ? document.location.hash : ''; return window.history.replaceState(currentState, '', location.href + preservedHash); } }; rememberReferer = function() { return referer = document.location.href; }; rememberCurrentUrl = function() { return window.history.replaceState({ turbolinks: true, url: document.location.href }, '', document.location.href); }; rememberCurrentState = function() { return currentState = window.history.state; }; manuallyTriggerHashChangeForFirefox = function() { var url; if (navigator.userAgent.match(/Firefox/) && !(url = new ComponentUrl).hasNoHash()) { window.history.replaceState(currentState, '', url.withoutHash()); return document.location.hash = url.hash; } }; recallScrollPosition = function(page) { return window.scrollTo(page.positionX, page.positionY); }; resetScrollPosition = function() { if (document.location.hash) { return document.location.href = document.location.href; } else { return window.scrollTo(0, 0); } }; clone = function(original) { var copy, key, value; if ((original == null) || typeof original !== 'object') { return original; } copy = new original.constructor(); for (key in original) { value = original[key]; copy[key] = clone(value); } return copy; }; popCookie = function(name) { var value, _ref; value = ((_ref = document.cookie.match(new RegExp(name + "=(\\w+)"))) != null ? _ref[1].toUpperCase() : void 0) || ''; document.cookie = name + '=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/'; return value; }; triggerEvent = function(name, data) { var event; if (typeof Prototype !== 'undefined') { Event.fire(document, name, data, true); } event = document.createEvent('Events'); if (data) { event.data = data; } event.initEvent(name, true, true); return document.dispatchEvent(event); }; pageChangePrevented = function(url) { return !triggerEvent(EVENTS.BEFORE_CHANGE, { url: url }); }; processResponse = function() { var assetsChanged, clientOrServerError, doc, extractTrackAssets, intersection, validContent; clientOrServerError = function() { var _ref; return (400 <= (_ref = xhr.status) && _ref < 600); }; validContent = function() { var contentType; return ((contentType = xhr.getResponseHeader('Content-Type')) != null) && contentType.match(/^(?:text\/html|application\/xhtml\+xml|application\/xml)(?:;|$)/); }; extractTrackAssets = function(doc) { var node, _i, _len, _ref, _results; _ref = doc.querySelector('head').childNodes; _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { node = _ref[_i]; if ((typeof node.getAttribute === "function" ? node.getAttribute('data-turbolinks-track') : void 0) != null) { _results.push(node.getAttribute('src') || node.getAttribute('href')); } } return _results; }; assetsChanged = function(doc) { var fetchedAssets; loadedAssets || (loadedAssets = extractTrackAssets(document)); fetchedAssets = extractTrackAssets(doc); return fetchedAssets.length !== loadedAssets.length || intersection(fetchedAssets, loadedAssets).length !== loadedAssets.length; }; intersection = function(a, b) { var value, _i, _len, _ref, _results; if (a.length > b.length) { _ref = [b, a], a = _ref[0], b = _ref[1]; } _results = []; for (_i = 0, _len = a.length; _i < _len; _i++) { value = a[_i]; if (__indexOf.call(b, value) >= 0) { _results.push(value); } } return _results; }; if (!clientOrServerError() && validContent()) { doc = createDocument(xhr.responseText); if (doc && !assetsChanged(doc)) { return doc; } } }; extractTitleAndBody = function(doc) { var title; title = doc.querySelector('title'); return [title != null ? title.textContent : void 0, removeNoscriptTags(doc.querySelector('body')), CSRFToken.get(doc).token, 'runScripts']; }; CSRFToken = { get: function(doc) { var tag; if (doc == null) { doc = document; } return { node: tag = doc.querySelector('meta[name="csrf-token"]'), token: tag != null ? typeof tag.getAttribute === "function" ? tag.getAttribute('content') : void 0 : void 0 }; }, update: function(latest) { var current; current = this.get(); if ((current.token != null) && (latest != null) && current.token !== latest) { return current.node.setAttribute('content', latest); } } }; browserCompatibleDocumentParser = function() { var buildTestsUsing, createDocumentUsingDOM, createDocumentUsingFragment, createDocumentUsingParser, createDocumentUsingWrite, docTest, docTests, e, _i, _len; createDocumentUsingParser = function(html) { return (new DOMParser).parseFromString(html, 'text/html'); }; createDocumentUsingDOM = function(html) { var doc; doc = document.implementation.createHTMLDocument(''); doc.documentElement.innerHTML = html; return doc; }; createDocumentUsingWrite = function(html) { var doc; doc = document.implementation.createHTMLDocument(''); doc.open('replace'); doc.write(html); doc.close(); return doc; }; createDocumentUsingFragment = function(html) { var body, doc, head, htmlWrapper, _ref, _ref1; head = ((_ref = html.match(/]*>([\s\S.]*)<\/head>/i)) != null ? _ref[0] : void 0) || ''; body = ((_ref1 = html.match(/]*>([\s\S.]*)<\/body>/i)) != null ? _ref1[0] : void 0) || ''; htmlWrapper = document.createElement('html'); htmlWrapper.innerHTML = head + body; doc = document.createDocumentFragment(); doc.appendChild(htmlWrapper); return doc; }; buildTestsUsing = function(createMethod) { var buildTest, formNestingTest, structureTest; buildTest = function(fallback, passes) { return { passes: passes(), fallback: fallback }; }; structureTest = buildTest(createDocumentUsingWrite, (function(_this) { return function() { var _ref, _ref1; return ((_ref = createMethod('

test')) != null ? (_ref1 = _ref.body) != null ? _ref1.childNodes.length : void 0 : void 0) === 1; }; })(this)); formNestingTest = buildTest(createDocumentUsingFragment, (function(_this) { return function() { var _ref, _ref1; return ((_ref = createMethod('

')) != null ? (_ref1 = _ref.body) != null ? _ref1.childNodes.length : void 0 : void 0) === 2; }; })(this)); return [structureTest, formNestingTest]; }; try { if (window.DOMParser) { docTests = buildTestsUsing(createDocumentUsingParser); return createDocumentUsingParser; } } catch (_error) { e = _error; docTests = buildTestsUsing(createDocumentUsingDOM); return createDocumentUsingDOM; } finally { for (_i = 0, _len = docTests.length; _i < _len; _i++) { docTest = docTests[_i]; if (!docTest.passes) { return docTest.fallback; } } } }; ComponentUrl = (function() { function ComponentUrl(original) { this.original = original != null ? original : document.location.href; if (this.original.constructor === ComponentUrl) { return this.original; } this._parse(); } ComponentUrl.prototype.withoutHash = function() { return this.href.replace(this.hash, '').replace('#', ''); }; ComponentUrl.prototype.withoutHashForIE10compatibility = function() { return this.withoutHash(); }; ComponentUrl.prototype.hasNoHash = function() { return this.hash.length === 0; }; ComponentUrl.prototype._parse = function() { var _ref; (this.link != null ? this.link : this.link = document.createElement('a')).href = this.original; _ref = this.link, this.href = _ref.href, this.protocol = _ref.protocol, this.host = _ref.host, this.hostname = _ref.hostname, this.port = _ref.port, this.pathname = _ref.pathname, this.search = _ref.search, this.hash = _ref.hash; this.origin = [this.protocol, '//', this.hostname].join(''); if (this.port.length !== 0) { this.origin += ":" + this.port; } this.relative = [this.pathname, this.search, this.hash].join(''); return this.absolute = this.href; }; return ComponentUrl; })(); Link = (function(_super) { __extends(Link, _super); Link.HTML_EXTENSIONS = ['html']; Link.allowExtensions = function() { var extension, extensions, _i, _len; extensions = 1 <= arguments.length ? __slice.call(arguments, 0) : []; for (_i = 0, _len = extensions.length; _i < _len; _i++) { extension = extensions[_i]; Link.HTML_EXTENSIONS.push(extension); } return Link.HTML_EXTENSIONS; }; function Link(link) { this.link = link; if (this.link.constructor === Link) { return this.link; } this.original = this.link.href; this.originalElement = this.link; this.link = this.link.cloneNode(false); Link.__super__.constructor.apply(this, arguments); } Link.prototype.shouldIgnore = function() { return this._crossOrigin() || this._anchored() || this._nonHtml() || this._optOut() || this._target(); }; Link.prototype._crossOrigin = function() { return this.origin !== (new ComponentUrl).origin; }; Link.prototype._anchored = function() { return (this.hash.length > 0 || this.href.charAt(this.href.length - 1) === '#') && (this.withoutHash() === (new ComponentUrl).withoutHash()); }; Link.prototype._nonHtml = function() { return this.pathname.match(/\.[a-z]+$/g) && !this.pathname.match(new RegExp("\\.(?:" + (Link.HTML_EXTENSIONS.join('|')) + ")?$", 'g')); }; Link.prototype._optOut = function() { var ignore, link; link = this.originalElement; while (!(ignore || link === document)) { ignore = link.getAttribute('data-no-turbolink') != null; link = link.parentNode; } return ignore; }; Link.prototype._target = function() { return this.link.target.length !== 0; }; return Link; })(ComponentUrl); Click = (function() { Click.installHandlerLast = function(event) { if (!event.defaultPrevented) { document.removeEventListener('click', Click.handle, false); return document.addEventListener('click', Click.handle, false); } }; Click.handle = function(event) { return new Click(event); }; function Click(event) { this.event = event; if (this.event.defaultPrevented) { return; } this._extractLink(); if (this._validForTurbolinks()) { if (!pageChangePrevented(this.link.absolute)) { visit(this.link.href); } this.event.preventDefault(); } } Click.prototype._extractLink = function() { var link; link = this.event.target; while (!(!link.parentNode || link.nodeName === 'A')) { link = link.parentNode; } if (link.nodeName === 'A' && link.href.length !== 0) { return this.link = new Link(link); } }; Click.prototype._validForTurbolinks = function() { return (this.link != null) && !(this.link.shouldIgnore() || this._nonStandardClick()); }; Click.prototype._nonStandardClick = function() { return this.event.which > 1 || this.event.metaKey || this.event.ctrlKey || this.event.shiftKey || this.event.altKey; }; return Click; })(); bypassOnLoadPopstate = function(fn) { return setTimeout(fn, 500); }; installDocumentReadyPageEventTriggers = function() { return document.addEventListener('DOMContentLoaded', (function() { triggerEvent(EVENTS.CHANGE); return triggerEvent(EVENTS.UPDATE); }), true); }; installJqueryAjaxSuccessPageUpdateTrigger = function() { if (typeof jQuery !== 'undefined') { return jQuery(document).on('ajaxSuccess', function(event, xhr, settings) { if (!jQuery.trim(xhr.responseText)) { return; } return triggerEvent(EVENTS.UPDATE); }); } }; installHistoryChangeHandler = function(event) { var cachedPage, _ref; if ((_ref = event.state) != null ? _ref.turbolinks : void 0) { if (cachedPage = pageCache[(new ComponentUrl(event.state.url)).absolute]) { cacheCurrentPage(); return fetchHistory(cachedPage); } else { return visit(event.target.location.href); } } }; initializeTurbolinks = function() { rememberCurrentUrl(); rememberCurrentState(); createDocument = browserCompatibleDocumentParser(); document.addEventListener('click', Click.installHandlerLast, true); window.addEventListener('hashchange', function(event) { rememberCurrentUrl(); return rememberCurrentState(); }, false); return bypassOnLoadPopstate(function() { return window.addEventListener('popstate', installHistoryChangeHandler, false); }); }; historyStateIsDefined = window.history.state !== void 0 || navigator.userAgent.match(/Firefox\/2[6|7]/); browserSupportsPushState = window.history && window.history.pushState && window.history.replaceState && historyStateIsDefined; browserIsntBuggy = !navigator.userAgent.match(/CriOS\//); requestMethodIsSafe = (_ref = popCookie('request_method')) === 'GET' || _ref === ''; browserSupportsTurbolinks = browserSupportsPushState && browserIsntBuggy && requestMethodIsSafe; browserSupportsCustomEvents = document.addEventListener && document.createEvent; if (browserSupportsCustomEvents) { installDocumentReadyPageEventTriggers(); installJqueryAjaxSuccessPageUpdateTrigger(); } if (browserSupportsTurbolinks) { visit = fetch; initializeTurbolinks(); } else { visit = function(url) { return document.location.href = url; }; } this.Turbolinks = { visit: visit, pagesCached: pagesCached, enableTransitionCache: enableTransitionCache, allowLinkExtensions: Link.allowExtensions, supported: browserSupportsTurbolinks, EVENTS: clone(EVENTS) }; }).call(this); ;TI"dependency_digest;TI"%c1571315093f12420b239e18c74fdd8f;FI"required_paths;T[I"n/Users/benoit/.rvm/gems/ruby-2.0.0-p247/gems/turbolinks-2.4.0/lib/assets/javascripts/turbolinks.js.coffee;FI"dependency_paths;T[{I" path;TI"n/Users/benoit/.rvm/gems/ruby-2.0.0-p247/gems/turbolinks-2.4.0/lib/assets/javascripts/turbolinks.js.coffee;FI" mtime;TI"2014-10-13T08:51:53+02:00;TI" digest;TI"%23170c217fb507fe851d999143421c47;FI" _version;TI"%aed3113fdeca372cf743bc063ad6b94a;F