##// END OF EJS Templates
Move cursor to the text area end after replying.
Pavel Ryapolov -
r106:fc19fce9 default
parent child Browse files
Show More
@@ -68,13 +68,27 b' function make_table_dom()'
68 );
68 );
69 }
69 }
70
70
71 function moveCaretToEnd(el) {
72 if (typeof el.selectionStart == "number") {
73 el.selectionStart = el.selectionEnd = el.value.length;
74 } else if (typeof el.createTextRange != "undefined") {
75 el.focus();
76 var range = el.createTextRange();
77 range.collapse(false);
78 range.select();
79 }
80 }
81
71 function addQuickReply(postId) {
82 function addQuickReply(postId) {
72 var textToAdd = '>>' + postId + '\n\n';
83 var textToAdd = '>>' + postId + '\n\n';
73 $('#id_text').val($('#id_text').val()+ textToAdd);
84 $('#id_text').val($('#id_text').val()+ textToAdd);
74
85
86 var textarea = document.getElementById('id_text');
87 moveCaretToEnd(textarea);
88
75 $("html, body").animate({ scrollTop: $('#id_text').offset().top }, "slow");
89 $("html, body").animate({ scrollTop: $('#id_text').offset().top }, "slow");
76 }
90 }
77
91
78 $(document).ready(function(){
92 $(document).ready(function(){
79 add_panel('.navigation_panel');
93 add_panel('.navigation_panel');
80 }); No newline at end of file
94 });
General Comments 0
You need to be logged in to leave comments. Login now