aboutsummaryrefslogtreecommitdiffhomepage
path: root/public/scripts/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/scripts/main.js')
-rw-r--r--public/scripts/main.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/public/scripts/main.js b/public/scripts/main.js
index 75fae1b..b2f2816 100644
--- a/public/scripts/main.js
+++ b/public/scripts/main.js
@@ -28,6 +28,7 @@ function connect(id) {
// setup listener
connectedUser.on('open', () => {
// TODO: Activate chat or sth
+ // TODO: Send public key
});
connectedUser.on('data', message => receivedMessage(message))
@@ -50,10 +51,9 @@ function sendMessage(message) {
*/
function receivedMessage(message, self = false) {
if (self) {
- $('#messages').append(`<span style="color: green">${message}</span><hr>`);
+ $('#messages').append(`<span style="color: green">${message}</span><br>`);
} else {
- $('#user_id').val(connectedUserId); // TODO: WTH DOESNT THIS WORK LOL
- $('#messages').append(`${message}<hr>`);
+ $('#messages').append(`${message}<br>`);
}
}
@@ -61,6 +61,8 @@ function receivedMessage(message, self = false) {
* Events after load
*/
$(document).ready(() => {
- $('#user_id_form').on('click', () => connect($('#user_id').val()));
- $('#message_form').on('click', () => sendMessage($('#message').val()));
+ $('#add_user_id').on('click', () => connect($('#user_id').val()));
+ $('#send_message').on('click', () => sendMessage($('#message').val()));
+
+ $('[toggle-contact-modal]').on('click', () => $('#add_contact_modal').toggleClass('is-active'))
});