Move check of whether any changes have occured into Index.pageLoad.
Minor changes in under what circumstances we scroll to the top.
This commit is contained in:
parent
d74ba15247
commit
9f0c2e59f4
@ -248,8 +248,7 @@ Index =
|
|||||||
if Index.currentPage isnt page
|
if Index.currentPage isnt page
|
||||||
Index.changed.page = true
|
Index.changed.page = true
|
||||||
Index.currentPage = page
|
Index.currentPage = page
|
||||||
if Object.keys(Index.changed).length
|
Index.pageLoad false
|
||||||
Index.pageLoad false
|
|
||||||
else
|
else
|
||||||
# page load or hash change
|
# page load or hash change
|
||||||
if Index.processHash()
|
if Index.processHash()
|
||||||
@ -287,7 +286,7 @@ Index =
|
|||||||
if Conf['Refreshed Navigation']
|
if Conf['Refreshed Navigation']
|
||||||
Index.update()
|
Index.update()
|
||||||
else
|
else
|
||||||
Index.pageLoad() if Object.keys(Index.changed).length
|
Index.pageLoad()
|
||||||
|
|
||||||
processHash: ->
|
processHash: ->
|
||||||
# XXX https://bugzilla.mozilla.org/show_bug.cgi?id=483304
|
# XXX https://bugzilla.mozilla.org/show_bug.cgi?id=483304
|
||||||
@ -344,14 +343,15 @@ Index =
|
|||||||
$.set 'Previous Index Mode', mode
|
$.set 'Previous Index Mode', mode
|
||||||
|
|
||||||
pageLoad: (scroll=true) ->
|
pageLoad: (scroll=true) ->
|
||||||
{threads, search, mode} = Index.changed
|
{threads, search, mode, page} = Index.changed
|
||||||
if threads or search
|
if threads or search
|
||||||
Index.sort()
|
Index.sort()
|
||||||
Index.buildPagelist()
|
Index.buildPagelist()
|
||||||
Index.setupSearch() if search
|
Index.setupSearch() if search
|
||||||
Index.applyMode() if mode
|
Index.applyMode() if mode
|
||||||
Index.buildIndex()
|
if threads or search or mode or page
|
||||||
Index.setPage()
|
Index.buildIndex()
|
||||||
|
Index.setPage()
|
||||||
Index.scrollToIndex() if scroll
|
Index.scrollToIndex() if scroll
|
||||||
Index.changed = {}
|
Index.changed = {}
|
||||||
|
|
||||||
@ -474,7 +474,7 @@ Index =
|
|||||||
try
|
try
|
||||||
if req.status is 200
|
if req.status is 200
|
||||||
Index.parse req.response
|
Index.parse req.response
|
||||||
else if req.status is 304 and Object.keys(Index.changed).length
|
else if req.status is 304
|
||||||
Index.pageLoad()
|
Index.pageLoad()
|
||||||
catch err
|
catch err
|
||||||
c.error "Index failure: #{err.message}", err.stack
|
c.error "Index failure: #{err.message}", err.stack
|
||||||
@ -498,7 +498,6 @@ Index =
|
|||||||
timeEl = $ '#index-last-refresh time', Index.navLinks
|
timeEl = $ '#index-last-refresh time', Index.navLinks
|
||||||
timeEl.dataset.utc = Date.parse req.getResponseHeader 'Last-Modified'
|
timeEl.dataset.utc = Date.parse req.getResponseHeader 'Last-Modified'
|
||||||
RelativeDates.update timeEl
|
RelativeDates.update timeEl
|
||||||
Index.scrollToIndex()
|
|
||||||
|
|
||||||
parse: (pages) ->
|
parse: (pages) ->
|
||||||
$.cleanCache (url) -> /^\/\/a\.4cdn\.org\//.test url
|
$.cleanCache (url) -> /^\/\/a\.4cdn\.org\//.test url
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user