o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1357543300.248359: @value"„{I" class:EFI"ProcessedAsset;FI"logical_path;FI"wiselinks.js;TI" pathname;FI"O/Users/igor/workspace/wiselinks/lib/assets/javascripts/wiselinks.js.coffee;TI"content_type;FI"application/javascript;FI" mtime;FI"2012-12-28T21:38:43+04:00;FI" length;FiiI" digest;F"%c2d8419a0ac9b27fc95bb9926142dda5I" source;FI"i(function() { var Wiselinks; String.prototype.ends_with = function(suffix) { return this.indexOf(suffix, this.length - suffix.length) !== -1; }; Wiselinks = (function() { function Wiselinks($target, options) { var self; this.$target = $target != null ? $target : $('body'); this.options = options != null ? options : {}; if (window.jQuery == null) { throw "Load jQuery to use Wiselinks"; } self = this; this.options = jQuery.extend(self._defaults(), this.options); if (self.enabled()) { this.assets_digest = $("meta[name='assets-digest']").attr("content"); if (History.emulated.pushState && this.options.html4 === true) { if (window.location.href.indexOf('#!') === -1 && window.location.pathname !== '/') { window.location.href = "" + window.location.protocol + "//" + window.location.host + "/#!" + window.location.pathname; } if (window.location.hash.indexOf('#!') !== -1) { self._call(window.location.hash.substring(2)); } } History.Adapter.bind(window, "statechange", function(event, data) { var state; if (!History.ready) { return false; } state = History.getState(); return self._call(state.url, state.data.target, state.data.render); }); $(document).on("submit", "form[data-push], form[data-replace]", function(event) { self._process_form($(this)); event.preventDefault(); return false; }); $(document).on("click", "a[data-push], a[data-replace]", function(event) { if (self._cross_origin_link(event.target) || self._non_standard_click(event)) { return true; } self._process_link($(this)); event.preventDefault(); return false; }); } } Wiselinks.prototype.enabled = function() { return !History.emulated.pushState || this.options.html4 === true; }; Wiselinks.prototype.load = function(url, target, render) { if (render == null) { render = 'template'; } History.ready = true; return History.pushState({ timestamp: new Date().getTime(), render: render, target: target }, document.title, url); }; Wiselinks.prototype.reload = function() { History.ready = true; return History.replaceState({ timestamp: new Date().getTime(), render: 'template' }, document.title, History.getState().url); }; Wiselinks.prototype._defaults = function() { return { html4: true }; }; Wiselinks.prototype._call = function(url, target, render) { var $document, $target, self; if (render == null) { render = 'template'; } self = this; $target = target != null ? $(target) : self.$target; $document = $(document).trigger('page:loading', [url, $target.selector, render]); return $.ajax({ url: url, headers: { 'X-Render': render }, complete: function(xhr, status) { return $document.trigger('page:complete', [xhr, status]); }, success: function(data, status, xhr) { if (self._assets_changed(xhr.getResponseHeader('X-Assets-Digest'))) { return window.location.reload(true); } else { self._set_title(xhr); $target.html(data); return $document.trigger('page:success', [data, status]); } }, error: function(xhr, status, error) { return $document.trigger('page:error', [status, error]); }, dataType: "html" }); }; Wiselinks.prototype._process_form = function($form) { var $disable, item, key, name, params, self, serialized, type, url, _i, _len, _ref; self = this; $disable = $form.find(':input[value=""]'); $disable.attr('disabled', true); params = {}; _ref = $form.serializeArray(); for (_i = 0, _len = _ref.length; _i < _len; _i++) { item = _ref[_i]; if (item.name !== 'utf8') { name = item.name.ends_with('[]') ? item.name.substr(0, item.name.length - 2) : item.name; if (params[name] != null) { params[name] = params[name] + ("," + item.value); } else { params[name] = item.value; } } } serialized = []; for (key in params) { serialized.push("" + key + "=" + params[key]); } serialized = serialized.join('&').replace(/%|!/g, ''); url = $form.attr("action"); if (serialized.length > 0) { url += "?" + serialized; } $disable.attr('disabled', false); type = $form.attr("data-push") === 'partial' ? 'partial' : 'template'; return self.load(url, $form.attr("data-target"), type); }; Wiselinks.prototype._process_link = function($link) { var self, type; self = this; type = $link.attr("data-push") === 'partial' ? 'partial' : 'template'; return self.load($link.attr("href"), $link.attr("data-target"), type); }; Wiselinks.prototype._cross_origin_link = function(link) { return (location.protocol !== link.protocol) || (location.host.split(':')[0] !== link.host.split(':')[0]); }; Wiselinks.prototype._non_standard_click = function(event) { return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey; }; Wiselinks.prototype._assets_changed = function(digest) { return (this.assets_digest != null) && this.assets_digest !== digest; }; Wiselinks.prototype._set_title = function(xhr) { var value; value = xhr.getResponseHeader('X-Title'); if (value != null) { return document.title = decodeURI(value); } }; return Wiselinks; })(); window.Wiselinks = Wiselinks; }).call(this); ;TI"dependency_digest;F"%e9ceff7512778917c1be99e3e295b2efI"required_paths;F[ I"G/Users/igor/workspace/wiselinks/lib/assets/javascripts/_history.js;TI"M/Users/igor/workspace/wiselinks/lib/assets/javascripts/_history.html4.js;TI"V/Users/igor/workspace/wiselinks/lib/assets/javascripts/_history.adapter.jquery.js;TI"O/Users/igor/workspace/wiselinks/lib/assets/javascripts/wiselinks.js.coffee;TI"dependency_paths;F[ {I" path;FI"O/Users/igor/workspace/wiselinks/lib/assets/javascripts/wiselinks.js.coffee;TI" mtime;FI"2012-12-28T21:38:43+04:00;FI" digest;F"%9a924f363ddfe964d981ece142fca743{I" path;FI"G/Users/igor/workspace/wiselinks/lib/assets/javascripts/_history.js;TI" mtime;FI"2012-12-26T12:53:50+04:00;FI" digest;F"%cfb7a031b62bcdf71ed3765a0cdd02bf{I" path;FI"M/Users/igor/workspace/wiselinks/lib/assets/javascripts/_history.html4.js;TI" mtime;FI"2012-12-26T11:52:54+04:00;FI" digest;F"%5221fbd078a8713ac27378052f7bde84{I" path;FI"V/Users/igor/workspace/wiselinks/lib/assets/javascripts/_history.adapter.jquery.js;TI" mtime;FI"2012-12-24T17:10:52+04:00;FI" digest;F"%fca8ad52436d121e1da7f6ac17b4d5e5I" _version;F"%ffd318ca8b794f42f5029101c2cf5d91