/** * This is for MeControl sign-in function. */ var shellOptions = { meControlOptions: { rpData: { msaInfo: { signInUrl: "http://approjects.co.za/?big=winrcauth/Signin", signOutUrl: "http://approjects.co.za/?big=winrcauth/Signout", }, }, userData: { authenticatedState: false, }, }, }; var getUserData = function () { var email = $("#Email").val(); if (email != null && email.toString() != "") { shellOptions.meControlOptions.userData.firstName = $("#FirstName").val(); shellOptions.meControlOptions.userData.lastName = $("#LastName").val(); shellOptions.meControlOptions.userData.memberName = $("#Email").val(); ((shellOptions.meControlOptions.userData.idp = "msa"), (shellOptions.meControlOptions.userData.authenticatedState = "1")); window.msCommonShell.load(shellOptions); } else { if (window.msCommonShell) { window.msCommonShell.load(shellOptions); } else { window.onShellReadyToLoad = function () { window.onShellReadyToLoad = null; window.msCommonShell.load(shellOptions); }; } } }; var getData = function () { $.ajax({ url: "http://approjects.co.za/?big=winrcauth/GetUserIdentity/", type: "POST", success: function (response) { updateSigninControl(response); }, error: function (ex) { window.msCommonShell.load(shellOptions); //loadShell(); }, }); }; var int = setTimerToCheckShellAvailability(); function setTimerToCheckShellAvailability() { i = setInterval(function () { if (window.msCommonShell) { //getData(); getUserData(); clearInterval(int); } return window.msCommonShell; }, 500); return i; } updateSigninControl = function (data) { //if (data != "" && data != null && typeof (data) !== 'undefined' && data.isSignedIn) { if (data != "" && data != null && typeof data !== "undefined") { shellOptions.meControlOptions.userData.firstName = data.firstName; shellOptions.meControlOptions.userData.lastName = data.lastName; shellOptions.meControlOptions.userData.memberName = data.memberName; ((shellOptions.meControlOptions.userData.idp = "msa"), (shellOptions.meControlOptions.userData.authenticatedState = "1")); window.msCommonShell.load(shellOptions); } else { if (window.msCommonShell) { window.msCommonShell.load(shellOptions); } else { window.onShellReadyToLoad = function () { window.onShellReadyToLoad = null; window.msCommonShell.load(shellOptions); }; } } }; /** * This is for managing the Microsoft cookie consent (MSCC) state. */ const interval = setInterval(() => { if (window.siteConsent !== undefined) { clearInterval(interval); setMldcc(); } }, 50); // on consent initialization function setMldcc() { var c = document.cookie.match(/(^| )MSCC=([^;]+)/); var v = c ? c[2] : ""; if (window.siteConsent && window.siteConsent.isConsentRequired && !v) { window.mldcc = "MSCC:c1=0-c2=0-c3=0"; } else if ( window.siteConsent && !window.siteConsent.isConsentRequired && !v ) { window.mldcc = "NR"; } else { var t = v; if (v.match("^cid")) { var i = v.indexOf("c1="); t = v.substring(i); } else if (v.match("^c1")) { var r = v.indexOf("-cid"); if (r > -1) t = v.substring(0, r); } window.mldcc = "MSCC:" + t; } } function onConsentChanged() { var n = window.getCookie("MSCC") || ""; window.mldcc = "MSCC:" + GetCategoryFromMSCC(n.toLowerCase()); } function ManageConsentChanges() { siteConsent.manageConsent(); } function GetCategoryFromMSCC(n) { var t = n, i, r; return ( n.match("^cid") && ((i = n.indexOf("c1=")), (t = n.substring(i, n.length))), n.match("^c1") && ((r = n.indexOf("-cid")), (t = n.substring(0, r))), t ); } function ShowHideManageCookies(n) { if ( typeof window.siteConsent !== "undefined" && window.siteConsent.isConsentRequired ) { var existingElement = document.getElementById( "c-uhff-footer_managecookies", ); if (existingElement) { // Element already exists, just show it existingElement.classList.remove("x-hidden"); // Ensure click handler is attached var link = existingElement.querySelector("a"); if (link && !link.hasClickHandler) { link.addEventListener("click", function (e) { e.preventDefault(); ManageConsentChanges(); }); link.hasClickHandler = true; } } else { // Create new element var html = '