Cleanup "that".
This commit is contained in:
parent
2b8ce2c1a8
commit
6dcf2adcc2
@ -170,7 +170,8 @@ class Fetcher
|
|||||||
new Board @boardID
|
new Board @boardID
|
||||||
thread = g.threads["#{@boardID}.#{@threadID}"] or
|
thread = g.threads["#{@boardID}.#{@threadID}"] or
|
||||||
new Thread @threadID, board
|
new Thread @threadID, board
|
||||||
post = new Post Build.post(o), thread, board, {isArchived: true}
|
post = new Post Build.post(o), thread, board
|
||||||
|
post.kill()
|
||||||
post.file.thumbURL = o.file.turl if post.file
|
post.file.thumbURL = o.file.turl if post.file
|
||||||
post.isFetchedQuote = true
|
post.isFetchedQuote = true
|
||||||
Main.callbackNodes Post, [post]
|
Main.callbackNodes Post, [post]
|
||||||
|
|||||||
@ -2,7 +2,7 @@ class Post
|
|||||||
@callbacks = new Callbacks 'Post'
|
@callbacks = new Callbacks 'Post'
|
||||||
toString: -> @ID
|
toString: -> @ID
|
||||||
|
|
||||||
constructor: (root, @thread, @board, that={}) ->
|
constructor: (root, @thread, @board) ->
|
||||||
<% if (tests_enabled) { %>
|
<% if (tests_enabled) { %>
|
||||||
root2 = root.cloneNode true
|
root2 = root.cloneNode true
|
||||||
for el in $$ '.mobile', root2
|
for el in $$ '.mobile', root2
|
||||||
@ -29,7 +29,6 @@ class Post
|
|||||||
@ID = +root.id[2..]
|
@ID = +root.id[2..]
|
||||||
@fullID = "#{@board}.#{@ID}"
|
@fullID = "#{@board}.#{@ID}"
|
||||||
|
|
||||||
@cleanup root if that.isOriginalMarkup
|
|
||||||
post = $ '.post', root
|
post = $ '.post', root
|
||||||
info = $ '.postInfo', post
|
info = $ '.postInfo', post
|
||||||
@nodes =
|
@nodes =
|
||||||
@ -82,7 +81,7 @@ class Post
|
|||||||
|
|
||||||
@parseComment()
|
@parseComment()
|
||||||
@parseQuotes()
|
@parseQuotes()
|
||||||
@parseFile that
|
@parseFile()
|
||||||
|
|
||||||
@isDead = false
|
@isDead = false
|
||||||
@isHidden = false
|
@isHidden = false
|
||||||
@ -93,7 +92,6 @@ class Post
|
|||||||
@clones = g.posts[@fullID].clones
|
@clones = g.posts[@fullID].clones
|
||||||
clone.origin = @ for clone in @clones
|
clone.origin = @ for clone in @clones
|
||||||
g.posts.push @fullID, thread.posts.push @, board.posts.push @, @
|
g.posts.push @fullID, thread.posts.push @, board.posts.push @, @
|
||||||
@kill() if that.isArchived
|
|
||||||
|
|
||||||
parseComment: ->
|
parseComment: ->
|
||||||
# Merge text nodes and remove empty ones.
|
# Merge text nodes and remove empty ones.
|
||||||
@ -161,7 +159,7 @@ class Post
|
|||||||
fullID = "#{match[1]}.#{match[2]}"
|
fullID = "#{match[1]}.#{match[2]}"
|
||||||
@quotes.push fullID unless fullID in @quotes
|
@quotes.push fullID unless fullID in @quotes
|
||||||
|
|
||||||
parseFile: (that) ->
|
parseFile: ->
|
||||||
return unless (fileEl = $ '.file', @nodes.post) and thumb = $ 'img[data-md5]', fileEl
|
return unless (fileEl = $ '.file', @nodes.post) and thumb = $ 'img[data-md5]', fileEl
|
||||||
# Supports JPG/PNG/GIF/PDF.
|
# Supports JPG/PNG/GIF/PDF.
|
||||||
# Flash files are not supported.
|
# Flash files are not supported.
|
||||||
@ -186,13 +184,6 @@ class Post
|
|||||||
@file.dimensions = nameNode.nextSibling.textContent.match(/\d+x\d+/)[0]
|
@file.dimensions = nameNode.nextSibling.textContent.match(/\d+x\d+/)[0]
|
||||||
@file.name = fileText.title or nameNode.title or nameNode.textContent
|
@file.name = fileText.title or nameNode.title or nameNode.textContent
|
||||||
|
|
||||||
cleanup: (root) ->
|
|
||||||
for node in $$ '.mobile', root
|
|
||||||
$.rm node
|
|
||||||
for node in $$ '.desktop', root
|
|
||||||
$.rmClass node, 'desktop'
|
|
||||||
return
|
|
||||||
|
|
||||||
kill: (file) ->
|
kill: (file) ->
|
||||||
if file
|
if file
|
||||||
return if @file.isDead
|
return if @file.isDead
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user