diff --git a/static/js/hub.js b/static/js/hub.js index 2147507..3a8cd00 100644 --- a/static/js/hub.js +++ b/static/js/hub.js @@ -192,10 +192,11 @@ document.addEventListener('DOMContentLoaded', () => { iframeWrapper.style.display = 'none'; if (iframeLoadTimeout) clearTimeout(iframeLoadTimeout); if (iframeAuthNotice) iframeAuthNotice.style.display = 'none'; - if (iframe) iframe.src = 'about:blank'; + // Ne plus reinitialiser iframe.src ici : garder DSH/filebrowser vivants en arriere-plan + // pour preserver leur etat cote client (langue, session) entre deux passages. } - function showIframeView(url) { + function showIframeView(url, force) { nativeChatLayout.style.display = 'none'; iframeWrapper.style.display = 'flex'; currentIframeUrl = url; @@ -211,6 +212,13 @@ document.addEventListener('DOMContentLoaded', () => { if (btnAuthNoticeOpen) btnAuthNoticeOpen.href = url; if (iframeAuthNotice) iframeAuthNotice.style.display = 'none'; + // Deja sur la bonne URL et pas de rechargement force : ne pas toucher l'iframe, + // preserve l'etat cote client (langue, session DSH) entre deux passages. + if (iframe && iframe.src === url && !force) { + if (loader) loader.classList.add('hidden'); + return; + } + if (loader) loader.classList.remove('hidden'); if (iframeLoadTimeout) clearTimeout(iframeLoadTimeout); @@ -240,13 +248,13 @@ document.addEventListener('DOMContentLoaded', () => { if (iframeReloadBtn) { iframeReloadBtn.addEventListener('click', () => { - if (currentIframeUrl) showIframeView(currentIframeUrl); + if (currentIframeUrl) showIframeView(currentIframeUrl, true); }); } if (btnAuthNoticeReload) { btnAuthNoticeReload.addEventListener('click', () => { - if (currentIframeUrl) showIframeView(currentIframeUrl); + if (currentIframeUrl) showIframeView(currentIframeUrl, true); }); }