mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-11-03 20:45:58 +01:00 
			
		
		
		
	optimize ajaxify
- do not call $.timeago twice on topic load and for widgets - do not use toLocaleString for each timeago string, use a single Intl.DateTimeFormat instance instead - do not call format for empty timeago strings, ie a post that isnt edited doesnt have a timeago string - do not call isTouchDevice for every element - remove app.replaceSelfLinks, this is superceded with /me route - store references to jquery objects in navigator instead of creating them on every scroll
This commit is contained in:
		@@ -205,7 +205,7 @@ define('forum/topic/posts', [
 | 
			
		||||
 | 
			
		||||
			$(window).trigger('action:posts.loaded', { posts: data.posts });
 | 
			
		||||
 | 
			
		||||
			Posts.processPage(html);
 | 
			
		||||
			Posts.onNewPostsAddedToDom(html);
 | 
			
		||||
 | 
			
		||||
			callback(html);
 | 
			
		||||
		});
 | 
			
		||||
@@ -251,18 +251,22 @@ define('forum/topic/posts', [
 | 
			
		||||
		});
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	Posts.processPage = function (posts) {
 | 
			
		||||
	Posts.onTopicPageLoad = function (posts) {
 | 
			
		||||
		images.unloadImages(posts);
 | 
			
		||||
		Posts.showBottomPostBar();
 | 
			
		||||
		posts.find('[component="post/content"] img:not(.not-responsive)').addClass('img-responsive');
 | 
			
		||||
		addBlockquoteEllipses(posts.find('[component="post/content"] > blockquote > blockquote'));
 | 
			
		||||
		hidePostToolsForDeletedPosts(posts);
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	Posts.onNewPostsAddedToDom = function (posts) {
 | 
			
		||||
		Posts.onTopicPageLoad(posts);
 | 
			
		||||
 | 
			
		||||
		app.createUserTooltips(posts);
 | 
			
		||||
		app.replaceSelfLinks(posts.find('a'));
 | 
			
		||||
 | 
			
		||||
		utils.addCommasToNumbers(posts.find('.formatted-number'));
 | 
			
		||||
		utils.makeNumbersHumanReadable(posts.find('.human-readable-number'));
 | 
			
		||||
		posts.find('.timeago').timeago();
 | 
			
		||||
 | 
			
		||||
		addBlockquoteEllipses(posts.find('[component="post/content"] > blockquote > blockquote'));
 | 
			
		||||
		hidePostToolsForDeletedPosts(posts);
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	Posts.showBottomPostBar = function () {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user