Fix bug causing replies to not immediately show when catalog thread is clicked.
This commit is contained in:
parent
21d165a161
commit
379dd13e0f
@ -9,9 +9,10 @@ Get =
|
|||||||
return "#{excerpt[...70]}..." if excerpt.length > 73
|
return "#{excerpt[...70]}..." if excerpt.length > 73
|
||||||
excerpt
|
excerpt
|
||||||
threadFromRoot: (root) ->
|
threadFromRoot: (root) ->
|
||||||
|
return null unless root?
|
||||||
g.threads["#{g.BOARD}.#{root.id[1..]}"]
|
g.threads["#{g.BOARD}.#{root.id[1..]}"]
|
||||||
threadFromNode: (node) ->
|
threadFromNode: (node) ->
|
||||||
Get.threadFromRoot $.x 'ancestor::div[@class="thread"]', node
|
Get.threadFromRoot $.x 'ancestor-or-self::div[contains(concat(" ",@class," ")," thread ")]', node
|
||||||
postFromRoot: (root) ->
|
postFromRoot: (root) ->
|
||||||
return null unless root?
|
return null unless root?
|
||||||
post = g.posts[root.dataset.fullID]
|
post = g.posts[root.dataset.fullID]
|
||||||
|
|||||||
@ -288,8 +288,9 @@ Index =
|
|||||||
hoverToggle: (e) ->
|
hoverToggle: (e) ->
|
||||||
if Conf['Catalog Hover Expand'] and !$.modifiedClick(e) and !$.x('ancestor-or-self::a', e.target)
|
if Conf['Catalog Hover Expand'] and !$.modifiedClick(e) and !$.x('ancestor-or-self::a', e.target)
|
||||||
$.toggleClass doc, 'catalog-hover-expand'
|
$.toggleClass doc, 'catalog-hover-expand'
|
||||||
if (post = Get.postFromNode e.target)
|
if (thread = Get.threadFromNode e.target)
|
||||||
Index.cb.hoverAdjust.call post.nodes
|
Index.cb.catalogReplies.call thread
|
||||||
|
Index.cb.hoverAdjust.call thread.OP.nodes
|
||||||
|
|
||||||
popstate: (e) ->
|
popstate: (e) ->
|
||||||
if e?.state
|
if e?.state
|
||||||
@ -324,9 +325,8 @@ Index =
|
|||||||
Index.update()
|
Index.update()
|
||||||
|
|
||||||
catalogReplies: ->
|
catalogReplies: ->
|
||||||
return unless Conf['Show Replies'] and $.hasClass(doc, 'catalog-hover-expand')
|
if Conf['Show Replies'] and $.hasClass(doc, 'catalog-hover-expand') and !@catalogView.nodes.replies
|
||||||
$.off @, 'mouseenter', Index.cb.catalogReplies
|
Index.buildCatalogReplies @
|
||||||
Index.buildCatalogReplies Get.threadFromRoot @
|
|
||||||
|
|
||||||
hoverAdjust: ->
|
hoverAdjust: ->
|
||||||
# Prevent hovered catalog threads from going offscreen.
|
# Prevent hovered catalog threads from going offscreen.
|
||||||
@ -660,7 +660,7 @@ Index =
|
|||||||
thread.setCount 'file', threadData.images + !!threadData.ext, threadData.imagelimit
|
thread.setCount 'file', threadData.images + !!threadData.ext, threadData.imagelimit
|
||||||
thread.setStatus 'Sticky', !!threadData.sticky
|
thread.setStatus 'Sticky', !!threadData.sticky
|
||||||
thread.setStatus 'Closed', !!threadData.closed
|
thread.setStatus 'Closed', !!threadData.closed
|
||||||
if thread.catalogView and (isStale or !(isCatalog and Conf['Show Replies'] and Conf['Catalog Hover Expand']))
|
if thread.catalogView
|
||||||
$.rm thread.catalogView.nodes.replies
|
$.rm thread.catalogView.nodes.replies
|
||||||
thread.catalogView.nodes.replies = null
|
thread.catalogView.nodes.replies = null
|
||||||
else
|
else
|
||||||
@ -743,11 +743,6 @@ Index =
|
|||||||
{nodes} = thread.catalogView
|
{nodes} = thread.catalogView
|
||||||
return if not (lastReplies = Index.liveThreadDict[thread.ID].last_replies)
|
return if not (lastReplies = Index.liveThreadDict[thread.ID].last_replies)
|
||||||
|
|
||||||
if nodes.replies
|
|
||||||
# RelativeDates will stop updating elements if they go out of document.
|
|
||||||
RelativeDates.update timeEl for timeEl in $$ 'time', nodes.replies
|
|
||||||
return
|
|
||||||
|
|
||||||
replies = []
|
replies = []
|
||||||
for data in lastReplies
|
for data in lastReplies
|
||||||
continue if PostHiding.isHidden(g.BOARD.ID, thread.ID, data.no)
|
continue if PostHiding.isHidden(g.BOARD.ID, thread.ID, data.no)
|
||||||
@ -865,7 +860,7 @@ Index =
|
|||||||
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
|
||||||
$.on thread.catalogView.nodes.root, 'mouseenter', Index.cb.catalogReplies
|
$.on thread.catalogView.nodes.root, 'mouseenter', Index.cb.catalogReplies.bind(thread)
|
||||||
$.on thread.OP.nodes.root, 'mouseenter', Index.cb.hoverAdjust.bind(thread.OP.nodes)
|
$.on thread.OP.nodes.root, 'mouseenter', Index.cb.hoverAdjust.bind(thread.OP.nodes)
|
||||||
$.add Index.root, nodes
|
$.add Index.root, nodes
|
||||||
nodes
|
nodes
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user