Remove mobile nodes in posts parsed from 4chan's markup.

This commit is contained in:
Mayhem 2013-12-14 16:15:34 +01:00
parent a46a5a0141
commit 410fbf3444
2 changed files with 9 additions and 1 deletions

View File

@ -174,7 +174,8 @@ Main =
posts = []
for postRoot in $$ '.thread > .postContainer', threadRoot
try
posts.push new Post postRoot, thread, g.BOARD
posts.push post = new Post postRoot, thread, g.BOARD
post.cleanup()
catch err
# Skip posts that we failed to parse.
errors = [] unless errors

View File

@ -141,6 +141,13 @@ class Post
if @file.isImage = /(jpg|png|gif)$/i.test @file.name
@file.dimensions = fileText.textContent.match(/\d+x\d+/)[0]
cleanup: ->
for node in $$ '.mobile', @nodes.root
$.rm node
for node in $$ '.desktop', @nodes.root
$.rmClass node, 'desktop'
return
kill: (file, now) ->
now or= new Date()
if file