o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1388436948.918636: @value"{I" class:EFI"ProcessedAsset;FI"logical_path;FI" mercury/regions/snippets.js;FI" pathname;FI"š/Users/jrissler/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/mercury-6daffeeb487e/app/assets/javascripts/mercury/regions/snippets.js.coffee;FI"content_type;FI"application/javascript;FI" mtime;FI"2013-11-20T08:09:45-05:00;FI" length;Fi I" digest;F"%0d42e3d9f4f83127bf3bd1ebe0b8ba42I" source;FI" (function() { var __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; }; this.Mercury.Regions.Snippets = (function(_super) { var type; __extends(Snippets, _super); Snippets.supported = document.getElementById; Snippets.supportedText = "Chrome 10+, Firefox 4+, IE 7+, Safari 5+, Opera 8+"; type = 'snippets'; Snippets.prototype.type = function() { return type; }; function Snippets(element, window, options) { this.element = element; this.window = window; this.options = options != null ? options : {}; Mercury.log("building " + type, this.element, this.options); Snippets.__super__.constructor.apply(this, arguments); this.makeSortable(); } Snippets.prototype.build = function() { var snippet, _i, _len, _ref; _ref = this.element.find('[data-snippet]'); for (_i = 0, _len = _ref.length; _i < _len; _i++) { snippet = _ref[_i]; jQuery(snippet).attr('data-version', 0); } if (this.element.css('minHeight') === '0px') { return this.element.css({ minHeight: 20 }); } }; Snippets.prototype.bindEvents = function() { var _this = this; Snippets.__super__.bindEvents.apply(this, arguments); Mercury.on('unfocus:regions', function(event) { if (_this.previewing) { return; } if (Mercury.region === _this) { _this.element.removeClass('focus'); _this.element.sortable('destroy'); return Mercury.trigger('region:blurred', { region: _this }); } }); Mercury.on('focus:window', function(event) { if (_this.previewing) { return; } if (Mercury.region === _this) { _this.element.removeClass('focus'); _this.element.sortable('destroy'); return Mercury.trigger('region:blurred', { region: _this }); } }); this.element.on('mouseup', function() { if (_this.previewing) { return; } _this.focus(); return Mercury.trigger('region:focused', { region: _this }); }); this.element.on('dragover', function(event) { if (_this.previewing) { return; } event.preventDefault(); return event.originalEvent.dataTransfer.dropEffect = 'copy'; }); this.element.on('drop', function(event) { if (_this.previewing || !Mercury.snippet) { return; } _this.focus(); event.preventDefault(); return Mercury.Snippet.displayOptionsFor(Mercury.snippet.name, {}, Mercury.snippet.hasOptions); }); jQuery(this.document).on('keydown', function(event) { if (_this.previewing || Mercury.region !== _this) { return; } switch (event.keyCode) { case 90: if (!event.metaKey) { return; } event.preventDefault(); if (event.shiftKey) { return _this.execCommand('redo'); } else { return _this.execCommand('undo'); } } }); return jQuery(this.document).on('keyup', function() { if (_this.previewing || Mercury.region !== _this) { return; } return Mercury.changes = true; }); }; Snippets.prototype.focus = function() { Mercury.region = this; this.makeSortable(); return this.element.addClass('focus'); }; Snippets.prototype.togglePreview = function() { if (this.previewing) { this.makeSortable(); } else { this.element.sortable('destroy'); this.element.removeClass('focus'); } return Snippets.__super__.togglePreview.apply(this, arguments); }; Snippets.prototype.execCommand = function(action, options) { var handler; if (options == null) { options = {}; } Snippets.__super__.execCommand.apply(this, arguments); if (handler = Mercury.Regions.Snippets.actions[action]) { return handler.call(this, options); } }; Snippets.prototype.makeSortable = function() { var _this = this; return this.element.sortable('destroy').sortable({ document: this.document, scroll: false, containment: 'parent', items: '[data-snippet]', opacity: 0.4, revert: 100, tolerance: 'pointer', beforeStop: function() { Mercury.trigger('hide:toolbar', { type: 'snippet', immediately: true }); return true; }, stop: function() { setTimeout((function() { return _this.pushHistory(); }), 100); return true; } }); }; Snippets.actions = { undo: function() { return this.content(this.history.undo()); }, redo: function() { return this.content(this.history.redo()); }, insertSnippet: function(options) { var existing, snippet, _this = this; snippet = options.value; if ((existing = this.element.find("[data-snippet=" + snippet.identity + "]")).length) { return existing.replaceWith(snippet.getHTML(this.document, function() { return _this.pushHistory(); })); } else { return this.element.append(snippet.getHTML(this.document, function() { return _this.pushHistory(); })); } }, editSnippet: function() { var snippet; if (!this.snippet) { return; } snippet = Mercury.Snippet.find(this.snippet.data('snippet')); return snippet.displayOptions(); }, removeSnippet: function() { if (this.snippet) { this.snippet.remove(); } return Mercury.trigger('hide:toolbar', { type: 'snippet', immediately: true }); } }; return Snippets; })(Mercury.Region); }).call(this); ;TI"dependency_digest;F"%261b673a61c6d2f23e013c98004aa6a9I"required_paths;F[I"š/Users/jrissler/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/mercury-6daffeeb487e/app/assets/javascripts/mercury/regions/snippets.js.coffee;FI"dependency_paths;F[{I" path;FI"š/Users/jrissler/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/mercury-6daffeeb487e/app/assets/javascripts/mercury/regions/snippets.js.coffee;FI" mtime;FI"2013-11-20T08:09:45-05:00;FI" digest;F"%194155bc0fa5c1641f7620e5d63c75a9I" _version;F"%6776f581a4329e299531e1d52aa59832