2023-02-19 09:36:14 +05:30
|
|
|
import {hideElem, showElem} from '../utils/dom.js';
|
2022-01-29 02:30:11 +05:30
|
|
|
|
2021-10-16 22:58:04 +05:30
|
|
|
export function initUserSettings() {
|
2024-02-16 21:22:50 +05:30
|
|
|
if (document.querySelectorAll('.user.settings.profile').length === 0) return;
|
|
|
|
|
|
|
|
const usernameInput = document.getElementById('username');
|
|
|
|
if (!usernameInput) return;
|
|
|
|
usernameInput.addEventListener('input', function () {
|
|
|
|
const prompt = document.getElementById('name-change-prompt');
|
|
|
|
const promptRedirect = document.getElementById('name-change-redirect-prompt');
|
|
|
|
if (this.value.toLowerCase() !== this.getAttribute('data-name').toLowerCase()) {
|
|
|
|
showElem(prompt);
|
|
|
|
showElem(promptRedirect);
|
|
|
|
} else {
|
|
|
|
hideElem(prompt);
|
|
|
|
hideElem(promptRedirect);
|
|
|
|
}
|
|
|
|
});
|
2021-10-16 22:58:04 +05:30
|
|
|
}
|