nodebb-plugin-mentions-cards
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "nodebb-plugin-mentions-cards", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "NodeBB plugin that extends the mentions plugin with hover cards", | ||
@@ -5,0 +5,0 @@ "main": "library.js", |
(function(window) { | ||
var delay, cardTpl, currentCard, destroyDelay; | ||
var delay, cardTpl, currentCard, destroyDelay, | ||
events = 'mouseenter.card mouseleave.card', | ||
selector = 'a[href*="/user/"]:not(.mentions-card-img-container a)'; | ||
$(document).ready(function() { | ||
@@ -8,7 +11,10 @@ window.ajaxify.loadTemplate('mentions/card', function(tpl) { | ||
$(window).on('action:ajaxify.end', function() { | ||
$('.plugin-mentions-a').off("mouseenter.card mouseleave.card").on("mouseenter.card mouseleave.card", function(e){ | ||
$('.container').off(events, selector).on(events, selector, function(e){ | ||
var target = $(e.currentTarget); | ||
if (target.children('img')) { | ||
target.children('img').tooltip('destroy'); | ||
} | ||
if (e.type === "mouseenter" && !target.is(currentCard)) { | ||
delay = setTimeout(function() { | ||
createCard(target, target.attr('href')); | ||
createCard(target, target.attr('href').match(/\/user\/.+/)[0]); | ||
}, 500); | ||
@@ -20,3 +26,3 @@ } else { | ||
}, 500); | ||
target.next('.popover').off("mouseenter.card mouseleave.card").on("mouseenter.card mouseleave.card", function(e) { | ||
target.data('bs.popover')['$tip'].off(events).on(events, function(e) { | ||
if (e.type === "mouseenter") { | ||
@@ -70,4 +76,5 @@ clearTimeout(destroyDelay); | ||
content: html, | ||
placement: "top", | ||
trigger: "manual" | ||
placement: 'top', | ||
trigger: 'manual', | ||
container: 'body' | ||
}).popover('show'); | ||
@@ -77,2 +84,4 @@ | ||
utils.makeNumbersHumanReadable($('.mentions-card-stats li span')); | ||
$('.mentions-card-chat').off('click.card').on('click.card', function(e) { | ||
@@ -86,2 +95,6 @@ var card = $(e.currentTarget).parents('.mentions-card'); | ||
} | ||
})(window); | ||
app.createUserTooltips = function() { | ||
//so metal | ||
} | ||
})(window); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
6168
104