]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - js/util.js
jquery infieldlabel.js removed from script list
[quix0rs-gnu-social.git] / js / util.js
index 1ed69be28e80465820dc6d062784d46bf1a9d8b9..85f917b09aeb67f107f20814c0f71166c2396342 100644 (file)
@@ -32,7 +32,6 @@ var SN = { // StatusNet
             MaxLength: 140,
             PatternUsername: /^[0-9a-zA-Z\-_.]*$/,
             HTTP20x30x: [200, 201, 202, 203, 204, 205, 206, 300, 301, 302, 303, 304, 305, 306, 307],
-            NoticeFormMaster: null // to be cloned from the one at top
         },
 
         /**
@@ -576,6 +575,32 @@ var SN = { // StatusNet
             }
         },
 
+        /**
+         * Setup function -- DOES NOT trigger actions immediately.
+         *
+         * Sets up event handlers on all visible notice's option <a> elements
+         * so they are called with AJAX enabled.
+         *
+         * (without javascript the link goes to a page that expects you to verify
+         * the action through a form)
+         *
+         * @access private
+         */
+        NoticeOptionsAjax: function () {
+            $(document).on('click', '.notice-options > a', function (e) {
+                e.preventDefault();
+                var noticeEl = $(this).closest('.notice');
+                $.get($(this).attr('href'), {ajax: 1}, function (data, textStatus, xhr) {
+                    SN.U.NoticeOptionPopup($('body', data).html());
+                });
+                return false;
+            });
+        },
+
+        NoticeOptionPopup: function (html) {
+            dialog = $(html).dialog();
+        },
+
         /**
          * Setup function -- DOES NOT trigger actions immediately.
          *
@@ -774,6 +799,14 @@ var SN = { // StatusNet
             });
         },
 
+        NoticeOptionPopup: function (html) {
+            dialog = $(html).dialog({
+                    resizable: false,
+                    height: 150,
+                    modal: true,
+                });
+        },
+
         /**
          * Setup function -- DOES NOT trigger actions immediately.
          *
@@ -1412,9 +1445,6 @@ var SN = { // StatusNet
                         });
                     }
                 });
-
-                // Infield labels for notice form inputs.
-                $('.input_forms fieldset fieldset label').inFieldLabels({ fadeOpacity:0 });
             }
         },
 
@@ -1444,13 +1474,10 @@ var SN = { // StatusNet
          */
         Notices: function () {
             if ($('body.user_in').length > 0) {
-                var masterForm = $('.form_notice:first');
-                if (masterForm.length > 0) {
-                    SN.C.I.NoticeFormMaster = document._importNode(masterForm[0], true);
-                }
                 SN.U.NoticeRepeat();
                 SN.U.NoticeReply();
                 SN.U.NoticeInlineReplySetup();
+                SN.U.NoticeOptionsAjax();
             }
 
             SN.U.NoticeAttachments();