]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Only run the scripts if the user is logged in
authorSarven Capadisli <csarven@status.net>
Fri, 30 Oct 2009 14:48:35 +0000 (15:48 +0100)
committerSarven Capadisli <csarven@status.net>
Fri, 30 Oct 2009 14:48:35 +0000 (15:48 +0100)
js/util.js

index 10c7bb18e0ce6145e50fc0ef791c9c323bf8d4ec..3e8d244b72a1925a31f198959f1e9bd5b51d1938 100644 (file)
  */
 
 $(document).ready(function(){
-    if ($('#'+SN.C.S.NoticeDataText).length) {
-        if (maxLength > 0) {
-            $('#'+SN.C.S.NoticeDataText).bind('keyup', function(e) {
+    if ($('body.user_in').length > 0) {
+        if ($('#'+SN.C.S.NoticeDataText).length) {
+            if (maxLength > 0) {
+                $('#'+SN.C.S.NoticeDataText).bind('keyup', function(e) {
+                    SN.U.Counter();
+                });
+                // run once in case there's something in there
                 SN.U.Counter();
+            }
+
+            $('#'+SN.C.S.NoticeDataText).bind('keydown', function(e) {
+                SN.U.SubmitOnReturn(e, $('#'+SN.C.S.FormNotice));
             });
-            // run once in case there's something in there
-            SN.U.Counter();
+
+            if($('body')[0].id != 'conversation') {
+                $('#'+SN.C.S.NoticeDataText).focus();
+            }
         }
 
-        $('#'+SN.C.S.NoticeDataText).bind('keydown', function(e) {
-            SN.U.SubmitOnReturn(e, $('#'+SN.C.S.FormNotice));
-        });
+        $('.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)); });
 
-        if($('body')[0].id != 'conversation') {
-            $('#'+SN.C.S.NoticeDataText).focus();
-        }
-    }
+        SN.U.FormNoticeXHR();
 
-    $('.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.FormNoticeXHR();
+        SN.U.NoticeDataAttach();
+    }
 
-    SN.U.NoticeReply();
     SN.U.NoticeAttachments();
-    SN.U.NoticeDataAttach();
 });