From 31e04378cda30421159765fba029ddc7859dfbe5 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Mon, 29 Apr 2019 23:30:51 +0200 Subject: Add 'reply to comment' processing --- view/js/main.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index 1322c2112..43e4634dd 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -231,6 +231,9 @@ function handle_comment_form(e) { $('#' + emptyCommentElm).removeAttr('tabindex'); $('#' + emptySubmitElm).removeAttr('tabindex'); form.find(':not(.comment-edit-text)').hide(); + form.find(':input[name=parent]').val(emptyCommentElm.replace(/\D/g,'')); + var btn = form.find(':button[type=submit]').html(); + form.find(':button[type=submit]').html(btn.replace(/<[^>]*>/g, '').trim()); } }); @@ -1140,6 +1143,16 @@ function dolike(ident, verb) { liking = 1; } +function doreply(parent, ident, owner) { + form = $('#comment-edit-form-' + parent.toString()); + form.find('input[name=parent]').val(ident); + var btn = form.find('button[type=submit]').html(); + form.find('button[type=submit]').html(' ' + btn); + taid = '#comment-edit-text-' + parent.toString(); + $(taid).val("@{" + owner + "}\n"); + $(taid).focus(); +} + function doprofilelike(ident, verb) { $.get('like/' + ident + '?verb=' + verb, function() { window.location.href=window.location.href; }); } -- cgit v1.2.3 From c0be4c36e1a80fcc1caae16b70c5d624e259f491 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Mon, 29 Apr 2019 23:40:21 +0200 Subject: Update main.js --- view/js/main.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index 43e4634dd..568f5bb4b 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1148,9 +1148,8 @@ function doreply(parent, ident, owner) { form.find('input[name=parent]').val(ident); var btn = form.find('button[type=submit]').html(); form.find('button[type=submit]').html(' ' + btn); - taid = '#comment-edit-text-' + parent.toString(); - $(taid).val("@{" + owner + "}\n"); - $(taid).focus(); + form.find('textarea').val("@{" + owner + "}\n"); + $('#comment-edit-text-' + parent.toString()).focus(); } function doprofilelike(ident, verb) { -- cgit v1.2.3 From 5066945adc2ac9654d773ddf5406674aa4075ae0 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Tue, 30 Apr 2019 11:17:22 +0200 Subject: Fix add multiple icons on 'Submit' button when reply on comment --- view/js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index 568f5bb4b..d6bdc8238 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1146,7 +1146,7 @@ function dolike(ident, verb) { function doreply(parent, ident, owner) { form = $('#comment-edit-form-' + parent.toString()); form.find('input[name=parent]').val(ident); - var btn = form.find('button[type=submit]').html(); + var btn = form.find('button[type=submit]').html().replace(/<[^>]*>/g, '').trim(); form.find('button[type=submit]').html(' ' + btn); form.find('textarea').val("@{" + owner + "}\n"); $('#comment-edit-text-' + parent.toString()).focus(); -- cgit v1.2.3 From 4da96ee98035956620dcb80e4a76832e3d4ff168 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Tue, 30 Apr 2019 17:35:53 +0200 Subject: Remove 'doreply' JS function --- view/js/main.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index d6bdc8238..8f644dc8e 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -234,6 +234,7 @@ function handle_comment_form(e) { form.find(':input[name=parent]').val(emptyCommentElm.replace(/\D/g,'')); var btn = form.find(':button[type=submit]').html(); form.find(':button[type=submit]').html(btn.replace(/<[^>]*>/g, '').trim()); + form.find(':button[type=submit]').prop('title', ''); } }); @@ -1143,15 +1144,6 @@ function dolike(ident, verb) { liking = 1; } -function doreply(parent, ident, owner) { - form = $('#comment-edit-form-' + parent.toString()); - form.find('input[name=parent]').val(ident); - var btn = form.find('button[type=submit]').html().replace(/<[^>]*>/g, '').trim(); - form.find('button[type=submit]').html(' ' + btn); - form.find('textarea').val("@{" + owner + "}\n"); - $('#comment-edit-text-' + parent.toString()).focus(); -} - function doprofilelike(ident, verb) { $.get('like/' + ident + '?verb=' + verb, function() { window.location.href=window.location.href; }); } -- cgit v1.2.3 From c340416c9424c285de4701158714541f24d66e85 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Wed, 1 May 2019 06:24:58 +0200 Subject: Add 'reply on comment' code --- view/js/main.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index 8f644dc8e..325ad9a51 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1148,6 +1148,16 @@ 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); + i.prop('title', hint); + form.find('textarea').val("@{" + owner + "}\n"); + $('#comment-edit-text-' + parent.toString()).focus(); +} function dropItem(url, object) { -- cgit v1.2.3