|
|
|
@@ -1920,29 +1920,16 @@ window.cancelAnimFrame = (function () {
|
|
|
|
|
if (!options.skipHistory) {
|
|
|
|
|
const returnUrl = window._onaraReturnUrl || getOnaraBaseUrl();
|
|
|
|
|
const returnTitle = window._onaraReturnTitle || window.f0ckDomain || '';
|
|
|
|
|
// Always jump directly to the return URL — never step back through stacked item history.
|
|
|
|
|
// history.back() would re-open the previous item via popstate; replaceState exits cleanly.
|
|
|
|
|
const depth = window._onaraOpenHistoryLength != null
|
|
|
|
|
? history.length - window._onaraOpenHistoryLength
|
|
|
|
|
: 0;
|
|
|
|
|
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);
|
|
|
|
|
const resolvedReturn = new URL(returnUrl, window.location.origin).href;
|
|
|
|
|
if (window.location.href !== resolvedReturn) {
|
|
|
|
|
history.pushState({ onaraGrid: true }, '', returnUrl);
|
|
|
|
|
}
|
|
|
|
|
if (returnTitle) {
|
|
|
|
|
document.title = returnTitle;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
window._onaraReturnUrl = null;
|
|
|
|
|
window._onaraReturnTitle = null;
|
|
|
|
|
window._onaraOpenHistoryLength = null;
|
|
|
|
|
|
|
|
|
|
// Maintain focus on active item so user TAB navigation seamlessly resumes from current progress
|
|
|
|
|
const activeThumb = document.querySelector('.posts > a.thumb.onara-active');
|
|
|
|
@@ -3610,9 +3597,7 @@ window.cancelAnimFrame = (function () {
|
|
|
|
|
const loadPageAjax = async (url, replace = true, options = {}) => {
|
|
|
|
|
if (isNavigating) return;
|
|
|
|
|
|
|
|
|
|
const fromOnaraModal = document.body.classList.contains('onara-modal-open') ||
|
|
|
|
|
(document.getElementById('onara-modal') && document.getElementById('onara-modal').style.display !== 'none');
|
|
|
|
|
const shouldReplaceHistory = options.replaceHistory ?? (fromOnaraModal && !options.skipPush);
|
|
|
|
|
const shouldReplaceHistory = options.replaceHistory ?? false;
|
|
|
|
|
|
|
|
|
|
// Immediately restore scrollability and hide modals
|
|
|
|
|
if (window.resetGlobalScrollState) window.resetGlobalScrollState();
|
|
|
|
@@ -4648,8 +4633,6 @@ window.cancelAnimFrame = (function () {
|
|
|
|
|
window._onaraReturnUrl = window.location.href;
|
|
|
|
|
}
|
|
|
|
|
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) ───────────────────
|
|
|
|
@@ -5681,8 +5664,7 @@ window.cancelAnimFrame = (function () {
|
|
|
|
|
loadItemAjax(targetUrl, !_skipInherit);
|
|
|
|
|
} else {
|
|
|
|
|
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, replaceHistory: fromModal });
|
|
|
|
|
loadPageAjax(targetUrl, true, { bypassCache: isBrand });
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@@ -6142,9 +6124,6 @@ window.cancelAnimFrame = (function () {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
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 p = window.location.pathname;
|
|
|
|
|
|
|
|
|
@@ -6187,6 +6166,8 @@ window.cancelAnimFrame = (function () {
|
|
|
|
|
if (currentPath !== targetPath) {
|
|
|
|
|
window._onaraCurrentGridUrl = url;
|
|
|
|
|
loadPageAjax(url, true, { skipPush: true });
|
|
|
|
|
} else {
|
|
|
|
|
document.title = window._onaraReturnTitle || window.f0ckDomain || 'f0ck';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|