|
|
|
@ -178,11 +178,13 @@ onclick = (event) ->
|
|
|
|
|
link = $.eventTarget(event)
|
|
|
|
|
link = link.parentNode while link and link.tagName isnt 'A'
|
|
|
|
|
|
|
|
|
|
if link and not link.target and isSameOrigin(link.href) and isSameOriginDifferentDoc(link)
|
|
|
|
|
event.preventDefault()
|
|
|
|
|
path = link.pathname + link.search + link.hash
|
|
|
|
|
path = path.replace /^\/\/+/, '/' # IE11 bug
|
|
|
|
|
page.show(path)
|
|
|
|
|
if link and not link.target and isSameOrigin(link.href)
|
|
|
|
|
|
|
|
|
|
if link.className.match('_list-item') or not isSameOriginDifferentDoc(link)
|
|
|
|
|
event.preventDefault()
|
|
|
|
|
path = link.pathname + link.search + link.hash
|
|
|
|
|
path = path.replace /^\/\/+/, '/' # IE11 bug
|
|
|
|
|
page.show(path)
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
@ -190,9 +192,7 @@ isSameOrigin = (url) ->
|
|
|
|
|
url.indexOf("#{location.protocol}//#{location.hostname}") is 0
|
|
|
|
|
|
|
|
|
|
isSameOriginDifferentDoc = (url) ->
|
|
|
|
|
console.log(url.pathname)
|
|
|
|
|
console.log(location.pathname)
|
|
|
|
|
url.pathname == location.pathname
|
|
|
|
|
url.pathname.split('/')[1] != location.pathname.split('/')[1]
|
|
|
|
|
|
|
|
|
|
updateCanonicalLink = ->
|
|
|
|
|
@canonicalLink ||= document.head.querySelector('link[rel="canonical"]')
|
|
|
|
|