aboutsummaryrefslogtreecommitdiffstats
path: root/view/js
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-11-20 20:38:10 +0000
committerMario <mario@mariovavti.com>2020-11-20 20:38:10 +0000
commit2d4064aca4517eac695ba0f0f3618f4a7f7a08cb (patch)
tree8326859d41f4211483bc261c1ce5bc8c2de80577 /view/js
parent337d8ea78c2e799257fa4cbaf0ba96bc7c3d05d3 (diff)
downloadvolse-hubzilla-2d4064aca4517eac695ba0f0f3618f4a7f7a08cb.tar.gz
volse-hubzilla-2d4064aca4517eac695ba0f0f3618f4a7f7a08cb.tar.bz2
volse-hubzilla-2d4064aca4517eac695ba0f0f3618f4a7f7a08cb.zip
returning the rendered html when liking a post or comment
Diffstat (limited to 'view/js')
-rw-r--r--view/js/main.js19
1 files changed, 16 insertions, 3 deletions
diff --git a/view/js/main.js b/view/js/main.js
index c6460f356..133d71863 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -633,12 +633,11 @@ function updateConvItems(mode,data) {
}
if(mode === 'replace') {
- $('.thread-wrapper').remove(); // clear existing content
+ $('.thread-parent').remove(); // clear existing content
}
$('.thread-wrapper', data).each(function() {
if(this.classList.contains('toplevel_item')) {
-
var ident = this.id;
var convId = ident.replace('thread-wrapper-','');
var commentWrap = $('#'+ident+' .collapsed-comments').attr('id');
@@ -1158,7 +1157,21 @@ function justifyPhotosAjax(id) {
// is delayed and updateInit runs before it completes.
function dolike(ident, verb) {
$('#like-rotator-' + ident.toString()).show();
- $.get('like/' + ident.toString() + '?verb=' + verb, updateInit );
+ $.get('like/' + ident.toString() + '?verb=' + verb, function (data) {
+ data = JSON.parse(data);
+ if(data.success) {
+ // this is a bit tricky since the top level thread wrapper wraps the whole thread
+ if($('#thread-wrapper-' + data.id).hasClass('toplevel_item')) {
+ var wrapper = $('<div></div>').html( data.html ).find('#wall-item-outside-wrapper-' + data.id);
+ $('#wall-item-outside-wrapper-' + data.id).html(wrapper[0].innerHTML);
+ }
+ else {
+ $('#thread-wrapper-' + data.id).replaceWith(data.html);
+ }
+ $('#wall-item-ago-' + data.id + ' .autotime').timeago();
+ liking = 0;
+ }
+ });
liking = 1;
}