diff --git a/src/General/lib/post.class b/src/General/lib/post.class index 74a92cfeb..feecfcc57 100755 --- a/src/General/lib/post.class +++ b/src/General/lib/post.class @@ -92,16 +92,25 @@ class Post # Preceding and following new lines. # Trailing spaces. bq = @nodes.comment.cloneNode true - nodes = $$ '.abbr, .exif, b', bq - i = 0 - while node = nodes[i++] + for node in $$ '.abbr, .exif, b', bq $.rm node + @info.comment = @nodesToText bq + # Hide spoilers. + spoilers = $$ 's', bq + @info.commentSpoilered = if spoilers.length + for node in spoilers + $.replace node, $.tn '[spoiler]' + @nodesToText bq + else + @info.comment + + nodesToText: (bq) -> text = "" nodes = $.X './/br|.//text()', bq i = 0 while node = nodes.snapshotItem i++ text += node.data or '\n' - @info.comment = text.trim().replace /\s+$/gm, '' + text.trim().replace /\s+$/gm, '' parseQuotes: -> @quotes = [] diff --git a/src/Monitoring/Unread.coffee b/src/Monitoring/Unread.coffee index 88c691470..71819e4ee 100755 --- a/src/Monitoring/Unread.coffee +++ b/src/Monitoring/Unread.coffee @@ -100,7 +100,7 @@ Unread = else $('.nameBlock', post.nodes.info).textContent.trim() notif = new Notification "#{name} replied to you", - body: post.info.comment + body: post.info[if Conf['Remove Spoilers'] or Conf['Reveal Spoilers'] then 'comment' else 'commentSpoilered'] icon: Favicon.logo notif.onclick = -> Header.scrollToIfNeeded post.nodes.root, true