Parse comments from JSON for filter/search.
Also fix post building testing skipping posts with EXIF data.
This commit is contained in:
parent
2fcb5b1d7c
commit
fdae25dc9e
@ -126,7 +126,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
|
comment: (post) -> post.info.comment ? Build.parseComment(post)
|
||||||
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
|
||||||
|
|||||||
@ -78,6 +78,15 @@ 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) ->
|
||||||
|
html = o.info.commentHTML.innerHTML
|
||||||
|
.replace(/<br><br><span class="abbr">.*$/, '')
|
||||||
|
.replace(/^<b>Rolled [^<]*<br><br><\/b>/, '')
|
||||||
|
.replace(/<span class="fortune".*$/, '')
|
||||||
|
.replace(/<br\s*\/?>/gi, '\n')
|
||||||
|
.replace(/<[^>]*>/g, '')
|
||||||
|
o.info.comment = Build.unescape html
|
||||||
|
|
||||||
postFromObject: (data, boardID, suppressThumb) ->
|
postFromObject: (data, boardID, suppressThumb) ->
|
||||||
o = Build.parseJSON data, boardID
|
o = Build.parseJSON data, boardID
|
||||||
Build.post o, suppressThumb
|
Build.post o, suppressThumb
|
||||||
|
|||||||
@ -56,7 +56,7 @@ BuildTest =
|
|||||||
c.log x.outerHTML
|
c.log x.outerHTML
|
||||||
c.log y.outerHTML
|
c.log y.outerHTML
|
||||||
|
|
||||||
for key of Config.filter when not (key is 'comment' or key is 'MD5' and post.board.ID is 'f')
|
for key of Config.filter when not (key is 'MD5' and post.board.ID is 'f')
|
||||||
val1 = Filter[key] obj
|
val1 = Filter[key] obj
|
||||||
val2 = Filter[key] post2
|
val2 = Filter[key] post2
|
||||||
if val1 isnt val2
|
if val1 isnt val2
|
||||||
@ -76,8 +76,9 @@ BuildTest =
|
|||||||
|
|
||||||
testAll: ->
|
testAll: ->
|
||||||
g.posts.forEach (post) ->
|
g.posts.forEach (post) ->
|
||||||
unless post.isClone or post.isFetchedQuote or $ '.abbr', post.nodes.comment
|
unless post.isClone or post.isFetchedQuote
|
||||||
BuildTest.testOne post
|
unless (abbr = $ '.abbr', post.nodes.comment) and /Comment too long\./.test(abbr.textContent)
|
||||||
|
BuildTest.testOne post
|
||||||
return
|
return
|
||||||
|
|
||||||
postsRemaining: 0
|
postsRemaining: 0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user