- client-side, no server-side PHP blah blah blah dependencies like some of the other alternative friends selectors
- only requires several lines of code to drop-in
- Apache 2.0 license
- Hosted at GitHub: source and demo
Quick disclaimer- as of this post, I haven’t done any testing on Windows or IE, just the latest of Chrome, Safari and Firefox on Mac. There are other features I want to include and probably a bug or two to work through, but for the most part it’s functional.
- display all of a logged in users friends and lets you select zero to all of them
- filter by those already selected
- fast filter textbox that filters list quickly as you type
- shift-select to select multiple friends at a time
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script src="jquery.facebook.multifriend.select.js"></script> <link rel="stylesheet" href="jquery.facebook.multifriend.select.css" /> <script src="http://connect.facebook.net/en_US/all.js"></script>
This loads the friend selector into the jfmfs-container (can be whatever you want it to be). It calls the Facebook Graph API to fetch the list of friends of the logged in user and loads them into the scrollable region. Then after the user has selected their friends, you can call getSelectedIds() on the plugin to get an array of friends Ids that were selected.
var friendSelector = $("#jfmfs-container").data('jfmfs'); var friendIds = friendSelector.getSelectedIds();
A handle to the object is stored as data of the element, so you need to call data(‘jfmfs’) on the element you loaded the selector to get a handle to the plugin object to call getSelectedIds().
Here’s a screencast demo. Let me know what you think!