Skip to content

Commit 83c0ac7

Browse files
authored
Add files via upload
1 parent 0dbe6cf commit 83c0ac7

File tree

1 file changed

+25
-18
lines changed

1 file changed

+25
-18
lines changed

examples/control.html

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,30 @@
7171

7272
var roomID = "undefined";
7373

74-
if (urlParams.has("room")){
75-
roomID = urlParams.get("room");
76-
} else {
77-
roomID = generateStreamID();
78-
updateURL("room="+roomID);
79-
}
80-
81-
var url = document.URL.substr(0,document.URL.lastIndexOf('/'));
82-
83-
84-
navigator.clipboard.writeText(url+"/mixer?room="+roomID).then(() => {
85-
/* clipboard successfully set */
86-
}, () => {
87-
/* clipboard write failed */
88-
});
89-
90-
document.getElementById("body").innerHTML+=url+"/mixer?room="+roomID;
74+
if (urlParams.has("room")){
75+
roomID = urlParams.get("room");
76+
} else {
77+
roomID = generateStreamID();
78+
updateURL("room="+roomID);
79+
}
80+
81+
var url = document.URL.substr(0,document.URL.lastIndexOf('/'));
82+
var mixerURL = url + "/mixer?room=" + encodeURIComponent(roomID);
83+
var bodyElement = document.getElementById("body");
84+
var linkWrapper = document.createElement("div");
85+
var mixerLink = document.createElement("a");
86+
mixerLink.href = mixerURL;
87+
mixerLink.textContent = mixerURL;
88+
linkWrapper.appendChild(mixerLink);
89+
90+
91+
navigator.clipboard.writeText(mixerURL).then(() => {
92+
/* clipboard successfully set */
93+
}, () => {
94+
/* clipboard write failed */
95+
});
96+
97+
bodyElement.appendChild(linkWrapper);
9198

9299

93100
var socket = new WebSocket("wss://api.action.wtf:666"); // api.action.wtf has been deprecated.
@@ -120,4 +127,4 @@
120127

121128
</script>
122129
</body>
123-
</html>
130+
</html>

0 commit comments

Comments
 (0)