-
-
Save adeelnasir/31cf6d021ecbf17a8225c61d9af7bd9c to your computer and use it in GitHub Desktop.
ADFS onload.js branding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ********************************************** | |
// Customized load process from here... | |
// ********************************************** | |
//Function used to set HRD based on the dropdown selection | |
function SetHRD(selectedHRD) | |
{ | |
if(selectedHRD.value==="0") | |
return false; | |
else if (typeof HRD !== "undefined") { | |
HRD.selection(selectedHRD.value); | |
return false; | |
} | |
} | |
//Load JQuery and do customization | |
(function () { | |
function loadScript(url, callback) { | |
var script = document.createElement("script"); | |
script.type = "text/javascript"; | |
console.log('Loading jQuery'); | |
if (script.readyState) { //IE | |
script.onreadystatechange = function () { | |
if (script.readyState === "loaded" || script.readyState === "complete") { | |
script.onreadystatechange = null; | |
callback(); | |
} | |
}; | |
} else { //Others | |
script.onload = function () { | |
callback(); | |
}; | |
} | |
script.src = url; | |
document.getElementsByTagName("head")[0].appendChild(script); | |
} | |
loadScript("/adfs/portal/script/jquery-3.min.js", function () { | |
// jQuery loaded | |
console.log('jQuery loaded'); | |
//Check if we are displaying the hrd page | |
var myCheckHRD = document.getElementById('hrdArea') ; | |
if ( myCheckHRD ) { | |
var sel = $('<select id="idp" onchange="SetHRD(this)" tabindex="1"/>'); | |
sel.append('<option value="0">Choose Your AD FS</option>'); | |
var adIdp= $(".idp[onclick*='AD AUTHORITY']"); | |
var onclickattr=$(adIdp).attr("onclick"); | |
var startIndex= onclickattr.indexOf('(')+2; | |
onclickattr= onclickattr.substr(startIndex); | |
var endIndex = onclickattr.length-17; | |
onclickattr=onclickattr.substr(0,endIndex); | |
sel.append("<option value='"+onclickattr+"'>Active Directory</option>"); | |
$(".idp[onclick*='adfs']").each(function(){// div | |
onclickattr=$(this).attr("onclick"); | |
startIndex= onclickattr.indexOf('(')+2; | |
onclickattr= onclickattr.substr(startIndex); | |
endIndex = onclickattr.length-17; | |
onclickattr=onclickattr.substr(0,endIndex); | |
sel.append('<option value='+onclickattr+'>'+this.innerHTML+'</option>'); | |
}); | |
$('.idp').hide(); | |
$(sel).insertAfter('#openingMessage'); | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment