rework the liveupdate fixes - what a mess

This commit is contained in:
friendica 2011-11-24 18:26:06 -08:00
parent 757ca5014c
commit 4b95e8ebe8
2 changed files with 29 additions and 13 deletions

View file

@ -291,7 +291,7 @@ function conversation(&$a, $items, $mode, $update) {
$arr = array('item' => $item, 'output' => $tmp_item); $arr = array('item' => $item, 'output' => $tmp_item);
call_hooks('display_item', $arr); call_hooks('display_item', $arr);
$threads[$threadsid]['id'] = $threadsid; $threads[$threadsid]['id'] = $arr[$item['item_id']];
$threads[$threadsid]['html'] .= $arr['output']; $threads[$threadsid]['html'] .= $arr['output'];
} }
@ -375,7 +375,7 @@ function conversation(&$a, $items, $mode, $update) {
$comments_collapsed = false; $comments_collapsed = false;
$threadsid++; $threadsid++;
$threads[$threadsid]['id'] = $threadsid; $threads[$threadsid]['id'] = $item['item_id'];
$threads[$threadsid]['html'] = ""; $threads[$threadsid]['html'] = "";
} }

View file

@ -233,7 +233,25 @@
// $('#' + ident).hide(); // $('#' + ident).hide();
// } // }
//}); //});
// add a new thread
$('.tread-wrapper',data).each(function() { $('.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'); var ident = $(this).attr('id');
if($('#' + ident).length == 0) { if($('#' + ident).length == 0) {
$('img',this).each(function() { $('img',this).each(function() {
@ -242,21 +260,19 @@
$('#' + prev).after($(this)); $('#' + prev).after($(this));
} }
else { else {
$(this).find('.wall-item-outside-wrapper').each(function() { $('#' + ident + ' ' + '.wall-item-ago').replaceWith($(this).find('.wall-item-ago'));
var iident = $(this).attr('id'); if($('#' + ident + ' ' + '.comment-edit-text-empty').length)
$('#' + iident + ' ' + '.wall-item-ago').replaceWith($(this).find('.wall-item-ago')); $('#' + ident + ' ' + '.wall-item-comment-wrapper').replaceWith($(this).find('.wall-item-comment-wrapper'));
if($('#' + iident + ' ' + '.comment-edit-text-empty').length) $('#' + ident + ' ' + '.hide-comments-total').replaceWith($(this).find('.hide-comments-total'));
$('#' + iident + ' ' + '.wall-item-comment-wrapper').replaceWith($(this).find('.wall-item-comment-wrapper')); $('#' + ident + ' ' + '.wall-item-like').replaceWith($(this).find('.wall-item-like'));
$('#' + iident + ' ' + '.hide-comments-total').replaceWith($(this).find('.hide-comments-total')); $('#' + ident + ' ' + '.wall-item-dislike').replaceWith($(this).find('.wall-item-dislike'));
$('#' + iident + ' ' + '.wall-item-like').replaceWith($(this).find('.wall-item-like')); $('#' + ident + ' ' + '.my-comment-photo').each(function() {
$('#' + iident + ' ' + '.wall-item-dislike').replaceWith($(this).find('.wall-item-dislike')); $(this).attr('src',$(this).attr('dst'));
$('#' + iident + ' ' + '.my-comment-photo').each(function() {
$(this).attr('src',$(this).attr('dst'));
});
}); });
} }
prev = ident; prev = ident;
}); });
$('.like-rotator').hide(); $('.like-rotator').hide();
if(commentBusy) { if(commentBusy) {
commentBusy = false; commentBusy = false;