Commit 2fa95144 authored by Brion Vibber's avatar Brion Vibber

Cleanup & minification for migration to reusable notice form in inline replies. Yay!

parent a1002cc1
......@@ -615,77 +615,6 @@ var SN = { // StatusNet
nextStep();
});
/*
replyItem = $('<li class="notice-reply">' +
'<form class="notice-reply-form" method="post">' +
'<textarea name="status_textarea"></textarea>' +
'<div class="controls">' +
'<input type="hidden" name="token">' +
'<input type="hidden" name="inreplyto">' +
'<input type="submit" class="submit">' +
'</div>' +
'</form>' +
'</li>');
var baseForm = $('#form_notice');
replyForm = replyItem.find('form');
replyForm.attr('action', baseForm.attr('action'));
replyForm.find('input[name="token"]').val(baseForm.find('input[name=token]').val());
replyForm.find('input[type="submit"]').val(SN.msg('reply_submit'));
list.append(replyItem);
replyForm.find('textarea').blur(function() {
var textarea = $(this);
var txt = $.trim(textarea.val());
if (txt == '' || txt == textarea.data('initialText')) {
// Nothing to say? Begone!
replyItem.remove();
if (list.find('li').length > 0) {
SN.U.NoticeInlineReplyPlaceholder(parentNotice);
} else {
list.remove();
}
}
});
replyForm.submit(function(event) {
var form = replyForm;
$.ajax({
type: 'POST',
dataType: 'xml',
url: SN.U.RewriteAjaxAction(form.attr('action')),
data: form.serialize() + '&ajax=1',
beforeSend: function(xhr) {
form
.addClass(SN.C.S.Processing)
.find('.submit')
.addClass(SN.C.S.Disabled)
.attr(SN.C.S.Disabled, SN.C.S.Disabled)
.end()
.find('textarea')
.addClass(SN.C.S.Disabled)
.attr(SN.C.S.Disabled, SN.C.S.Disabled);
},
error: function (xhr, textStatus, errorThrown) {
alert(errorThrown || textStatus);
},
success: function(data, textStatus) {
var orig_li = $('li', data)[0];
if (orig_li) {
var li = document._importNode(orig_li, true);
var id = $(li).attr('id');
if ($("#"+id).length == 0) {
replyItem.replaceWith(li);
SN.U.NoticeInlineReplyPlaceholder(parentNotice);
} else {
// Realtime came through before us...
replyItem.remove();
}
}
}
});
event.preventDefault();
return false;
});
*/
}
}
},
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment