From 0d3ad8a1ecb4fd4b46b108c7ef4ea8d996397a87 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Wed, 28 Sep 2016 22:55:51 -0700 Subject: [PATCH] Move this code into Build.catalogReply function. --- src/General/Build.coffee | 15 +++++++++++++++ src/General/{Index => Build}/CatalogReply.html | 0 src/General/Index.coffee | 14 +------------- 3 files changed, 16 insertions(+), 13 deletions(-) rename src/General/{Index => Build}/CatalogReply.html (100%) diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 398492bcb..a0ce81f8d 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -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(//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') %> diff --git a/src/General/Index/CatalogReply.html b/src/General/Build/CatalogReply.html similarity index 100% rename from src/General/Index/CatalogReply.html rename to src/General/Build/CatalogReply.html diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 3d4678b9d..c6ad91458 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -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(//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