Fix errors when index settings changed before index loaded.
This commit is contained in:
parent
d2db9993da
commit
f78f04a85c
@ -129,7 +129,7 @@ Index =
|
|||||||
$.rmClass doc, 'index-loading'
|
$.rmClass doc, 'index-loading'
|
||||||
|
|
||||||
scroll: ->
|
scroll: ->
|
||||||
return if Index.req or Conf['Index Mode'] isnt 'infinite' or (window.scrollY <= doc.scrollHeight - (300 + window.innerHeight))
|
return if Index.req or !Index.liveThreadData or Conf['Index Mode'] isnt 'infinite' or (window.scrollY <= doc.scrollHeight - (300 + window.innerHeight))
|
||||||
Index.pageNum ?= Index.currentPage # Avoid having to pushState to keep track of the current page
|
Index.pageNum ?= Index.currentPage # Avoid having to pushState to keep track of the current page
|
||||||
|
|
||||||
pageNum = ++Index.pageNum
|
pageNum = ++Index.pageNum
|
||||||
@ -334,6 +334,7 @@ Index =
|
|||||||
Index.currentPage = page
|
Index.currentPage = page
|
||||||
|
|
||||||
pageLoad: (scroll=true) ->
|
pageLoad: (scroll=true) ->
|
||||||
|
return unless Index.liveThreadData
|
||||||
{threads, search, mode, page} = Index.changed
|
{threads, search, mode, page} = Index.changed
|
||||||
if threads or search
|
if threads or search
|
||||||
Index.sort()
|
Index.sort()
|
||||||
@ -512,6 +513,7 @@ Index =
|
|||||||
return
|
return
|
||||||
|
|
||||||
buildThreads: ->
|
buildThreads: ->
|
||||||
|
return unless Index.liveThreadData
|
||||||
Index.nodes = []
|
Index.nodes = []
|
||||||
threads = []
|
threads = []
|
||||||
posts = []
|
posts = []
|
||||||
@ -595,6 +597,7 @@ Index =
|
|||||||
|
|
||||||
sort: ->
|
sort: ->
|
||||||
{liveThreadIDs, liveThreadData} = Index
|
{liveThreadIDs, liveThreadData} = Index
|
||||||
|
return unless liveThreadData
|
||||||
sortedThreadIDs = switch Conf['Index Sort']
|
sortedThreadIDs = switch Conf['Index Sort']
|
||||||
when 'lastreply'
|
when 'lastreply'
|
||||||
[liveThreadData...].sort((a, b) ->
|
[liveThreadData...].sort((a, b) ->
|
||||||
@ -627,6 +630,7 @@ Index =
|
|||||||
Index.sortedNodes = topNodes.concat(bottomNodes)
|
Index.sortedNodes = topNodes.concat(bottomNodes)
|
||||||
|
|
||||||
buildIndex: ->
|
buildIndex: ->
|
||||||
|
return unless Index.liveThreadData
|
||||||
switch Conf['Index Mode']
|
switch Conf['Index Mode']
|
||||||
when 'all pages'
|
when 'all pages'
|
||||||
nodes = Index.sortedNodes
|
nodes = Index.sortedNodes
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user