mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 17:16:14 +01:00
refactor: simple load new posts
This commit is contained in:
@@ -7,18 +7,5 @@
|
|||||||
"alltime": "All Time",
|
"alltime": "All Time",
|
||||||
"no_recent_topics": "There are no recent topics.",
|
"no_recent_topics": "There are no recent topics.",
|
||||||
"no_popular_topics": "There are no popular topics.",
|
"no_popular_topics": "There are no popular topics.",
|
||||||
|
"load-new-posts": "Load new posts"
|
||||||
"there-is-a-new-topic": "There is a new topic.",
|
|
||||||
"there-is-a-new-topic-and-a-new-post": "There is a new topic and a new post.",
|
|
||||||
"there-is-a-new-topic-and-new-posts": "There is a new topic and %1 new posts.",
|
|
||||||
|
|
||||||
"there-are-new-topics": "There are %1 new topics.",
|
|
||||||
"there-are-new-topics-and-a-new-post": "There are %1 new topics and a new post.",
|
|
||||||
"there-are-new-topics-and-new-posts": "There are %1 new topics and %2 new posts.",
|
|
||||||
|
|
||||||
"there-is-a-new-post": "There is a new post.",
|
|
||||||
"there-are-new-posts": "There are %1 new posts.",
|
|
||||||
|
|
||||||
"click-here-to-reload": "Click here to reload."
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -78,9 +78,6 @@ define('topicList', [
|
|||||||
}
|
}
|
||||||
|
|
||||||
TopicList.watchForNewPosts = function () {
|
TopicList.watchForNewPosts = function () {
|
||||||
$('#new-topics-alert').on('click', function () {
|
|
||||||
$(this).addClass('hide');
|
|
||||||
});
|
|
||||||
newPostCount = 0;
|
newPostCount = 0;
|
||||||
newTopicCount = 0;
|
newTopicCount = 0;
|
||||||
TopicList.removeListeners();
|
TopicList.removeListeners();
|
||||||
@@ -150,36 +147,10 @@ define('topicList', [
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateAlertText() {
|
function updateAlertText() {
|
||||||
let text = '';
|
if (newTopicCount > 0 || newPostCount > 0) {
|
||||||
|
$('#new-topics-alert').removeClass('hide').fadeIn('slow');
|
||||||
if (newTopicCount === 0) {
|
$('#category-no-topics').addClass('hide');
|
||||||
if (newPostCount === 1) {
|
|
||||||
text = '[[recent:there-is-a-new-post]]';
|
|
||||||
} else if (newPostCount > 1) {
|
|
||||||
text = '[[recent:there-are-new-posts, ' + newPostCount + ']]';
|
|
||||||
}
|
|
||||||
} else if (newTopicCount === 1) {
|
|
||||||
if (newPostCount === 0) {
|
|
||||||
text = '[[recent:there-is-a-new-topic]]';
|
|
||||||
} else if (newPostCount === 1) {
|
|
||||||
text = '[[recent:there-is-a-new-topic-and-a-new-post]]';
|
|
||||||
} else if (newPostCount > 1) {
|
|
||||||
text = '[[recent:there-is-a-new-topic-and-new-posts, ' + newPostCount + ']]';
|
|
||||||
}
|
|
||||||
} else if (newTopicCount > 1) {
|
|
||||||
if (newPostCount === 0) {
|
|
||||||
text = '[[recent:there-are-new-topics, ' + newTopicCount + ']]';
|
|
||||||
} else if (newPostCount === 1) {
|
|
||||||
text = '[[recent:there-are-new-topics-and-a-new-post, ' + newTopicCount + ']]';
|
|
||||||
} else if (newPostCount > 1) {
|
|
||||||
text = '[[recent:there-are-new-topics-and-new-posts, ' + newTopicCount + ', ' + newPostCount + ']]';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
text += ' [[recent:click-here-to-reload]]';
|
|
||||||
|
|
||||||
$('#new-topics-alert').translateText(text).removeClass('hide').fadeIn('slow');
|
|
||||||
$('#category-no-topics').addClass('hide');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TopicList.loadMoreTopics = function (direction) {
|
TopicList.loadMoreTopics = function (direction) {
|
||||||
|
|||||||
Reference in New Issue
Block a user