NoticeReply will now set the focus() position to textare for IE

This commit is contained in:
Sarven Capadisli 2009-11-27 17:11:49 +00:00
parent 35f2239ce4
commit 8df2985eee

View File

@ -266,19 +266,24 @@ var SN = { // StatusNet
NoticeReplySet: function(nick,id) { NoticeReplySet: function(nick,id) {
if (nick.match(SN.C.I.PatternUsername)) { if (nick.match(SN.C.I.PatternUsername)) {
var text = $('#'+SN.C.S.NoticeDataText); var text = $('#'+SN.C.S.NoticeDataText);
if (text.length) { if (text.length > 0) {
replyto = '@' + nick + ' '; replyto = '@' + nick + ' ';
text.val(replyto + text.val().replace(RegExp(replyto, 'i'), '')); text.val(replyto + text.val().replace(RegExp(replyto, 'i'), ''));
$('#'+SN.C.S.FormNotice+' input#'+SN.C.S.NoticeInReplyTo).val(id); $('#'+SN.C.S.FormNotice+' #'+SN.C.S.NoticeInReplyTo).val(id);
if (text[0].setSelectionRange) {
var len = text.val().length; 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].setSelectionRange(len,len);
text[0].focus();
} }
return false;
text[0].focus();
} }
} }
return true;
}, },
NoticeFavor: function() { NoticeFavor: function() {