From 5ab31d5e75f9a2bef7c7a2925423e4553bfa26b0 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 12 Apr 2014 17:02:08 -0700 Subject: [PATCH 1/3] fix JSON navigation history bugs --- src/General/Index.coffee | 3 ++- src/General/Navigate.coffee | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 1fc908b24..7e4ae9c9c 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -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) -> diff --git a/src/General/Navigate.coffee b/src/General/Navigate.coffee index 14fa10b14..32a5f9c0e 100644 --- a/src/General/Navigate.coffee +++ b/src/General/Navigate.coffee @@ -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', From ca216894ffac6fb749bd147e0a32fe91b17d426b Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 12 Apr 2014 17:21:34 -0700 Subject: [PATCH 2/3] "page 0" -> "front page" --- src/General/Config.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 59142edf2..828ab1469 100755 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -672,11 +672,11 @@ vp-replace # Board Navigation 'Front page': [ '0' - 'Jump to page 0.' + 'Jump to front page.' ] 'Open front page': [ 'Shift+0' - 'Open page 0 in a new tab.' + 'Open front page in a new tab.' ] 'Next page': [ 'Shift+Right' From 8812d4b326967e49b57bfb46e6a98e92dd51f1e7 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 12 Apr 2014 17:56:44 -0700 Subject: [PATCH 3/3] post building should not depend on JSON navigation --- src/General/Build.coffee | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 9aba0cff7..b8684853f 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -181,12 +181,16 @@ Build = else '' - if isOP and g.VIEW is 'index' + if isOP and g.VIEW is 'index' and Conf['JSON Navigation'] pageNum = Math.floor Index.liveThreadIDs.indexOf(postID) / Index.threadsNumPerPage pageIcon = " [#{pageNum}]" + else + pageIcon = '' + + if isOP and g.VIEW is 'index' replyLink = "   [Reply]" else - pageIcon = replyLink = '' + replyLink = '' container = $.el 'div', id: "pc#{postID}"