main: work in progress [might break]

This commit is contained in:
Leon van Kammen 2024-06-26 12:42:00 +00:00
parent 0bc9b1a989
commit 36391678c7
4 changed files with 41016 additions and 16 deletions

41002
dist/xrfragment.module.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -920,10 +920,11 @@ window.frontend = (opts) => new Proxy({
updateHashPosition(randomize){
const pos = xrf.frag.pos.get()
xrf.navigator.reactifyHash.enabled = false // prevent teleport
xrf.navigator.updateHash.active = false // prevent teleport
xrf.navigator.URI.hash.pos = `${pos.x},${pos.y},${pos.z}`
xrf.navigator.reactifyHash.enabled = true
this.copyToClipboard( window.location.href );
document.location.hash = `#${xrf.navigator.URI.fragment}`
xrf.navigator.updateHash.active = true
return document.location.href
},
copyToClipboard(text){
@ -941,11 +942,8 @@ window.frontend = (opts) => new Proxy({
if( network.meetingLink && !xrf.navigator.URI.hash.meet ){
xrf.navigator.URI.hash.meet = network.meetingLink
}
if( !xrf.navigator.URI.hash.pos && (network.posName || network.pos) ){
xrf.navigator.URI.hash.pos = network.posName || network.pos
}else frontend.updateHashPosition()
let url = window.location.href
let url = frontend.updateHashPosition()
console.log(url)
if( opts.linkonly ) return url
this.copyToClipboard( url )
// End of *TODO*

View File

@ -1,5 +1,5 @@
/*
* v0.5.1 generated at Tue Jun 25 01:51:16 PM UTC 2024
* v0.5.1 generated at Wed Jun 26 11:16:30 AM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: MPL-2.0
*/
@ -2122,7 +2122,7 @@ xrf.navigator.init = () => {
xrf.navigator.URI = xrfragment.URI.parse(document.location.href)
window.addEventListener('popstate', function (event){
if( !xrf.navigator.updateHash.active ){ // ignore programmatic hash updates (causes infinite recursion)
if( xrf.navigator.updateHash.active ){ // ignore programmatic hash updates (causes infinite recursion)
xrf.navigator.to( document.location.href.replace(/.*\?/,'') )
}
})
@ -2189,9 +2189,10 @@ xrf.navigator.reactifyHash = ( obj ) => {
get(me,k) { return me[k] },
set(me,k,v){
me[k] = v
if( xrf.navigator.reactifyHash.enabled ){
if( xrf.navigator.updateHash.active ){
xrf.navigator.to( "#" + this.toString(me) )
}
xrf.navigator.URI.fragment = this.toString(me)
},
toString(me){
let parts = []
@ -2202,7 +2203,6 @@ xrf.navigator.reactifyHash = ( obj ) => {
}
})
}
xrf.navigator.reactifyHash.enabled = true
/**
*
* navigation, portals & mutations

View File

@ -1,5 +1,5 @@
/*
* v0.5.1 generated at Tue Jun 25 01:51:16 PM UTC 2024
* v0.5.1 generated at Wed Jun 26 11:16:30 AM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: MPL-2.0
*/
@ -2122,7 +2122,7 @@ xrf.navigator.init = () => {
xrf.navigator.URI = xrfragment.URI.parse(document.location.href)
window.addEventListener('popstate', function (event){
if( !xrf.navigator.updateHash.active ){ // ignore programmatic hash updates (causes infinite recursion)
if( xrf.navigator.updateHash.active ){ // ignore programmatic hash updates (causes infinite recursion)
xrf.navigator.to( document.location.href.replace(/.*\?/,'') )
}
})
@ -2189,9 +2189,10 @@ xrf.navigator.reactifyHash = ( obj ) => {
get(me,k) { return me[k] },
set(me,k,v){
me[k] = v
if( xrf.navigator.reactifyHash.enabled ){
if( xrf.navigator.updateHash.active ){
xrf.navigator.to( "#" + this.toString(me) )
}
xrf.navigator.URI.fragment = this.toString(me)
},
toString(me){
let parts = []
@ -2202,7 +2203,6 @@ xrf.navigator.reactifyHash = ( obj ) => {
}
})
}
xrf.navigator.reactifyHash.enabled = true
/**
*
* navigation, portals & mutations