diff options
author | Sarven Capadisli <csarven@status.net> | 2009-11-27 17:11:49 +0000 |
---|---|---|
committer | Sarven Capadisli <csarven@status.net> | 2009-11-27 17:11:49 +0000 |
commit | 8df2985eeeb2533ae2aa38abcce2dce1c96bdd64 (patch) | |
tree | 038849414ed54c89540e0d6b6a8045a4aea43d0d /js | |
parent | 35f2239ce49d4837be6bd8231a64257a6c50fbaa (diff) |
NoticeReply will now set the focus() position to textare for IE
Diffstat (limited to 'js')
-rw-r--r-- | js/util.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/js/util.js b/js/util.js index 81018a4b8..5df0acf37 100644 --- a/js/util.js +++ b/js/util.js @@ -266,19 +266,24 @@ var SN = { // StatusNet NoticeReplySet: function(nick,id) { if (nick.match(SN.C.I.PatternUsername)) { var text = $('#'+SN.C.S.NoticeDataText); - if (text.length) { + if (text.length > 0) { replyto = '@' + nick + ' '; text.val(replyto + text.val().replace(RegExp(replyto, 'i'), '')); - $('#'+SN.C.S.FormNotice+' input#'+SN.C.S.NoticeInReplyTo).val(id); - if (text[0].setSelectionRange) { - var len = text.val().length; + $('#'+SN.C.S.FormNotice+' #'+SN.C.S.NoticeInReplyTo).val(id); + + var len = text.val().length; + if (text[0].createTextRange) { + var r = text[0].createTextRange(); + r.moveStart('character', len); + r.moveEnd('character', len); + r.select(); + } else if (text[0].setSelectionRange) { text[0].setSelectionRange(len,len); - text[0].focus(); } - return false; + + text[0].focus(); } } - return true; }, NoticeFavor: function() { |