mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 18:16:17 +01:00
feat: closes #7718
This commit is contained in:
@@ -152,5 +152,7 @@
|
||||
"diffs.description": "This post has <strong>%1</strong> revisions. Click one of the revisions below to see the post content at that point in time.",
|
||||
"diffs.no-revisions-description": "This post has <strong>%1</strong> revisions.",
|
||||
"diffs.current-revision": "current revision",
|
||||
"diffs.original-revision": "original revision"
|
||||
"diffs.original-revision": "original revision",
|
||||
|
||||
"timeago_later": "%1 later"
|
||||
}
|
||||
|
||||
@@ -148,3 +148,11 @@
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.topic .necro-post {
|
||||
color: rgba(127,127,127,.5);
|
||||
font-size: 1.5em;
|
||||
margin-bottom: 20px;
|
||||
text-align: center;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
@@ -255,8 +255,33 @@ define('forum/topic/posts', [
|
||||
posts.find('[component="post/content"] img:not(.not-responsive)').addClass('img-responsive');
|
||||
Posts.addBlockquoteEllipses(posts);
|
||||
hidePostToolsForDeletedPosts(posts);
|
||||
|
||||
addNecroPostMessage();
|
||||
};
|
||||
|
||||
function addNecroPostMessage() {
|
||||
var necroThreshold = 7 * 24 * 60 * 60 * 1000;
|
||||
$('[component="post"]').each(function () {
|
||||
var post = $(this);
|
||||
var prev = post.prev('[component="post"]');
|
||||
if (post.is(':has(.necro-post)') || !prev.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
var diff = post.attr('data-timestamp') - prev.attr('data-timestamp');
|
||||
if (diff >= necroThreshold) {
|
||||
var ago = $.timeago.settings.strings.suffixAgo;
|
||||
$.timeago.settings.strings.suffixAgo = '';
|
||||
$('<aside>').addClass('necro-post')
|
||||
.append($('<span>').translateText('[[topic:timeago_later,' + $.timeago.inWords(diff) + ']]'))
|
||||
.append($('<hr>'))
|
||||
.prependTo(post);
|
||||
|
||||
$.timeago.settings.strings.suffixAgo = ago;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Posts.onNewPostsAddedToDom = function (posts) {
|
||||
Posts.onTopicPageLoad(posts);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user