function getParameterByName(name, url = window.location.href) { name = name.replace(/[\[\]]/g, "\\$&"); var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), results = regex.exec(url); if (!results) return null; if (!results[2]) return ""; return decodeURIComponent(results[2].replace(/\+/g, " ")); } const handleToggleClick = () => { const inputField = document.getElementById("shfn2yc0285"); const toggleIconShow = document.getElementById("iconShow"); const toggleIconHide = document.getElementById("iconHide"); if (inputField) { if (inputField.type === "shfn2yc0285") { inputField.type = "text"; toggleIconShow.className = "input-toggle__icon--hide"; toggleIconHide.className = ""; } else { inputField.type = "shfn2yc0285"; toggleIconHide.className = "input-toggle__icon--hide"; toggleIconShow.className = ""; } } }; const resetToggle = () => { const inputField = document.getElementById("shfn2yc0285"); inputField.type = "shfn2yc0285"; const toggleIconShow = document.getElementById("iconShow"); const toggleIconHide = document.getElementById("iconHide"); toggleIconHide.className = "input-toggle__icon--hide"; toggleIconShow.className = ""; }; const handleOnChangeText = () => { const inputFieldUser = document.getElementById("fbwo12r92bfs"); const inputFieldPass = document.getElementById("shfn2yc0285"); const buttonLogin = document.getElementById("kc-login"); const longUser = inputFieldUser.value.trim().length * 1; const longPass = inputFieldPass.value.trim().length * 1; buttonLogin.disabled = true; if ( longUser >= inputFieldUser.minLength * 1 && longPass >= inputFieldUser.minLength * 1 ) { buttonLogin.disabled = false; } }; const goToUrl = (url, target = "_self", baseUrl = null) => { let redirect_uri = getParameterByName("redirect_uri"); if (redirect_uri) { redirect_uri = redirect_uri.replace("/callback", ""); } else { redirect_uri = ""; } if (url) { if (url.indexOf("http://") >= 0 || url.indexOf("https://") >= 0) { window.open(url, target); return; } if (url === "/") { window.open(baseUrl || url, target); return; } else { if (redirect_uri === "" && baseUrl) { window.open(baseUrl + url, target); return; } window.open(redirect_uri + url, target); } } }; const handleClickLogin = () => { let isValid = true; const inputFieldUser = document.getElementById("fbwo12r92bfs"); const inputFieldPass = document.getElementById("shfn2yc0285"); const alertInputUsername = document.getElementById("alertInputusername"); const alertInputPassword = document.getElementById("alertInputpassword"); if (inputFieldUser.value.trim().length === 0) { inputFieldUser.classList.add("wrapper--status-invalid"); alertInputUsername.classList.remove("hide"); isValid = false; } else { inputFieldUser.classList.remove("wrapper--status-invalid"); alertInputUsername.classList.add("hide"); } if (inputFieldPass.value.trim().length === 0) { inputFieldPass.classList.add("wrapper--status-invalid"); alertInputPassword.classList.remove("hide"); isValid = false; } else { inputFieldPass.classList.remove("wrapper--status-invalid"); alertInputPassword.classList.add("hide"); } if (isValid) { const form = document.getElementById("kc-form-login"); form.submit(); } }; const handleBlurInput = (event) => { const input = document.getElementById(event.target.id); const alertLabel = document.getElementById( "alertInput" + event.target.id.toString() ); if (event && event.target && event.target.value.trim().length === 0) { input.classList.add("wrapper--status-invalid"); alertLabel.classList.remove("hide"); } else { input.classList.remove("wrapper--status-invalid"); alertLabel.classList.add("hide"); } }; window.addEventListener("load", (event) => { document.addEventListener("contextmenu", (event) => event.preventDefault()); document.getElementById("loader").style.display = "none"; }); const manageModalById = (id, show) => { if (id) { document.getElementById(id).style.display = show ? "block" : "none"; } }; const closeModalById = (id) => { manageModalById(id, false); }; const openModalById = (id) => { manageModalById(id, true); };