summaryrefslogtreecommitdiff
path: root/js/util.js
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@status.net>2009-10-30 14:31:57 +0100
committerSarven Capadisli <csarven@status.net>2009-10-30 14:31:57 +0100
commit1ddf69f30ef576e3090d43be9e3aca9ee24f6119 (patch)
tree26c83da6176e163df6c1b5e736c7ca7cf7b2aa8a /js/util.js
parent53e91f22d231772199e11d29357a0c8d897a1c40 (diff)
Updated SubmitOnReturn
Diffstat (limited to 'js/util.js')
-rw-r--r--js/util.js29
1 files changed, 16 insertions, 13 deletions
diff --git a/js/util.js b/js/util.js
index 203dca28e..4ba1bcfba 100644
--- a/js/util.js
+++ b/js/util.js
@@ -56,18 +56,7 @@ $(document).ready(function(){
counter(null);
}
- function submitonreturn(event) {
- if (event.keyCode == 13 || event.keyCode == 10) {
- // iPhone sends \n not \r for 'return'
- $("#form_notice").submit();
- event.preventDefault();
- event.stopPropagation();
- $("#notice_data-text").blur();
- $("body").focus();
- return false;
- }
- return true;
- }
+
// define maxLength if it wasn't defined already
@@ -82,7 +71,9 @@ $(document).ready(function(){
counter();
}
- $("#notice_data-text").bind("keydown", submitonreturn);
+ $('#'+SN.C.S.NoticeDataText).bind('keydown', function(e) {
+ SN.U.SubmitOnReturn(e, $('#'+SN.C.S.FormNotice));
+ });
if($('body')[0].id != 'conversation') {
$("#notice_data-text").focus();
@@ -130,6 +121,18 @@ var SN = { // StatusNet
},
U: { // Utils
+ SubmitOnReturn: function(event, el) {
+ if (event.keyCode == 13 || event.keyCode == 10) {
+ el.submit();
+ event.preventDefault();
+ event.stopPropagation();
+ $('#'+SN.U.NoticeDataText).blur();
+ $('body').focus();
+ return false;
+ }
+ return true;
+ },
+
FormXHR: function(f) {
f.bind('submit', function(e) {
form_id = $(this)[0].id;