diff options
author | Jefferson Julio <[email protected]> | 2021-06-02 23:38:09 -0300 |
---|---|---|
committer | Jefferson Julio <[email protected]> | 2021-06-02 23:38:09 -0300 |
commit | 7d773221e7711c4e534e89264c719b4cc5aabb1f (patch) | |
tree | baf59501215d3ee874b865c70c9b9d1408545a16 /static/navigator.js | |
parent | 5caf63d3897f353717fd69be9174d028fd078b23 (diff) | |
download | blog.sh-7d773221e7711c4e534e89264c719b4cc5aabb1f.tar.bz2 blog.sh-7d773221e7711c4e534e89264c719b4cc5aabb1f.zip |
support for comments on pages
Diffstat (limited to 'static/navigator.js')
-rw-r--r-- | static/navigator.js | 8 |
1 files changed, 8 insertions, 0 deletions
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(); |