If the page doesn't have .notices, silently skip the notice XHR response

This commit is contained in:
Sarven Capadisli 2009-12-02 23:13:15 +01:00
parent 5f0c6f3eaa
commit 7b550f386a
1 changed files with 33 additions and 29 deletions

View File

@ -214,6 +214,9 @@ var SN = { // StatusNet
self.close(); self.close();
} }
var notices = $("#notices_primary .notices");
if (notices.length > 0) {
if ($('#'+SN.C.S.CommandResult, data).length > 0) { if ($('#'+SN.C.S.CommandResult, data).length > 0) {
result = document._importNode($('p', data)[0], true); result = document._importNode($('p', data)[0], true);
result = result.textContent || result.innerHTML; result = result.textContent || result.innerHTML;
@ -231,7 +234,7 @@ var SN = { // StatusNet
$($(notice_irt+' .notices')[0]).append(notice); $($(notice_irt+' .notices')[0]).append(notice);
} }
else { else {
$("#notices_primary .notices").prepend(notice); notices.prepend(notice);
} }
$('#'+notice.id).css({display:'none'}); $('#'+notice.id).css({display:'none'});
$('#'+notice.id).fadeIn(2500); $('#'+notice.id).fadeIn(2500);
@ -246,6 +249,7 @@ var SN = { // StatusNet
$('#'+form_id+' #'+SN.C.S.NoticeDataAttachSelected).remove(); $('#'+form_id+' #'+SN.C.S.NoticeDataAttachSelected).remove();
SN.U.FormNoticeEnhancements($('#'+form_id)); SN.U.FormNoticeEnhancements($('#'+form_id));
} }
}
}, },
complete: function(xhr, textStatus) { complete: function(xhr, textStatus) {
form.removeClass(SN.C.S.Processing); form.removeClass(SN.C.S.Processing);