mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-17 05:50:25 +01:00
collapsible blockquotes, closes #1359
This commit is contained in:
@@ -47,6 +47,8 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools',
|
|||||||
|
|
||||||
enableInfiniteLoading();
|
enableInfiniteLoading();
|
||||||
|
|
||||||
|
addBlockquoteEllipses($('.topic .post-content > blockquote'));
|
||||||
|
|
||||||
var bookmark = localStorage.getItem('topic:' + tid + ':bookmark');
|
var bookmark = localStorage.getItem('topic:' + tid + ':bookmark');
|
||||||
if (window.location.hash) {
|
if (window.location.hash) {
|
||||||
Topic.scrollToPost(window.location.hash.substr(1), true);
|
Topic.scrollToPost(window.location.hash.substr(1), true);
|
||||||
@@ -101,6 +103,19 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools',
|
|||||||
createNewPosts(data);
|
createNewPosts(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addBlockquoteEllipses(blockquotes) {
|
||||||
|
blockquotes.each(function() {
|
||||||
|
var $this = $(this);
|
||||||
|
if ($this.find(':hidden').length) {
|
||||||
|
$this.append('<i class="fa fa-ellipsis-h pointer toggle"></i>');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('blockquote .toggle').on('click', function() {
|
||||||
|
$(this).parent('blockquote').toggleClass('uncollapsed');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function enableInfiniteLoading() {
|
function enableInfiniteLoading() {
|
||||||
if(!config.usePagination) {
|
if(!config.usePagination) {
|
||||||
|
|
||||||
@@ -291,8 +306,12 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools',
|
|||||||
var firstPid = parseInt(data.posts[0].pid, 10);
|
var firstPid = parseInt(data.posts[0].pid, 10);
|
||||||
|
|
||||||
$('#post-container li[data-pid]').each(function() {
|
$('#post-container li[data-pid]').each(function() {
|
||||||
if(firstPid > parseInt($(this).attr('data-pid'), 10)) {
|
var $this = $(this);
|
||||||
after = $(this);
|
|
||||||
|
addBlockquoteEllipses($this.find('.post-content > blockquote'));
|
||||||
|
|
||||||
|
if(firstPid > parseInt($this.attr('data-pid'), 10)) {
|
||||||
|
after = $this;
|
||||||
if(after.next().length && after.next().hasClass('post-bar')) {
|
if(after.next().length && after.next().hasClass('post-bar')) {
|
||||||
after = after.next();
|
after = after.next();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user