A jQuery-based implementation of a Facebook-like MultiFriendSelector.
h1. MultiFriendSelector
A Facebook-like Multi-friend selector interface for social applications built on the "jQuery framework.":http://jquery.com/. Support for Twitter is built into the public methods but can be used with basically any service that can follow the same JSON data model.
h2. About
The MultiFriendSelector was written by Eston Bond for use on the social game "Spymaster":http://playspymaster.com/, which needed such an interface for its invite page. The multi-friend selector control is licensed under an "MIT License":http://en.wikipedia.org/wiki/MIT_License, just as jQuery is. I'd like to know where this control is being used — if you decide to use it, please drop me a line at "[email protected]":mailto:[email protected].
h2. Usage
To implement a MultiFriendSelector control, simply give it the div element you wish for it to instantiate itself in. For example, to instantiate the control in a div with the id my-friend-selector, simply write:
bq. $('#my-friend-selector').multifriendselector({id: 'eston'});
This will instantiate a MultiFriendSelector for the twitter user "eston":http://twitter.com/eston.
The MultiFriendSelector has many options you can set upon instantiation. Many mimic the same syntax used for the FBML "fb:multi-friend-selector":http://wiki.developers.facebook.com/index.php/Fb:multi-friend-selector for the sake of other platform developers. Supported options are described below. These should be passed in as key/value pairs in an object as the first argument.
h2. Public methods
Most functionality is encapsulated such that it will not clutter the namespace of your application further, including the HTML and CSS that the MultiFriendSelector code writes. However, two functions have been namespaced such that they are editable, in case you wish to deploy this function using Twitter authentication or server-side proxies for communication. If you are interested in this type of extension, please see $.fn.multifriendselector.getData, the function responsible for retrieving a user's friends/followers and $.fn.multifriendselector.postForm, the asynchronous form posting plugin.
h2. Interfacing with other social networks or proxies
If you wish to interface the MultiFriendSelector control with your own API proxy (like I do with Spymaster) or a different social network, you will still need to follow a Twitter-based object model for the user data returned so that the MultiFriendSelector control can properly render the data. In your result object for each user, you will need:
All other data in the default Twitter object is not used by the MultiFriendSelector.
h2. Bug reports
Any bugs in this code should be reported to me via email at the email address above. Bugs have a far greater chance of being patched if you submit a patch or request a pull.