Move same-page check

ccd0:
Was a part of 1d56914bcb9f892ca341428067f8536971d06438
Implement a silly breadcrumb for JSON Navigation
This commit is contained in:
Zixaphir 2014-03-06 09:49:36 -07:00 committed by ccd0
parent 52303cfdc6
commit 8d52da3a32

View File

@ -154,6 +154,9 @@ Navigate =
navigate: (e) ->
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
if @pathname is Navigate.path
e.preventDefault()
return
$.addClass Index.button, 'fa-spin'
Index.clearSearch() if Index.isSearching
@ -167,18 +170,18 @@ Navigate =
delete Index.pageNum
$.rmAll Header.hover
path = @pathname
path += @hash if @hash
history.pushState null, '', path unless @id is 'popState'
Navigate.path = @pathname
if threadID
view = 'thread'
else
pageNum = +view or 1 # string to number, '' to 1
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
Navigate.disconnect()
Navigate.updateContext view
@ -281,7 +284,6 @@ Navigate =
Navigate.path = window.location.pathname
popstate: ->
return if window.location.pathname is Navigate.path
a = $.el 'a',
href: window.location
id: 'popState'