Skip to content

Instantly share code, notes, and snippets.

@madhur
Created June 2, 2011 21:33
Show Gist options
  • Save madhur/1005378 to your computer and use it in GitHub Desktop.
Save madhur/1005378 to your computer and use it in GitHub Desktop.
socialminer
function SocialMiner()
{
var verbose=true;
var profileArray=new Array();
var tabUrl;
this.getTabUrl=function()
{
logToConsole("getTabUrl is called");
chrome.tabs.getSelected(null, function(tab)
{
tabUrl = tab.url;
logToConsole(tabUrl);
});
return tabUrl;
}
this.getUrlType=function(pageUrl)
{
logToConsole(pageUrl);
var fbRegex="(?:http:\/\/)?(?:www.)?facebook.com\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[?\w\-]*\/)?(?:profile.php\?id=(?=\d.*))?([\w\-]*)?";
var soRegex="(?:http:\/\/)?(?:www.)?stackoverflow.com\/(?:(?:\w)*#!\/)?(?:users\/)?(?:[?\w\-]*\/)?(?:profile.php\?id=(?=\d.*))?([\w\-]*)?";
var lnkdRegex="(?:http:\/\/)?(?:www.)?linkedin.com\/(?:(?:\w)*#!\/)?(?:in\/)?(?:[?\w\-]*\/)?(?:profile.php\?id=(?=\d.*))?([\w\-]*)?";
if(pageUrl.matches(fbRegex))
{
logToConsole("Its FB Page");
return "fb";
}
else if(pageUrl.matches(soRegex))
{
logToConsole("Its SO Page");
return "so";
}
else if(pageUrl.matches(lnkdRegex))
{
logToConsole("Its LNKD Page");
return "lnkd";
}
}
this.GetSOProfiles=function(email)
{
}
this.GetFBProfiles=function(email)
{
}
this.GetLKPDProfiles=function(email)
{
}
function logToConsole(text)
{
if (verbose)
console.log(text);
}
this.logToConsole1=logToConsole;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment