Index: static/js/main/main.js |
diff --git a/static/js/main/main.js b/static/js/main/main.js |
index 6e84d7d3648ad7d5ae126febc94f457f4fee5834..e0592613f9ac881137b4d351300cc480caf9faab 100644 |
--- a/static/js/main/main.js |
+++ b/static/js/main/main.js |
@@ -21,6 +21,7 @@ function help_init() { |
message.onmouseover = help_show; |
message.onmousemove = help_show; |
message.onmouseout = help_hide; |
+ message.onkeypress = auto_submit; |
var help = document.getElementById('help'); |
help.onmouseover = help_show; |
@@ -39,3 +40,19 @@ function help_hide() { |
var help = document.getElementById('help'); |
help.hidden = true; |
} |
+ |
+/* |
+ * Misc functions. |
+ */ |
+ |
+// Used by the status field. |
+function auto_submit(e) { |
+ if (!e.shiftKey && e.keyCode == 13) { |
+ // Catch the enter key in the textarea. Allow shift+enter to work |
+ // so people editing a lot of text can play around with things. |
+ var form = document.getElementsByName('add_new_message')[0] |
+ form.submit(); |
+ return false; |
+ } |
+ return true; |
+} |