mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 04:25:55 +01:00
reduce initial js payload/requests
This commit is contained in:
@@ -8,12 +8,11 @@ define('forum/topic', [
|
||||
'forum/topic/events',
|
||||
'forum/topic/posts',
|
||||
'forum/topic/images',
|
||||
'forum/topic/replies',
|
||||
'navigator',
|
||||
'sort',
|
||||
'components',
|
||||
'storage',
|
||||
], function (infinitescroll, threadTools, postTools, events, posts, images, replies, navigator, sort, components, storage) {
|
||||
], function (infinitescroll, threadTools, postTools, events, posts, images, navigator, sort, components, storage) {
|
||||
var Topic = {};
|
||||
var currentUrl = '';
|
||||
|
||||
@@ -49,7 +48,6 @@ define('forum/topic', [
|
||||
|
||||
postTools.init(tid);
|
||||
threadTools.init(tid);
|
||||
replies.init(tid);
|
||||
events.init();
|
||||
|
||||
sort.handleSort('topicPostSort', 'user.setTopicSort', 'topic/' + ajaxify.data.slug);
|
||||
@@ -61,6 +59,7 @@ define('forum/topic', [
|
||||
addBlockQuoteHandler();
|
||||
addParentHandler();
|
||||
addDropupHandler();
|
||||
addRepliesHandler();
|
||||
|
||||
navigator.init('[component="post"]', ajaxify.data.postcount, Topic.toTop, Topic.toBottom, Topic.navigatorCallback, Topic.calculateIndex);
|
||||
|
||||
@@ -177,6 +176,15 @@ define('forum/topic', [
|
||||
});
|
||||
}
|
||||
|
||||
function addRepliesHandler() {
|
||||
$('[component="topic"]').on('click', '[component="post/reply-count"]', function () {
|
||||
var btn = $(this);
|
||||
require(['forum/topic/replies'], function (replies) {
|
||||
replies.init(btn);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function updateTopicTitle() {
|
||||
var span = components.get('navbar/title').find('span');
|
||||
if ($(window).scrollTop() > 50 && span.hasClass('hidden')) {
|
||||
|
||||
Reference in New Issue
Block a user