/**
* This file handles basic functionality of the login page.
*
* @module scripts/login
*/
/**
* Is executed as a result of the page loading.
*
* @function window.addEventListener
*
* @param {string} type - Defines the type of event to catch.
* @param {Function} listener - Defines what should happen when the event is triggered.
*/
window.addEventListener('DOMContentLoaded', () => {
const FOCUSED_CLASS_NAME = "focused";
const passwordInput = document.querySelectorAll('.password-input')[0];
const passwordWrapper = document.querySelectorAll('.password-wrapper')[0];
passwordInput.addEventListener('focusin', () => {
if (!passwordWrapper.classList.contains(FOCUSED_CLASS_NAME)) {
passwordWrapper.classList.add(FOCUSED_CLASS_NAME);
}
});
passwordInput.addEventListener('focusout', () => {
if (passwordInput.value == "" && passwordWrapper.classList.contains(FOCUSED_CLASS_NAME)) {
passwordWrapper.classList.remove(FOCUSED_CLASS_NAME);
}
});
});