]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
do submit on keydown
authorEvan Prodromou <evan@prodromou.name>
Fri, 5 Sep 2008 04:57:36 +0000 (00:57 -0400)
committerEvan Prodromou <evan@prodromou.name>
Fri, 5 Sep 2008 04:57:36 +0000 (00:57 -0400)
darcs-hash:20080905045736-84dde-7232813dafb70b75309f5cb9e58831fb49497918.gz

js/util.js

index e68a6bab2e4e1a9c71e3be965dcd0ef6390a18aa..deefc5844cde1d72291aac32c0c3927147810789 100644 (file)
 $(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();
         }