SlideShare a Scribd company logo
1 of 1
function LIConnect(config){
this.config = config;
if(this.config.login_source == ""){
this.config.login_source = "li-connect";
}
this.config.connectRoute = config.connectRoute === undefined ? "connect" :
config.connectRoute;
this.config.connectUrl = window.location.protocol + "//" +
window.location.host + "/liconnect/" + this.config.connectRoute + "?
login_source=" + this.config.login_source;
this.bindEvents();
};
LIConnect.prototype.openAuthDialog = function() {
window.open("https://www.linkedin.com/uas/oauth2/authorization?
response_type=code&client_id=y4wa9oe4c6nu&scope=&state="+ this.config.state +
"&redirect_uri=" +
this.config.connectUrl,null,"height=400,width=600,status=yes,toolbar=no,menubar=
no,location=no");
};
LIConnect.prototype.bindEvents = function(){
var that = this;
$(this.config.connectButtonClass).live("click",function(e){
that.openAuthDialog();
})
};
LIConnect.prototype.onAuthSuccess = function(){
window._gaq = _gaq || [];
if(typeof $().modal == 'function' && $("#j-
linkedinConnectedMessage").length){
$("#j-linkedinConnectedMessage").removeClass("hide").modal("show");
} else {
var isIFrame = (window.location != window.parent.location);
if(isIFrame){
_gaq.push(["_trackEvent", "Login", "linkedin", "modal_" +
this.config.login_source + "_successful"]);
$.postMessage('modalLoginSubmit', $('#target_url').val(), parent);
} else if(this.config.connectRoute == "bind_account"){
_gaq.push(["_trackEvent", "Login", "linkedin", "modal_" +
this.config.login_source + "_successful"]);
document.location.reload();
} else {
_gaq.push(["_trackEvent", "Login", "linkedin", this.config.login_source +
"_successful" ]);
var fromSource = getUrlVar('from_source') || '/login?nf_redirect=true',
fromType = getUrlVar('from') || "login";
if ( isInternalRedirect(fromSource) ) {
document.location.href = decodeURIComponent(fromSource);
} else {
document.location.reload();
}
}
}
};

More Related Content

Viewers also liked

NgageNsee Introductie presentatie
NgageNsee Introductie presentatieNgageNsee Introductie presentatie
NgageNsee Introductie presentatieNgageNsee
 
Chelsea Martin's social media brand
Chelsea Martin's social media brandChelsea Martin's social media brand
Chelsea Martin's social media brandChelsea J Martin
 
New media andreas harsono
New media andreas harsonoNew media andreas harsono
New media andreas harsonobahanamahasiswa
 
Academic Success Presentation
Academic Success PresentationAcademic Success Presentation
Academic Success Presentationhartzell
 
About Million Arts
About Million ArtsAbout Million Arts
About Million ArtsMillion Arts
 
How to Plan a Successful Association Online Community
How to Plan a Successful Association Online CommunityHow to Plan a Successful Association Online Community
How to Plan a Successful Association Online CommunitySocious
 
PBI Leadership Camp
PBI Leadership CampPBI Leadership Camp
PBI Leadership CampJohn Gunter
 
Nicole Ellison ICWSM 2010 "Researching Interaction in Social Media"
Nicole Ellison ICWSM 2010 "Researching Interaction in Social Media"Nicole Ellison ICWSM 2010 "Researching Interaction in Social Media"
Nicole Ellison ICWSM 2010 "Researching Interaction in Social Media"Nicole
 
Global Highland Engineering
Global Highland EngineeringGlobal Highland Engineering
Global Highland Engineeringmartinbova
 
OUHK COMM 6024 Lecture 4 - Building effective media relations with press and...
OUHK COMM 6024 Lecture 4 -  Building effective media relations with press and...OUHK COMM 6024 Lecture 4 -  Building effective media relations with press and...
OUHK COMM 6024 Lecture 4 - Building effective media relations with press and...THE HANG SENG UNIVERSITY OF HONG KONG
 
How to Make Your Association's Private Online Community Your Most Valuable Me...
How to Make Your Association's Private Online Community Your Most Valuable Me...How to Make Your Association's Private Online Community Your Most Valuable Me...
How to Make Your Association's Private Online Community Your Most Valuable Me...Socious
 
MMJ Culture Code (16/4)
MMJ Culture Code (16/4) MMJ Culture Code (16/4)
MMJ Culture Code (16/4) hengbin
 
Speck social media training 2014
Speck social media training 2014Speck social media training 2014
Speck social media training 2014SPECK Media
 

Viewers also liked (17)

Strategic Planning
Strategic PlanningStrategic Planning
Strategic Planning
 
Research
ResearchResearch
Research
 
NgageNsee Introductie presentatie
NgageNsee Introductie presentatieNgageNsee Introductie presentatie
NgageNsee Introductie presentatie
 
Chelsea Martin's social media brand
Chelsea Martin's social media brandChelsea Martin's social media brand
Chelsea Martin's social media brand
 
New media andreas harsono
New media andreas harsonoNew media andreas harsono
New media andreas harsono
 
Academic Success Presentation
Academic Success PresentationAcademic Success Presentation
Academic Success Presentation
 
About Million Arts
About Million ArtsAbout Million Arts
About Million Arts
 
How to Plan a Successful Association Online Community
How to Plan a Successful Association Online CommunityHow to Plan a Successful Association Online Community
How to Plan a Successful Association Online Community
 
PBI Leadership Camp
PBI Leadership CampPBI Leadership Camp
PBI Leadership Camp
 
Nicole Ellison ICWSM 2010 "Researching Interaction in Social Media"
Nicole Ellison ICWSM 2010 "Researching Interaction in Social Media"Nicole Ellison ICWSM 2010 "Researching Interaction in Social Media"
Nicole Ellison ICWSM 2010 "Researching Interaction in Social Media"
 
Global Highland Engineering
Global Highland EngineeringGlobal Highland Engineering
Global Highland Engineering
 
OUHK COMM 6024 Lecture 4 - Building effective media relations with press and...
OUHK COMM 6024 Lecture 4 -  Building effective media relations with press and...OUHK COMM 6024 Lecture 4 -  Building effective media relations with press and...
OUHK COMM 6024 Lecture 4 - Building effective media relations with press and...
 
How to Make Your Association's Private Online Community Your Most Valuable Me...
How to Make Your Association's Private Online Community Your Most Valuable Me...How to Make Your Association's Private Online Community Your Most Valuable Me...
How to Make Your Association's Private Online Community Your Most Valuable Me...
 
Hr
HrHr
Hr
 
News 5
News 5News 5
News 5
 
MMJ Culture Code (16/4)
MMJ Culture Code (16/4) MMJ Culture Code (16/4)
MMJ Culture Code (16/4)
 
Speck social media training 2014
Speck social media training 2014Speck social media training 2014
Speck social media training 2014
 

Similar to Li conn

WebAPIs & WebRTC - Spotify/sthlm.js
WebAPIs & WebRTC - Spotify/sthlm.jsWebAPIs & WebRTC - Spotify/sthlm.js
WebAPIs & WebRTC - Spotify/sthlm.jsRobert Nyman
 
Knockoutjs UG meeting presentation
Knockoutjs UG meeting presentationKnockoutjs UG meeting presentation
Knockoutjs UG meeting presentationValdis Iljuconoks
 
HTML5 APIs - Where no man has gone before! - Altran
HTML5 APIs - Where no man has gone before! - AltranHTML5 APIs - Where no man has gone before! - Altran
HTML5 APIs - Where no man has gone before! - AltranRobert Nyman
 
https://www.facebook.com/valdyna.monna?fref=ts
https://www.facebook.com/valdyna.monna?fref=tshttps://www.facebook.com/valdyna.monna?fref=ts
https://www.facebook.com/valdyna.monna?fref=tsArif Alexi
 
Micro app-framework - NodeLive Boston
Micro app-framework - NodeLive BostonMicro app-framework - NodeLive Boston
Micro app-framework - NodeLive BostonMichael Dawson
 
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09Frédéric Harper
 
Building Persona: federated and privacy-sensitive identity for the Web (LCA 2...
Building Persona: federated and privacy-sensitive identity for the Web (LCA 2...Building Persona: federated and privacy-sensitive identity for the Web (LCA 2...
Building Persona: federated and privacy-sensitive identity for the Web (LCA 2...Francois Marier
 
Building Persona: federated and privacy-sensitive identity for the Web (Open ...
Building Persona: federated and privacy-sensitive identity for the Web (Open ...Building Persona: federated and privacy-sensitive identity for the Web (Open ...
Building Persona: federated and privacy-sensitive identity for the Web (Open ...Francois Marier
 
Mashing up JavaScript – Advanced Techniques for modern Web Apps
Mashing up JavaScript – Advanced Techniques for modern Web AppsMashing up JavaScript – Advanced Techniques for modern Web Apps
Mashing up JavaScript – Advanced Techniques for modern Web AppsBastian Hofmann
 
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013Kiril Iliev
 
Authenticating and Securing Node.js APIs
Authenticating and Securing Node.js APIsAuthenticating and Securing Node.js APIs
Authenticating and Securing Node.js APIsJimmy Guerrero
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsFrancois Zaninotto
 
Build Secure Cloud-Hosted Apps for SharePoint 2013
Build Secure Cloud-Hosted Apps for SharePoint 2013Build Secure Cloud-Hosted Apps for SharePoint 2013
Build Secure Cloud-Hosted Apps for SharePoint 2013Danny Jessee
 

Similar to Li conn (20)

WebAPIs & WebRTC - Spotify/sthlm.js
WebAPIs & WebRTC - Spotify/sthlm.jsWebAPIs & WebRTC - Spotify/sthlm.js
WebAPIs & WebRTC - Spotify/sthlm.js
 
Knockoutjs UG meeting presentation
Knockoutjs UG meeting presentationKnockoutjs UG meeting presentation
Knockoutjs UG meeting presentation
 
meet.js - QooXDoo
meet.js - QooXDoomeet.js - QooXDoo
meet.js - QooXDoo
 
HTML5 APIs - Where no man has gone before! - Altran
HTML5 APIs - Where no man has gone before! - AltranHTML5 APIs - Where no man has gone before! - Altran
HTML5 APIs - Where no man has gone before! - Altran
 
https://www.facebook.com/valdyna.monna?fref=ts
https://www.facebook.com/valdyna.monna?fref=tshttps://www.facebook.com/valdyna.monna?fref=ts
https://www.facebook.com/valdyna.monna?fref=ts
 
Micro app-framework - NodeLive Boston
Micro app-framework - NodeLive BostonMicro app-framework - NodeLive Boston
Micro app-framework - NodeLive Boston
 
Micro app-framework
Micro app-frameworkMicro app-framework
Micro app-framework
 
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
 
Building Persona: federated and privacy-sensitive identity for the Web (LCA 2...
Building Persona: federated and privacy-sensitive identity for the Web (LCA 2...Building Persona: federated and privacy-sensitive identity for the Web (LCA 2...
Building Persona: federated and privacy-sensitive identity for the Web (LCA 2...
 
Discontinuing Reader Matches
Discontinuing Reader MatchesDiscontinuing Reader Matches
Discontinuing Reader Matches
 
Mashing up JavaScript
Mashing up JavaScriptMashing up JavaScript
Mashing up JavaScript
 
mobl
moblmobl
mobl
 
Building Persona: federated and privacy-sensitive identity for the Web (Open ...
Building Persona: federated and privacy-sensitive identity for the Web (Open ...Building Persona: federated and privacy-sensitive identity for the Web (Open ...
Building Persona: federated and privacy-sensitive identity for the Web (Open ...
 
Mashing up JavaScript – Advanced Techniques for modern Web Apps
Mashing up JavaScript – Advanced Techniques for modern Web AppsMashing up JavaScript – Advanced Techniques for modern Web Apps
Mashing up JavaScript – Advanced Techniques for modern Web Apps
 
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013
 
Authenticating and Securing Node.js APIs
Authenticating and Securing Node.js APIsAuthenticating and Securing Node.js APIs
Authenticating and Securing Node.js APIs
 
Dojo and Adobe AIR
Dojo and Adobe AIRDojo and Adobe AIR
Dojo and Adobe AIR
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node js
 
Pyramid REST
Pyramid RESTPyramid REST
Pyramid REST
 
Build Secure Cloud-Hosted Apps for SharePoint 2013
Build Secure Cloud-Hosted Apps for SharePoint 2013Build Secure Cloud-Hosted Apps for SharePoint 2013
Build Secure Cloud-Hosted Apps for SharePoint 2013
 

More from <svg> \">

4thingsyouradagencyissecretlydyingtotellyou-140122041940-phpapp02
4thingsyouradagencyissecretlydyingtotellyou-140122041940-phpapp024thingsyouradagencyissecretlydyingtotellyou-140122041940-phpapp02
4thingsyouradagencyissecretlydyingtotellyou-140122041940-phpapp02<svg> \">
 
Https set up
Https set upHttps set up
Https set up<svg> \">
 
Studiodrad designhubworkshop-tokyo-140316055155-phpapp01
Studiodrad designhubworkshop-tokyo-140316055155-phpapp01Studiodrad designhubworkshop-tokyo-140316055155-phpapp01
Studiodrad designhubworkshop-tokyo-140316055155-phpapp01<svg> \">
 
Pptwithlinks
PptwithlinksPptwithlinks
Pptwithlinks<svg> \">
 

More from <svg> \"> (7)

111111
111111111111
111111
 
4thingsyouradagencyissecretlydyingtotellyou-140122041940-phpapp02
4thingsyouradagencyissecretlydyingtotellyou-140122041940-phpapp024thingsyouradagencyissecretlydyingtotellyou-140122041940-phpapp02
4thingsyouradagencyissecretlydyingtotellyou-140122041940-phpapp02
 
Https set up
Https set upHttps set up
Https set up
 
Xmas 2012
Xmas 2012Xmas 2012
Xmas 2012
 
Empty
EmptyEmpty
Empty
 
Studiodrad designhubworkshop-tokyo-140316055155-phpapp01
Studiodrad designhubworkshop-tokyo-140316055155-phpapp01Studiodrad designhubworkshop-tokyo-140316055155-phpapp01
Studiodrad designhubworkshop-tokyo-140316055155-phpapp01
 
Pptwithlinks
PptwithlinksPptwithlinks
Pptwithlinks
 

Li conn

  • 1. function LIConnect(config){ this.config = config; if(this.config.login_source == ""){ this.config.login_source = "li-connect"; } this.config.connectRoute = config.connectRoute === undefined ? "connect" : config.connectRoute; this.config.connectUrl = window.location.protocol + "//" + window.location.host + "/liconnect/" + this.config.connectRoute + "? login_source=" + this.config.login_source; this.bindEvents(); }; LIConnect.prototype.openAuthDialog = function() { window.open("https://www.linkedin.com/uas/oauth2/authorization? response_type=code&client_id=y4wa9oe4c6nu&scope=&state="+ this.config.state + "&redirect_uri=" + this.config.connectUrl,null,"height=400,width=600,status=yes,toolbar=no,menubar= no,location=no"); }; LIConnect.prototype.bindEvents = function(){ var that = this; $(this.config.connectButtonClass).live("click",function(e){ that.openAuthDialog(); }) }; LIConnect.prototype.onAuthSuccess = function(){ window._gaq = _gaq || []; if(typeof $().modal == 'function' && $("#j- linkedinConnectedMessage").length){ $("#j-linkedinConnectedMessage").removeClass("hide").modal("show"); } else { var isIFrame = (window.location != window.parent.location); if(isIFrame){ _gaq.push(["_trackEvent", "Login", "linkedin", "modal_" + this.config.login_source + "_successful"]); $.postMessage('modalLoginSubmit', $('#target_url').val(), parent); } else if(this.config.connectRoute == "bind_account"){ _gaq.push(["_trackEvent", "Login", "linkedin", "modal_" + this.config.login_source + "_successful"]); document.location.reload(); } else { _gaq.push(["_trackEvent", "Login", "linkedin", this.config.login_source + "_successful" ]); var fromSource = getUrlVar('from_source') || '/login?nf_redirect=true', fromType = getUrlVar('from') || "login"; if ( isInternalRedirect(fromSource) ) { document.location.href = decodeURIComponent(fromSource); } else { document.location.reload(); } } } };