make fewer requests for list pages when scrolling fast through a list

This commit is contained in:
rolux 2010-07-16 08:50:30 +02:00
parent 624c1cd105
commit 6693a3996e

View file

@ -1282,7 +1282,12 @@ requires
function toggle() {
Ox.print("toggle");
var size = self.options.collapsed ? 0 : -self.options.size,
if (Ox.isUndefined(self.options.position)) {
self.options.position = parseInt(self.options.parent.css(self.options.edge)) +
(self.options.collapsed ? self.options.size : 0);
}
var size = self.options.position -
(self.options.collapsed ? 0 : self.options.size),
animate = {};
Ox.print("s.o.e", self.options.edge);
animate[self.options.edge] = size;
@ -3005,26 +3010,30 @@ requires
function scroll() {
var page = self.page;
self.page = getPage();
if (self.page == page - 1) {
unloadPage(self.page + 2);
loadPage(self.page - 1);
} else if (self.page ==page + 1) {
unloadPage(self.page - 2);
loadPage(self.page + 1);
} else if (self.page == page - 2) {
unloadPage(self.page + 3);
unloadPage(self.page + 2);
loadPage(self.page);
loadPage(self.page - 1);
} else if (self.page == page + 2) {
unloadPage(self.page - 3);
unloadPage(self.page - 2);
loadPage(self.page);
loadPage(self.page + 1);
} else if (self.page != page) {
unloadPages(page);
loadPages(self.page);
}
setTimeout(function() {
if (self.page == getPage()) {
if (self.page == page - 1) {
unloadPage(self.page + 2);
loadPage(self.page - 1);
} else if (self.page == page + 1) {
unloadPage(self.page - 2);
loadPage(self.page + 1);
} else if (self.page == page - 2) {
unloadPage(self.page + 3);
unloadPage(self.page + 2);
loadPage(self.page);
loadPage(self.page - 1);
} else if (self.page == page + 2) {
unloadPage(self.page - 3);
unloadPage(self.page - 2);
loadPage(self.page);
loadPage(self.page + 1);
} else if (self.page != page) {
unloadPages(page);
loadPages(self.page);
}
}
}, 100);
}
function scrollPageDown() {
@ -4610,7 +4619,7 @@ requires
Ox.SplitPanel = function(options, self) {
var self = self || {},
that = new Ox.Element({}, self)
that = new Ox.Element({}, self) // fixme: Container
.defaults({
elements: [],
orientation: "horizontal"
@ -4639,7 +4648,7 @@ requires
$.each(self.options.elements, function(i, v) {
//that.append(element)
that.$elements[i].appendTo(that);
that.$elements[i].appendTo(that); // fixme: that.$content
if (v.collapsible || v.resizable) {
Ox.print("v.size", v.size)
$resizebar = new Ox.Resizebar({
@ -4650,7 +4659,7 @@ requires
[that.$elements[0], that.$elements[1]] :
[that.$elements[1], that.$elements[2]],
orientation: self.options.orientation == "horizontal" ? "vertical" : "horizontal",
parent: that,
parent: that, // fixme: that.$content
resizable: v.resizable,
resize: v.resize,
size: v.size
@ -4659,7 +4668,7 @@ requires
if (i == 0) {
$resizebar.appendTo(that);
} else {
$resizebar.prependTo(that);
$resizebar.prependTo(that); // fixme: that.$content
}
}
});