summaryrefslogtreecommitdiff
path: root/js/util.js
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-09-05 00:57:36 -0400
committerEvan Prodromou <evan@prodromou.name>2008-09-05 00:57:36 -0400
commite29c2b293808c4676c0677e59083b2a020ececfe (patch)
tree6edcdaccdd18aacd341a73930d747fc40244aafd /js/util.js
parenta0d607ecaa3cd228e322c7f210756a820c0a9a63 (diff)
do submit on keydown
darcs-hash:20080905045736-84dde-7232813dafb70b75309f5cb9e58831fb49497918.gz
Diffstat (limited to 'js/util.js')
-rw-r--r--js/util.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/js/util.js b/js/util.js
index e68a6bab2..deefc5844 100644
--- a/js/util.js
+++ b/js/util.js
@@ -19,10 +19,6 @@
$(document).ready(function(){
// count character on keyup
function counter(event){
- if (event.keyCode == 13) {
- $("#status_form").submit();
- }
-
var maxLength = 140;
var currentLength = $("#status_textarea").val().length;
var remaining = maxLength - currentLength;
@@ -36,9 +32,16 @@ $(document).ready(function(){
}
}
- $("#status_textarea").bind("keyup", counter);
+ function submitonreturn(event) {
+ if (event.keyCode == 13) {
+ $("#status_form").submit();
+ }
+ }
if ($("#status_textarea").length) {
+ $("#status_textarea").bind("keyup", counter);
+ $("#status_textarea").bind("keydown", submitonreturn);
+
// run once in case there's something in there
counter();
}