Get rid of Index.nodes.
This commit is contained in:
parent
a117e3ed36
commit
2947665a29
@ -121,15 +121,15 @@ Index =
|
|||||||
$.onExists doc, '.board > .thread > .postContainer, .board + *', ->
|
$.onExists doc, '.board > .thread > .postContainer, .board + *', ->
|
||||||
Build.hat = $ '.board > .thread > img:first-child'
|
Build.hat = $ '.board > .thread > img:first-child'
|
||||||
if Build.hat
|
if Build.hat
|
||||||
if Index.nodes
|
g.BOARD.threads.forEach (thread) ->
|
||||||
for ID, threadRoot of Index.nodes
|
if thread.nodes.root
|
||||||
$.prepend threadRoot, Build.hat.cloneNode false
|
$.prepend thread.nodes.root, Build.hat.cloneNode false
|
||||||
$.addClass doc, 'hats-enabled'
|
$.addClass doc, 'hats-enabled'
|
||||||
$.addStyle ".catalog-thread::after {background-image: url(#{Build.hat.src});}"
|
$.addStyle ".catalog-thread::after {background-image: url(#{Build.hat.src});}"
|
||||||
|
|
||||||
board = $ '.board'
|
board = $ '.board'
|
||||||
$.replace board, Index.root
|
$.replace board, Index.root
|
||||||
if Index.nodes
|
if Index.liveThreadData
|
||||||
$.event 'PostsInserted'
|
$.event 'PostsInserted'
|
||||||
# Hacks:
|
# Hacks:
|
||||||
# - When removing an element from the document during page load,
|
# - When removing an element from the document during page load,
|
||||||
@ -612,7 +612,6 @@ Index =
|
|||||||
|
|
||||||
buildThreads: ->
|
buildThreads: ->
|
||||||
return unless Index.liveThreadData
|
return unless Index.liveThreadData
|
||||||
Index.nodes = {}
|
|
||||||
threads = []
|
threads = []
|
||||||
posts = []
|
posts = []
|
||||||
for threadData, i in Index.liveThreadData
|
for threadData, i in Index.liveThreadData
|
||||||
@ -636,7 +635,7 @@ Index =
|
|||||||
posts.push OP
|
posts.push OP
|
||||||
thread.setPage i // Index.threadsNumPerPage + 1
|
thread.setPage i // Index.threadsNumPerPage + 1
|
||||||
|
|
||||||
Index.nodes[thread.ID] = Build.thread thread, threadData
|
Build.thread thread, threadData
|
||||||
catch err
|
catch err
|
||||||
# Skip posts that we failed to parse.
|
# Skip posts that we failed to parse.
|
||||||
errors = [] unless errors
|
errors = [] unless errors
|
||||||
@ -668,7 +667,7 @@ Index =
|
|||||||
errors.push
|
errors.push
|
||||||
message: "Parsing of Post No.#{data.no} failed. Post will be skipped."
|
message: "Parsing of Post No.#{data.no} failed. Post will be skipped."
|
||||||
error: err
|
error: err
|
||||||
$.add Index.nodes[thread.ID], nodes
|
$.add thread.nodes.root, nodes
|
||||||
|
|
||||||
Main.handleErrors errors if errors
|
Main.handleErrors errors if errors
|
||||||
Main.callbackNodes 'Post', posts
|
Main.callbackNodes 'Post', posts
|
||||||
@ -788,7 +787,7 @@ Index =
|
|||||||
thumb.src = thumb.dataset.src
|
thumb.src = thumb.dataset.src
|
||||||
# XXX https://bugzilla.mozilla.org/show_bug.cgi?id=1021289
|
# XXX https://bugzilla.mozilla.org/show_bug.cgi?id=1021289
|
||||||
thumb.removeAttribute 'data-src'
|
thumb.removeAttribute 'data-src'
|
||||||
nodes.push Index.nodes[thread.ID], $.el('hr')
|
nodes.push thread.nodes.root, $.el('hr')
|
||||||
$.add Index.root, nodes
|
$.add Index.root, nodes
|
||||||
if doc.contains Index.root
|
if doc.contains Index.root
|
||||||
$.event 'PostsInserted'
|
$.event 'PostsInserted'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user