forked from GNUsocial/gnu-social
Refactored NoticeReply() so that a notice item can use NoticeReplyTo
instead of rebinding all of the notice replies again.
This commit is contained in:
parent
1ec0950006
commit
11d9c1955c
17
js/util.js
17
js/util.js
@ -231,7 +231,7 @@ var SN = { // StatusNet
|
|||||||
$('#'+notice.id).css({display:'none'});
|
$('#'+notice.id).css({display:'none'});
|
||||||
$('#'+notice.id).fadeIn(2500);
|
$('#'+notice.id).fadeIn(2500);
|
||||||
SN.U.NoticeAttachments();
|
SN.U.NoticeAttachments();
|
||||||
SN.U.NoticeReply();
|
SN.U.NoticeReplyTo($('#'+notice.id));
|
||||||
SN.U.FormXHR($('#'+notice.id+' .form_favor'));
|
SN.U.FormXHR($('#'+notice.id+' .form_favor'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,14 +252,21 @@ var SN = { // StatusNet
|
|||||||
|
|
||||||
NoticeReply: function() {
|
NoticeReply: function() {
|
||||||
if ($('#'+SN.C.S.NoticeDataText).length > 0 && $('#content .notice_reply').length > 0) {
|
if ($('#'+SN.C.S.NoticeDataText).length > 0 && $('#content .notice_reply').length > 0) {
|
||||||
$('#content .notice').each(function() {
|
$('#content .notice').each(function() { SN.U.NoticeReplyTo($(this)); });
|
||||||
var notice = $(this)[0];
|
}
|
||||||
$($('.notice_reply', notice)[0]).click(function() {
|
},
|
||||||
|
|
||||||
|
NoticeReplyTo: function(notice_item) {
|
||||||
|
var notice = notice_item[0];
|
||||||
|
var notice_reply = $('.notice_reply', notice)[0];
|
||||||
|
|
||||||
|
if (jQuery.data(notice_reply, "ElementData") === undefined) {
|
||||||
|
jQuery.data(notice_reply, "ElementData", {Bind:'submit'});
|
||||||
|
$(notice_reply).bind('click', function() {
|
||||||
var nickname = ($('.author .nickname', notice).length > 0) ? $($('.author .nickname', notice)[0]) : $('.author .nickname.uid');
|
var nickname = ($('.author .nickname', notice).length > 0) ? $($('.author .nickname', notice)[0]) : $('.author .nickname.uid');
|
||||||
SN.U.NoticeReplySet(nickname.text(), $($('.notice_id', notice)[0]).text());
|
SN.U.NoticeReplySet(nickname.text(), $($('.notice_id', notice)[0]).text());
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user