diff --git a/onionshare_gui/tab/tab.py b/onionshare_gui/tab/tab.py index fdad4898..ecc2542d 100644 --- a/onionshare_gui/tab/tab.py +++ b/onionshare_gui/tab/tab.py @@ -532,6 +532,8 @@ class Tab(QtWidgets.QWidget): return self.share_mode elif self.mode == self.common.gui.MODE_RECEIVE: return self.receive_mode + elif self.mode == self.common.gui.MODE_CHAT: + return self.chat_mode else: return self.website_mode else: diff --git a/share/static/js/chat.js b/share/static/js/chat.js index 7cbf9ab6..fdddfab7 100644 --- a/share/static/js/chat.js +++ b/share/static/js/chat.js @@ -34,6 +34,15 @@ $(function(){ emitMessage(socket); }); + // Keep buttons disabled unless changed or not empty + $('#username').on('keyup',function() { + if ($('#username').val() !== '' && $('#username').val() !== current_username) { + $('#update-username').removeAttr('disabled'); + } else { + $('#update-username').attr('disabled', true); + } + }); + // Update username $('#update-username').on('click', function() { var username = $('#username').val(); diff --git a/share/templates/chat.html b/share/templates/chat.html index 6eb5eeb6..cb595399 100644 --- a/share/templates/chat.html +++ b/share/templates/chat.html @@ -28,7 +28,7 @@