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 */
|
/* autocomplete @nicknames */
|
||||||
$(".comment-edit-form textarea").editor_autocomplete(baseurl+"/acl?f=&n=1");
|
$(".comment-edit-form textarea").editor_autocomplete(baseurl+"/acl?f=&n=1");
|
||||||
/*
|
|
||||||
var bimgs = $(".wall-item-body img").not(function() { return this.complete; });
|
var bimgs = $(".wall-item-body img").not(function() { return this.complete; });
|
||||||
var bimgcount = bimgs.length;
|
var bimgcount = bimgs.length;
|
||||||
|
|
||||||
@ -631,8 +631,8 @@ function updateConvItems(mode,data) {
|
|||||||
} else {
|
} else {
|
||||||
collapseHeight();
|
collapseHeight();
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
collapseHeight();
|
//collapseHeight();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -648,7 +648,6 @@ function collapseHeight() {
|
|||||||
if(! $(this).hasClass('divmore')) {
|
if(! $(this).hasClass('divmore')) {
|
||||||
|
|
||||||
//var trigger = $(window).scrollTop() < $(this).offset().top ? true : false;
|
//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
|
// check if we will collapse some content above the visible content and compensate the diff later
|
||||||
if($(window).scrollTop() > $(this).offset().top) {
|
if($(window).scrollTop() > $(this).offset().top) {
|
||||||
@ -657,23 +656,23 @@ function collapseHeight() {
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(trigger) {
|
//if(trigger) {
|
||||||
$(this).readmore({
|
$(this).readmore({
|
||||||
speed: 0,
|
speed: 0,
|
||||||
heightMargin: 50,
|
heightMargin: 50,
|
||||||
collapsedHeight: divmore_height,
|
collapsedHeight: divmore_height,
|
||||||
moreLink: '<a href="#" class="divgrow-showmore">' + aStr.divgrowmore + '</a>',
|
moreLink: '<a href="#" class="divgrow-showmore">' + aStr.divgrowmore + '</a>',
|
||||||
lessLink: '<a href="#" class="divgrow-showmore">' + aStr.divgrowless + '</a>',
|
lessLink: '<a href="#" class="divgrow-showmore">' + aStr.divgrowless + '</a>',
|
||||||
beforeToggle: function(trigger, element, expanded) {
|
beforeToggle: function(trigger, element, expanded) {
|
||||||
if(expanded) {
|
if(expanded) {
|
||||||
if((($(element).offset().top + divmore_height) - $(window).scrollTop()) < 65 ) {
|
if((($(element).offset().top + divmore_height) - $(window).scrollTop()) < 65 ) {
|
||||||
$(window).scrollTop($(window).scrollTop() - (orgHeight - divmore_height));
|
$(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');
|
console.log('collapseHeight() - contentHeightDiff: ' + contentHeightDiff + 'px');
|
||||||
|
|
||||||
if(i){
|
if(i){
|
||||||
var sval = position - cDiff + $(".divgrow-showmore").height();
|
var sval = position - cDiff + ($(".divgrow-showmore").outerHeight() * i);
|
||||||
console.log('collapsed above content count: ' + i);
|
console.log('collapsed above content count: ' + i);
|
||||||
$(window).scrollTop(sval);
|
$(window).scrollTop(sval);
|
||||||
}
|
}
|
||||||
@ -739,22 +738,48 @@ function liveUpdate() {
|
|||||||
$.get(update_url, function(data) {
|
$.get(update_url, function(data) {
|
||||||
var dready = new Date();
|
var dready = new Date();
|
||||||
console.log('DATA ready in: ' + (dready - dstart)/1000 + ' seconds.');
|
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;
|
page_load = false;
|
||||||
scroll_next = false;
|
scroll_next = false;
|
||||||
updateConvItems(update_mode,data);
|
updateConvItems(update_mode,data);
|
||||||
$("#page-spinner").spin(false);
|
$("#page-spinner").spin(false);
|
||||||
$("#profile-jot-text-loading").spin(false);
|
$("#profile-jot-text-loading").spin(false);
|
||||||
|
|
||||||
if(update_mode === 'update') {
|
|
||||||
$(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight + contentHeightDiff);
|
|
||||||
}
|
|
||||||
|
|
||||||
in_progress = false;
|
in_progress = false;
|
||||||
|
|
||||||
// FIXME - the following lines were added so that almost
|
// FIXME - the following lines were added so that almost
|
||||||
@ -771,7 +796,7 @@ function liveUpdate() {
|
|||||||
if(timer) clearTimeout(timer);
|
if(timer) clearTimeout(timer);
|
||||||
timer = setTimeout(NavUpdate,10);
|
timer = setTimeout(NavUpdate,10);
|
||||||
|
|
||||||
});
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user