commit: e2f7860a0630a8f2b9cac0782ee12d14eca4993e
parent 04abf3e1da066203cb6ba547f10d43ec1ba4e0c0
Author: neauoire <aliceffekt@gmail.com>
Date: Thu, 12 Dec 2019 11:08:31 -0500
Fixed issue with links
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/scripts/nodes/query.js b/scripts/nodes/query.js
@@ -46,13 +46,14 @@ const detectBackOrForward = function (onBack, onForward) {
}
window.addEventListener('hashchange', detectBackOrForward(
- function () { console.log('back'); Ø('query').bang() },
- function () { console.log('forward'); Ø('query').bang() }
+ function () { Ø('query').bang() },
+ function () { Ø('query').bang() }
))
document.addEventListener('click', (e) => {
- if (e.target.getAttribute('href')) {
- Ø('query').bang(e.target.getAttribute('href'))
+ const href = (e.target && e.target.getAttribute('href')) || (e.target && e.target.parentNode && e.target.parentNode.getAttribute('href'))
+ if (href && href.substr(0, 1) === '#') {
+ Ø('query').bang(href)
e.preventDefault()
}
})