]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - js/util.js
give UnsandboxForm correct superclass
[quix0rs-gnu-social.git] / js / util.js
index b90f33ec7d01424539e79c9a1738e4ebc45132a6..c59c6391038f0db874009fa98270466ec12d9542 100644 (file)
@@ -228,6 +228,7 @@ var SN = { // StatusNet
                                 $('#'+notice.id).fadeIn(2500);
                                 SN.U.NoticeAttachments();
                                 SN.U.NoticeReply();
+                                SN.U.NoticeFavor();
                              }
                         }
                         $('#'+form_id+' #'+SN.C.S.NoticeDataText).val('');
@@ -276,6 +277,11 @@ var SN = { // StatusNet
             return true;
         },
 
+        NoticeFavor: function() {
+            $('.form_favor').each(function() { SN.U.FormXHR($(this)); });
+            $('.form_disfavor').each(function() { SN.U.FormXHR($(this)); });
+        },
+
         NoticeAttachments: function() {
             $.fn.jOverlay.options = {
                 method : 'GET',
@@ -370,31 +376,53 @@ 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: {
+        NoticeForm: function() {
+            if ($('body.user_in').length > 0) {
+                $('.'+SN.C.S.FormNotice).each(function() {
+                    SN.U.FormNoticeXHR($(this));
+                    SN.U.FormNoticeEnhancements($(this));
+                });
+
+                SN.U.NoticeDataAttach();
+            }
+        },
 
-        $('.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)); });
+        Notices: function() {
+            if ($('body.user_in').length > 0) {
+                SN.U.NoticeFavor();
 
-        SN.U.NoticeReply();
+                SN.U.NoticeReply();
+            }
+
+            SN.U.NoticeAttachments();
+        },
 
-        SN.U.NoticeDataAttach();
+        EntityActions: function() {
+            if ($('body.user_in').length > 0) {
+                $('.form_user_subscribe').each(function() { SN.U.FormXHR($(this)); });
+                $('.form_user_unsubscribe').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.NewDirectMessage();
+                SN.U.NewDirectMessage();
+            }
+        }
     }
+};
 
-    SN.U.NoticeAttachments();
+$(document).ready(function(){
+    if ($('.'+SN.C.S.FormNotice).length > 0) {
+        SN.Init.NoticeForm();
+    }
+    if ($('#content .notices').length > 0) {
+        SN.Init.Notices();
+    }
+    if ($('#content .entity_actions').length > 0) {
+        SN.Init.EntityActions();
+    }
 });