Move this code into Build.catalogReply function.

This commit is contained in:
ccd0 2016-09-28 22:55:51 -07:00
parent 236a3b8ba9
commit 0d3ad8a1ec
3 changed files with 16 additions and 13 deletions

View File

@ -224,3 +224,18 @@ Build =
$.addClass root, 'noFile' unless thread.OP.file
root
catalogReply: (thread, data) ->
excerpt = ''
if data.com
excerpt = Build.parseCommentDisplay(data.com).replace(/>>\d+/g, '').trim().replace(/\n+/g, ' // ')
if data.ext
excerpt or= "#{data.filename}#{data.ext}"
if data.com
excerpt or= Build.unescape data.com.replace(/<br\b[^<]*>/gi, ' // ')
excerpt or= '\xA0'
excerpt = "#{excerpt[...70]}..." if excerpt.length > 73
link = Build.postURL thread.board.ID, thread.ID, data.no
$.el 'div', {className: 'catalog-reply'},
<%= readHTML('CatalogReply.html') %>

View File

@ -690,19 +690,7 @@ Index =
replies = []
for data in lastReplies
excerpt = ''
if data.com
excerpt = Build.parseCommentDisplay(data.com).replace(/>>\d+/g, '').trim().replace(/\n+/g, ' // ')
if data.ext
excerpt or= "#{data.filename}#{data.ext}"
if data.com
excerpt or= Build.unescape data.com.replace(/<br\b[^<]*>/gi, ' // ')
excerpt or= '\xA0'
excerpt = "#{excerpt[...70]}..." if excerpt.length > 73
link = Build.postURL thread.board.ID, thread.ID, data.no
reply = $.el 'div', {className: 'catalog-reply'},
<%= readHTML('CatalogReply.html') %>
reply = Build.catalogReply thread, data
RelativeDates.update $('time', reply)
$.on $('.catalog-reply-preview', reply), 'mouseover', QuotePreview.mouseover
replies.push reply