Index: static/js/main/main.js |
diff --git a/static/js/main/main.js b/static/js/main/main.js |
index 69a19f170893bbea5ce3536bca7661faca374544..161b1614ba6f5b3473688fa8a6ecd5b1c1fcf79e 100644 |
--- a/static/js/main/main.js |
+++ b/static/js/main/main.js |
@@ -82,6 +82,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; |
@@ -100,3 +101,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; |
+} |