only prefetch images on update_mode update
This commit is contained in:
parent
3be6ef6bfc
commit
45247d1595
@ -617,7 +617,7 @@ function updateConvItems(mode,data) {
|
||||
|
||||
/* autocomplete @nicknames */
|
||||
$(".comment-edit-form textarea").editor_autocomplete(baseurl+"/acl?f=&n=1");
|
||||
/*
|
||||
|
||||
var bimgs = $(".wall-item-body img").not(function() { return this.complete; });
|
||||
var bimgcount = bimgs.length;
|
||||
|
||||
@ -631,8 +631,8 @@ function updateConvItems(mode,data) {
|
||||
} else {
|
||||
collapseHeight();
|
||||
}
|
||||
*/
|
||||
collapseHeight();
|
||||
|
||||
//collapseHeight();
|
||||
|
||||
}
|
||||
|
||||
@ -648,7 +648,6 @@ function collapseHeight() {
|
||||
if(! $(this).hasClass('divmore')) {
|
||||
|
||||
//var trigger = $(window).scrollTop() < $(this).offset().top ? true : false;
|
||||
var trigger = true;
|
||||
|
||||
// check if we will collapse some content above the visible content and compensate the diff later
|
||||
if($(window).scrollTop() > $(this).offset().top) {
|
||||
@ -657,23 +656,23 @@ function collapseHeight() {
|
||||
i++;
|
||||
}
|
||||
|
||||
if(trigger) {
|
||||
$(this).readmore({
|
||||
speed: 0,
|
||||
heightMargin: 50,
|
||||
collapsedHeight: divmore_height,
|
||||
moreLink: '<a href="#" class="divgrow-showmore">' + aStr.divgrowmore + '</a>',
|
||||
lessLink: '<a href="#" class="divgrow-showmore">' + aStr.divgrowless + '</a>',
|
||||
beforeToggle: function(trigger, element, expanded) {
|
||||
if(expanded) {
|
||||
if((($(element).offset().top + divmore_height) - $(window).scrollTop()) < 65 ) {
|
||||
$(window).scrollTop($(window).scrollTop() - (orgHeight - divmore_height));
|
||||
}
|
||||
//if(trigger) {
|
||||
$(this).readmore({
|
||||
speed: 0,
|
||||
heightMargin: 50,
|
||||
collapsedHeight: divmore_height,
|
||||
moreLink: '<a href="#" class="divgrow-showmore">' + aStr.divgrowmore + '</a>',
|
||||
lessLink: '<a href="#" class="divgrow-showmore">' + aStr.divgrowless + '</a>',
|
||||
beforeToggle: function(trigger, element, expanded) {
|
||||
if(expanded) {
|
||||
if((($(element).offset().top + divmore_height) - $(window).scrollTop()) < 65 ) {
|
||||
$(window).scrollTop($(window).scrollTop() - (orgHeight - divmore_height));
|
||||
}
|
||||
}
|
||||
});
|
||||
$(this).addClass('divmore');
|
||||
}
|
||||
}
|
||||
});
|
||||
$(this).addClass('divmore');
|
||||
//}
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -683,7 +682,7 @@ function collapseHeight() {
|
||||
console.log('collapseHeight() - contentHeightDiff: ' + contentHeightDiff + 'px');
|
||||
|
||||
if(i){
|
||||
var sval = position - cDiff + $(".divgrow-showmore").height();
|
||||
var sval = position - cDiff + ($(".divgrow-showmore").outerHeight() * i);
|
||||
console.log('collapsed above content count: ' + i);
|
||||
$(window).scrollTop(sval);
|
||||
}
|
||||
@ -739,22 +738,48 @@ function liveUpdate() {
|
||||
$.get(update_url, function(data) {
|
||||
var dready = new Date();
|
||||
console.log('DATA ready in: ' + (dready - dstart)/1000 + ' seconds.');
|
||||
console.log('LOADING images...');
|
||||
|
||||
$('.wall-item-body, .wall-photo-item',data).imagesLoaded( function() {
|
||||
var iready = new Date();
|
||||
console.log('IMAGES ready in: ' + (iready - dready)/1000 + ' seconds.');
|
||||
|
||||
if(update_mode === 'update') {
|
||||
console.log('LOADING images...');
|
||||
|
||||
$('.wall-item-body, .wall-photo-item',data).imagesLoaded( function() {
|
||||
var iready = new Date();
|
||||
console.log('IMAGES ready in: ' + (iready - dready)/1000 + ' seconds.');
|
||||
|
||||
page_load = false;
|
||||
scroll_next = false;
|
||||
updateConvItems(update_mode,data);
|
||||
$("#page-spinner").spin(false);
|
||||
$("#profile-jot-text-loading").spin(false);
|
||||
|
||||
$(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight + contentHeightDiff);
|
||||
|
||||
in_progress = false;
|
||||
|
||||
// FIXME - the following lines were added so that almost
|
||||
// immediately after we update the posts on the page, we
|
||||
// re-check and update the notification counts.
|
||||
// As it turns out this causes a bit of an inefficiency
|
||||
// as we're pinging twice for every update, once before
|
||||
// and once after. A btter way to do this is to rewrite
|
||||
// NavUpdate and perhaps LiveUpdate so that we check for
|
||||
// post updates first and only call the notification ping
|
||||
// once.
|
||||
|
||||
updateCountsOnly = true;
|
||||
if(timer) clearTimeout(timer);
|
||||
timer = setTimeout(NavUpdate,10);
|
||||
|
||||
});
|
||||
}
|
||||
else {
|
||||
page_load = false;
|
||||
scroll_next = false;
|
||||
updateConvItems(update_mode,data);
|
||||
$("#page-spinner").spin(false);
|
||||
$("#profile-jot-text-loading").spin(false);
|
||||
|
||||
if(update_mode === 'update') {
|
||||
$(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight + contentHeightDiff);
|
||||
}
|
||||
|
||||
in_progress = false;
|
||||
|
||||
// FIXME - the following lines were added so that almost
|
||||
@ -771,7 +796,7 @@ function liveUpdate() {
|
||||
if(timer) clearTimeout(timer);
|
||||
timer = setTimeout(NavUpdate,10);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user