Skip to content

Instantly share code, notes, and snippets.

@nkartha
Created August 21, 2010 23:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nkartha/543002 to your computer and use it in GitHub Desktop.
Save nkartha/543002 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand({
name: "LinkedIn Search",
author: { name: "Nalini Kartha", email: "nalinikartha@gmail.com" },
description: "Lookup someone on LinkedIn",
help: "Looks up the specified person (select or enter FULL name) on LinkedIn."+
"The middle intitals or names are ignored when searching.",
preview: function( pblock ) {
var msg = 'Lookup someone on LinkedIn. Supported Formats - <br/>' +
'"Firstname (Middle Initials or Names) Lastname"';
pblock.innerHTML = _( msg );
},
icon: "http://linkedin.com/favicon.ico",
arguments: [{role: "object",
nountype: noun_arb_text,
label: "name"}],
execute: function( arguments )
{
var name = arguments.object.text;
var nameTokens = name.split( /[\s]+/ );
// Check that a name is specified
if( nameTokens.length == 0 ) {
displayMessage( _('Please specify a name.') );
return;
}
// Check that the name is long enough
if( nameTokens.length == 1 ) {
displayMessage( _('Please specify a FULL name.') );
return;
}
var fname = nameTokens[0];
var lname = nameTokens[nameTokens.length-1];
var url = "http://www.linkedin.com/pub/dir/?first="+fname+"&last="+lname;
Utils.openUrlInBrowser(url);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment