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)
This commit is contained in:
parent
ac880bd6ea
commit
6b5b6d072b
22
js/util.js
22
js/util.js
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
2
js/util.min.js
vendored
2
js/util.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user