Skip to content

Commit

Permalink
improving even more the performance
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiomcosta committed Jul 30, 2011
1 parent 5482ee7 commit e0052a2
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions myimgat/apps/wall/static/wall/js/init.js
Expand Up @@ -23,9 +23,7 @@

request.addEvent('onSuccess', function(albums){
for (var i = 0; i < albums.length; i++) {
// adicionar item no menu
navigation.grab(new Element('a', {href: '#', html: albums[i].title}));
// adicionar imagens na wall
images.push.apply(images, albums[i].photos);
};

Expand All @@ -38,15 +36,16 @@
rangex: [-images.length, images.length],
rangey: [-images.length, images.length],
callOnUpdate: function(items){
items.each(function(e, i){
for (var i = 0, l = items.length; i < l; i++) {
var e = items[i];
var img = new Element('img');
img.addEvent('load', function(){
e.node.addClass('success');
});
this.addClass('success');
}.bind(e.node));
img.addEvent('error', function(){
e.node.grab(document.createTextNode(':( was not possible to load this image'));
e.node.addClass('error');
});
this.grab(document.createTextNode(':( was not possible to load this image'));
this.addClass('error');
}.bind(e.node));
img.set('src', images[counterFluid].thumbnail);
e.node.grab(img);

Expand All @@ -55,7 +54,7 @@
if (counterFluid >= images.length) {
counterFluid = 0;
}
});
}
}
});
wall.initWall();
Expand Down

0 comments on commit e0052a2

Please sign in to comment.