]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - js/util.js
Fix to allow any notice item with an attachment to use the overlay view
[quix0rs-gnu-social.git] / js / util.js
index c6a9682de23782427b46f45d3e604890aa405df6..3021872d42fc3ba5e2793f6169b854f489579915 100644 (file)
@@ -356,42 +356,44 @@ var SN = { // StatusNet
         },
 
         NoticeRepeat: function() {
-            $('.form_repeat').live('click', function() {
-                SN.U.FormXHR($(this));
+            $('.form_repeat').live('click', function(e) {
+                e.preventDefault();
+
                 SN.U.NoticeRepeatConfirmation($(this));
                 return false;
             });
         },
 
         NoticeRepeatConfirmation: function(form) {
-            function NRC() {
-                form.closest('.notice-options').addClass('opaque');
-                form.addClass('dialogbox');
+            var submit_i = form.find('.submit');
 
-                form.append('<button class="close">&#215;</button>');
-                form.find('button.close').click(function(){
-                    $(this).remove();
+            var submit = submit_i.clone();
+            submit
+                .addClass('submit_dialogbox')
+                .removeClass('submit');
+            form.append(submit);
+            submit.bind('click', function() { SN.U.FormXHR(form); return false; });
 
-                    form.closest('.notice-options').removeClass('opaque');
-                    form.removeClass('dialogbox');
-                    form.find('.submit_dialogbox').remove();
-                    form.find('.submit').show();
+            submit_i.hide();
 
-                    return false;
-                });
-            };
+            form
+                .addClass('dialogbox')
+                .append('<button class="close">&#215;</button>')
+                .closest('.notice-options')
+                    .addClass('opaque');
 
-            form.find('.submit').bind('click', function(e) {
-                e.preventDefault();
+            form.find('button.close').click(function(){
+                $(this).remove();
 
-                var submit = form.find('.submit').clone();
-                submit.addClass('submit_dialogbox');
-                submit.removeClass('submit');
-                form.append(submit);
+                form
+                    .removeClass('dialogbox')
+                    .closest('.notice-options')
+                        .removeClass('opaque');
 
-                $(this).hide();
+                form.find('.submit_dialogbox').remove();
+                form.find('.submit').show();
 
-                NRC();
+                return false;
             });
         },
 
@@ -402,12 +404,10 @@ var SN = { // StatusNet
         },
 
         NoticeWithAttachment: function(notice) {
-            if ($('.attachment', notice).length === 0) {
+            if (notice.find('.attachment').length === 0) {
                 return;
             }
 
-            var notice_id = notice.attr('id');
-
             $.fn.jOverlay.options = {
                 method : 'GET',
                 data : '',
@@ -427,13 +427,13 @@ var SN = { // StatusNet
                 css : {'max-width':'542px', 'top':'5%', 'left':'32.5%'}
             };
 
-            $('#'+notice_id+' a.attachment').click(function() {
+            notice.find('a.attachment').click(function() {
                 $().jOverlay({url: $('address .url')[0].href+'attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/ajax'});
                 return false;
             });
 
             var t;
-            $("body:not(#shownotice) #"+notice_id+" a.thumbnail").hover(
+            $("body:not(#shownotice) .notice a.thumbnail").hover(
                 function() {
                     var anchor = $(this);
                     $("a.thumbnail").children('img').hide();