Browse Source

Disallow sending empty messages

Thomas Dy 11 years ago
parent
commit
df856fbc60
3 changed files with 3 additions and 4 deletions
  1. 1 1
      public/javascripts/main.js
  2. 1 1
      public/partials/chatRoom.html
  3. 1 2
      public/stylesheets/main.css

+ 1 - 1
public/javascripts/main.js

@@ -41,7 +41,7 @@ function ChatCtrl($scope, Chat, Connection) {
   $scope.chat = Chat;
 
   $scope.onType = function(event) {
-    if(event.keyCode == 13) {
+    if($scope.text != '' && event.keyCode == 13) {
       Chat.send($scope.text);
       $scope.text = '';
       event.originalEvent.preventDefault();

+ 1 - 1
public/partials/chatRoom.html

@@ -21,7 +21,7 @@
           <p>{{message.message}}</p>
         </div>
       </div>
-      <textarea ng-model="text" id="talk" ng-keypress="onType($event)"></textarea>
+      <input type="text" ng-model="text" id="talk" ng-keypress="onType($event)">
     </div>
     <div class="span4" ng-controller="GameCtrl">
       <button class="btn" ng-show="game.pendingRound" ng-click="game.startRound()">Start</button>

+ 1 - 2
public/stylesheets/main.css

@@ -68,7 +68,7 @@ body {
 
 #messages {
     position: absolute;
-    bottom: 60px;
+    bottom: 40px;
 }
 
 #talk {
@@ -77,7 +77,6 @@ body {
     left: 0;
     right: 0;
     width: auto;
-    height: 40px
 }
 
 .message {