o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1388437012.9854321: @value"'{I" class:EFI"BundledAsset;FI"logical_path;FI"mercury/snippet_toolbar.js;FI" pathname;FI"/Users/jrissler/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/mercury-rails-0.9.0/app/assets/javascripts/mercury/snippet_toolbar.js.coffee;FI"content_type;FI"application/javascript;FI" mtime;FI"2013-12-30T11:31:51-05:00;FI" length;FiI" digest;F"%0551d612b792de2534bd90e8e7ae22eeI" 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.SnippetToolbar = (function(_super) { __extends(SnippetToolbar, _super); function SnippetToolbar(document, options) { this.document = document; this.options = options != null ? options : {}; this._boundEvents = []; SnippetToolbar.__super__.constructor.call(this, this.options); } SnippetToolbar.prototype.build = function() { var button, buttonName, options, _ref, _ref1, _results; this.element = jQuery('
', { "class": 'mercury-toolbar mercury-snippet-toolbar', style: 'display:none' }); this.element.appendTo((_ref = jQuery(this.options.appendTo).get(0)) != null ? _ref : 'body'); _ref1 = Mercury.config.toolbars.snippets; _results = []; for (buttonName in _ref1) { if (!__hasProp.call(_ref1, buttonName)) continue; options = _ref1[buttonName]; button = this.buildButton(buttonName, options); if (button) { _results.push(button.appendTo(this.element)); } else { _results.push(void 0); } } return _results; }; SnippetToolbar.prototype.bindEvents = function() { var _this = this; this.bindReleasableEvent(Mercury, 'show:toolbar', function(event, options) { if (!options.snippet) { return; } options.snippet.mouseout(function() { return _this.hide(); }); return _this.show(options.snippet); }); this.bindReleasableEvent(Mercury, 'hide:toolbar', function(event, options) { if (!(options.type && options.type === 'snippet')) { return; } return _this.hide(options.immediately); }); this.bindReleasableEvent(jQuery(this.document), 'scroll', function() { if (_this.visible) { return _this.position(); } }); this.element.mousemove(function() { return clearTimeout(_this.hideTimeout); }); return this.element.mouseout(function() { return _this.hide(); }); }; SnippetToolbar.prototype.bindReleasableEvent = function(target, eventName, handler) { target.on(eventName, handler); return this._boundEvents.push([target, eventName, handler]); }; SnippetToolbar.prototype.show = function(snippet) { this.snippet = snippet; Mercury.tooltip.hide(); this.position(); return this.appear(); }; SnippetToolbar.prototype.position = function() { var left, offset, top; offset = this.snippet.offset(); top = offset.top + Mercury.displayRect.top - jQuery(this.document).scrollTop() - this.height() + 10; left = offset.left - jQuery(this.document).scrollLeft(); return this.element.css({ top: top, left: left }); }; SnippetToolbar.prototype.appear = function() { clearTimeout(this.hideTimeout); if (this.visible) { return; } this.visible = true; this.element.css({ display: 'block', opacity: 0 }); return this.element.stop().animate({ opacity: 1 }, 200, 'easeInOutSine'); }; SnippetToolbar.prototype.hide = function(immediately) { var _this = this; if (immediately == null) { immediately = false; } clearTimeout(this.hideTimeout); if (immediately) { this.element.hide(); return this.visible = false; } else { return this.hideTimeout = setTimeout(function() { _this.element.stop().animate({ opacity: 0 }, 300, 'easeInOutSine', function() { return _this.element.hide(); }); return _this.visible = false; }, 500); } }; SnippetToolbar.prototype.release = function() { var eventName, handler, target, _i, _len, _ref, _ref1; this.element.off(); this.element.remove(); _ref = this._boundEvents; for (_i = 0, _len = _ref.length; _i < _len; _i++) { _ref1 = _ref[_i], target = _ref1[0], eventName = _ref1[1], handler = _ref1[2]; target.off(eventName, handler); } return this._boundEvents = []; }; return SnippetToolbar; })(Mercury.Toolbar); }).call(this); ;FI"required_assets_digest;F"%be4f8899ade0792c8ecedf01c4c42675I" _version;F"%6776f581a4329e299531e1d52aa59832