Skip to content

Instantly share code, notes, and snippets.

@gattu
Created July 9, 2009 11:41
Show Gist options
  • Save gattu/143593 to your computer and use it in GitHub Desktop.
Save gattu/143593 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand({
names: ["fb-friend", "facebook-friend"],
arguments: [{ role: "object", nountype: noun_arb_text, label: "your friend"}],
execute: function(arguments) {
var params = {view: 'search', q: arguments.object.text};
jQuery.get("http://new.facebook.com/friends/ajax/friends.php", params, function(fbjson) {
var re = /id=\\"f(\d+)/;
var res = re.exec(fbjson);
if (res && res[1] > 0) {
Utils.openUrlInBrowser('http://new.facebook.com/profile.php?id='+res[1]);
} else {
displayMessage('Facebook friend not found!');
}
});
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment