From d45cc0eb1a033b4bcb5df68cdfddaa9b2c783383 Mon Sep 17 00:00:00 2001 From: Enoc Date: Tue, 23 Mar 2021 22:06:28 -0600 Subject: [PATCH] Remove logs and improve feature Elementes in the sidebar werent served as xhr request due this feature, now it works checking if it is an element in the sidebar --- assets/javascripts/lib/page.coffee | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/assets/javascripts/lib/page.coffee b/assets/javascripts/lib/page.coffee index b245098d..b8baef01 100644 --- a/assets/javascripts/lib/page.coffee +++ b/assets/javascripts/lib/page.coffee @@ -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"]')