More Related Content
Similar to Https set up (20)
Https set up
- 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();
}
}
}
};