|
|
|
@ -36,13 +36,26 @@ define('forum/topic/postTools', ['composer', 'share', 'navigator'], function(com
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function addFavouriteHandler() {
|
|
|
|
|
$('#post-container').on('mouseenter', '.favourite-tooltip', function(e) {
|
|
|
|
|
$('#post-container').on('mouseenter', '.favourite-tooltip', function() {
|
|
|
|
|
if (!$(this).data('users-loaded')) {
|
|
|
|
|
$(this).data('users-loaded', "true");
|
|
|
|
|
$(this).data('users-loaded', 'true');
|
|
|
|
|
var pid = $(this).parents('.post-row').attr('data-pid');
|
|
|
|
|
var el = $(this).attr('title', "Loading...");
|
|
|
|
|
socket.emit('posts.getFavouritedUsers', pid, function(err, usernames) {
|
|
|
|
|
el.attr('title', usernames).tooltip('show');
|
|
|
|
|
if (err) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (usernames.length > 6) {
|
|
|
|
|
var otherCount = usernames.length - 5;
|
|
|
|
|
usernames = usernames.slice(0, 5).join(', ').replace(/,/g, '|');
|
|
|
|
|
translator.translate('[[topic:users_and_others, ' + usernames + ', ' + otherCount + ']]', function(translated) {
|
|
|
|
|
translated = translated.replace(/\|/g, ',');
|
|
|
|
|
el.attr('title', translated).tooltip('show');
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
usernames = usernames.join(', ');
|
|
|
|
|
el.attr('title', usernames).tooltip('show');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|