mbrevoort / jquery-facebook-multi-friend-selector

A jQuery based Alternative Facebook Multi-Friend Selector that uses the Graph API
Other
266 stars 64 forks source link

Not usable with lots of friends #2

Closed amirshim closed 13 years ago

amirshim commented 13 years ago

I created a fork to fix a couple of problems, check it out at amirshim/jquery-facebook-multi-friend-selector@ad81497d0267e093d482e739ad9ffd78721ce131

Here's a summary...

When there are lots of friends, the browser gets bogged down with having to do 1000's of secure http requests... for each photo, it has to get the real photo url. it might also prevent caching on some browsers. Fixed it by doing a FQL query to get all the actual photos along with the names/ids of your friends.

Even with the fixes, rendering is still slow, but manageable. For 5000 friends, it takes 20 seconds or so, probably because of the float left. Maybe this could be fixed by using absolute positioning. (?)

Could also load the images as needed... i.e. only when they are displayed... something like http://developer.yahoo.com/yui/3/imageloader/

Also you should disable default behavior for clicking on all/selected buttons... in case developers are using hash for ajax.

I had some problems with live(), so I switched them to delegate(). Probably didn't need to, but I think it also makes it more readable... sorry.

mbrevoort commented 13 years ago

Great, thanks I'll take a look at this soon. I have some similar changes that I'll merge together with yours around lazy loading photos once they are in the visible area.

mbrevoort commented 13 years ago

I did some things a little differently and addressed everything but avoiding the use of floats. Anyone implementing the widget can certain remove floats and replace with using 'left' or whatever, especially if they know how many friends will be in each row.

You should see improved rendering and I added lazy loading of images. The one quark however is that every .jfmfs-friend element should have the exact same height otherwise the scrollable region viewport calculation will be off. In the future I'll try to make the lazy loading of images optional or more flexible but should work for the majority of cases as long as you understand that one quark.

Thanks for the feedback!