-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
101 lines (94 loc) · 2.98 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>runeworks206</title>
<style>
html, body {
overflow: hidden;
width : 100%;
height : 100%;
margin : 0;
padding : 0;
background-image: url('background.png');
background-size : cover;
}
</style>
<script src="rw-utility/rw-utility.js"></script>
<script src="rw-splash/rw-splash64.js"></script>
<script src="rw-splash/rw-splash.js"></script>
<script src="rw-chatbox/rw-chatbox.js"></script>
<!-- External dependency -->
<script
src="https://cdnjs.cloudflare.com/ajax/libs/fastdom/1.0.11/fastdom.min.js"
integrity="sha512-vmIWrwa/LN2C/PQiV5lWDjXEuKPJ7G4yigVsFDhy2zlcECnl3ER4/96QErZ5BlB6/PVg36MjBP6q8gE167fVQg=="
crossorigin="anonymous"
referrerpolicy="no-referrer"></script>
<script src="https://cdn.babylonjs.com/babylon.js"></script>
<script src="rw-babylon/rw-babylon.js"></script>
</head>
<body>
<canvas id="rw-canvas"></canvas>
</body>
<script>
let yourChatbox = 'thisChatbox'
let offset = 25
/* dummy functions */
// your application sending to server
let sendToServer = function(message, channel) {
receiveAtServer(message, channel)
}
// your server receiving chat data
let receiveAtServer = function(message, channel) {
// identify sender here && implement serverside verification if required
let user = 'smolprotecc'
broadcastToAll(message, channel, user)
}
// your server broadcasting data to appropriate people
let broadcastToAll = function(message, channel, user) {
let timestamp = new Date().getTime()
receiveAtWebpage(message, channel, user, timestamp)
}
// your application receiving data
let receiveAtWebpage = function(message, channel, user, timestamp) {
raiseEvent(document.querySelector('body'),
'rw-receive-message-' + yourChatbox,
{
user : user,
message: message,
channel: channel,
timestamp: timestamp,
})
}
document.addEventListener("DOMContentLoaded", async function(event) {
console.log(runeworks)
/*
let rws = runeworks.splash.start({
fadeOutDelay: 1100,
})
rws.next()
// Your intermediate code here
rws.next()
// Continue here
*/
let chatA = await runeworks.chatbox.new({
uuid : yourChatbox,
channels: ['main','admin','notifs','a','b','c','d','e','f'],
right : offset + 'px',
bottom : offset + 'px',
height : '80vh',
width : '23vw',
})
console.log(chatA)
chatA.self.style.backdropFilter = 'blur(6px)'
chatA.self.style.webkitBackdropFilter = 'blur(6px)'
document.querySelector('body').addEventListener('rw-raise-message-' + yourChatbox, (e) => {
let message = e.detail[0]
let channel = e.detail[1]
// your implementations of jsonWebToken or some other authy protocol here to transmit back to your server
sendToServer(message, channel)
})
})
</script>
</html>