aboutsummaryrefslogtreecommitdiff
path: root/static/navigator.js
diff options
context:
space:
mode:
authorJefferson Julio <[email protected]>2021-06-02 23:38:09 -0300
committerJefferson Julio <[email protected]>2021-06-02 23:38:09 -0300
commit7d773221e7711c4e534e89264c719b4cc5aabb1f (patch)
treebaf59501215d3ee874b865c70c9b9d1408545a16 /static/navigator.js
parent5caf63d3897f353717fd69be9174d028fd078b23 (diff)
downloadblog.sh-7d773221e7711c4e534e89264c719b4cc5aabb1f.tar.bz2
blog.sh-7d773221e7711c4e534e89264c719b4cc5aabb1f.zip
support for comments on pages
Diffstat (limited to 'static/navigator.js')
-rw-r--r--static/navigator.js8
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();