-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feeding user ids, rather than getting all friends #12
Comments
I am not a git person, so I won't branch and ask for a pull request. But I have prepared a patch, that adds filter_friends setting, that allows to do what I described in the issue. I don't see any place, where I could attach this patch, so I place it in the comment: diff -r e63ce7957111 static/jquery.facebook.multifriend.select.js
|
Crap, it didn't work as I expected. Here, this should be better. diff -r e63ce7957111 static/jquery.facebook.multifriend.select.js
--- a/static/jquery.facebook.multifriend.select.js Wed May 04 00:17:33 2011 +0200
+++ b/static/jquery.facebook.multifriend.select.js Wed May 04 00:39:34 2011 +0200
@@ -28,6 +28,7 @@
max_selected: -1,
max_selected_message: "{0} of {1} selected",
pre_selected_friends: [],
+ filter_friends: null,
exclude_friends: [],
friend_fields: "id,name",
sorter: function(a, b) {
@@ -73,6 +74,10 @@
preselected_friends_graph = arrayToObjectGraph(settings.pre_selected_friends),
excluded_friends_graph = arrayToObjectGraph(settings.exclude_friends),
all_friends;
+ if (settings.filter_friends == null)
+ filtered_friends_graph = null
+ else
+ filtered_friends_graph = arrayToObjectGraph(settings.filter_friends)
FB.api('/me/friends?fields=' + settings.friend_fields, function(response) {
var sortedFriendData = response.data.sort(settings.sorter),
@@ -81,7 +86,10 @@
selectedClass = "";
$.each(sortedFriendData, function(i, friend) {
- if(! (friend.id in excluded_friends_graph)) {
+ should_push = (!(friend.id in excluded_friends_graph) &&
+ (filtered_friends_graph == null ||
+ friend.id in filtered_friends_graph))
+ if (should_push) {
selectedClass = (friend.id in preselected_friends_graph) ? "selected" : "";
buffer.push("<div class='jfmfs-friend " + selectedClass + " ' id='" + friend.id +"'><img/><div class='friend-name'>" + friend.name + "</div></div>");
} |
Would it be possible to add an option, that accepts ids of users and displays only those users, rather than all friends of a user? That would be extremely useful for me. I know, that I can simply exclude all the users but the ones I want, but that seems like an overkill for me.
The text was updated successfully, but these errors were encountered: