summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@status.net>2009-11-27 17:35:58 +0000
committerSarven Capadisli <csarven@status.net>2009-11-27 17:35:58 +0000
commit8f7c7b55ba3e0b65d8b7026477fdd849027c9444 (patch)
tree2f410a67bef310df020240ccfea29128d66b55ea
parentf68c47e7e06ae9040c5181eb79951a2404b6c173 (diff)
A simpler way to focus and set the cursor position for NoticeReply().
Works in IE7+, Safari4, Firefox 3.
-rw-r--r--js/util.js12
1 files changed, 3 insertions, 9 deletions
diff --git a/js/util.js b/js/util.js
index 5df0acf37..b29ce7f02 100644
--- a/js/util.js
+++ b/js/util.js
@@ -271,17 +271,11 @@ var SN = { // StatusNet
text.val(replyto + text.val().replace(RegExp(replyto, 'i'), ''));
$('#'+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].focus();
+ if (text[0].setSelectionRange) {
+ var len = text.val().length;
text[0].setSelectionRange(len,len);
}
-
- text[0].focus();
}
}
},