allow quotelinks, dice rolls, fortunes in catalog

This commit is contained in:
ccd0 2014-09-27 17:54:43 -07:00
parent 6c9757632f
commit 7c45f642f5
2 changed files with 9 additions and 7 deletions

View File

@ -337,6 +337,8 @@ Build =
else else
<%= html('') %> <%= html('') %>
comment = innerHTML: data.com or ''
root = $.el 'div', root = $.el 'div',
className: 'catalog-thread' className: 'catalog-thread'
$.extend root, <%= html( $.extend root, <%= html(
@ -348,17 +350,20 @@ Build =
'<span class="catalog-icons"></span>' + '<span class="catalog-icons"></span>' +
'</div>' + '</div>' +
'&{subject}' + '&{subject}' +
'<div class="comment">&{thread.OP.info.commentHTML}</div>' '<div class="comment">&{comment}</div>'
) %> ) %>
root.dataset.fullID = thread.fullID root.dataset.fullID = thread.fullID
$.addClass root, thread.OP.highlights... if thread.OP.highlights $.addClass root, thread.OP.highlights... if thread.OP.highlights
for quotelink in $$ '.quotelink, .deadlink', root.lastElementChild for quote in $$ '.quotelink', root.lastElementChild
$.replace quotelink, [quotelink.childNodes...] href = quote.getAttribute 'href'
quote.href = "/#{thread.board}/thread/#{thread.ID}" + href if href[0] is '#'
for exif in $$ '.abbr, .exif', root.lastElementChild
$.rm exif
for pp in $$ '.prettyprint', root.lastElementChild for pp in $$ '.prettyprint', root.lastElementChild
$.replace pp, $.tn pp.textContent $.replace pp, $.tn pp.textContent
for br in $$ 'br', root.lastElementChild when !br.previousSibling or br.previousSibling.nodeName is 'BR' for br in $$ 'br', root.lastElementChild when br.previousSibling?.nodeName is 'BR'
$.rm br $.rm br
if thread.isSticky if thread.isSticky

View File

@ -102,9 +102,6 @@ class Post
$.rm node $.rm node
@info.comment = @nodesToText bq @info.comment = @nodesToText bq
# Save cleaned comment HTML.
@info.commentHTML = <%= html('&{bq}') %>
# Get the comment's text with spoilers hidden. # Get the comment's text with spoilers hidden.
spoilers = $$ 's', bq spoilers = $$ 's', bq
@info.commentSpoilered = if spoilers.length @info.commentSpoilered = if spoilers.length