Snippets Collections
/* Added for B2C login links */
$("#samlSignInLink,#samlSignInLinkPopUp,#samlSignInLinkHomepage").off('click', function (e) {
	  
});



$("#samlSignInLink,#samlSignInLinkPopUp,#samlSignInLinkHomepage").on('click', function (e) {
	var redirectUrl;
	var currentPath = document.location.pathname == '/error' ? '' : document.location.pathname;
	var queryString = window.location.search;
	if(queryString) {
		redirectUrl = document.location.origin + "/samlsinglesignon/saml" + currentPath + queryString +"&"
	} else {
		redirectUrl = document.location.origin + "/samlsinglesignon/saml" + currentPath + "?"
	}
	if ($('#isDeviceApp').val() == 'true') {
		redirectUrl =redirectUrl + "idp=B2C_1A_signup_signin_SAML_APP_KMSI"
	} else if ($('#isMobileBrowser').val() == 'true') {
		redirectUrl = redirectUrl + "idp=B2C_1A_signup_signin_SAML_MOBILE"
	} else {
		redirectUrl = redirectUrl + "idp=B2C_1A_signup_signin_SAML"
	}
	

	if(window.parent.location.href.indexOf('smartedit') >= 0){
		localStorage.setItem("SE_login", true);
		console.log("set SE_login TRUE")
		window.open(redirectUrl, '_blank');
	}else{
		window.location.href = redirectUrl;
	}

});


if(localStorage.getItem("SE_login") != null && JSON.parse(localStorage.getItem("SE_login")) == true){
	localStorage.setItem("SE_login", false);
	console.log("set SE_login FALSE")

	window.opener.location.reload();
	window.close();
}
<script type="text/javascript">
    if (window.parent.location.pathname.indexOf("smartedit") <= -1) {
        // Only redirect if NOT in smartedit
    	window.location.replace("/warranty-your-way");
    }else if (window.parent.location.pathname.indexOf("smartedit") >= 0){
    	// IS smartedit, show comment	
       	document.getElementById("redirectJS").style.display = "block";
	}
    
</script>

<h3 id="redirectJS" style="display: none; text-align: center;"> redirect code </h3>
star

Thu Jan 13 2022 22:57:45 GMT+0000 (Coordinated Universal Time)

#javascript #smartedit
star

Fri Jan 07 2022 18:25:40 GMT+0000 (Coordinated Universal Time)

#javascript #smartedit

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension