diff options
author | Marvin Borner | 2019-01-23 16:44:27 +0100 |
---|---|---|
committer | Marvin Borner | 2019-01-23 16:44:27 +0100 |
commit | 6f9cd73f5b8273ab659554e541e52af786789bac (patch) | |
tree | 86adaac338bc3dc649e7eca128eda2cd5a66f0e4 /public/scripts | |
parent | 4980f79caa07d8c2ec878ceceba6e846679a0ad1 (diff) |
Many frontend improvements
Diffstat (limited to 'public/scripts')
-rw-r--r-- | public/scripts/0_general.js | 4 | ||||
-rw-r--r-- | public/scripts/main.js | 12 |
2 files changed, 11 insertions, 5 deletions
diff --git a/public/scripts/0_general.js b/public/scripts/0_general.js new file mode 100644 index 0000000..ea259e7 --- /dev/null +++ b/public/scripts/0_general.js @@ -0,0 +1,4 @@ +/** + * General imports + */ +require('@fortawesome/fontawesome-free/js/all.min'); 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')) }); |