nodebb-plugin-cards
Advanced tools
Comparing version 0.0.9 to 0.1.0
{ | ||
"name": "nodebb-plugin-cards", | ||
"version": "0.0.9", | ||
"version": "0.1.0", | ||
"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, targetCard, currentCard, destroyDelay, | ||
events = 'mouseenter.card mouseleave.card', | ||
@@ -32,2 +32,3 @@ exitEvent = 'click.card', | ||
}, 500); | ||
targetCard = target; | ||
} else { | ||
@@ -51,2 +52,3 @@ //Otherwise add some handlers for destroying a card | ||
clearTimeout(delay); | ||
targetCard = null; | ||
} | ||
@@ -57,2 +59,6 @@ } | ||
$(window).on('action:ajaxify.start', function() { | ||
if (delay) { | ||
clearTimeout(delay); | ||
delay = 0; | ||
} | ||
//Destroy any cards before ajaxifying | ||
@@ -62,2 +68,3 @@ if (currentCard) { | ||
} | ||
targetCard = null; | ||
}); | ||
@@ -79,3 +86,4 @@ }); | ||
translator.translate(html, function(translated) { | ||
if (!target.is(currentCard)) { | ||
//If target is not the currentCard and if the target is the targetCard | ||
if (!target.is(currentCard) && target.is(targetCard)) { | ||
//If there's an existing card, destroy it | ||
@@ -82,0 +90,0 @@ if (currentCard) { |
7323
130