Refresh the index when trying to navigate to the same board.
Close #1461.
This commit is contained in:
parent
d9cfe0e410
commit
5ca21b1f4a
@ -322,30 +322,32 @@ Index =
|
|||||||
a = e.target
|
a = e.target
|
||||||
return if e.button isnt 0 or a.nodeName isnt 'A' or a.hostname isnt 'boards.4chan.org'
|
return if e.button isnt 0 or a.nodeName isnt 'A' or a.hostname isnt 'boards.4chan.org'
|
||||||
# Save settings
|
# Save settings
|
||||||
onSameBoard = a.pathname.split('/')[1] is g.BOARD.ID
|
onSameIndex = g.VIEW is 'index' and a.pathname.split('/')[1] is g.BOARD.ID
|
||||||
Index.cb.indexNav a, onSameBoard
|
needChange = Index.cb.indexNav a, onSameIndex
|
||||||
# Do nav if this isn't a simple click, or different board.
|
# Do nav if this isn't a simple click, or different board.
|
||||||
return if e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or !onSameBoard
|
return if e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or !onSameIndex
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
indexNav: (a, onSameBoard) ->
|
Index.update() unless needChange
|
||||||
|
indexNav: (a, onSameIndex) ->
|
||||||
{indexMode, indexSort} = a.dataset
|
{indexMode, indexSort} = a.dataset
|
||||||
if indexMode
|
if indexMode and Conf['Index Mode'] isnt indexMode
|
||||||
$.set 'Index Mode', indexMode
|
$.set 'Index Mode', indexMode
|
||||||
Conf['Index Mode'] = indexMode
|
Conf['Index Mode'] = indexMode
|
||||||
if g.VIEW is 'index' and onSameBoard
|
if onSameIndex
|
||||||
Index.selectMode.value = indexMode
|
Index.selectMode.value = indexMode
|
||||||
Index.cb.mode()
|
Index.cb.mode()
|
||||||
if indexSort
|
needChange = true
|
||||||
|
if indexSort and Conf['Index Sort'] isnt indexSort
|
||||||
$.set 'Index Sort', indexSort
|
$.set 'Index Sort', indexSort
|
||||||
Conf['Index Sort'] = indexSort
|
Conf['Index Sort'] = indexSort
|
||||||
if g.VIEW is 'index' and onSameBoard
|
if onSameIndex
|
||||||
Index.selectSort.value = indexSort
|
Index.selectSort.value = indexSort
|
||||||
Index.cb.sort()
|
Index.cb.sort()
|
||||||
if g.VIEW is 'index' and onSameBoard and (indexMode or indexSort)
|
needChange = true
|
||||||
|
if needChange
|
||||||
Index.buildIndex()
|
Index.buildIndex()
|
||||||
Index.scrollToIndex()
|
Index.scrollToIndex()
|
||||||
return true
|
needChange
|
||||||
false
|
|
||||||
|
|
||||||
scrollToIndex: ->
|
scrollToIndex: ->
|
||||||
Header.scrollToIfNeeded Index.navLinks
|
Header.scrollToIfNeeded Index.navLinks
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user