Skip to content
This repository was archived by the owner on May 18, 2025. It is now read-only.

Commit 88b1177

Browse files
href buttons with nonhttp protocol in scene, now trigger connection popup
1 parent 21ef1de commit 88b1177

File tree

7 files changed

+31
-18
lines changed

7 files changed

+31
-18
lines changed

src/3rd/js/aframe/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ window.AFRAME.registerComponent('xrf', {
6161
let url = opts.xrf.string
6262
let isLocal = url.match(/^#/)
6363
let hasPos = url.match(/pos=/)
64+
if( !isLocal && !url.match(/^http/) ) return // dont fade/load for custom protocol handlers
6465
if( isLocal && hasPos ){
6566
// local teleports only
6667
let fastFadeMs = 200

src/3rd/js/extra/$chat.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ chatComponent = {
5050

5151
send(opts){
5252
opts = { linebreak:true, message:"", class:[], ...opts }
53+
let div = document.createElement('div')
5354
let msg = document.createElement('div')
5455
let br = document.createElement('br')
5556
msg.className = "msg"
@@ -62,8 +63,9 @@ chatComponent = {
6263
msg.classList.add.apply(msg.classList, opts.class)
6364
br.classList.add.apply(br.classList, opts.class)
6465
}
65-
$messages.appendChild(msg)
66-
if( opts.linebreak ) $messages.appendChild(br)
66+
div.appendChild(msg)
67+
$messages.appendChild(div)
68+
if( opts.linebreak ) div.appendChild(br)
6769
$messages.scrollTop = $messages.scrollHeight // scroll down
6870
document.dispatchEvent( new CustomEvent("$chat:receive", {detail: opts}) )
6971
$messages.last = msg.innerHTML
@@ -161,6 +163,7 @@ chatComponent.css = `
161163
box-sizing:border-box;
162164
height: 24px;
163165
font-size: var(--xrf-font-size-2);
166+
max-width:unset;
164167
}
165168
#messages{
166169
position: absolute;

src/3rd/js/extra/$connections.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ connectionsComponent = {
22

33
html: `
44
<div id="connections">
5-
<h2>Network channels:</h2>
5+
<h2>Connection layers:</h2>
66
<table>
77
<tr>
8-
<td>Webcam</td>
8+
<td>Webcam/Audio</td>
99
<td>
1010
<select id="webcam"></select>
1111
</td>
@@ -59,7 +59,7 @@ connectionsComponent = {
5959
show(){
6060
$chat.visible = true
6161
if( !network.connected ){
62-
if( el.parentElement ) el.parentElement.remove()
62+
if( el.parentElement ) el.parentElement.parentElement.remove()
6363
$chat.send({message:"", el})
6464
this.renderSettings()
6565
if( !network.meetinglink ){ // set default
@@ -115,9 +115,13 @@ connectionsComponent = {
115115
set(data,k,v){
116116
data[k] = v
117117
switch( k ){
118-
case "webcam": $webcam.innerHTML = `<option>${data[k].map((p)=>p.plugin.name).join('</option><option>')}</option>`; break;
119-
case "chatnetwork": $chatnetwork.innerHTML = `<option>${data[k].map((p)=>p.plugin.name).join('</option><option>')}</option>`; break;
120-
case "scene": $scene.innerHTML = `<option>${data[k].map((p)=>p.plugin.name).join('</option><option>')}</option>`; break;
118+
case "webcam": $webcam.innerHTML = `<option>${data[k].map((p)=>p.plugin.name).join('</option><option>')}</option>`; break;
119+
case "chatnetwork": $chatnetwork.innerHTML = `<option>${data[k].map((p)=>p.plugin.name).join('</option><option>')}</option>`; break;
120+
case "scene": $scene.innerHTML = `<option>${data[k].map((p)=>p.plugin.name).join('</option><option>')}</option>`; break;
121+
case "selectedScene": $scene.value = v; data.renderSettings(); break;
122+
case "selectedWebcam": $webcam.value = v; data.renderSettings(); break;
123+
case "selectedChatnetwork": $chatnetwork.value = v; data.renderSettings(); break;
124+
121125
}
122126
}
123127

src/3rd/js/extra/$menu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ $menu.css = `
855855
text-align:right;
856856
}
857857
.xrf table tr td:nth-child(1){
858-
min-width:115px;
858+
min-width:70px;
859859
height:40px;
860860
padding-right:15px;
861861
}

src/3rd/js/extra/network/matrix.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ window.matrix = (opts) => new Proxy({
3737
</td>
3838
</tr>
3939
<tr>
40-
<td>authenticate</td>
40+
<td>auth</td>
4141
<td>
42-
<select>
42+
<select id="auth">
4343
<option>via password</option>
4444
<option>via access token</option>
4545
</select>
@@ -48,7 +48,7 @@ window.matrix = (opts) => new Proxy({
4848
<tr>
4949
<td></td>
5050
<td>
51-
<input type="text" id="secret" placeholder="password or token"/>
51+
<input type="text" id="secret" placeholder="enter password"/>
5252
</td>
5353
</tr>
5454
</table>
@@ -79,6 +79,9 @@ window.matrix = (opts) => new Proxy({
7979
if( this.html[i] ) html += this.html[i](opts)
8080
}
8181
this.el.innerHTML = html
82+
this.el.querySelector('#auth').addEventListener('change', (e) => {
83+
this.el.querySelector('#secret').setAttribute('placeholder', `enter ${e.target.value.replace(/.* /,'')}`)
84+
})
8285
window.notify(`${opts.name} is ${opts.description}, it is the hottest internet technology available at this moment.<br>Read more about it <a href="${opts.url}" target="_blank">here</a>.<br>You can basically make up a new channelname or use an existing one`)
8386
return this.el
8487
},
@@ -90,11 +93,11 @@ window.matrix = (opts) => new Proxy({
9093
if( mesh.userData.href.match(this.protocol) ){
9194
let parts = mesh.userData.href.replace(this.plugin.protocol,'')
9295
if( parts[0] == 'r' ){ // room
93-
$connections.$chatnetwork.value = this.plugin.name
94-
$connections.$scene.value = this.plugin.name
95-
$connections.show()
9696
let server = parts.split("/")[1].replace(/:.*/,'')
9797
let channel = parts.split("/")[1].replace(/.*:/,'')
98+
$connections.show()
99+
$connections.selectedChatnetwork = this.plugin.name
100+
$connections.selectedScene = this.plugin.name
98101
this.el.querySelector('#channel').value = `#${channel}:${server}`
99102
this.el.querySelector('#server').value = server
100103
console.log("configured matrix")

src/3rd/js/extra/network/trystero.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ window.trystero = (opts) => new Proxy({
8282
this.server = parts.split("/")[1].replace(/.*:/,'')
8383
if( this.server != 'bittorrent' ) window.notify("only bittorrent is supported for trystero (for now) :/")
8484
$connections.show()
85-
$connections.$webcam.value = this.plugin.name
86-
$connections.$chatnetwork.value = this.plugin.name
87-
$connections.$scene.value = this.plugin.name
85+
$connections.selectedWebcam = this.plugin.name
86+
$connections.selectedChatnetwork= this.plugin.name
87+
$connections.selectedScene = this.plugin.name
8888
console.log("configured trystero")
8989
}
9090
}else window.notify("malformed connection URI: "+mesh.userData.href)

src/3rd/js/three/xrf/href.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ xrf.frag.href = function(v, opts){
4848
//}
4949
const flags = v.string[0] == '#' ? xrf.XRF.PV_OVERRIDE : undefined
5050
let toFrag = xrf.URI.parse( v.string, xrf.XRF.NAVIGATOR | xrf.XRF.PV_OVERRIDE | xrf.XRF.METADATA )
51+
// *TODO* support for multiple protocols
52+
if( !v.string.match(/^http/) ) return
5153
// always commit current location (keep a trail of last positions before we navigate)
5254
if( !e.nocommit && !document.location.hash.match(lastPos) ) xrf.navigator.to(`#${lastPos}`)
5355
xrf.navigator.to(v.string) // let's surf to HREF!

0 commit comments

Comments
 (0)