Move same-page check
ccd0: Was a part of 1d56914bcb9f892ca341428067f8536971d06438 Implement a silly breadcrumb for JSON Navigation
This commit is contained in:
parent
52303cfdc6
commit
8d52da3a32
@ -154,6 +154,9 @@ Navigate =
|
|||||||
navigate: (e) ->
|
navigate: (e) ->
|
||||||
return if @hostname isnt 'boards.4chan.org' or window.location.hostname is 'rs.4chan.org'
|
return if @hostname isnt 'boards.4chan.org' or window.location.hostname is 'rs.4chan.org'
|
||||||
return if e and (e.shiftKey or e.ctrlKey or (e.type is 'click' and e.button isnt 0)) # Not simply a left click
|
return if e and (e.shiftKey or e.ctrlKey or (e.type is 'click' and e.button isnt 0)) # Not simply a left click
|
||||||
|
if @pathname is Navigate.path
|
||||||
|
e.preventDefault()
|
||||||
|
return
|
||||||
|
|
||||||
$.addClass Index.button, 'fa-spin'
|
$.addClass Index.button, 'fa-spin'
|
||||||
Index.clearSearch() if Index.isSearching
|
Index.clearSearch() if Index.isSearching
|
||||||
@ -167,18 +170,18 @@ Navigate =
|
|||||||
delete Index.pageNum
|
delete Index.pageNum
|
||||||
$.rmAll Header.hover
|
$.rmAll Header.hover
|
||||||
|
|
||||||
path = @pathname
|
|
||||||
path += @hash if @hash
|
|
||||||
|
|
||||||
history.pushState null, '', path unless @id is 'popState'
|
|
||||||
Navigate.path = @pathname
|
|
||||||
|
|
||||||
if threadID
|
if threadID
|
||||||
view = 'thread'
|
view = 'thread'
|
||||||
else
|
else
|
||||||
pageNum = +view or 1 # string to number, '' to 1
|
pageNum = +view or 1 # string to number, '' to 1
|
||||||
view = 'index' # path is "/boardID/". See the problem?
|
view = 'index' # path is "/boardID/". See the problem?
|
||||||
|
|
||||||
|
path = @pathname
|
||||||
|
path += @hash if @hash
|
||||||
|
|
||||||
|
history.pushState null, '', path unless @id is 'popState'
|
||||||
|
Navigate.path = @pathname
|
||||||
|
|
||||||
unless view is 'index' and 'index' is g.VIEW and boardID is g.BOARD.ID
|
unless view is 'index' and 'index' is g.VIEW and boardID is g.BOARD.ID
|
||||||
Navigate.disconnect()
|
Navigate.disconnect()
|
||||||
Navigate.updateContext view
|
Navigate.updateContext view
|
||||||
@ -281,7 +284,6 @@ Navigate =
|
|||||||
Navigate.path = window.location.pathname
|
Navigate.path = window.location.pathname
|
||||||
|
|
||||||
popstate: ->
|
popstate: ->
|
||||||
return if window.location.pathname is Navigate.path
|
|
||||||
a = $.el 'a',
|
a = $.el 'a',
|
||||||
href: window.location
|
href: window.location
|
||||||
id: 'popState'
|
id: 'popState'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user