From ba3a6ecb52b5a092ea5dbf56ddd8faccfc6c4335 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Mon, 30 Sep 2019 16:50:24 +0200 Subject: Fix empty string quotation; remove trailing spaces --- view/js/main.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'view') diff --git a/view/js/main.js b/view/js/main.js index bc1c48cf1..2b4acdf61 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1140,15 +1140,17 @@ 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); - var i = form.find('button[type=submit]'); - var btn = i.html().replace(/<[^>]*>/g, '').trim(); - i.html(' ' + 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")); - $('#comment-edit-text-' + parent.toString()).focus(); + var form = $('#comment-edit-form-' + parent.toString()); + form.find('input[name=parent]').val(ident); + var i = form.find('button[type=submit]'); + var btn = i.html().replace(/<[^>]*>/g, '').trim(); + i.html(' ' + btn); + var sel = 'wall-item-body-' + ident.toString(); + 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(); } function doscroll(parent, hidden) { -- cgit v1.2.3