updated build + example with navigator fix

This commit is contained in:
Leon van Kammen 2024-07-24 12:43:25 +00:00
parent ab026ea8a1
commit c6ee20bf01
7 changed files with 4753 additions and 10 deletions

View File

@ -1,5 +1,5 @@
/*
* v0.5.1 generated at Fri Jul 19 03:41:31 PM UTC 2024
* v0.5.1 generated at Wed Jul 24 12:06:14 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: MPL-2.0
*/
@ -2022,6 +2022,9 @@ xrf.hasNoMaterial = (mesh) => {
}
xrf.navigator = {
opts: {
openInNewTab: true
},
URI: xrf.URI.parse(document.location.href)
// scheme: document.location.protocol.replace(/:$/,''),
// directory: document.location.pathname,
@ -2156,7 +2159,12 @@ xrf.navigator.setupNavigateFallbacks = () => {
if( url.match(/^http/) && url != xrf.navigator.URI.URN && !xrf.loaders[fileExt] ){
let inIframe
try { inIframe = window.self !== window.top; } catch (e) { inIframe = true; }
return inIframe ? window.parent.postMessage({ url }, '*') : window.open( url, '_blank')
if( inIframe ){
window.parent.postMessage({ url }, '*')
}else{
if( xrf.navigator.opts.openInNewTab ) window.open( url, '_blank')
else{ setTimeout( () => document.location.href = url, 1000) }
}
// in case you're running in an iframe, then use this in the parent page:
//
// window.addEventListener("message", (e) => {

View File

@ -1,5 +1,5 @@
/*
* v0.5.1 generated at Fri Jul 19 03:41:31 PM UTC 2024
* v0.5.1 generated at Wed Jul 24 12:06:14 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: MPL-2.0
*/
@ -2020,6 +2020,9 @@ xrf.hasNoMaterial = (mesh) => {
}
xrf.navigator = {
opts: {
openInNewTab: true
},
URI: xrf.URI.parse(document.location.href)
// scheme: document.location.protocol.replace(/:$/,''),
// directory: document.location.pathname,
@ -2154,7 +2157,12 @@ xrf.navigator.setupNavigateFallbacks = () => {
if( url.match(/^http/) && url != xrf.navigator.URI.URN && !xrf.loaders[fileExt] ){
let inIframe
try { inIframe = window.self !== window.top; } catch (e) { inIframe = true; }
return inIframe ? window.parent.postMessage({ url }, '*') : window.open( url, '_blank')
if( inIframe ){
window.parent.postMessage({ url }, '*')
}else{
if( xrf.navigator.opts.openInNewTab ) window.open( url, '_blank')
else{ setTimeout( () => document.location.href = url, 1000) }
}
// in case you're running in an iframe, then use this in the parent page:
//
// window.addEventListener("message", (e) => {

View File

@ -2017,6 +2017,9 @@ xrf.hasNoMaterial = (mesh) => {
}
xrf.navigator = {
opts: {
openInNewTab: true
},
URI: xrf.URI.parse(document.location.href)
// scheme: document.location.protocol.replace(/:$/,''),
// directory: document.location.pathname,
@ -2151,7 +2154,12 @@ xrf.navigator.setupNavigateFallbacks = () => {
if( url.match(/^http/) && url != xrf.navigator.URI.URN && !xrf.loaders[fileExt] ){
let inIframe
try { inIframe = window.self !== window.top; } catch (e) { inIframe = true; }
return inIframe ? window.parent.postMessage({ url }, '*') : window.open( url, '_blank')
if( inIframe ){
window.parent.postMessage({ url }, '*')
}else{
if( xrf.navigator.opts.openInNewTab ) window.open( url, '_blank')
else{ setTimeout( () => document.location.href = url, 1000) }
}
// in case you're running in an iframe, then use this in the parent page:
//
// window.addEventListener("message", (e) => {

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/*
* v0.5.1 generated at Fri Jul 19 03:41:31 PM UTC 2024
* v0.5.1 generated at Wed Jul 24 12:06:14 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: MPL-2.0
*/
@ -2020,6 +2020,9 @@ xrf.hasNoMaterial = (mesh) => {
}
xrf.navigator = {
opts: {
openInNewTab: true
},
URI: xrf.URI.parse(document.location.href)
// scheme: document.location.protocol.replace(/:$/,''),
// directory: document.location.pathname,
@ -2154,7 +2157,12 @@ xrf.navigator.setupNavigateFallbacks = () => {
if( url.match(/^http/) && url != xrf.navigator.URI.URN && !xrf.loaders[fileExt] ){
let inIframe
try { inIframe = window.self !== window.top; } catch (e) { inIframe = true; }
return inIframe ? window.parent.postMessage({ url }, '*') : window.open( url, '_blank')
if( inIframe ){
window.parent.postMessage({ url }, '*')
}else{
if( xrf.navigator.opts.openInNewTab ) window.open( url, '_blank')
else{ setTimeout( () => document.location.href = url, 1000) }
}
// in case you're running in an iframe, then use this in the parent page:
//
// window.addEventListener("message", (e) => {

View File

@ -1,5 +1,5 @@
/*
* v0.5.1 generated at Fri Jul 19 03:41:31 PM UTC 2024
* v0.5.1 generated at Wed Jul 24 12:06:14 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: MPL-2.0
*/
@ -2020,6 +2020,9 @@ xrf.hasNoMaterial = (mesh) => {
}
xrf.navigator = {
opts: {
openInNewTab: true
},
URI: xrf.URI.parse(document.location.href)
// scheme: document.location.protocol.replace(/:$/,''),
// directory: document.location.pathname,
@ -2154,7 +2157,12 @@ xrf.navigator.setupNavigateFallbacks = () => {
if( url.match(/^http/) && url != xrf.navigator.URI.URN && !xrf.loaders[fileExt] ){
let inIframe
try { inIframe = window.self !== window.top; } catch (e) { inIframe = true; }
return inIframe ? window.parent.postMessage({ url }, '*') : window.open( url, '_blank')
if( inIframe ){
window.parent.postMessage({ url }, '*')
}else{
if( xrf.navigator.opts.openInNewTab ) window.open( url, '_blank')
else{ setTimeout( () => document.location.href = url, 1000) }
}
// in case you're running in an iframe, then use this in the parent page:
//
// window.addEventListener("message", (e) => {

View File

@ -41,7 +41,6 @@
<script>
document.addEventListener('$menu:ready', (e) => {
frontend.notify_links = true // shows href/src's as notifications when hovering buttons
// add your menubuttons:
let {$menu} = e.detail
$menu.buttons = $menu.buttons.concat([
@ -72,6 +71,9 @@
</a>
<br><br>
`,{timeout:false})
frontend.notify_links = true // shows href/src's as notifications when hovering buttons
xrf.navigator.opts.openInNewTab = false // open webpages in new tabs
})
</script>