nondestructive hash setting
parent
b6c1b3aeac
commit
e0ead8f3c6
|
|
@ -1,4 +1,5 @@
|
||||||
todo:
|
todo:
|
||||||
- https://developer.mozilla.org/en-US/docs/Web/API/History/pushState#change_a_query_parameter
|
|
||||||
- preview default via q param
|
- preview default via q param
|
||||||
- css
|
- css
|
||||||
|
done:
|
||||||
|
- https://developer.mozilla.org/en-US/docs/Web/API/History/pushState#change_a_query_parameter
|
||||||
|
|
@ -189,8 +189,14 @@
|
||||||
lastNavigateToQuery = new Date()
|
lastNavigateToQuery = new Date()
|
||||||
const url = new URL(window.location)
|
const url = new URL(window.location)
|
||||||
url.searchParams.set(k, v)
|
url.searchParams.set(k, v)
|
||||||
window.location.hash = "#?"+k+"="+v
|
var hash = "#?"
|
||||||
//window.history.pushState({}, '', url)
|
const it = url.searchParams.entries()
|
||||||
|
let result = it.next()
|
||||||
|
while (!result.done) {
|
||||||
|
hash = hash + result.value[0] + "=" + result.value[1] + "&"
|
||||||
|
result = it.next()
|
||||||
|
}
|
||||||
|
window.location.hash = hash
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onhashchange = () => {
|
window.onhashchange = () => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue