Files
@@ -575,15 +575,32 @@
const dlg = wrap.firstElementChild;
document.body.appendChild(dlg);
- const close = () => { try { dlg.remove(); } catch {} };
+ const close = () => {
+ if (location.hash === '#gallery') {
+ history.back();
+ } else {
+ try { dlg.remove(); } catch {}
+ }
+ };
dlg.onclick = (e) => { if (e.target === e.currentTarget) close(); };
dlg.querySelectorAll('.dlgClose').forEach(b => b.onclick = close);
+
+ if (location.hash !== '#gallery') {
+ history.pushState(null, '', '#gallery');
+ }
}
btnFilesRefresh.onclick = loadDirs;
filesSearchQ.oninput = () => { clearTimeout(filesSearchQ._t); filesSearchQ._t = setTimeout(loadDirs, 300); };
filesSortSel.onchange = loadDirs;
+ window.addEventListener('popstate', () => {
+ const galleryModal = document.querySelector('#gallery-modal');
+ if (galleryModal) {
+ galleryModal.remove();
+ }
+ });
+
loadDirs();