Delay catalog reply building until hover.
This commit is contained in:
parent
28e2ea7af7
commit
c370ca0ddd
@ -312,6 +312,11 @@ Index =
|
|||||||
Index.pushState {page: 1}
|
Index.pushState {page: 1}
|
||||||
Index.update()
|
Index.update()
|
||||||
|
|
||||||
|
catalogReplies: ->
|
||||||
|
$.off @, 'mouseover', Index.cb.catalogReplies
|
||||||
|
return unless Conf['Show Replies'] and Conf['Catalog Hover Expand'] and @parentNode
|
||||||
|
Index.buildCatalogReplies Get.threadFromRoot @
|
||||||
|
|
||||||
scrollToIndex: ->
|
scrollToIndex: ->
|
||||||
# Scroll to navlinks, or top of board if navlinks are hidden.
|
# Scroll to navlinks, or top of board if navlinks are hidden.
|
||||||
Header.scrollToIfNeeded (if Index.navLinks.getBoundingClientRect().height then Index.navLinks else Index.root)
|
Header.scrollToIfNeeded (if Index.navLinks.getBoundingClientRect().height then Index.navLinks else Index.root)
|
||||||
@ -709,26 +714,25 @@ Index =
|
|||||||
thumb.style.height = height * ratio + 'px'
|
thumb.style.height = height * ratio + 'px'
|
||||||
return
|
return
|
||||||
|
|
||||||
buildCatalogReplies: (threads) ->
|
buildCatalogReplies: (thread) ->
|
||||||
for thread in threads
|
{nodes} = thread.catalogView
|
||||||
{nodes} = thread.catalogView
|
return if not (lastReplies = Index.liveThreadDict[thread.ID].last_replies)
|
||||||
continue if not (lastReplies = Index.liveThreadDict[thread.ID].last_replies)
|
|
||||||
|
|
||||||
if nodes.replies
|
if nodes.replies
|
||||||
# RelativeDates will stop updating elements if they go out of document.
|
# RelativeDates will stop updating elements if they go out of document.
|
||||||
RelativeDates.update timeEl for timeEl in $$ 'time', nodes.replies
|
RelativeDates.update timeEl for timeEl in $$ 'time', nodes.replies
|
||||||
continue
|
return
|
||||||
|
|
||||||
replies = []
|
replies = []
|
||||||
for data in lastReplies
|
for data in lastReplies
|
||||||
reply = Build.catalogReply thread, data
|
reply = Build.catalogReply thread, data
|
||||||
RelativeDates.update $('time', reply)
|
RelativeDates.update $('time', reply)
|
||||||
$.on $('.catalog-reply-preview', reply), 'mouseover', QuotePreview.mouseover
|
$.on $('.catalog-reply-preview', reply), 'mouseover', QuotePreview.mouseover
|
||||||
replies.push reply
|
replies.push reply
|
||||||
|
|
||||||
nodes.replies = $.el 'div', className: 'catalog-replies'
|
nodes.replies = $.el 'div', className: 'catalog-replies'
|
||||||
$.add nodes.replies, replies
|
$.add nodes.replies, replies
|
||||||
$.add thread.OP.nodes.post, nodes.replies
|
$.add thread.OP.nodes.post, nodes.replies
|
||||||
return
|
return
|
||||||
|
|
||||||
sort: ->
|
sort: ->
|
||||||
@ -826,12 +830,13 @@ Index =
|
|||||||
threads = Index.buildThreads threadIDs, true
|
threads = Index.buildThreads threadIDs, true
|
||||||
Index.buildCatalogViews threads
|
Index.buildCatalogViews threads
|
||||||
Index.sizeCatalogViews threads
|
Index.sizeCatalogViews threads
|
||||||
Index.buildCatalogReplies threads if Conf['Show Replies'] and Conf['Catalog Hover Expand']
|
|
||||||
nodes = []
|
nodes = []
|
||||||
for thread in threads
|
for thread in threads
|
||||||
thread.OP.setCatalogOP true
|
thread.OP.setCatalogOP true
|
||||||
$.add thread.catalogView.nodes.root, thread.OP.nodes.root
|
$.add thread.catalogView.nodes.root, thread.OP.nodes.root
|
||||||
nodes.push thread.catalogView.nodes.root
|
nodes.push thread.catalogView.nodes.root
|
||||||
|
if Conf['Show Replies'] and Conf['Catalog Hover Expand']
|
||||||
|
$.on thread.catalogView.nodes.root, 'mouseover', Index.cb.catalogReplies
|
||||||
$.add Index.root, nodes
|
$.add Index.root, nodes
|
||||||
nodes
|
nodes
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user