]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Separated actions that's particular to the notice stream pages into
authorSarven Capadisli <csarven@status.net>
Wed, 11 Nov 2009 18:20:58 +0000 (18:20 +0000)
committerSarven Capadisli <csarven@status.net>
Wed, 11 Nov 2009 18:20:58 +0000 (18:20 +0000)
its own function. It can be reused whenever the common behaviours
needs to be initialized.

js/util.js

index b90f33ec7d01424539e79c9a1738e4ebc45132a6..f03a1e67cce2bacc91a8cfd7f07db2abafe6c837 100644 (file)
@@ -370,31 +370,39 @@ var SN = { // StatusNet
                 return false;
             });
         }
-    }
-};
+    },
 
-$(document).ready(function(){
-    if ($('body.user_in').length > 0) {
-        $('.'+SN.C.S.FormNotice).each(function() {
-            SN.U.FormNoticeXHR($(this));
-            SN.U.FormNoticeEnhancements($(this));
-        });
+    Init: {
+        Notices: function() {
+            if ($('body.user_in').length > 0) {
+                $('.'+SN.C.S.FormNotice).each(function() {
+                    SN.U.FormNoticeXHR($(this));
+                    SN.U.FormNoticeEnhancements($(this));
+                });
 
-        $('.form_user_subscribe').each(function() { SN.U.FormXHR($(this)); });
-        $('.form_user_unsubscribe').each(function() { SN.U.FormXHR($(this)); });
-        $('.form_favor').each(function() { SN.U.FormXHR($(this)); });
-        $('.form_disfavor').each(function() { SN.U.FormXHR($(this)); });
-        $('.form_group_join').each(function() { SN.U.FormXHR($(this)); });
-        $('.form_group_leave').each(function() { SN.U.FormXHR($(this)); });
-        $('.form_user_nudge').each(function() { SN.U.FormXHR($(this)); });
+                $('.form_user_subscribe').each(function() { SN.U.FormXHR($(this)); });
+                $('.form_user_unsubscribe').each(function() { SN.U.FormXHR($(this)); });
+                $('.form_favor').each(function() { SN.U.FormXHR($(this)); });
+                $('.form_disfavor').each(function() { SN.U.FormXHR($(this)); });
+                $('.form_group_join').each(function() { SN.U.FormXHR($(this)); });
+                $('.form_group_leave').each(function() { SN.U.FormXHR($(this)); });
+                $('.form_user_nudge').each(function() { SN.U.FormXHR($(this)); });
 
-        SN.U.NoticeReply();
+                SN.U.NoticeReply();
 
-        SN.U.NoticeDataAttach();
+                SN.U.NoticeDataAttach();
 
-        SN.U.NewDirectMessage();
+                SN.U.NewDirectMessage();
+            }
+
+            SN.U.NoticeAttachments();
+        }
     }
+};
 
-    SN.U.NoticeAttachments();
+$(document).ready(function(){
+    if ($('#content .notices').length >0) {
+        SN.Init.Notices();
+    }
 });