hide spoilers in desktop notifications
This commit is contained in:
parent
a08823eae9
commit
7d14a5395f
@ -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 = []
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user