},
success: function(data, textStatus) {
if (typeof($('form', data)[0]) != 'undefined') {
- var form_new = document._importNode($('form', data)[0], true);
+ form_new = document._importNode($('form', data)[0], true);
form.replaceWith(form_new);
if (onSuccess) {
onSuccess();
// Find the notice we're replying to...
var id = $($('.notice_id', notice)[0]).text();
var parentNotice = notice;
+ var stripForm = true; // strip a couple things out of reply forms that are inline
// Find the threaded replies view we'll be adding to...
var list = notice.closest('.notices');
- if (list.hasClass('threaded-replies')) {
+ if (list.closest('.old-school').length) {
+ // We're replying to an old-school conversation thread;
+ // use the old-style ping into the top form.
+ SN.U.switchInputFormTab("status")
+ replyForm = $('#input_form_status').find('form');
+ stripForm = false;
+ } else if (list.hasClass('threaded-replies')) {
// We're replying to a reply; use reply form on the end of this list.
// We'll add our form at the end of this; grab the root notice.
parentNotice = list.closest('.notice');
+
+ // See if the form's already open...
+ var replyForm = $('.notice-reply-form', list);
} else {
// We're replying to a parent notice; pull its threaded list
// and we'll add on the end of it. Will add if needed.
SN.U.NoticeInlineReplyPlaceholder(notice);
}
}
- }
- // See if the form's already open...
- var replyForm = $('.notice-reply-form', list);
+ // See if the form's already open...
+ var replyForm = $('.notice-reply-form', list);
+ }
var nextStep = function() {
// Override...?
replyForm.find('input[name=inreplyto]').val(id);
- replyForm.find('#notice_to').attr('disabled', 'disabled').hide();
- replyForm.find('#notice_private').attr('disabled', 'disabled').hide();
- replyForm.find('label[for=notice_to]').hide();
- replyForm.find('label[for=notice_private]').hide();
+ if (stripForm) {
+ // Don't do this for old-school reply form, as they don't come back!
+ replyForm.find('#notice_to').attr('disabled', 'disabled').hide();
+ replyForm.find('#notice_private').attr('disabled', 'disabled').hide();
+ replyForm.find('label[for=notice_to]').hide();
+ replyForm.find('label[for=notice_private]').hide();
+ }
// Set focus...
var text = replyForm.find('textarea');
nextStep();
} else {
// Hide the placeholder...
- placeholder = list.find('li.notice-reply-placeholder').hide();
+ var placeholder = list.find('li.notice-reply-placeholder').hide();
// Create the reply form entry at the end
var replyItem = $('li.notice-reply', list);
replyItem = $('<li class="notice-reply"></li>');
var intermediateStep = function(formMaster) {
- replyItem.append(formMaster);
+ var formEl = document._importNode(formMaster, true);
+ replyItem.append(formEl);
list.append(replyItem); // *after* the placeholder
- var form = replyForm = formMaster;
+ var form = replyForm = $(formEl);
SN.Init.NoticeFormSetup(form);
nextStep();
if (SN.C.I.NoticeFormMaster) {
// We've already saved a master copy of the form.
// Clone it in!
- console.debug("we have a saved for, using it");
intermediateStep(SN.C.I.NoticeFormMaster);
} else {
// Fetch a fresh copy of the notice form over AJAX.
// @fixme this fallback may or may not work
var url = $('#form_notice').attr('action');
$.get(url, {ajax: 1}, function(data, textStatus, xhr) {
- intermediateStep($('form', $(data).children()));
- }, 'xml');
+ intermediateStep($('form', data)[0]);
+ });
}
}
}
list = notice.find('ul.threaded-replies');
}
var placeholder = $('<li class="notice-reply-placeholder">' +
- '<input class="placeholder">' +
+ '<input class="placeholder" />' +
'</li>');
placeholder.find('input')
.val(SN.msg('reply_placeholder'));
var url = $(this).attr('href');
var area = $(this).closest('.threaded-replies');
$.get(url, {ajax: 1}, function(data, textStatus, xhr) {
- var replies = $('.threaded-replies', $(data).children());
+ var replies = $('.threaded-replies', data);
if (replies.length) {
- area.replaceWith(replies);
+ area.replaceWith(document._importNode(replies[0], true));
}
- }, 'xml');
+ });
return false;
});
},
if (NDMF.length === 0) {
$(this).addClass(SN.C.S.Processing);
$.get(NDM.attr('href'), null, function(data) {
- $('.entity_send-a-message').append($('form', $(data).children()));
+ $('.entity_send-a-message').append(document._importNode($('form', data)[0], true));
NDMF = $('.entity_send-a-message .form_notice');
SN.U.FormNoticeXHR(NDMF);
SN.U.FormNoticeEnhancements(NDMF);
return false;
});
NDM.removeClass(SN.C.S.Processing);
- }, 'xml');
+ });
}
else {
NDMF.show();
SN.Init.NoticeFormSetup(form);
})
.find('.notice_data-text').focus();
- }
+ },
+
+ showMoreMenuItems: function(menuid) {
+ $('#'+menuid+' .more_link').remove();
+ var selector = '#'+menuid+' .extended_menu';
+ var extended = $(selector);
+ extended.removeClass('extended_menu');
+ return void(0);
+ }
},
Init: {
if ($('body.user_in').length > 0) {
var masterForm = $('.form_notice:first');
if (masterForm.length > 0) {
- SN.C.I.NoticeFormMaster = masterForm;
+ SN.C.I.NoticeFormMaster = document._importNode(masterForm[0], true);
}
SN.U.NoticeRepeat();
SN.U.NoticeReply();