when in list mode, make the max height half of the normal height before 'divgrow' kicks in.

This commit is contained in:
friendica 2014-11-16 19:33:58 -08:00
parent 591f10e235
commit acc8c69242
2 changed files with 17 additions and 18 deletions

View File

@ -458,25 +458,17 @@ function updateConvItems(mode,data) {
if(isVisible) if(isVisible)
showHideComments(itmId); showHideComments(itmId);
$(".autotime").timeago(); $(".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
// issues related to how we're trying to use it.
// disable for now.
// $("div.wall-item-body").divgrow({ initialHeight: 400 });
} }
else { else {
$('img',this).each(function() { $('img',this).each(function() {
$(this).attr('src',$(this).attr('dst')); $(this).attr('src',$(this).attr('dst'));
}); });
// more FIXME related to expanded comments
if($('#collapsed-comments-'+itmId).is(':visible')) if($('#collapsed-comments-'+itmId).is(':visible'))
isVisible = true; isVisible = true;
$('#' + ident).replaceWith($(this)); $('#' + ident).replaceWith($(this));
if(isVisible) if(isVisible)
showHideComments(itmId); showHideComments(itmId);
$(".autotime").timeago(); $(".autotime").timeago();
// $("div.wall-item-body").divgrow({ initialHeight: 400 });
} }
prev = ident; prev = ident;
}); });
@ -508,8 +500,6 @@ function updateConvItems(mode,data) {
if(isVisible) if(isVisible)
showHideComments(itmId); showHideComments(itmId);
$(".autotime").timeago(); $(".autotime").timeago();
// $("div.wall-item-body").divgrow({ initialHeight: 400 });
} }
else { else {
$('img',this).each(function() { $('img',this).each(function() {
@ -521,7 +511,6 @@ function updateConvItems(mode,data) {
if(isVisible) if(isVisible)
showHideComments(itmId); showHideComments(itmId);
$(".autotime").timeago(); $(".autotime").timeago();
// $("div.wall-item-body").divgrow({ initialHeight: 400 });
} }
}); });
@ -557,7 +546,6 @@ function updateConvItems(mode,data) {
showHideComments(itmId); showHideComments(itmId);
$(".autotime").timeago(); $(".autotime").timeago();
// $("div.wall-item-body").divgrow({ initialHeight: 400 });
} }
prev = ident; prev = ident;
}); });
@ -596,18 +584,29 @@ function updateConvItems(mode,data) {
function collapseHeight() { function collapseHeight() {
var isListMode = false;
$(".wall-item-listbody").each(function() {
isListMode = true;
if($(this).height() > 210) {
if(! $(this).hasClass('divmore')) {
$(this).divgrow({ initialHeight: 200, moreText: aStr['divgrowmore'], lessText: aStr['divgrowless'], showBrackets: false });
$(this).addClass('divmore');
}
}
});
$(".wall-item-body").each(function() { $(".wall-item-body").each(function() {
if(! isListMode) {
if($(this).height() > 410) { if($(this).height() > 410) {
if(! $(this).hasClass('divmore')) { if(! $(this).hasClass('divmore')) {
$(this).divgrow({ initialHeight: 400, moreText: aStr['divgrowmore'], lessText: aStr['divgrowless'], showBrackets: false }); $(this).divgrow({ initialHeight: 400, moreText: aStr['divgrowmore'], lessText: aStr['divgrowless'], showBrackets: false });
$(this).addClass('divmore'); $(this).addClass('divmore');
} }
} }
}
}); });
} }
function liveUpdate() { function liveUpdate() {
if((src == null) || (stopped) || (! profile_uid)) { $('.like-rotator').spin(false); return; } if((src == null) || (stopped) || (! profile_uid)) { $('.like-rotator').spin(false); return; }
if(($('.comment-edit-text-full').length) || (in_progress)) { if(($('.comment-edit-text-full').length) || (in_progress)) {

View File

@ -32,7 +32,7 @@
</div> </div>
<div class="wall-item-content" id="wall-item-content-{{$item.id}}"> <div class="wall-item-content" id="wall-item-content-{{$item.id}}">
<div class="wall-item-title-end"></div> <div class="wall-item-title-end"></div>
<div class="wall-item-body" id="wall-item-body-{{$item.id}}" > <div class="wall-item-body wall-item-listbody" id="wall-item-body-{{$item.id}}" >
{{$item.body}} {{$item.body}}
{{if $item.tags}} {{if $item.tags}}
<div class="body-tag"> <div class="body-tag">