mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 22:45:46 +01:00
perf: create user tooltips on demand
This commit is contained in:
@@ -214,12 +214,16 @@ app.flags = {};
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
els = els || $('body');
|
els = els || $('body');
|
||||||
els.find('.avatar,img[title].teaser-pic,img[title].user-img,div.user-icon,span.user-icon').each(function () {
|
els.find('.avatar,img[title].teaser-pic,img[title].user-img,div.user-icon,span.user-icon').one('mouseenter', function (ev) {
|
||||||
$(this).tooltip({
|
const $this = $(this);
|
||||||
placement: placement || $(this).attr('title-placement') || 'top',
|
// perf: create tooltips on demand
|
||||||
title: $(this).attr('title'),
|
$this.tooltip({
|
||||||
|
placement: placement || $this.attr('title-placement') || 'top',
|
||||||
|
title: $this.attr('title'),
|
||||||
container: '#content',
|
container: '#content',
|
||||||
});
|
});
|
||||||
|
// this will cause the tooltip to show up
|
||||||
|
$this.trigger(ev);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -234,15 +238,10 @@ app.flags = {};
|
|||||||
|
|
||||||
app.processPage = function () {
|
app.processPage = function () {
|
||||||
highlightNavigationLink();
|
highlightNavigationLink();
|
||||||
|
|
||||||
$('.timeago').timeago();
|
$('.timeago').timeago();
|
||||||
|
|
||||||
utils.makeNumbersHumanReadable($('.human-readable-number'));
|
utils.makeNumbersHumanReadable($('.human-readable-number'));
|
||||||
|
|
||||||
utils.addCommasToNumbers($('.formatted-number'));
|
utils.addCommasToNumbers($('.formatted-number'));
|
||||||
|
|
||||||
app.createUserTooltips($('#content'));
|
app.createUserTooltips($('#content'));
|
||||||
|
|
||||||
app.createStatusTooltips();
|
app.createStatusTooltips();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ define('forum/account/posts', ['forum/account/header', 'forum/infinitescroll', '
|
|||||||
$('[component="posts"]').append(html);
|
$('[component="posts"]').append(html);
|
||||||
html.find('img:not(.not-responsive)').addClass('img-responsive');
|
html.find('img:not(.not-responsive)').addClass('img-responsive');
|
||||||
html.find('.timeago').timeago();
|
html.find('.timeago').timeago();
|
||||||
app.createUserTooltips();
|
app.createUserTooltips(html);
|
||||||
utils.makeNumbersHumanReadable(html.find('.human-readable-number'));
|
utils.makeNumbersHumanReadable(html.find('.human-readable-number'));
|
||||||
hooks.fire('action:posts.loaded', { posts: posts });
|
hooks.fire('action:posts.loaded', { posts: posts });
|
||||||
callback();
|
callback();
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ define('forum/account/topics', [
|
|||||||
app.parseAndTranslate(template, 'topics', { topics: topics }, function (html) {
|
app.parseAndTranslate(template, 'topics', { topics: topics }, function (html) {
|
||||||
$('[component="category"]').append(html);
|
$('[component="category"]').append(html);
|
||||||
html.find('.timeago').timeago();
|
html.find('.timeago').timeago();
|
||||||
app.createUserTooltips();
|
app.createUserTooltips(html);
|
||||||
utils.makeNumbersHumanReadable(html.find('.human-readable-number'));
|
utils.makeNumbersHumanReadable(html.find('.human-readable-number'));
|
||||||
hooks.fire('action:topics.loaded', { topics: topics });
|
hooks.fire('action:topics.loaded', { topics: topics });
|
||||||
callback();
|
callback();
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ define('forum/categories', ['components', 'categorySelector', 'hooks'], function
|
|||||||
|
|
||||||
html.fadeIn();
|
html.fadeIn();
|
||||||
|
|
||||||
app.createUserTooltips();
|
app.createUserTooltips(html);
|
||||||
html.find('.timeago').timeago();
|
html.find('.timeago').timeago();
|
||||||
|
|
||||||
if (category.find('[component="category/posts"]').length > parseInt(numRecentReplies, 10)) {
|
if (category.find('[component="category/posts"]').length > parseInt(numRecentReplies, 10)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user