o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1388436950.109694:@value"ø
{I"
class:EFI"BundledAsset; FI"logical_path; FI"mercury/tooltip.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/tooltip.js.coffee; FI"content_type; FI"application/javascript; FI"
mtime; FI"2013-11-20T08:09:45-05:00; FI"length; FiÞI"digest; F"%f4e11964dca2234c2b437911ea8d9419I"source; FI"Þ(function() {
this.Mercury.tooltip = function(forElement, content, options) {
if (options == null) {
options = {};
}
Mercury.tooltip.show(forElement, content, options);
return Mercury.tooltip;
};
jQuery.extend(Mercury.tooltip, {
show: function(forElement, content, options) {
this.forElement = forElement;
this.content = content;
this.options = options != null ? options : {};
this.document = this.forElement.get(0).ownerDocument;
this.initialize();
if (this.visible) {
return this.update();
} else {
return this.appear();
}
},
initialize: function() {
if (this.initialized) {
return;
}
this.build();
this.bindEvents();
return this.initialized = true;
},
build: function() {
var _ref;
this.element = jQuery('
', {
"class": 'mercury-tooltip'
});
return this.element.appendTo((_ref = jQuery(this.options.appendTo).get(0)) != null ? _ref : 'body');
},
bindEvents: function() {
var parent, _i, _len, _ref,
_this = this;
Mercury.on('resize', function() {
if (_this.visible) {
return _this.position();
}
});
this.element.on('mousedown', function(event) {
event.preventDefault();
return event.stopPropagation();
});
_ref = this.forElement.parentsUntil(jQuery('body', this.document));
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
parent = _ref[_i];
if (!(parent.scrollHeight > parent.clientHeight)) {
continue;
}
jQuery(parent).on('scroll', function() {
if (_this.visible) {
return _this.position();
}
});
}
return jQuery(this.document).on('scroll', function() {
if (_this.visible) {
return _this.position();
}
});
},
appear: function() {
var _this = this;
this.update();
this.element.show();
return this.element.animate({
opacity: 1
}, 200, 'easeInOutSine', function() {
return _this.visible = true;
});
},
update: function() {
this.element.html(this.content);
return this.position();
},
position: function() {
var left, offset, top, width;
offset = this.forElement.offset();
width = this.element.width();
top = offset.top + (Mercury.displayRect.top - jQuery(this.document).scrollTop()) + this.forElement.outerHeight();
left = offset.left - jQuery(this.document).scrollLeft();
if ((left + width + 25) > Mercury.displayRect.width) {
left = left - (left + width + 25) - Mercury.displayRect.width;
}
left = left <= 0 ? 0 : left;
return this.element.css({
top: top,
left: left
});
},
hide: function() {
if (!this.initialized) {
return;
}
this.element.hide();
return this.visible = false;
}
});
}).call(this);
; FI"required_assets_digest; F"%8de533e096f8f7141c07118e8ad28819I"
_version; F"%6776f581a4329e299531e1d52aa59832