summaryrefslogtreecommitdiff
path: root/js/util.js
diff options
context:
space:
mode:
authorZach Copley <zach@controlyourself.ca>2009-08-05 19:01:15 +0000
committerZach Copley <zach@controlyourself.ca>2009-08-05 19:01:15 +0000
commit3ebbc1c3886a67dcc83ca4f906bdd375d599e86b (patch)
treec86e6084b49cacdf84ff0eb4527d6f4aeabd3f4f /js/util.js
parentcd71f9cc51f77b6b8e3b11c34cb7523f36339cea (diff)
parentc3a522623c3a0628c33407ee01b16e189c44bba5 (diff)
Merge branch '0.8.x' into twitter-oauth
Diffstat (limited to 'js/util.js')
-rw-r--r--js/util.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/js/util.js b/js/util.js
index f3ed918cf..ef147bef4 100644
--- a/js/util.js
+++ b/js/util.js
@@ -25,7 +25,7 @@ $(document).ready(function(){
var counter = $("#notice_text-count");
counter.text(remaining);
- if (remaining <= 0) {
+ if (remaining < 0) {
$("#form_notice").addClass("warning");
} else {
$("#form_notice").removeClass("warning");
@@ -244,7 +244,7 @@ function NoticeReply() {
$('#content .notice').each(function() {
var notice = $(this)[0];
$($('.notice_reply', notice)[0]).click(function() {
- var nickname = ($('.author .nickname', notice).length > 0) ? $($('.author .nickname', notice)[0]) : $('.author .nickname');
+ var nickname = ($('.author .nickname', notice).length > 0) ? $($('.author .nickname', notice)[0]) : $('.author .nickname.uid');
NoticeReplySet(nickname.text(), $($('.notice_id', notice)[0]).text());
return false;
});
@@ -256,10 +256,15 @@ function NoticeReplySet(nick,id) {
rgx_username = /^[0-9a-zA-Z\-_.]*$/;
if (nick.match(rgx_username)) {
replyto = "@" + nick + " ";
- if ($("#notice_data-text").length) {
- $("#notice_data-text").val(replyto);
+ var text = $("#notice_data-text");
+ if (text.length) {
+ text.val(replyto + text.val());
$("#form_notice input#notice_in-reply-to").val(id);
- $("#notice_data-text").focus();
+ if (text.get(0).setSelectionRange) {
+ var len = text.val().length;
+ text.get(0).setSelectionRange(len,len);
+ text.get(0).focus();
+ }
return false;
}
}