From 3934f2ec88f47ea01b86c20022ad61b8f37fbf65 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Mon, 5 May 2014 12:15:17 -0400 Subject: [PATCH] collapsible blockquotes, closes #1359 --- public/src/forum/topic.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index de564f00cb..cf2277a13e 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -47,6 +47,8 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools', enableInfiniteLoading(); + addBlockquoteEllipses($('.topic .post-content > blockquote')); + var bookmark = localStorage.getItem('topic:' + tid + ':bookmark'); if (window.location.hash) { Topic.scrollToPost(window.location.hash.substr(1), true); @@ -101,6 +103,19 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools', createNewPosts(data); } + function addBlockquoteEllipses(blockquotes) { + blockquotes.each(function() { + var $this = $(this); + if ($this.find(':hidden').length) { + $this.append(''); + } + }); + + $('blockquote .toggle').on('click', function() { + $(this).parent('blockquote').toggleClass('uncollapsed'); + }); + } + function enableInfiniteLoading() { if(!config.usePagination) { @@ -291,8 +306,12 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools', var firstPid = parseInt(data.posts[0].pid, 10); $('#post-container li[data-pid]').each(function() { - if(firstPid > parseInt($(this).attr('data-pid'), 10)) { - after = $(this); + var $this = $(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')) { after = after.next(); }