feat: section Profil (langue) + ghost text lie a la langue
- Section Profil dans Configuration: langue (fr/en/es/de), nom - Persistance localStorage (obsigate-lang, obsigate-name) - Ghost text adapte le prompt a la langue du profil - CSS profile-form, config-select stylise
This commit is contained in:
@@ -644,6 +644,9 @@ function initConfigModal() {
|
||||
|
||||
// Init theme picker
|
||||
initThemePicker();
|
||||
|
||||
// Init profile
|
||||
initProfile();
|
||||
}
|
||||
|
||||
function closeConfigModal() {
|
||||
@@ -1387,6 +1390,7 @@ export {
|
||||
loadHiddenFilesSettings as initHiddenFilesConfig,
|
||||
initThemePicker,
|
||||
initAboutModal,
|
||||
initProfile,
|
||||
switchSidebarTab,
|
||||
};
|
||||
|
||||
@@ -1508,3 +1512,28 @@ function initAboutModal() {
|
||||
if (jokeEl) jokeEl.textContent = '« ' + jokes[Math.floor(Math.random() * jokes.length)] + ' »';
|
||||
}
|
||||
}
|
||||
|
||||
// ── Profile ──────────────────────────────────────────────────────────
|
||||
function initProfile() {
|
||||
var langSel = document.getElementById('profile-lang');
|
||||
var nameInp = document.getElementById('profile-name');
|
||||
var saveBtn = document.getElementById('profile-save');
|
||||
var savedEl = document.getElementById('profile-saved');
|
||||
if (!langSel || !saveBtn) return;
|
||||
|
||||
// Load saved profile
|
||||
try {
|
||||
var lang = localStorage.getItem('obsigate-lang') || 'fr';
|
||||
var name = localStorage.getItem('obsigate-name') || '';
|
||||
if (langSel) langSel.value = lang;
|
||||
if (nameInp) nameInp.value = name;
|
||||
} catch(e) {}
|
||||
|
||||
saveBtn.addEventListener('click', function() {
|
||||
try {
|
||||
localStorage.setItem('obsigate-lang', langSel.value);
|
||||
if (nameInp) localStorage.setItem('obsigate-name', nameInp.value.trim());
|
||||
if (savedEl) { savedEl.style.display = 'inline'; setTimeout(function() { savedEl.style.display = 'none'; }, 2000); }
|
||||
} catch(e) {}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user