]> git.mxchange.org Git - friendica.git/commitdiff
rework the liveupdate fixes - what a mess
authorfriendica <info@friendica.com>
Fri, 25 Nov 2011 02:26:06 +0000 (18:26 -0800)
committerfriendica <info@friendica.com>
Fri, 25 Nov 2011 02:26:06 +0000 (18:26 -0800)
include/conversation.php
js/main.js

index f7c8d5168e5c5b08194ca7e2db859fdf171c2acf..20baf7dc5fed773aec893f70cc05e9502ad9ba4d 100644 (file)
@@ -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'] = "";
 
                                }
index 1a8cb4b85e1b346d5bc5af911aba32d20d074029..f41071ca1e3171ed0eaa9aa198fe770f7596f21d 100644 (file)
                        //                      $('#' + 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() {
                                        $('#' + 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;