Faster Post::parseQuotes
What changed is 4~6 times faster.
This commit is contained in:
parent
b628cd7eba
commit
a344ef4afa
@ -76,7 +76,7 @@ class Post
|
|||||||
@info.comment = text.join('').trim().replace /\s+$/gm, ''
|
@info.comment = text.join('').trim().replace /\s+$/gm, ''
|
||||||
|
|
||||||
parseQuotes: ->
|
parseQuotes: ->
|
||||||
quotes = {}
|
@quotes = []
|
||||||
for quotelink in $$ '.quotelink', @nodes.comment
|
for quotelink in $$ '.quotelink', @nodes.comment
|
||||||
# Only add quotes that link to posts on an imageboard.
|
# Only add quotes that link to posts on an imageboard.
|
||||||
# Don't add:
|
# Don't add:
|
||||||
@ -95,11 +95,12 @@ class Post
|
|||||||
@nodes.quotelinks.push quotelink
|
@nodes.quotelinks.push quotelink
|
||||||
|
|
||||||
# Don't count capcode replies as quotes in OPs. (Admin/Mod/Dev Replies: ...)
|
# Don't count capcode replies as quotes in OPs. (Admin/Mod/Dev Replies: ...)
|
||||||
continue if !@isReply and $.hasClass quotelink.parentNode.parentNode, 'capcodeReplies'
|
continue if @isClone or !@isReply and $.hasClass quotelink.parentNode.parentNode, 'capcodeReplies'
|
||||||
|
|
||||||
quotes["#{match[1]}.#{match[2]}"] = true
|
# ES6 Set when?
|
||||||
return if @isClone
|
fullID = "#{match[1]}.#{match[2]}"
|
||||||
@quotes = Object.keys quotes
|
@quotes.push fullID if @quotes.indexOf(fullID) is -1
|
||||||
|
return
|
||||||
|
|
||||||
parseFile: (that) ->
|
parseFile: (that) ->
|
||||||
return unless (fileEl = $ '.file', @nodes.post) and thumb = $ 'img[data-md5]', fileEl
|
return unless (fileEl = $ '.file', @nodes.post) and thumb = $ 'img[data-md5]', fileEl
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user