Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Allow submitting the user message via Ctrl+Enter

  • Loading branch information...
commit e1d41276ccdf50eac4f5456b5d6c39375aa2bb50 1 parent a6f4c43
Sebastian Zartner authored July 23, 2012 janodvarko committed July 31, 2012

Showing 1 changed file with 21 additions and 2 deletions. Show diff stats Hide diff stats

  1. 23  tests/FBTest/content/userMessage.js
23  tests/FBTest/content/userMessage.js
@@ -12,13 +12,30 @@ var UserMessage =
12 12
 
13 13
     onOK: function()
14 14
     {
15  
-        var textBox = $("message", window);
16  
-        this.params.message = textBox.value;
  15
+        UserMessage.saveMessage();
17 16
     },
18 17
 
19 18
     onCancel: function()
20 19
     {
21 20
         this.params.cancel = true;
  21
+    },
  22
+
  23
+    onKeyDown: function(event)
  24
+    {
  25
+        if (event.keyCode == KeyEvent.DOM_VK_RETURN && (event.metaKey || event.ctrlKey) &&
  26
+            !event.shiftKey && !event.altKey)
  27
+        {
  28
+            UserMessage.saveMessage();
  29
+            $("fbTestUserMessage", window).acceptDialog();
  30
+        }
  31
+    },
  32
+
  33
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  34
+
  35
+    saveMessage: function()
  36
+    {
  37
+        var textBox = $("message", window);
  38
+        this.params.message = textBox.value;
22 39
     }
23 40
 }
24 41
 
@@ -31,3 +48,5 @@ function $(id, win)
31 48
 }
32 49
 
33 50
 // ********************************************************************************************* //
  51
+
  52
+window.document.addEventListener("keydown", UserMessage.onKeyDown, true);

0 notes on commit e1d4127

Please sign in to comment.
Something went wrong with that request. Please try again.