From 4b95e8ebe8719827566b484810dfe140f7b51726 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 24 Nov 2011 18:26:06 -0800 Subject: [PATCH] rework the liveupdate fixes - what a mess --- include/conversation.php | 4 ++-- js/main.js | 38 +++++++++++++++++++++++++++----------- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/include/conversation.php b/include/conversation.php index f7c8d5168e..20baf7dc5f 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -291,7 +291,7 @@ function conversation(&$a, $items, $mode, $update) { $arr = array('item' => $item, 'output' => $tmp_item); call_hooks('display_item', $arr); - $threads[$threadsid]['id'] = $threadsid; + $threads[$threadsid]['id'] = $arr[$item['item_id']]; $threads[$threadsid]['html'] .= $arr['output']; } @@ -375,7 +375,7 @@ function conversation(&$a, $items, $mode, $update) { $comments_collapsed = false; $threadsid++; - $threads[$threadsid]['id'] = $threadsid; + $threads[$threadsid]['id'] = $item['item_id']; $threads[$threadsid]['html'] = ""; } diff --git a/js/main.js b/js/main.js index 1a8cb4b85e..f41071ca1e 100644 --- a/js/main.js +++ b/js/main.js @@ -233,7 +233,25 @@ // $('#' + ident).hide(); // } //}); + + // add a new thread + $('.tread-wrapper',data).each(function() { + var ident = $(this).attr('id'); + if($('#' + ident).length == 0) { + $('img',this).each(function() { + $(this).attr('src',$(this).attr('dst')); + }); + $('#' + prev).after($(this)); + } + prev = ident; + }); + + // reset vars for inserting individual items + + prev = 'live-' + src; + + $('.wall-item-outside-wrapper',data).each(function() { var ident = $(this).attr('id'); if($('#' + ident).length == 0) { $('img',this).each(function() { @@ -242,21 +260,19 @@ $('#' + prev).after($(this)); } else { - $(this).find('.wall-item-outside-wrapper').each(function() { - var iident = $(this).attr('id'); - $('#' + iident + ' ' + '.wall-item-ago').replaceWith($(this).find('.wall-item-ago')); - if($('#' + iident + ' ' + '.comment-edit-text-empty').length) - $('#' + iident + ' ' + '.wall-item-comment-wrapper').replaceWith($(this).find('.wall-item-comment-wrapper')); - $('#' + iident + ' ' + '.hide-comments-total').replaceWith($(this).find('.hide-comments-total')); - $('#' + iident + ' ' + '.wall-item-like').replaceWith($(this).find('.wall-item-like')); - $('#' + iident + ' ' + '.wall-item-dislike').replaceWith($(this).find('.wall-item-dislike')); - $('#' + iident + ' ' + '.my-comment-photo').each(function() { - $(this).attr('src',$(this).attr('dst')); - }); + $('#' + ident + ' ' + '.wall-item-ago').replaceWith($(this).find('.wall-item-ago')); + if($('#' + ident + ' ' + '.comment-edit-text-empty').length) + $('#' + ident + ' ' + '.wall-item-comment-wrapper').replaceWith($(this).find('.wall-item-comment-wrapper')); + $('#' + ident + ' ' + '.hide-comments-total').replaceWith($(this).find('.hide-comments-total')); + $('#' + ident + ' ' + '.wall-item-like').replaceWith($(this).find('.wall-item-like')); + $('#' + ident + ' ' + '.wall-item-dislike').replaceWith($(this).find('.wall-item-dislike')); + $('#' + ident + ' ' + '.my-comment-photo').each(function() { + $(this).attr('src',$(this).attr('dst')); }); } prev = ident; }); + $('.like-rotator').hide(); if(commentBusy) { commentBusy = false;