v1.18.x
psychobunny 9 years ago
parent 71cd6b39d2
commit 5d77e37a3c

@ -64,17 +64,21 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator
}; };
function addVoteHandler() { function addVoteHandler() {
components.get('topic').on('mouseenter', '[data-pid] [component="post/vote-count"]', function() { components.get('topic').on('mouseenter', '[data-pid] [component="post/vote-count"]', loadDataAndCreateTooltip);
loadDataAndCreateTooltip($(this).parent());
});
} }
function loadDataAndCreateTooltip(el) { function loadDataAndCreateTooltip() {
var pid = el.parents('[data-pid]').attr('data-pid'); var $this = $(this),
el = $this.parent(),
pid = el.parents('[data-pid]').attr('data-pid');
$this.off('mouseenter', loadDataAndCreateTooltip);
socket.emit('posts.getUpvoters', [pid], function(err, data) { socket.emit('posts.getUpvoters', [pid], function(err, data) {
if (!err && data.length) { if (!err && data.length) {
createTooltip(el, data[0]); createTooltip(el, data[0]);
} }
$this.on('mouseenter', loadDataAndCreateTooltip);
}); });
} }

Loading…
Cancel
Save