From: Sarven Capadisli Date: Wed, 2 Dec 2009 22:25:38 +0000 (+0100) Subject: Revert "If the page doesn't have .notices, silently skip the notice XHR response" X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=62d5f056691a194809c6e94c2221ba92f4e187bd;p=quix0rs-gnu-social.git Revert "If the page doesn't have .notices, silently skip the notice XHR response" This reverts commit 7b550f386a8a3f38ced8ee587d7ae1c997e97906. --- diff --git a/js/util.js b/js/util.js index 3c9c3986a5..9ffbd88e41 100644 --- a/js/util.js +++ b/js/util.js @@ -214,41 +214,37 @@ var SN = { // StatusNet self.close(); } - var notices = $("#notices_primary .notices"); - - if (notices.length > 0) { - if ($('#'+SN.C.S.CommandResult, data).length > 0) { - result = document._importNode($('p', data)[0], true); - result = result.textContent || result.innerHTML; - form.append('

'+result+'

'); - } - else { - notice = document._importNode($('li', data)[0], true); - if ($('#'+notice.id).length === 0) { - var notice_irt_value = $('#'+SN.C.S.NoticeInReplyTo).val(); - var notice_irt = '#notices_primary #notice-'+notice_irt_value; - if($('body')[0].id == 'conversation') { - if(notice_irt_value.length > 0 && $(notice_irt+' .notices').length < 1) { - $(notice_irt).append(''); - } - $($(notice_irt+' .notices')[0]).append(notice); - } - else { - notices.prepend(notice); + if ($('#'+SN.C.S.CommandResult, data).length > 0) { + result = document._importNode($('p', data)[0], true); + result = result.textContent || result.innerHTML; + form.append('

'+result+'

'); + } + else { + notice = document._importNode($('li', data)[0], true); + if ($('#'+notice.id).length === 0) { + var notice_irt_value = $('#'+SN.C.S.NoticeInReplyTo).val(); + var notice_irt = '#notices_primary #notice-'+notice_irt_value; + if($('body')[0].id == 'conversation') { + if(notice_irt_value.length > 0 && $(notice_irt+' .notices').length < 1) { + $(notice_irt).append(''); } - $('#'+notice.id).css({display:'none'}); - $('#'+notice.id).fadeIn(2500); - SN.U.NoticeWithAttachment($('#'+notice.id)); - SN.U.NoticeReplyTo($('#'+notice.id)); - SN.U.FormXHR($('#'+notice.id+' .form_favor')); - } - } - $('#'+form_id+' #'+SN.C.S.NoticeDataText).val(''); - $('#'+form_id+' #'+SN.C.S.NoticeDataAttach).val(''); - $('#'+form_id+' #'+SN.C.S.NoticeInReplyTo).val(''); - $('#'+form_id+' #'+SN.C.S.NoticeDataAttachSelected).remove(); - SN.U.FormNoticeEnhancements($('#'+form_id)); + $($(notice_irt+' .notices')[0]).append(notice); + } + else { + $("#notices_primary .notices").prepend(notice); + } + $('#'+notice.id).css({display:'none'}); + $('#'+notice.id).fadeIn(2500); + SN.U.NoticeWithAttachment($('#'+notice.id)); + SN.U.NoticeReplyTo($('#'+notice.id)); + SN.U.FormXHR($('#'+notice.id+' .form_favor')); + } } + $('#'+form_id+' #'+SN.C.S.NoticeDataText).val(''); + $('#'+form_id+' #'+SN.C.S.NoticeDataAttach).val(''); + $('#'+form_id+' #'+SN.C.S.NoticeInReplyTo).val(''); + $('#'+form_id+' #'+SN.C.S.NoticeDataAttachSelected).remove(); + SN.U.FormNoticeEnhancements($('#'+form_id)); } }, complete: function(xhr, textStatus) {