fine tuning

This commit is contained in:
Mike Macgirvin 2023-07-23 18:23:03 +10:00
parent c140966292
commit fde50d3a3c

View file

@ -848,22 +848,6 @@ function updateConvItems(mode,data) {
collapseHeight();
/*
let bimgs = ((preloadImages) ? false : $(".wall-item-body img, .wall-photo-item img").not(function() { return this.complete; }));
let bimgcount = bimgs.length;
if (bimgcount) {
bimgs.on('load',function() {
bimgcount--;
if (! bimgcount) {
collapseHeight();
}
});
} else {
collapseHeight();
}
*/
// auto-scroll to a particular comment in a thread (designated by mid) when in single-thread mode
// use the same method to generate the submid as we use in ThreadItem,
// base64_encode + replace(['+','='],['','']);
@ -889,67 +873,22 @@ function updateConvItems(mode,data) {
}
function collapseHeight() {
if (! divmore_height) {
return;
}
$(".wall-item-content, .directory-collapse").each(function() {
let scrollid = $(this).attr('id');
scrollid = scrollid.replace('wall-item-content-', '');
$scrollable = $(this).get(0).scrollHeight > $(this).get(0).clientHeight;
if ($scrollable) {
let scrollable = $(this).get(0).scrollHeight > $(this).get(0).clientHeight;
if (scrollable && divmore_height) {
$(this).addClass('scrollable');
$(this).css('max-height', divmore_height + 'px');
$("#wall-item-scroll-" + scrollid).show();
}
else {
$(this).removeClass('scrollable');
$(this).css('max-height', 'none');
$("#wall-item-scroll-" + scrollid).hide();
}
});
/*
orgHeight = $(this).outerHeight(true);
if(orgHeight > divmore_height) {
if(! $(this).hasClass('divmore') && $(this).has('div.no-collapse').length == 0) {
// check if we will collapse some content above the visible content and compensate the diff later
if($(this).offset().top + divmore_height - $(window).scrollTop() + cDiff - ($(".divgrow-showmore").outerHeight() * i) < 65) {
diff = orgHeight - divmore_height;
cDiff = cDiff + diff;
i++;
}
$(this).readmore({
speed: 0,
heightMargin: 50,
collapsedHeight: divmore_height,
moreLink: '<a href="#" class="divgrow-showmore fakelink">' + aStr.divgrowmore + '</a>',
lessLink: '<a href="#" class="divgrow-showmore fakelink">' + aStr.divgrowless + '</a>',
beforeToggle: function(trigger, element, expanded) {
if(expanded) {
if((($(element).offset().top + divmore_height) - $(window).scrollTop()) < 65 ) {
$(window).scrollTop($(window).scrollTop() - ($(element).outerHeight(true) - divmore_height));
}
}
}
});
$(this).addClass('divmore');
}
}
});
let collapsedContentHeight = Math.ceil($("#region_2").height());
contentHeightDiff = liking ? 0 : origContentHeight - collapsedContentHeight;
// contentHeightDiff = origContentHeight - collapsedContentHeight;
console.log('collapseHeight() - contentHeightDiff: ' + contentHeightDiff + 'px');
if(i && ! liking){
let sval = position - cDiff + ($(".divgrow-showmore").outerHeight() * i);
console.log('collapsed above viewport count: ' + i);
// $(window).scrollTop(sval);
}
*/
}
function updateInit() {