-
Notifications
You must be signed in to change notification settings - Fork 0
/
startup.js
28 lines (26 loc) · 1.15 KB
/
startup.js
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
document.addEventListener('DOMContentLoaded', () => {
window.txtTunnelInstance = new URL("https://lluck.hackclub.app");
window.tunnelObj;
window.tunnelTickInterval = 3000;
window.userId;
window.keys = {};
window.previousMessageHash = "This is not a valid hash";
window.displayName;
window.usersInTunnel = {};
const createButton = document.getElementById('createButton');
const joinButton = document.getElementById('joinButton');
const sendButton = document.getElementById('sendButton');
window.tunnelChatHeader = document.getElementById('tunnelChatHeader');
window.chatLog = document.getElementById('chatBox');
window.userNameHeader = document.getElementById('userNameHeader');
// Add event listener for CTRL+Enter to send messages
document.addEventListener('keydown', (event) => {
if (event.ctrlKey && event.altKey) {
sendMessage();
}
});
createButton.addEventListener('click', createTunnel);
joinButton.addEventListener('click', joinTunnel);
sendButton.addEventListener('click', sendMessage);
userNameHeader.addEventListener('click', changeDisplayName);
});