Calling NoticeReply() after a new notice is posted.

This commit is contained in:
sarven 2009-01-23 02:49:48 +00:00
parent 0905586355
commit 658eebd977
1 changed files with 14 additions and 10 deletions

View File

@ -177,6 +177,7 @@ $(document).ready(function(){
$("#notices_primary .notice:first").css({display:"none"}); $("#notices_primary .notice:first").css({display:"none"});
$("#notices_primary .notice:first").fadeIn(2500); $("#notices_primary .notice:first").fadeIn(2500);
NoticeHover(); NoticeHover();
NoticeReply();
} }
$("#notice_action-submit").removeAttr("disabled"); $("#notice_action-submit").removeAttr("disabled");
$("#notice_action-submit").removeClass("disabled"); $("#notice_action-submit").removeClass("disabled");
@ -186,15 +187,7 @@ $(document).ready(function(){
$("#form_notice").each(addAjaxHidden); $("#form_notice").each(addAjaxHidden);
NoticeHover(); NoticeHover();
NoticeReply();
$('#content .notice').each(function() {
var notice = $(this);
$('.notice_reply', $(this)).click(function() {
var nickname = ($('.author .nickname', notice).length > 0) ? $('.author .nickname', notice) : $('.author .nickname');
NoticeReply(nickname.text(), $('.notice_id', notice).text());
return false;
});
});
}); });
function NoticeHover() { function NoticeHover() {
@ -208,7 +201,18 @@ function NoticeHover() {
); );
} }
function NoticeReply(nick,id) { function NoticeReply() {
$('#content .notice').each(function() {
var notice = $(this);
$('.notice_reply', $(this)).click(function() {
var nickname = ($('.author .nickname', notice).length > 0) ? $('.author .nickname', notice) : $('.author .nickname');
NoticeReplySet(nickname.text(), $('.notice_id', notice).text());
return false;
});
});
}
function NoticeReplySet(nick,id) {
rgx_username = /^[0-9a-zA-Z\-_.]*$/; rgx_username = /^[0-9a-zA-Z\-_.]*$/;
if (nick.match(rgx_username)) { if (nick.match(rgx_username)) {
replyto = "@" + nick + " "; replyto = "@" + nick + " ";