]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Refactored NoticeReply() so that a notice item can use NoticeReplyTo
authorSarven Capadisli <csarven@status.net>
Sat, 28 Nov 2009 15:44:16 +0000 (15:44 +0000)
committerEvan Prodromou <evan@status.net>
Tue, 1 Dec 2009 17:10:54 +0000 (12:10 -0500)
instead of rebinding all of the notice replies again.

js/util.js

index de3979195ff08f4fddd7eb663108f8b989194fa5..335ed24bb3697007b9bcb7e7b053c7119a9a3781 100644 (file)
@@ -231,7 +231,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'));
                              }
                         }
@@ -252,13 +252,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;
                 });
             }
         },