From 331011b90e230fdda89f698a2c65897c8bcb53f4 Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 16 Jul 2010 08:50:30 +0200 Subject: [PATCH] make fewer requests for list pages when scrolling fast through a list --- build/js/ox.ui.js | 59 +++++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/build/js/ox.ui.js b/build/js/ox.ui.js index d8d602c..8d9d96a 100644 --- a/build/js/ox.ui.js +++ b/build/js/ox.ui.js @@ -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 } } });