]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
NoticeReply will now set the focus() position to textare for IE
authorSarven Capadisli <csarven@status.net>
Fri, 27 Nov 2009 17:11:49 +0000 (17:11 +0000)
committerSarven Capadisli <csarven@status.net>
Fri, 27 Nov 2009 17:11:49 +0000 (17:11 +0000)
js/util.js

index 81018a4b8c0dc90b3f9adb5381f2eedc8cd0f654..5df0acf374abd4bf530fdb44272d40914d641e9c 100644 (file)
@@ -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() {