fix: keep dsh/filebrowser iframe alive across universe switches to preserve client-side state
This commit is contained in:
+12
-4
@@ -192,10 +192,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
iframeWrapper.style.display = 'none';
|
iframeWrapper.style.display = 'none';
|
||||||
if (iframeLoadTimeout) clearTimeout(iframeLoadTimeout);
|
if (iframeLoadTimeout) clearTimeout(iframeLoadTimeout);
|
||||||
if (iframeAuthNotice) iframeAuthNotice.style.display = 'none';
|
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';
|
nativeChatLayout.style.display = 'none';
|
||||||
iframeWrapper.style.display = 'flex';
|
iframeWrapper.style.display = 'flex';
|
||||||
currentIframeUrl = url;
|
currentIframeUrl = url;
|
||||||
@@ -211,6 +212,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
if (btnAuthNoticeOpen) btnAuthNoticeOpen.href = url;
|
if (btnAuthNoticeOpen) btnAuthNoticeOpen.href = url;
|
||||||
if (iframeAuthNotice) iframeAuthNotice.style.display = 'none';
|
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 (loader) loader.classList.remove('hidden');
|
||||||
|
|
||||||
if (iframeLoadTimeout) clearTimeout(iframeLoadTimeout);
|
if (iframeLoadTimeout) clearTimeout(iframeLoadTimeout);
|
||||||
@@ -240,13 +248,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
|
|
||||||
if (iframeReloadBtn) {
|
if (iframeReloadBtn) {
|
||||||
iframeReloadBtn.addEventListener('click', () => {
|
iframeReloadBtn.addEventListener('click', () => {
|
||||||
if (currentIframeUrl) showIframeView(currentIframeUrl);
|
if (currentIframeUrl) showIframeView(currentIframeUrl, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (btnAuthNoticeReload) {
|
if (btnAuthNoticeReload) {
|
||||||
btnAuthNoticeReload.addEventListener('click', () => {
|
btnAuthNoticeReload.addEventListener('click', () => {
|
||||||
if (currentIframeUrl) showIframeView(currentIframeUrl);
|
if (currentIframeUrl) showIframeView(currentIframeUrl, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user