forked from GNUsocial/gnu-social
A simpler way to focus and set the cursor position for NoticeReply().
Works in IE7+, Safari4, Firefox 3.
This commit is contained in:
parent
f68c47e7e0
commit
8f7c7b55ba
10
js/util.js
10
js/util.js
@ -271,17 +271,11 @@ var SN = { // StatusNet
|
|||||||
text.val(replyto + text.val().replace(RegExp(replyto, 'i'), ''));
|
text.val(replyto + text.val().replace(RegExp(replyto, 'i'), ''));
|
||||||
$('#'+SN.C.S.FormNotice+' #'+SN.C.S.NoticeInReplyTo).val(id);
|
$('#'+SN.C.S.FormNotice+' #'+SN.C.S.NoticeInReplyTo).val(id);
|
||||||
|
|
||||||
|
text[0].focus();
|
||||||
|
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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user