summaryrefslogtreecommitdiff
path: root/js/util.js
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@status.net>2009-12-02 23:41:58 +0100
committerSarven Capadisli <csarven@status.net>2009-12-02 23:41:58 +0100
commitad8d6c8fbf51975c22ef66107520f33af4e0ec79 (patch)
treec641364ebe5b7a4a9129f221ed2f4ce9b50827ec /js/util.js
parent62d5f056691a194809c6e94c2221ba92f4e187bd (diff)
If an XHR notice is sent form a page that has no timeline, show a
message like 'Notice sent'
Diffstat (limited to 'js/util.js')
-rw-r--r--js/util.js42
1 files changed, 25 insertions, 17 deletions
diff --git a/js/util.js b/js/util.js
index 9ffbd88e4..73fcf37be 100644
--- a/js/util.js
+++ b/js/util.js
@@ -220,25 +220,33 @@ var SN = { // StatusNet
form.append('<p class="success">'+result+'</p>');
}
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('<ul class="notices"></ul>');
+ var notices = $('#notices_primary .notices');
+ if (notices.length > 0) {
+ var 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('<ul class="notices"></ul>');
+ }
+ $($(notice_irt+' .notices')[0]).append(notice);
}
- $($(notice_irt+' .notices')[0]).append(notice);
- }
- else {
- $("#notices_primary .notices").prepend(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'));
}
- $('#'+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 {
+ result = document._importNode($('title', data)[0], true);
+ result_title = result.textContent || result.innerHTML;
+ form.append('<p class="success">'+result_title+'</p>');
+ }
}
$('#'+form_id+' #'+SN.C.S.NoticeDataText).val('');
$('#'+form_id+' #'+SN.C.S.NoticeDataAttach).val('');