From 0b26cfdd43a7feca20487e11552ca3b8403b8a86 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Sun, 4 Oct 2015 01:13:47 -0400 Subject: [PATCH] #3705 --- public/src/app.js | 5 +++-- public/src/client/topic/posts.js | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/public/src/app.js b/public/src/app.js index 77b58014ed..6d724f3f49 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -157,8 +157,9 @@ app.cacheBuster = null; } } - app.createUserTooltips = function() { - $('img[title].teaser-pic,img[title].user-img').each(function() { + app.createUserTooltips = function(els) { + els = els || $('body'); + els.find('img[title].teaser-pic,img[title].user-img').each(function() { $(this).tooltip({ placement: 'top', title: $(this).attr('title') diff --git a/public/src/client/topic/posts.js b/public/src/client/topic/posts.js index 18ece118bb..cce1c4d7d6 100644 --- a/public/src/client/topic/posts.js +++ b/public/src/client/topic/posts.js @@ -88,7 +88,7 @@ define('forum/topic/posts', [ } function removeAlreadyAddedPosts() { - var newPosts = components.get('topic').find('[data-index][data-index!="0"].new'); + var newPosts = $('[component="post"].new'); if (newPosts.length === data.posts.length) { var allSamePids = true; @@ -117,7 +117,7 @@ define('forum/topic/posts', [ } data.posts = data.posts.filter(function(post) { - return components.get('post', 'pid', post.pid).length === 0; + return $('[component="post"][data-pid="' + post.pid + '"]').length === 0; }); } @@ -157,7 +157,7 @@ define('forum/topic/posts', [ components.get('topic').append(html); } - infinitescroll.removeExtra(components.get('post'), direction, 40); + infinitescroll.removeExtra($('[component="post"]'), direction, 40); $(window).trigger('action:posts.loaded', {posts: data.posts}); @@ -207,7 +207,7 @@ define('forum/topic/posts', [ }; Posts.processPage = function(posts) { - app.createUserTooltips(); + app.createUserTooltips(posts); app.replaceSelfLinks(posts.find('a')); utils.addCommasToNumbers(posts.find('.formatted-number')); utils.makeNumbersHumanReadable(posts.find('.human-readable-number'));