This commit is contained in:
2026-09-13 16:31:15 +02:00
parent 9980080647
commit 54ee89e63c
5 changed files with 23 additions and 32 deletions
+9 -28
View File
@@ -1920,29 +1920,16 @@ window.cancelAnimFrame = (function () {
if (!options.skipHistory) { if (!options.skipHistory) {
const returnUrl = window._onaraReturnUrl || getOnaraBaseUrl(); const returnUrl = window._onaraReturnUrl || getOnaraBaseUrl();
const returnTitle = window._onaraReturnTitle || window.f0ckDomain || ''; const returnTitle = window._onaraReturnTitle || window.f0ckDomain || '';
// Always jump directly to the return URL — never step back through stacked item history. const resolvedReturn = new URL(returnUrl, window.location.origin).href;
// history.back() would re-open the previous item via popstate; replaceState exits cleanly. if (window.location.href !== resolvedReturn) {
const depth = window._onaraOpenHistoryLength != null history.pushState({ onaraGrid: true }, '', returnUrl);
? history.length - window._onaraOpenHistoryLength }
: 0; if (returnTitle) {
if (depth > 0) {
// Suppress popstate re-navigation while we jump out
window._onaraSuppressPopstate = true;
history.go(-depth);
// history.go is async — replace the landing state after it fires
setTimeout(() => {
history.replaceState({}, '', returnUrl);
document.title = returnTitle;
window._onaraSuppressPopstate = false;
}, 50);
} else {
history.replaceState({}, '', returnUrl);
document.title = returnTitle; document.title = returnTitle;
} }
} }
window._onaraReturnUrl = null; window._onaraReturnUrl = null;
window._onaraReturnTitle = null; window._onaraReturnTitle = null;
window._onaraOpenHistoryLength = null;
// Maintain focus on active item so user TAB navigation seamlessly resumes from current progress // Maintain focus on active item so user TAB navigation seamlessly resumes from current progress
const activeThumb = document.querySelector('.posts > a.thumb.onara-active'); const activeThumb = document.querySelector('.posts > a.thumb.onara-active');
@@ -3610,9 +3597,7 @@ window.cancelAnimFrame = (function () {
const loadPageAjax = async (url, replace = true, options = {}) => { const loadPageAjax = async (url, replace = true, options = {}) => {
if (isNavigating) return; if (isNavigating) return;
const fromOnaraModal = document.body.classList.contains('onara-modal-open') || const shouldReplaceHistory = options.replaceHistory ?? false;
(document.getElementById('onara-modal') && document.getElementById('onara-modal').style.display !== 'none');
const shouldReplaceHistory = options.replaceHistory ?? (fromOnaraModal && !options.skipPush);
// Immediately restore scrollability and hide modals // Immediately restore scrollability and hide modals
if (window.resetGlobalScrollState) window.resetGlobalScrollState(); if (window.resetGlobalScrollState) window.resetGlobalScrollState();
@@ -4648,8 +4633,6 @@ window.cancelAnimFrame = (function () {
window._onaraReturnUrl = window.location.href; window._onaraReturnUrl = window.location.href;
} }
window._onaraReturnTitle = document.title; window._onaraReturnTitle = document.title;
// Record history depth so we can jump past all stacked item entries on close
window._onaraOpenHistoryLength = history.length;
} }
// ── Scroller-active cleanup (same as loadPageAjax) ─────────────────── // ── Scroller-active cleanup (same as loadPageAjax) ───────────────────
@@ -5681,8 +5664,7 @@ window.cancelAnimFrame = (function () {
loadItemAjax(targetUrl, !_skipInherit); loadItemAjax(targetUrl, !_skipInherit);
} else { } else {
const isBrand = anyLink.classList.contains('navbar-brand'); const isBrand = anyLink.classList.contains('navbar-brand');
const fromModal = document.body.classList.contains('onara-modal-open') || !!anyLink.closest('#onara-modal'); loadPageAjax(targetUrl, true, { bypassCache: isBrand });
loadPageAjax(targetUrl, true, { bypassCache: isBrand, replaceHistory: fromModal });
} }
return false; return false;
} }
@@ -6142,9 +6124,6 @@ window.cancelAnimFrame = (function () {
}; };
window.addEventListener('popstate', (e) => { window.addEventListener('popstate', (e) => {
// Swallow popstate events fired during Onara close (history.go(-N) unwinding)
if (window._onaraSuppressPopstate) return;
const url = window.location.href; const url = window.location.href;
const p = window.location.pathname; const p = window.location.pathname;
@@ -6187,6 +6166,8 @@ window.cancelAnimFrame = (function () {
if (currentPath !== targetPath) { if (currentPath !== targetPath) {
window._onaraCurrentGridUrl = url; window._onaraCurrentGridUrl = url;
loadPageAjax(url, true, { skipPush: true }); loadPageAjax(url, true, { skipPush: true });
} else {
document.title = window._onaraReturnTitle || window.f0ckDomain || 'f0ck';
} }
} }
return; return;
+5 -1
View File
@@ -400,7 +400,11 @@
"name": "Name", "name": "Name",
"description": "Beschreibung", "description": "Beschreibung",
"private": "Privat", "private": "Privat",
"view": "Ansehen" "view": "Ansehen",
"save": "Speichern",
"delete": "Löschen",
"edit": "Bearbeiten",
"dismiss": "Schließen"
}, },
"mod": { "mod": {
"confirm_action": "Aktion bestätigen", "confirm_action": "Aktion bestätigen",
+2 -1
View File
@@ -403,7 +403,8 @@
"view": "View", "view": "View",
"save": "Save", "save": "Save",
"delete": "Delete", "delete": "Delete",
"edit": "Edit" "edit": "Edit",
"dismiss": "Dismiss"
}, },
"mod": { "mod": {
"confirm_action": "Confirm Action", "confirm_action": "Confirm Action",
+5 -1
View File
@@ -398,7 +398,11 @@
"name": "Naam", "name": "Naam",
"description": "Beschrijving", "description": "Beschrijving",
"private": "Privé", "private": "Privé",
"view": "Bekijken" "view": "Bekijken",
"save": "Opslaan",
"delete": "Verwijderen",
"edit": "Bewerken",
"dismiss": "Sluiten"
}, },
"mod": { "mod": {
"confirm_action": "Actie Bevestigen", "confirm_action": "Actie Bevestigen",
+2 -1
View File
@@ -398,7 +398,8 @@
"view": "Ansehen", "view": "Ansehen",
"save": "Speichern", "save": "Speichern",
"delete": "Löschen", "delete": "Löschen",
"edit": "Editieren" "edit": "Editieren",
"dismiss": "Weg damit"
}, },
"mod": { "mod": {
"confirm_action": "Aktion bestätigen", "confirm_action": "Aktion bestätigen",