aboutsummaryrefslogtreecommitdiffstats
path: root/js/main.js
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-07-02 20:15:45 -0700
committerfriendica <info@friendica.com>2013-07-02 20:15:45 -0700
commita4c77467a78a7301b53f4c9e54ca0f562e1ced4d (patch)
tree33395ec487d5a7ce9d6dff64c01e4fb54bbc3304 /js/main.js
parentda05b9736ec0f2712d1a6828ff819aa12dd9e391 (diff)
downloadvolse-hubzilla-a4c77467a78a7301b53f4c9e54ca0f562e1ced4d.tar.gz
volse-hubzilla-a4c77467a78a7301b53f4c9e54ca0f562e1ced4d.tar.bz2
volse-hubzilla-a4c77467a78a7301b53f4c9e54ca0f562e1ced4d.zip
with luck this will fix issue #61 and issue #62 - boy that was fun (not).
Diffstat (limited to 'js/main.js')
-rw-r--r--js/main.js37
1 files changed, 13 insertions, 24 deletions
diff --git a/js/main.js b/js/main.js
index c8c3ea48d..161068310 100644
--- a/js/main.js
+++ b/js/main.js
@@ -343,34 +343,26 @@
function updateConvItems(mode,data) {
- var expanded_comments = false;
-
if(mode === 'update') {
prev = 'threads-begin';
+
$('.thread-wrapper.toplevel_item',data).each(function() {
+
var ident = $(this).attr('id');
+ var commentWrap = $('#'+ident+' .collapsed-comments').attr('id');
+ var itmId = commentWrap.replace('collapsed-comments-','');
+ var isVisible = false;
if($('#' + ident).length == 0 && profile_page == 1) {
$('img',this).each(function() {
$(this).attr('src',$(this).attr('dst'));
});
-
- // FIXME this doesn't work at all to prevent open comments from
- // collapsing on update - but I'm leaving this experimental code here until
- // I have time to dig into it again. Ideally we want to find
- // the expanded comments div on the page and then expand the one we received
- // over the wire (in the data variable) before placing the thread on the page,
- // as then it won't blink.
-
- expanded_comments = false;
- $('.collapsed-comments',this).each(function() {
- if($('.thread-wrapper',this).is(':visible'))
- expanded_comments = this;
- });
+ if($('#collapsed-comments-'+itmId).is(':visible'))
+ isVisible = true;
$('#' + prev).after($(this));
- if(expanded_comments)
- $(expanded_comments).show();
+ if(isVisible)
+ showHideComments(itmId);
$(".autotime").timeago();
// divgrow doesn't prevent itself from attaching a second (or 500th)
// "show more" div to a content region - it also has a few other
@@ -383,14 +375,11 @@ function updateConvItems(mode,data) {
$(this).attr('src',$(this).attr('dst'));
});
// more FIXME related to expanded comments
- expanded_comments = false;
- $('.collapsed-comments',this).each(function() {
- if($('.thread-wrapper',this).is(':visible'))
- expanded_comments = $(this);
- });
+ if($('#collapsed-comments-'+itmId).is(':visible'))
+ isVisible = true;
$('#' + ident).replaceWith($(this));
- if(expanded_comments)
- $(expanded_comments).show();
+ if(isVisible)
+ showHideComments(itmId);
$(".autotime").timeago();
// $("div.wall-item-body").divgrow({ initialHeight: 400 });