Created
July 9, 2009 11:41
-
-
Save gattu/143593 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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