codersgrave / Facebook-Friend-Selector

This repo is no longer maintained. Feel free to fork and update!
http://facebook-friend-selector.codersgrave.com
64 stars 22 forks source link

Adding onPreStart #7

Closed ikarius6 closed 11 years ago

ikarius6 commented 11 years ago

This is to get a predefined config, when you select some ppl and save the dialog and then you open the dialog again the getStoredFriends is cleaned.... for some applications is usefull restore the friends selected and stored in an input, Example:

$(".who_share").fSelector({ getStoredFriends: [<?=!empty($amigos)?$amigos:""?>], closeOnSubmit: true, facebookInvite: false, onSubmit: function(response){ $('#priv_sel').removeClass().addClass('icon-group'); $('#priv_opcs>li').show(); $('input[name=privacidad]').val(3); alertify.log('Publicación Personalizada'); $('input[name=amigos]').val(response); }, onPreStart: function(response){ facebook_friends = $('input[name=amigos]').val().split(",") for(var i=0; i<facebook_friends.length; i++){ facebook_friends[i] = parseInt(facebook_friends[i], 10) } this.getStoredFriends= facebook_friends; } });