Have Post object track whether it is being used as a catalog OP.
This commit is contained in:
parent
2917636bcf
commit
e54a42edeb
@ -700,7 +700,8 @@ Index =
|
||||
if Conf['Index Mode'] is 'catalog'
|
||||
nodes = Index.buildCatalogViews threads
|
||||
Index.sizeCatalogViews nodes
|
||||
Index.moveComments threads
|
||||
for thread in threads
|
||||
thread.OP.setCatalogOP (Conf['Index Mode'] is 'catalog')
|
||||
if Conf['Index Mode'] is 'catalog'
|
||||
$.add Index.root, nodes
|
||||
if doc.contains Index.root
|
||||
@ -715,17 +716,6 @@ Index =
|
||||
offset = nodesPerPage * (pageNum - 1)
|
||||
Index.sortedThreads[offset ... offset + nodesPerPage]
|
||||
|
||||
moveComments: (threads) ->
|
||||
isCatalog = (Conf['Index Mode'] is 'catalog')
|
||||
for thread in threads
|
||||
node = if isCatalog then thread.catalogView.nodes.root else thread.OP.nodes.post
|
||||
{fileRoot, info, comment} = thread.OP.nodes
|
||||
unless node.contains comment
|
||||
comment.className = if isCatalog then 'comment' else 'postMessage'
|
||||
$.prepend node, fileRoot if fileRoot
|
||||
$.add node, [info, comment]
|
||||
return
|
||||
|
||||
buildStructure: (threads) ->
|
||||
for thread in threads
|
||||
if (file = thread.OP.file) and (thumb = thread.OP.file.thumb) and thumb.dataset.src
|
||||
|
||||
@ -12,8 +12,7 @@ Post.Clone = class extends Post
|
||||
else
|
||||
(node) -> node.cloneNode true
|
||||
root = cloneNode nodes.root
|
||||
# Handle case where comment has been moved into catalog thread
|
||||
if nodes.comment.parentNode isnt nodes.post
|
||||
if @origin.isCatalogOP
|
||||
$.prepend $('.post', root), cloneNode(nodes.fileRoot) if nodes.fileRoot
|
||||
$.add $('.post', root), [cloneNode(nodes.info), cloneNode(nodes.comment)]
|
||||
Post.Clone.prefix or= 0
|
||||
|
||||
@ -36,8 +36,9 @@ class Post
|
||||
@parseQuotes()
|
||||
@parseFile()
|
||||
|
||||
@isDead = false
|
||||
@isHidden = false
|
||||
@isDead = false
|
||||
@isHidden = false
|
||||
@isCatalogOP = false
|
||||
|
||||
@clones = []
|
||||
<% if (readJSON('/.tests_enabled')) { %>
|
||||
@ -257,3 +258,12 @@ class Post
|
||||
for clone in @clones[index..]
|
||||
clone.nodes.root.dataset.clone = index++
|
||||
return
|
||||
|
||||
setCatalogOP: (isCatalogOP) ->
|
||||
return if @isCatalogOP is isCatalogOP
|
||||
@isCatalogOP = isCatalogOP
|
||||
node = if isCatalogOP then @thread.catalogView.nodes.root else @nodes.post
|
||||
{fileRoot, info, comment} = @nodes
|
||||
comment.className = if isCatalogOP then 'comment' else 'postMessage'
|
||||
$.prepend node, fileRoot if fileRoot
|
||||
$.add node, [info, comment]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user