fix JSON navigation history bugs

This commit is contained in:
ccd0 2014-04-12 17:02:08 -07:00
parent 8a5cd7a610
commit 5ab31d5e75
2 changed files with 7 additions and 2 deletions

View File

@ -163,13 +163,13 @@ Index =
getCurrentPage: ->
+window.location.pathname.split('/')[2]
userPageNav: (pageNum) ->
Navigate.pushState if pageNum is 0 then './' else pageNum
if Conf['Refreshed Navigation'] and Conf['Index Mode'] isnt 'all pages'
Index.update pageNum
else
Index.pageNav pageNum
pageNav: (pageNum) ->
return if Index.currentPage is pageNum
history.pushState null, '', if pageNum is 0 then './' else pageNum
Index.pageLoad pageNum
pageLoad: (pageNum) ->
Index.currentPage = pageNum
@ -492,6 +492,7 @@ Index =
Index.buildIndex()
Index.setPage()
else
Navigate.pushState if pageNum is 0 then './' else pageNum
Index.pageNav pageNum
querySearch: (query) ->

View File

@ -198,7 +198,7 @@ Navigate =
if threadID
view = 'thread'
else
pageNum = view
pageNum = +view
view = 'index' # path is "/boardID/". See the problem?
if view is g.VIEW and boardID is g.BOARD.ID
@ -302,6 +302,10 @@ Navigate =
if Conf['Unread Count']
Navigate.ready 'Unread Count', Unread.ready, Conf['Unread Count']
pushState: (path) ->
history.pushState null, '', path
Navigate.path = window.location.pathname
popstate: ->
return if window.location.pathname is Navigate.path
a = $.el 'a',