]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
A simpler way to focus and set the cursor position for NoticeReply().
authorSarven Capadisli <csarven@status.net>
Fri, 27 Nov 2009 17:35:58 +0000 (17:35 +0000)
committerSarven Capadisli <csarven@status.net>
Fri, 27 Nov 2009 17:35:58 +0000 (17:35 +0000)
Works in IE7+, Safari4, Firefox 3.

js/util.js

index 5df0acf374abd4bf530fdb44272d40914d641e9c..b29ce7f02cac35e1f54560dda29c7815c5eabdcd 100644 (file)
@@ -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();
                 }
             }
         },