aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2019-09-30 16:50:24 +0200
committerMax Kostikov <max@kostikov.co>2019-09-30 16:50:24 +0200
commitba3a6ecb52b5a092ea5dbf56ddd8faccfc6c4335 (patch)
treee2c1371f8d4fc88e298fa81388d9681e27c2a430
parentcf27b7440dace81d29358af38dd63ba2978eedb0 (diff)
downloadvolse-hubzilla-ba3a6ecb52b5a092ea5dbf56ddd8faccfc6c4335.tar.gz
volse-hubzilla-ba3a6ecb52b5a092ea5dbf56ddd8faccfc6c4335.tar.bz2
volse-hubzilla-ba3a6ecb52b5a092ea5dbf56ddd8faccfc6c4335.zip
Fix empty string quotation; remove trailing spaces
-rw-r--r--view/js/main.js18
1 files changed, 10 insertions, 8 deletions
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('<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"));
- $('#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('<i class="fa fa-reply" ></i> ' + 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) {