diff --git a/index.html b/index.html
index a0a4460..ac43efc 100644
--- a/index.html
+++ b/index.html
@@ -590,8 +590,12 @@
-
-
+
+
@@ -1352,7 +1356,8 @@ window.showAuthForm = function() {
// PROFILE MODAL
window.openProfileModal = function() {
document.getElementById('profile-name-input').value = currentProfileData?.displayName || '';
- document.getElementById('profile-avatar-input').value = currentProfileData?.avatarUrl || '';
+ const avatarUrl = currentProfileData?.avatarUrl || '';
+ document.getElementById('profile-avatar-input').value = isEmoji(avatarUrl) ? avatarUrl : '';
document.getElementById('profile-error').style.display = 'none';
updateProfilePreview();
document.getElementById('profile-modal').classList.add('open');
@@ -1360,14 +1365,22 @@ window.openProfileModal = function() {
}
window.closeProfileModal = function() { document.getElementById('profile-modal').classList.remove('open'); }
window.closeProfileModalOutside = function(e) { if (e.target===document.getElementById('profile-modal')) closeProfileModal(); }
+function updateEmojiPreview(val) {
+ const preview = document.getElementById('emoji-preview');
+ if (!preview) return;
+ const emoji = val.trim();
+ preview.textContent = emoji || '🏃';
+}
function updateProfilePreview() {
const name = document.getElementById('profile-name-input').value.trim() || 'Your Name';
const url = document.getElementById('profile-avatar-input').value.trim();
const initial = name[0].toUpperCase();
document.getElementById('profile-modal-name-preview').textContent = name;
const avatarEl = document.getElementById('profile-modal-avatar');
- if (url) avatarEl.innerHTML = `
})
`;
+ if (url && isEmoji(url)) avatarEl.innerHTML = `
${url}`;
+ else if (url) avatarEl.innerHTML = `
})
`;
else avatarEl.innerHTML = `
${initial}`;
+ updateEmojiPreview(url);
}
window.saveProfile = async function() {
const name = document.getElementById('profile-name-input').value.trim();
@@ -1375,7 +1388,7 @@ window.saveProfile = async function() {
const errEl = document.getElementById('profile-error');
errEl.style.display = 'none';
if (!name || name.length < 2) { errEl.textContent = 'Display name must be at least 2 characters.'; errEl.style.display = 'block'; return; }
- if (avatarUrl && !avatarUrl.startsWith('http')) { errEl.textContent = 'Avatar URL must start with http:// or https://'; errEl.style.display = 'block'; return; }
+ if (avatarUrl && !avatarUrl.startsWith('http') && !isEmoji(avatarUrl)) { errEl.textContent = 'Please enter a valid emoji'; errEl.style.display = 'block'; return; }
const btn = document.querySelector('#profile-modal .btn-primary');
btn.disabled = true; btn.innerHTML = '
';
try {