From 7d773221e7711c4e534e89264c719b4cc5aabb1f Mon Sep 17 00:00:00 2001 From: Jefferson Julio Date: Wed, 2 Jun 2021 23:38:09 -0300 Subject: support for comments on pages --- static/navigator.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'static/navigator.js') diff --git a/static/navigator.js b/static/navigator.js index 6d53ee5..b1e7368 100644 --- a/static/navigator.js +++ b/static/navigator.js @@ -4,6 +4,14 @@ let pageTransitionCleared = false; function bindAllRelativeAnchors() { document.querySelectorAll('a[href^="/"]:not([navigator-bind])').forEach((el) => { + const url = new URL(el.href); + + if (url.pathname == window.location.pathname) { + if (url.href.match(/#.+$/)) { + return + } + } + el.setAttribute('navigator-bind', 'true'); el.addEventListener('click', (e) => { e.preventDefault(); -- cgit v1.2.3