Node.js based forum software built for the modern web
perf: create user tooltips on demand
Barış Soner Uşaklı231472354e59
diff --git a/public/src/app.js b/public/src/app.jsindex 6154c8b323..a20aaf0bde 100644--- a/public/src/app.js+++ b/public/src/app.js@@ -214,12 +214,16 @@ app.flags = {};return;}els = els || $('body');- els.find('.avatar,img[title].teaser-pic,img[title].user-img,div.user-icon,span.user-icon').each(function () {- $(this).tooltip({- placement: placement || $(this).attr('title-placement') || 'top',- title: $(this).attr('title'),+ els.find('.avatar,img[title].teaser-pic,img[title].user-img,div.user-icon,span.user-icon').one('mouseenter', function (ev) {+ const $this = $(this);+ // perf: create tooltips on demand+ $this.tooltip({+ placement: placement || $this.attr('title-placement') || 'top',+ title: $this.attr('title'),container: '#content',});+ // this will cause the tooltip to show up+ $this.trigger(ev);});};@@ -234,15 +238,10 @@ app.flags = {};app.processPage = function () {highlightNavigationLink();-$('.timeago').timeago();-utils.makeNumbersHumanReadable($('.human-readable-number'));-utils.addCommasToNumbers($('.formatted-number'));-app.createUserTooltips($('#content'));-app.createStatusTooltips();};diff --git a/public/src/client/account/posts.js b/public/src/client/account/posts.jsindex 27442e21a5..a4dbb619e1 100644--- a/public/src/client/account/posts.js+++ b/public/src/client/account/posts.js@@ -45,7 +45,7 @@ define('forum/account/posts', ['forum/account/header', 'forum/infinitescroll', '$('[component="posts"]').append(html);html.find('img:not(.not-responsive)').addClass('img-responsive');html.find('.timeago').timeago();- app.createUserTooltips();+ app.createUserTooltips(html);utils.makeNumbersHumanReadable(html.find('.human-readable-number'));hooks.fire('action:posts.loaded', { posts: posts });callback();diff --git a/public/src/client/account/topics.js b/public/src/client/account/topics.jsindex cba3358275..0bebfdac2f 100644--- a/public/src/client/account/topics.js+++ b/public/src/client/account/topics.js@@ -46,7 +46,7 @@ define('forum/account/topics', [app.parseAndTranslate(template, 'topics', { topics: topics }, function (html) {$('[component="category"]').append(html);html.find('.timeago').timeago();- app.createUserTooltips();+ app.createUserTooltips(html);utils.makeNumbersHumanReadable(html.find('.human-readable-number'));hooks.fire('action:topics.loaded', { topics: topics });callback();diff --git a/public/src/client/categories.js b/public/src/client/categories.jsindex 44025e8b8c..04010f5554 100644--- a/public/src/client/categories.js+++ b/public/src/client/categories.js@@ -56,7 +56,7 @@ define('forum/categories', ['components', 'categorySelector', 'hooks'], functionhtml.fadeIn();- app.createUserTooltips();+ app.createUserTooltips(html);html.find('.timeago').timeago();if (category.find('[component="category/posts"]').length > parseInt(numRecentReplies, 10)) {