From d5320c4aa12e6baa260dce3a1f7280fdf77b8486 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 30 Jan 2016 16:36:18 -0800 Subject: [PATCH] Make Build.parseComment more general. --- src/Filtering/Filter.coffee | 2 +- src/General/Build.coffee | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Filtering/Filter.coffee b/src/Filtering/Filter.coffee index 39fedfe22..f5b96d631 100644 --- a/src/Filtering/Filter.coffee +++ b/src/Filtering/Filter.coffee @@ -139,7 +139,7 @@ Filter = tripcode: (post) -> post.info.tripcode capcode: (post) -> post.info.capcode subject: (post) -> post.info.subject - comment: (post) -> post.info.comment ? Build.parseComment(post) + comment: (post) -> (post.info.comment ?= Build.parseComment post.info.commentHTML.innerHTML) flag: (post) -> post.info.flag filename: (post) -> post.file?.name dimensions: (post) -> post.file?.dimensions diff --git a/src/General/Build.coffee b/src/General/Build.coffee index e82c60a0f..de8358661 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -79,14 +79,14 @@ Build = o.file.dimensions = "#{o.file.width}x#{o.file.height}" unless /\.pdf$/.test o.file.url o - parseComment: (o) -> - html = o.info.commentHTML.innerHTML + parseComment: (html) -> + html = html .replace(//gi, '\n') .replace(/\n\nRolled [^<]*<\/b>/i, '') # Rolls (/tg/) .replace(/]*>/g, '') - o.info.comment = Build.unescape html + Build.unescape html postFromObject: (data, boardID, suppressThumb) -> o = Build.parseJSON data, boardID