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