diff --git a/src/js/main.js b/src/js/main.js index c143823..9bc5980 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -394,10 +394,19 @@ $(function() { } $('#join-modal .key').on('input propertychange paste change', function() { - var val = $(this).val(); + var val = $(this).val().trim(); joinKeyInputChanged(val); }); + $('#settings-modal input.key').on('input propertychange paste change', function() { + var val = $(this).val().trim(); + if (val !== encryptionKey && val.length) { + $('#settings-modal #save-key-edit').removeAttr('disabled'); + } else { + $('#settings-modal #save-key-edit').attr('disabled', 'disabled'); + } + }); + $('.navbar .participants').click(function() { renderParticipantsList(); $('#participants-modal').modal('show'); @@ -427,7 +436,8 @@ $(function() { // Prevent closing join-modal $('#join-modal').modal({ backdrop: 'static', - show: false + show: false, + keyboard: false }); $('.read-key').click(function() { @@ -437,19 +447,24 @@ $(function() { }); $('.edit-key #cancel-key-edit').click(function() { - $('.edit-key').hide(); - $('.read-key').show(); - updateKeyVal(encryptionKey); + cancelSaveKey(); }); $('.edit-key #save-key-edit').click(function() { saveKey(); }); - function saveKey() { + function cancelSaveKey() { $('.edit-key').hide(); $('.read-key').show(); + updateKeyVal(encryptionKey); + } + + function saveKey() { var key = $('.edit-key input.key').val().trim(); + if (!key.length) return; + $('.edit-key').hide(); + $('.read-key').show(); updateKeyVal(key || encryptionKey); } @@ -464,4 +479,8 @@ $(function() { $('#join-modal').modal('hide'); } + $('#settings-modal').on('hide.bs.modal', function (e) { + cancelSaveKey(); + }); + }); diff --git a/src/public/style.css b/src/public/style.css index db06e25..45aab39 100644 --- a/src/public/style.css +++ b/src/public/style.css @@ -167,26 +167,6 @@ input { border-radius: 0px; } -#settings-modal .modal-footer button.encryption-inactive { - display: none; -} - -.chat #input-icons { - position: absolute; - bottom: 15px; - right: 15px; -} - -.chat .warning-sign { - display: none; - cursor: pointer; - width: 35px; -} - -.inputMessage.encryption-disabled { - background-color: rgba(254, 6, 6, 0.15); -} - .participants { position: relative; top: 16px; diff --git a/src/views/index.mustache b/src/views/index.mustache index 26fd1ea..35bdbc0 100644 --- a/src/views/index.mustache +++ b/src/views/index.mustache @@ -53,9 +53,6 @@ -
- -
@@ -74,7 +71,7 @@

Questions/comments? Email us at hello[at]fatty.chat

@@ -100,14 +97,13 @@
- +
@@ -122,10 +118,10 @@ @@ -142,7 +138,7 @@ @@ -159,7 +155,7 @@