diff --git a/public/app.js b/public/app.js index a39278a..78b5898 100644 --- a/public/app.js +++ b/public/app.js @@ -1608,12 +1608,29 @@ function openCharEditModal(char, onSave) { reader.readAsDataURL(file); }); - // Avatar URL + // Avatar URL (inline form, no browser prompt) $('#m-url-avatar-btn')?.addEventListener('click', () => { - const u = prompt(state.lang === 'de' ? 'Bild-URL eingeben:' : 'Enter image URL:', currentAvatarKey?.startsWith('http') ? currentAvatarKey : ''); - if (u && u.trim()) { - currentAvatarKey = u.trim(); + const form = $('#m-url-avatar-form'); + if (!form) return; + const showing = form.style.display !== 'none'; + form.style.display = showing ? 'none' : 'block'; + if (!showing) { + const inp = $('#m-url-avatar-input'); + if (inp) { + inp.value = currentAvatarKey?.startsWith('http') ? currentAvatarKey : ''; + inp.focus(); + } + } + }); + $('#m-url-avatar-cancel')?.addEventListener('click', () => { + $('#m-url-avatar-form').style.display = 'none'; + }); + $('#m-url-avatar-apply')?.addEventListener('click', () => { + const u = $('#m-url-avatar-input')?.value.trim(); + if (u) { + currentAvatarKey = u; updateAvatarPreview(); + $('#m-url-avatar-form').style.display = 'none'; toast(t('avatar_updated')); } });