@@ -2227,15 +2227,12 @@ window.cancelAnimFrame = (function () {
|
||||
}
|
||||
|
||||
|
||||
// Check for cached grid (Index/Grid Only) - RESTORE EARLY to avoid pagination/layout destruction.
|
||||
// We check the cache for ANY grid navigation (not just skipPush/popstate) so that clicking the
|
||||
// logo or any other link back to a previously-viewed grid page is instant — no blank thumbs,
|
||||
// no re-fetch. The cached DOM node already has all background-images set on the thumb elements.
|
||||
if (isGrid) {
|
||||
// Check for cached grid (Index/Grid Only) - RESTORE EARLY to avoid pagination/layout destruction
|
||||
if (isGrid && options.skipPush) {
|
||||
const targetCacheKey = urlObj.pathname + urlObj.search;
|
||||
if (gridCacheMap.has(targetCacheKey)) {
|
||||
const cache = gridCacheMap.get(targetCacheKey);
|
||||
gridCacheMap.delete(targetCacheKey); // Consume cache (one-shot restore)
|
||||
gridCacheMap.delete(targetCacheKey); // Consume cache
|
||||
|
||||
stopMedia();
|
||||
|
||||
@@ -2284,12 +2281,6 @@ window.cancelAnimFrame = (function () {
|
||||
}
|
||||
}
|
||||
|
||||
// Push URL to history for forward navigations (logo click etc.) so the back button works.
|
||||
// skipPush navigations (popstate) must NOT push or we'd create a double history entry.
|
||||
if (!options.skipPush) {
|
||||
history.pushState({}, '', url);
|
||||
}
|
||||
|
||||
// Restore Scroll Position
|
||||
requestAnimationFrame(() => window.scrollTo(0, cache.scroll));
|
||||
|
||||
@@ -3715,18 +3706,6 @@ window.cancelAnimFrame = (function () {
|
||||
targetUrl = targetUrl.replace(/[?&]strict=1/, '').replace(/[?&]$/, '');
|
||||
}
|
||||
|
||||
// If we're already on this exact page and there's no cached grid to restore,
|
||||
// just scroll to top — no point wiping and re-fetching the current grid.
|
||||
const _targetBase = targetUrl.split('#')[0];
|
||||
const _currentBase = window.location.href.split('#')[0];
|
||||
if (_targetBase === _currentBase && !anyLink.hash) {
|
||||
const _cacheKey = new URL(targetUrl, window.location.origin).pathname + new URL(targetUrl, window.location.origin).search;
|
||||
if (!gridCacheMap.has(_cacheKey)) {
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const parts = pathname.split('/').filter(Boolean);
|
||||
const isItemLink = !pathname.match(/\/p\//) && (
|
||||
pathname.match(/^\/\d+/) ||
|
||||
|
||||
Reference in New Issue
Block a user