Make Build.parseComment more general.
This commit is contained in:
parent
f92a21e9ab
commit
d5320c4aa1
@ -139,7 +139,7 @@ Filter =
|
|||||||
tripcode: (post) -> post.info.tripcode
|
tripcode: (post) -> post.info.tripcode
|
||||||
capcode: (post) -> post.info.capcode
|
capcode: (post) -> post.info.capcode
|
||||||
subject: (post) -> post.info.subject
|
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
|
flag: (post) -> post.info.flag
|
||||||
filename: (post) -> post.file?.name
|
filename: (post) -> post.file?.name
|
||||||
dimensions: (post) -> post.file?.dimensions
|
dimensions: (post) -> post.file?.dimensions
|
||||||
|
|||||||
@ -79,14 +79,14 @@ Build =
|
|||||||
o.file.dimensions = "#{o.file.width}x#{o.file.height}" unless /\.pdf$/.test o.file.url
|
o.file.dimensions = "#{o.file.width}x#{o.file.height}" unless /\.pdf$/.test o.file.url
|
||||||
o
|
o
|
||||||
|
|
||||||
parseComment: (o) ->
|
parseComment: (html) ->
|
||||||
html = o.info.commentHTML.innerHTML
|
html = html
|
||||||
.replace(/<br\b[^<]*>/gi, '\n')
|
.replace(/<br\b[^<]*>/gi, '\n')
|
||||||
.replace(/\n\n<span\b[^<]* class="abbr"[^]*$/i, '') # EXIF data (/p/)
|
.replace(/\n\n<span\b[^<]* class="abbr"[^]*$/i, '') # EXIF data (/p/)
|
||||||
.replace(/^<b\b[^<]*>Rolled [^<]*<\/b>/i, '') # Rolls (/tg/)
|
.replace(/^<b\b[^<]*>Rolled [^<]*<\/b>/i, '') # Rolls (/tg/)
|
||||||
.replace(/<span\b[^<]* class="fortune"[^]*$/i, '') # Fortunes (/s4s/)
|
.replace(/<span\b[^<]* class="fortune"[^]*$/i, '') # Fortunes (/s4s/)
|
||||||
.replace(/<[^>]*>/g, '')
|
.replace(/<[^>]*>/g, '')
|
||||||
o.info.comment = Build.unescape html
|
Build.unescape html
|
||||||
|
|
||||||
postFromObject: (data, boardID, suppressThumb) ->
|
postFromObject: (data, boardID, suppressThumb) ->
|
||||||
o = Build.parseJSON data, boardID
|
o = Build.parseJSON data, boardID
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user