{I" class:ETI"BundledAsset;FI"logical_path;TI"rubber_ring/link_editor.js;FI" pathname;TI"`/home/vagrant/development/rubber_ring/app/assets/javascripts/rubber_ring/link_editor.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+až‚QI" length;TiI" digest;TI"%6bb450ed203c731312f48ca9f7a29515;FI" source;TI"(function() { this.LinkEditor = (function() { var getSelectionStartNode; function LinkEditor(editable_content) { this.editable_content = editable_content; } LinkEditor.prototype.init = function() { var $edit_link, _this = this; $edit_link = $("#rubber-ring-application #edit-link"); this.editable_content.bind("click", "a", function(e) { var $node; $node = $(getSelectionStartNode()); if ($node !== null && $node.is("a")) { e.stopPropagation(); $edit_link.css({ top: $node.offset().top - $edit_link.height() - 5, left: $node.offset().left }).show(); $edit_link.data("node", $node); $("#link-title").val($node.text()); $("#link-href").val($node.attr("href")); return $("#link-preview").attr("href", $node.attr("href")); } else { return $edit_link.hide(); } }); $(document).bind("click", function(e) { e.stopPropagation(); if ($("#edit-link").is(":visible") && $(e.target).parents("#edit-link").length === 0) { return $edit_link.hide(); } }); $("#link-title").bind("change", function(e) { var $node; $node = $edit_link.data("node"); $node.text($(e.currentTarget).val()); return $node.parents("[contenteditable]").trigger("change"); }); return $("#link-href").bind("change", function(e) { var $node; $node = $edit_link.data("node"); $node.add("#link-preview").attr("href", $(e.currentTarget).val()); return $node.parents("[contenteditable]").trigger("change"); }); }; getSelectionStartNode = function() { var node; if (window.getSelection) { node = window.getSelection().anchorNode; if (node !== null && node.nodeName === "#text") { return node.parentNode; } else { return node; } } }; return LinkEditor; })(); }).call(this); ;TI"required_assets_digest;TI"%742b35358a9778732cb8bc23e4db8f54;FI" _version;TI"%1e2632a10b8c877576b37720d5bf8883;F