summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@status.net>2009-11-28 15:44:16 +0000
committerSarven Capadisli <csarven@status.net>2009-11-28 15:44:16 +0000
commit27265be245c148d37a53e73dd36c1ce485f622ae (patch)
treecc1f8ef9fea6563daf35dfe82e6d8d2d21d3f1c0
parentc413a4d80b9a5bfc339f0c7e2fff8b2b4bbccc32 (diff)
Refactored NoticeReply() so that a notice item can use NoticeReplyTo
instead of rebinding all of the notice replies again.
-rw-r--r--js/util.js23
1 files changed, 15 insertions, 8 deletions
diff --git a/js/util.js b/js/util.js
index f52106eab..4c5118ccc 100644
--- a/js/util.js
+++ b/js/util.js
@@ -234,7 +234,7 @@ var SN = { // StatusNet
$('#'+notice.id).css({display:'none'});
$('#'+notice.id).fadeIn(2500);
SN.U.NoticeAttachments();
- SN.U.NoticeReply();
+ SN.U.NoticeReplyTo($('#'+notice.id));
SN.U.FormXHR($('#'+notice.id+' .form_favor'));
}
}
@@ -255,13 +255,20 @@ var SN = { // StatusNet
NoticeReply: function() {
if ($('#'+SN.C.S.NoticeDataText).length > 0 && $('#content .notice_reply').length > 0) {
- $('#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.uid');
- SN.U.NoticeReplySet(nickname.text(), $($('.notice_id', notice)[0]).text());
- return false;
- });
+ $('#content .notice').each(function() { SN.U.NoticeReplyTo($(this)); });
+ }
+ },
+
+ 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');
+ SN.U.NoticeReplySet(nickname.text(), $($('.notice_id', notice)[0]).text());
+ return false;
});
}
},