{I"
class:ETI"ProcessedAsset;�FI"logical_path;�TI"mercury/snippet_toolbar.js;�FI"
pathname;�TI"�/home/edik/.rvm/gems/ruby-2.0.0-p247@very_simple_cms/bundler/gems/mercury-3e0245e33195/app/assets/javascripts/mercury/snippet_toolbar.js.coffee;�FI"content_type;�TI"application/javascript;�TI"
mtime;�Tl+��9RI"length;�TiI"digest;�TI"%a2fad90d9507ab9cc51faa657ee83bc5;�FI"source;�TI"(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('<div>', {
        "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);
;�TI"dependency_digest;�TI"%86ebf093a643cc53f9c63ac2fbfc5fd6;�FI"required_paths;�T[I"�/home/edik/.rvm/gems/ruby-2.0.0-p247@very_simple_cms/bundler/gems/mercury-3e0245e33195/app/assets/javascripts/mercury/snippet_toolbar.js.coffee;�FI"dependency_paths;�T[{I"	path;�TI"�/home/edik/.rvm/gems/ruby-2.0.0-p247@very_simple_cms/bundler/gems/mercury-3e0245e33195/app/assets/javascripts/mercury/snippet_toolbar.js.coffee;�FI"
mtime;�TI"2013-09-18T16:51:09+04:00;�TI"digest;�TI"%9bedce05dd9b68f6d02795e88c3c50b7;�FI"
_version;�TI"%2cf3622cbba861b85d33ffabfa420c13;�F