(function(window) {
	var delay, cardTpl, currentCard, destroyDelay;
	$(document).ready(function() {
		window.ajaxify.loadTemplate('mentions/card', function(tpl) {
			cardTpl = tpl;

			$(window).on('action:ajaxify.end', function() {
				$('.container').off("mouseenter.card mouseleave.card", ".plugin-mentions-a").on("mouseenter.card mouseleave.card", ".plugin-mentions-a", function(e){
					var target = $(e.currentTarget);
					if (e.type === "mouseenter" && !target.is(currentCard)) {
						delay = setTimeout(function() {
							createCard(target, target.attr('href'));
						}, 500);
					} else {
						if (target.is(currentCard)) {
							destroyDelay = setTimeout(function() {
								destroyCard(target);
							}, 500);
							target.next('.popover').off("mouseenter.card mouseleave.card").on("mouseenter.card mouseleave.card", function(e) {
								if (e.type === "mouseenter") {
									clearTimeout(destroyDelay);
								} else {
									destroyDelay = setTimeout(function() {
										destroyCard(target);
									}, 500);
								}
							});
						}
						clearTimeout(delay);
					}
				});
			});
		});
	});

	function destroyCard(target) {
		target.popover('destroy');
		currentCard = null;
	}

	function createCard(target, url) {
		var api = '/api' + url;
		$.get(api, function(result) {
			result.name = result.fullname || result.username;
			switch (result.status) {
				case 'online':
					result.statusTitle = 'Online';
					break;
				case 'away':
					result.statusTitle = 'Away';
					break;
				case 'dnd':
					result.statusTitle = 'Do not Disturb';
					break;
				case 'offline':
					result.statusTitle = 'Offline';
					break;
				default:
					result.statusTitle = 'Offline';
					break
			}

			var html = window.templates.parse(cardTpl, result);

			target.popover({
				html: true,
				content: html,
				placement: "top",
				trigger: "manual"
			}).popover('show');

			$('.mentions-card-stats li').tooltip();

			utils.makeNumbersHumanReadable($('.mentions-card-stats li span'));

			$('.mentions-card-chat').off('click.card').on('click.card', function(e) {
				var card = $(e.currentTarget).parents('.mentions-card');
				app.openChat(card.data('username'), card.data('uid'));
				return false;
			});
			currentCard = target;
		});
	}
})(window);

@@ -59,17 +59,134 @@
 royDelay
-;
+,%0A%09%09events = 'mouseenter.card mouseleave.card',%0A%09%09selector = 'a%5Bhref*=%22/user/%22%5D:not(.mentions-card-img-container a)';%0A
 %0A%09$(docu
@@ -371,175 +371,188 @@
 off(
-%22mouseenter.card mouseleave.card%22, %22.plugin-mentions-a%22).on(%22mouseenter.card mouseleave.card%22, %22.plugin-mentions-a%22, function(e)%7B%0A%09%09%09%09%09var target = $(e.currentTarget);
+events, selector).on(events, selector, function(e)%7B%0A%09%09%09%09%09var target = $(e.currentTarget);%0A%09%09%09%09%09if (target.children('img')) %7B%0A%09%09%09%09%09%09target.children('img').tooltip('destroy');%0A%09%09%09%09%09%7D
 %0A%09%09%09
@@ -694,16 +694,39 @@
 ('href')
+.match(/%5C/user%5C/.+/)%5B0%5D
 );%0A%09%09%09%09%09
@@ -894,14 +894,16 @@
 get.
-next('
+data('bs
 .pop
@@ -912,84 +912,38 @@
 er')
-.off(%22mouseenter.card mouseleave.card%22).on(%22mouseenter.card mouseleave.card%22
+%5B'$tip'%5D.off(events).on(events
 , fu
@@ -1964,13 +1964,13 @@
 nt: 
-%22top%22
+'top'
 ,%0A%09%09
@@ -1984,16 +1984,39 @@
 er: 
-%22
+'
 manual
-%22
+',%0A%09%09%09%09container: 'body'
 %0A%09%09%09
@@ -2406,16 +2406,72 @@
 %09%09%7D);%0A%09%7D
+%0A%0A%09app.createUserTooltips = function() %7B%0A%09%09//so metal%0A%09%7D
 %0A%7D)(wind

Add cards to all the links!