Некодим© 2020-2026 Некодим
Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.
function tmst_profile__getPasswordForm() {
115 html += '<form method="post" id="form-change-password" class="tmst-password-form" action="/api/editpassword/">';116 html += '<div class="tlk-profile__form-wrap">';117 html += tmst_profile__getPasswordField('current-password', '{{current_password_label}}');118 html += tmst_profile__getPasswordField('new-password', '{{new_password_label}}');119 html += tmst_profile__getPasswordField('confirm-password', '{{confirm_password_label}}');121 html += '<div class="tlk-input-error tlk-input-error_all"></div>';122 html += tmst_profile__getPasswordFormButtons();128 * Возвращает HTML для одного поля ввода пароля с кнопкой-глазиком129 * @param {string} id - ID поля130 * @param {string} label - Текст метки133 function tmst_profile__getPasswordField(id, label) {135 html += '<div class="tlk-profile__item tlk-form__item">';136 html += '<div class="tlk-input-title" data-field="tlk-text">' + label + '</div>';137 html += '<div class="tlk-password-input-wrapper">';138 html += '<input type="password" id="' + id + '" name="' + id + '" class="tlk-input" required>';139 html += '<div class="tlk-password-toggle">';140 html += '<span class="tlk-password-icon tlk-password-icon-hidden"></span>';143 html += '<div class="tlk-input-error"></div>';149 * Настраивает обработчики для кнопок-глазиков в полях пароля151 function tmst_profile__setupPasswordToggleHandlers() {152 var toggleButtons = document.querySelectorAll('.tlk-password-toggle');153 toggleButtons.forEach(function (/** @type {HTMLElement} */ toggleButton) {154 toggleButton.addEventListener('click', function () {155 tmst_profile__handlePasswordToggleClick(toggleButton);161 * Обрабатывает клик по кнопке-глазику162 * @param {HTMLElement} toggleButton - кнопка-глазик164 function tmst_profile__handlePasswordToggleClick(toggleButton) {165 var input = toggleButton.previousElementSibling; // Находим соответствующий input167 if (!(input instanceof HTMLInputElement)) {171 if (input.type === 'password') {173 toggleButton.classList.add('tlk-password-visible');174 toggleButton.querySelector('.tlk-password-icon').classList.remove('tlk-password-icon-hidden');175 toggleButton.querySelector('.tlk-password-icon').classList.add('tlk-password-icon-visible');177 input.type = 'password';178 toggleButton.classList.remove('tlk-password-visible');179 toggleButton.querySelector('.tlk-password-icon').classList.remove('tlk-password-icon-visible');180 toggleButton.querySelector('.tlk-password-icon').classList.add('tlk-password-icon-hidden');185 * Возвращает HTML для кнопок формы смены пароля188 function tmst_profile__getPasswordFormButtons() {189 const buttonSuffix = tmst_profile__getButtonColorClassnameSuffix();191 html += '<div class="tlk-profile__buttons">';193 '<a href="/members/profile" class="tlk-profile__cancel-button tlk-profile__cancel-button__' +196 html += '{{form_change_password_btn_cancel}}';199 '<button type="submit" class="tlk-profile__close-save' +200 ' tlk-profile__close-save__' +