If an XHR notice is sent form a page that has no timeline, show a

message like 'Notice sent'
This commit is contained in:
Sarven Capadisli 2009-12-02 23:41:58 +01:00
parent 62d5f05669
commit ad8d6c8fbf

View File

@ -220,25 +220,33 @@ var SN = { // StatusNet
form.append('<p class="success">'+result+'</p>'); form.append('<p class="success">'+result+'</p>');
} }
else { else {
notice = document._importNode($('li', data)[0], true); var notices = $('#notices_primary .notices');
if ($('#'+notice.id).length === 0) { if (notices.length > 0) {
var notice_irt_value = $('#'+SN.C.S.NoticeInReplyTo).val(); var notice = document._importNode($('li', data)[0], true);
var notice_irt = '#notices_primary #notice-'+notice_irt_value; if ($('#'+notice.id).length === 0) {
if($('body')[0].id == 'conversation') { var notice_irt_value = $('#'+SN.C.S.NoticeInReplyTo).val();
if(notice_irt_value.length > 0 && $(notice_irt+' .notices').length < 1) { var notice_irt = '#notices_primary #notice-'+notice_irt_value;
$(notice_irt).append('<ul class="notices"></ul>'); if($('body')[0].id == 'conversation') {
if(notice_irt_value.length > 0 && $(notice_irt+' .notices').length < 1) {
$(notice_irt).append('<ul class="notices"></ul>');
}
$($(notice_irt+' .notices')[0]).append(notice);
} }
$($(notice_irt+' .notices')[0]).append(notice); else {
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'));
} }
else { }
$("#notices_primary .notices").prepend(notice); else {
} result = document._importNode($('title', data)[0], true);
$('#'+notice.id).css({display:'none'}); result_title = result.textContent || result.innerHTML;
$('#'+notice.id).fadeIn(2500); form.append('<p class="success">'+result_title+'</p>');
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.NoticeDataText).val('');
$('#'+form_id+' #'+SN.C.S.NoticeDataAttach).val(''); $('#'+form_id+' #'+SN.C.S.NoticeDataAttach).val('');