We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 6b5b6d07 authored by Brion Vibber's avatar Brion Vibber

Make inline reply forms close when clicking outside them if there's no text again.

(That went away when we switched to reusing the main notice form)
parent ac880bd6
......@@ -640,6 +640,7 @@ var SN = { // StatusNet
'</li>');
placeholder.click(function() {
SN.U.NoticeInlineReplyTrigger(notice);
return false;
});
placeholder.find('input').val(SN.msg('reply_placeholder'));
list.append(placeholder);
......@@ -1309,6 +1310,27 @@ var SN = { // StatusNet
var form = $(this);
SN.Init.NoticeFormSetup(form);
});
// Make inline reply forms self-close when clicking out.
$('body').bind('click', function(e) {
var openReplies = $('li.notice-reply');
if (openReplies.length > 0) {
var target = $(e.target).closest('li.notice-reply');
if (target.length == 0) {
// There are inline replies open, and we
// clicked outside of one...
openReplies.each(function() {
var replyItem = $(this);
// Only close if there's been no edit.
if (replyItem.find('.notice_data-text:first').val() == '') {
var parentNotice = replyItem.closest('li.notice');
replyItem.remove();
SN.U.NoticeInlineReplyPlaceholder(parentNotice);
}
});
}
}
});
}
},
......
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