diff --git a/src/General/Build.coffee b/src/General/Build.coffee index b8684853f..946ca1f3d 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -182,7 +182,7 @@ Build = '' if isOP and g.VIEW is 'index' and Conf['JSON Navigation'] - pageNum = Math.floor Index.liveThreadIDs.indexOf(postID) / Index.threadsNumPerPage + pageNum = Math.floor Index.liveThreadIDs.indexOf(postID) / Index.threadsNumPerPage + 1 pageIcon = " [#{pageNum}]" else pageIcon = '' diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 9f96228bf..630312cdd 100755 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -671,11 +671,11 @@ vp-replace ] # Board Navigation 'Front page': [ - '0' + '1' 'Jump to front page.' ] 'Open front page': [ - 'Shift+0' + 'Shift+1' 'Open front page in a new tab.' ] 'Next page': [ diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 496c5f770..2968dacf1 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -118,7 +118,7 @@ Index = Index.pageNum = Index.getCurrentPage() unless Index.pageNum? # Avoid having to pushState to keep track of the current page pageNum = Index.pageNum++ - return Index.endNotice() if pageNum >= Index.pagesNum + return Index.endNotice() if pageNum > Index.pagesNum nodes = Index.buildSinglePage pageNum Index.buildReplies nodes if Conf['Show Replies'] @@ -162,9 +162,9 @@ Index = Header.scrollToIfNeeded Index.root getCurrentPage: -> - +window.location.pathname.split('/')[2] + +window.location.pathname.split('/')[2] or 1 userPageNav: (pageNum) -> - Navigate.pushState if pageNum is 0 then './' else pageNum + Navigate.pushState if pageNum is 1 then './' else pageNum if Conf['Refreshed Navigation'] and Conf['Index Mode'] isnt 'all pages' Index.update pageNum else @@ -183,18 +183,18 @@ Index = else Index.pagesNum getMaxPageNum: -> - Math.max 0, Index.getPagesNum() - 1 + Math.max 1, Index.getPagesNum() togglePagelist: -> Index.pagelist.hidden = Conf['Index Mode'] isnt 'paged' buildPagelist: -> pagesRoot = $ '.pages', Index.pagelist maxPageNum = Index.getMaxPageNum() - if pagesRoot.childElementCount isnt maxPageNum + 1 + if pagesRoot.childElementCount isnt maxPageNum nodes = [] - for i in [0..maxPageNum] by 1 + for i in [1..maxPageNum] by 1 a = $.el 'a', textContent: i - href: if i then i else './' + href: if i is 1 then './' else i nodes.push $.tn('['), a, $.tn '] ' $.rmAll pagesRoot $.add pagesRoot, nodes @@ -206,11 +206,11 @@ Index = # Previous/Next buttons prev = pagesRoot.previousSibling.firstChild next = pagesRoot.nextSibling.firstChild - href = Math.max pageNum - 1, 0 - prev.href = if href is 0 then './' else href + href = Math.max pageNum - 1, 1 + prev.href = if href is 1 then './' else href prev.firstChild.disabled = href is pageNum href = Math.min pageNum + 1, maxPageNum - next.href = if href is 0 then './' else href + next.href = if href is 1 then './' else href next.firstChild.disabled = href is pageNum # current page if strong = $ 'strong', pagesRoot @@ -218,7 +218,7 @@ Index = $.replace strong, strong.firstChild else strong = $.el 'strong' - a = pagesRoot.children[pageNum] + a = pagesRoot.children[pageNum - 1] $.before a, strong $.add strong, a @@ -441,7 +441,7 @@ Index = buildSinglePage: (pageNum) -> nodes = [] nodesPerPage = Index.threadsNumPerPage - offset = nodesPerPage * pageNum + offset = nodesPerPage * (pageNum - 1) end = offset + nodesPerPage target = Index.sortedNodes.order()[offset] Index.sortedNodes @@ -470,7 +470,7 @@ Index = unless Index.searchInput.dataset.searching Index.searchInput.dataset.searching = 1 Index.pageBeforeSearch = Index.getCurrentPage() - pageNum = 0 + pageNum = 1 else pageNum = Index.getCurrentPage() else @@ -491,7 +491,7 @@ Index = Index.buildIndex() Index.setPage() else - Navigate.pushState if pageNum is 0 then './' else pageNum + Navigate.pushState if pageNum is 1 then './' else pageNum Index.pageLoad pageNum querySearch: (query) -> diff --git a/src/General/Navigate.coffee b/src/General/Navigate.coffee index 3140782c4..e179707c5 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 or 1 # string to number, '' to 1 view = 'index' # path is "/boardID/". See the problem? if view is g.VIEW and boardID is g.BOARD.ID diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index b9f73dc21..ebff9eb57 100755 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -87,7 +87,7 @@ Keybinds = # Board Navigation when Conf['Front page'] if Conf['JSON Navigation'] and g.VIEW is 'index' - Index.userPageNav 0 + Index.userPageNav 1 else window.location = "/#{g.BOARD}/" when Conf['Open front page'] diff --git a/src/Monitoring/ThreadStats.coffee b/src/Monitoring/ThreadStats.coffee index 0d8fcfdae..09468fa83 100755 --- a/src/Monitoring/ThreadStats.coffee +++ b/src/Monitoring/ThreadStats.coffee @@ -81,5 +81,5 @@ ThreadStats = for page in @response for thread in page.threads when thread.no is ThreadStats.thread.ID ThreadStats.pageCountEl.textContent = page.page - (if page.page is @response.length - 1 then $.addClass else $.rmClass) ThreadStats.pageCountEl, 'warning' + (if page.page is @response.length then $.addClass else $.rmClass) ThreadStats.pageCountEl, 'warning' return