var parent = imgElement.parentElement;
516 parent.removeChild(imgElement); 517 parent.insertAdjacentHTML('beforeend', tmst_profile__getDefaultLogoHtml()); 518 // Убираем пункт "Удалить" из меню 519 var deleteItem = document.querySelector('.js-delete-item'); 520 deleteItem.outerHTML = ''; 525 * Шаблон логотипа или базового изображения профиля 527 * @returns {string} - шаблон логотипа профиля по умолчанию 529function tmst_profile__getDefaultLogoHtml() { 532 html += '<div class="tlk-upload__default-preview">'; 533 html += '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 37 41" fill="none">'; 534 html += '<circle cx="18.5" cy="11.5" r="10.75" stroke="currentColor" stroke-width="1.5"/>'; 536 '<path d="M36 41C36 32.7157 28.165 26 18.5 26C8.83502 26 1 32.7157 1 41" stroke="currentColor" stroke-width="1.5"/>'; 544 * HTML разметка для кнопки загрузки изображения профиля 545 * @returns {string} - HTML разметка кнопки загрузки изображения профиля 547function tmst_profile__getChangeProfileImageButtonHtml() { 548 var objProfile = tma__getProfileObjFromLS(); 551 html += '<div class="tlk-upload-wrapper">'; 552 html += '<div class="tlk-profile-dropdown">'; 553 html += '<button class="tlk-profile__regular-button">{{edit_button}}</button>'; 554 html += '<div class="tlk-profile-dropdown-menu">'; 555 html += '<div class="tlk-profile-dropdown-arrow"></div>'; 556 html += '<ul class="tlk-profile-dropdown-list js-image-menu">'; 557 html += '<li class="tlk-profile-dropdown-item js-upload-item">'; 558 html += '<label class="tlk-upload-label">'; 559 html += '{{upload_image_menu_item}}'; 560 html += '<input type="file" class="tlk-upload-input" accept="image/*" style="display: none;">'; 563 if (objProfile.memberlogo && window.tildaMembers.upload) { 564 html += '<li class="tlk-profile-dropdown-item js-delete-item">{{delete_image_menu_item}}</li>'; 569 html += '<div class="tlk-upload__error"></div>'; 576 * Настраивает обработчики событий для выпадающего меню 578function tmst_profile__setupDropdownHandlers() { 579 var dropdown = document.querySelector('.tlk-profile-dropdown'); 580 var menu = document.querySelector('.tlk-profile-dropdown-menu'); 581 if (!dropdown || !menu) { 585 const button = dropdown.querySelector('button'); 590 var uploadInput = menu.querySelector('.tlk-upload-input'); 591 var deleteItem = menu.querySelector('.js-delete-item'); 593 // Открытие/закрытие меню 594 button.addEventListener('click', event => { 595 event.stopPropagation(); 596 dropdown.classList.toggle('show'); 599 // Закрытие меню при клике вне его 600 document.addEventListener('click', event => {