Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.