]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - js/util.js
Merge branch 'ping' of /var/www/mublog.corrupt into corrupt/ping
[quix0rs-gnu-social.git] / js / util.js
index 4aad8413409ab1c6d9e10733be0e412a8138319b..3ad0386122c53891bda591b85f6ed767cb7796b0 100644 (file)
@@ -108,20 +108,20 @@ $(document).ready(function(){
        $("form.form_group_join").each(addAjaxHidden);
        $("form.form_group_leave").each(addAjaxHidden);
 
-       $("#nudge").ajaxForm ({ dataType: 'xml',
-                                                       beforeSubmit: function(xml) { $("form#nudge input[type=submit]").attr("disabled", "disabled");
-                                                                                                                 $("form#nudge input[type=submit]").addClass("disabled");
-                                                                                                               },
-                                                       success: function(xml) { $("#nudge").replaceWith(document._importNode($("#nudge_response", xml).get(0),true));
-                                                                                                    $("#nudge input[type=submit]").removeAttr("disabled");
-                                                                                                    $("#nudge input[type=submit]").removeClass("disabled");
-                                                                                                  }
-                                                });
-       $("#nudge").each(addAjaxHidden);
+       $("#form_user_nudge").ajaxForm ({ dataType: 'xml',
+               beforeSubmit: function(xml) { $("#form_user_nudge input[type=submit]").attr("disabled", "disabled");
+                                                                         $("#form_user_nudge input[type=submit]").addClass("disabled");
+                                                                       },
+               success: function(xml) { $("#form_user_nudge").replaceWith(document._importNode($("#nudge_response", xml).get(0),true));
+                                                            $("#form_user_nudge input[type=submit]").removeAttr("disabled");
+                                                            $("#form_user_nudge input[type=submit]").removeClass("disabled");
+                                                          }
+        });
+       $("#form_user_nudge").each(addAjaxHidden);
 
        var Subscribe = { dataType: 'xml',
-                                         beforeSubmit: function(formData, jqForm, options) { $("form.subscribe input[type=submit]").attr("disabled", "disabled");
-                                                                                                                                             $("form.subscribe input[type=submit]").addClass("disabled");
+                                         beforeSubmit: function(formData, jqForm, options) { $(".form_user_subscribe input[type=submit]").attr("disabled", "disabled");
+                                                                                                                                             $(".form_user_subscribe input[type=submit]").addClass("disabled");
                                                                                                                                            },
                                          success: function(xml) { var form_unsubscribe = document._importNode($('form', xml).get(0), true);
                                                                                           var form_unsubscribe_id = form_unsubscribe.id;
@@ -129,14 +129,14 @@ $(document).ready(function(){
                                                                                           $("form#"+form_subscribe_id).replaceWith(form_unsubscribe);
                                                                                           $("form#"+form_unsubscribe_id).ajaxForm(UnSubscribe).each(addAjaxHidden);
                                                                                           $("dd.subscribers").text(parseInt($("dd.subscribers").text())+1);
-                                                                                          $("form.subscribe input[type=submit]").removeAttr("disabled");
-                                                                                          $("form.subscribe input[type=submit]").removeClass("disabled");
+                                                                                          $(".form_user_subscribe input[type=submit]").removeAttr("disabled");
+                                                                                          $(".form_user_subscribe input[type=submit]").removeClass("disabled");
                                                                                     }
                                        };
 
        var UnSubscribe = { dataType: 'xml',
-                                               beforeSubmit: function(formData, jqForm, options) { $("form.unsubscribe input[type=submit]").attr("disabled", "disabled");
-                                                                                                                                                   $("form.unsubscribe input[type=submit]").addClass("disabled");
+                                               beforeSubmit: function(formData, jqForm, options) { $(".form_user_unsubscribe input[type=submit]").attr("disabled", "disabled");
+                                                                                                                                                   $(".form_user_unsubscribe input[type=submit]").addClass("disabled");
                                                                                                                                                  },
                                            success: function(xml) { var form_subscribe = document._importNode($('form', xml).get(0), true);
                                                                                                 var form_subscribe_id = form_subscribe.id;
@@ -146,15 +146,15 @@ $(document).ready(function(){
                                                                                                 $("#profile_send_a_new_message").remove();
                                                                                                 $("#profile_nudge").remove();
                                                                                             $("dd.subscribers").text(parseInt($("dd.subscribers").text())-1);
-                                                                                                $("form.unsubscribe input[type=submit]").removeAttr("disabled");
-                                                                                                $("form.unsubscribe input[type=submit]").removeClass("disabled");
+                                                                                                $(".form_user_unsubscribe input[type=submit]").removeAttr("disabled");
+                                                                                                $(".form_user_unsubscribe input[type=submit]").removeClass("disabled");
                                                                                           }
                                          };
 
-       $("form.subscribe").ajaxForm(Subscribe);
-       $("form.unsubscribe").ajaxForm(UnSubscribe);
-       $("form.subscribe").each(addAjaxHidden);
-       $("form.unsubscribe").each(addAjaxHidden);
+       $(".form_user_subscribe").ajaxForm(Subscribe);
+       $(".form_user_unsubscribe").ajaxForm(UnSubscribe);
+       $(".form_user_subscribe").each(addAjaxHidden);
+       $(".form_user_unsubscribe").each(addAjaxHidden);
 
        var PostNotice = { dataType: 'xml',
                                           beforeSubmit: function(formData, jqForm, options) { if ($("#notice_data-text").get(0).value.length == 0) {
@@ -176,6 +176,8 @@ $(document).ready(function(){
                                                                                                        counter();
                                                                                                        $("#notices_primary .notice:first").css({display:"none"});
                                                                                                        $("#notices_primary .notice:first").fadeIn(2500);
+                                                                                                       NoticeHover();
+                                                                                                       NoticeReply();
                                                                                                }
                                                                                                $("#notice_action-submit").removeAttr("disabled");
                                                                                                $("#notice_action-submit").removeClass("disabled");
@@ -184,7 +186,12 @@ $(document).ready(function(){
        $("#form_notice").ajaxForm(PostNotice);
        $("#form_notice").each(addAjaxHidden);
 
-    $(".notice").hover(
+    NoticeHover();
+    NoticeReply();
+});
+
+function NoticeHover() {
+    $("#content .notice").hover(
         function () {
             $(this).addClass('hover');
         },
@@ -192,9 +199,22 @@ $(document).ready(function(){
             $(this).removeClass('hover');
         }
     );
-});
+}
+
+function NoticeReply() {
+    if ($('#notice_data-text').length > 0) {
+        $('#content .notice').each(function() {
+            var notice = $(this);
+            $('.notice_reply', $(this)).click(function() {
+                var nickname = ($('.author .nickname', notice).length > 0) ? $('.author .nickname', notice) : $('.author .nickname');
+                NoticeReplySet(nickname.text(), $('.notice_id', notice).text());
+                return false;
+            });
+        });
+    }
+}
 
-function doreply(nick,id) {
+function NoticeReplySet(nick,id) {
        rgx_username = /^[0-9a-zA-Z\-_.]*$/;
        if (nick.match(rgx_username)) {
                replyto = "@" + nick + " ";