Browse Source

Fixed issue where you wouldn't be able to press enter to send a message in chat.

KrisVos130 9 years ago
parent
commit
c86139a7cb
2 changed files with 19 additions and 6 deletions
  1. 8 6
      app/client/client.js
  2. 11 0
      app/client/templates/room.html

+ 8 - 6
app/client/client.js

@@ -471,12 +471,14 @@ Template.room.events({
     "click #submit": function() {
         sendMessage();
     },
-    //"keyup #chat-input": function(e) {
-    //    if (e.type === "keyup" && e.which === 13) {
-    //        e.preventDefault();
-    //        sendMessage()
-    //    }
-    //},
+    "keyup #chat-input": function(e) {
+        if (e.type === "keyup" && e.which === 13) {
+            e.preventDefault();
+            if (!$('#chat-input').data('dropdownshown')) {
+                sendMessage();
+            }
+        }
+    },
     "click #like": function(e) {
         $("#like").blur();
         Meteor.call("likeSong", Session.get("currentSong").mid);

+ 11 - 0
app/client/templates/room.html

@@ -484,6 +484,17 @@
                 }
                 ], {
                     footer: '<a href="http://www.emoji.codes" target="_blank">Browse All<span class="arrow">»</span></a>'
+                }).on('textComplete:show', function () {
+                    console.log("show");
+                    $(this).data('dropdownshown', true);
+                }).on('textComplete:hide', function () {
+                    console.log("hide");
+                    var self = this;
+                    Meteor.setTimeout(function () {
+                        console.log("really hiden");
+                        console.log(self);
+                        $(self).data('dropdownshown', false);
+                    }, 200); // adhoc
                 });
             } else {
                 Meteor.setTimeout(function () {