make fewer requests for item stats when scrolling fast through a list

This commit is contained in:
rolux 2010-07-16 09:12:46 +02:00
parent 4a990aea9b
commit fbd3dee4d3

View file

@ -656,7 +656,7 @@ $ui.statusbar = new Ox.Bar({
element: $ui.rightPanel = new Ox.SplitPanel({
elements: [
{
element: $ui.toolbar,
element: $ui.toolbar.css({ zIndex: 2 }), // fixme: remove later
size: 24
},
{
@ -893,6 +893,11 @@ $ui.statusbar = new Ox.Bar({
Ox.Event.bind("select_list", function(event, data) {
var $still, $timeline;
ui.selectedMovies = data.ids;
setTimeout(function() {
if (
data.ids.length == ui.selectedMovies.length &&
(data.ids.length == 0 || data.ids[0] == ui.selectedMovies[0])
) {
if (data.ids.length) {
$ui.mainMenu.enableItem("copy");
$ui.mainMenu.enableItem("openmovie");
@ -901,11 +906,6 @@ $ui.statusbar = new Ox.Bar({
$ui.mainMenu.disableItem("openmovie");
}
if (data.ids.length == 1) {
setTimeout(function() {
if (data.ids[0] != ui.selectedMovies[0]) {
Ox.print("cancel after timeout...")
return;
}
$still = $("<img>")
.attr({
src: "http://0xdb.org/" + data.ids[0] + "/still.jpg"
@ -968,7 +968,6 @@ $ui.statusbar = new Ox.Bar({
});
});
*/
}, 100);
}
app.request("find", {
query: {
@ -984,6 +983,10 @@ $ui.statusbar = new Ox.Bar({
}, function(result) {
$ui.selected.html(constructStatus("selected", result.data));
});
} else {
Ox.print("cancelled after timeout");
}
}, 100);
});
// Resize