Fix empty string quotation; remove trailing spaces

This commit is contained in:
Max Kostikov 2019-09-30 16:50:24 +02:00
parent cf27b7440d
commit ba3a6ecb52

View File

@ -1140,6 +1140,7 @@ function doprofilelike(ident, verb) {
$.get('like/' + ident + '?verb=' + verb, function() { window.location.href=window.location.href; });
}
function doreply(parent, ident, owner, hint) {
var form = $('#comment-edit-form-' + parent.toString());
form.find('input[name=parent]').val(ident);
@ -1147,7 +1148,8 @@ function doreply(parent, ident, owner, hint) {
var btn = i.html().replace(/<[^>]*>/g, '').trim();
i.html('<i class="fa fa-reply" ></i> ' + btn);
var sel = 'wall-item-body-' + ident.toString();
form.find('textarea').val("@{" + owner + "}" + (($(window.getSelection().anchorNode).closest("#" + sel).attr("id") != sel) ? " " : "\n[quote]" + window.getSelection().toString() + "[/quote]\n"));
var quote = window.getSelection().toString().trim();
form.find('textarea').val("@{" + owner + "}" + ((($(window.getSelection().anchorNode).closest("#" + sel).attr("id") != sel) || (quote.length === 0))? " " : "\n[quote]" + quote + "[/quote]\n"));
$('#comment-edit-text-' + parent.toString()).focus();
}