Revert "ef"

This reverts commit 1762687fc8.
This commit is contained in:
2026-07-12 20:22:17 +02:00
parent 8294d9626f
commit 9e579d2cdd
2 changed files with 17 additions and 49 deletions

View File

@@ -7156,12 +7156,6 @@ button#togglebg {
opacity: 0; opacity: 0;
} }
/* Quick fade-out for in-place grid reloads (logo click) — matches the 150ms JS setTimeout */
.grid-fade-out {
opacity: 0 !important;
transition: opacity 0.15s ease-out !important;
}
.grid-transition.show { .grid-transition.show {
opacity: 1 !important; opacity: 1 !important;
transition: opacity 0.3s ease-in-out; transition: opacity 0.3s ease-in-out;

View File

@@ -2379,15 +2379,7 @@ window.cancelAnimFrame = (function () {
// Show loading indicator // Show loading indicator
if (navbar) navbar.classList.add("pbwork"); if (navbar) navbar.classList.add("pbwork");
// For same-grid reloads (e.g. logo click while already on a grid page), keep the current if (replace && posts) {
// thumbs visible during the network fetch — fading out before data arrives causes a long
// blank-thumb period. We'll do a quick fade at the point of DOM swap instead.
// For structural transitions (item view → grid, profile → grid, etc.) the existing
// pre-fade is fine because posts was already cleared or doesn't exist yet.
const _postsHasContent = posts && posts.children.length > 0;
const _isInPlaceGridReload = replace && _postsHasContent;
if (replace && posts && !_isInPlaceGridReload) {
posts.classList.add('grid-transition'); posts.classList.add('grid-transition');
posts.classList.remove('show'); posts.classList.remove('show');
} }
@@ -2860,43 +2852,25 @@ window.cancelAnimFrame = (function () {
if (data.success) { if (data.success) {
if (replace) { if (replace) {
if (_isInPlaceGridReload) { // Atomic replacement to prevent "jumping"
// Same-grid reload: fade out current content, swap, fade back in. posts.innerHTML = data.html;
// .grid-fade-out has a 150ms opacity transition — we wait for it then swap. window.updateVisitIndicators();
posts.classList.add('grid-fade-out'); window.initLazyLoading();
const _doSwap = () => {
posts.classList.remove('grid-fade-out');
posts.classList.add('grid-transition');
posts.classList.remove('show');
posts.innerHTML = data.html;
window.updateVisitIndicators();
window.initLazyLoading();
window.scrollTo(0, 0);
requestAnimationFrame(() => posts.classList.add('show'));
};
// Wait for the .grid-fade-out transition (150ms in CSS)
setTimeout(_doSwap, 160);
} else {
// Structural transition: content is already blank/replaced, just inject and show
posts.innerHTML = data.html;
window.updateVisitIndicators();
window.initLazyLoading();
// Handle Scroll Position (Restore or Reset) // Handle Scroll Position (Restore or Reset)
if (options.skipPush && history.state && history.state.scroll !== undefined) { if (options.skipPush && history.state && history.state.scroll !== undefined) {
// Back/Forward Navigation: Restore saved scroll position // Back/Forward Navigation: Restore saved scroll position
requestAnimationFrame(() => window.scrollTo(0, history.state.scroll)); requestAnimationFrame(() => window.scrollTo(0, history.state.scroll));
} else if (replace) { } else if (replace) {
// New Navigation: Reset to top // New Navigation: Reset to top
window.scrollTo(0, 0); window.scrollTo(0, 0);
}
// Trigger fade-in
requestAnimationFrame(() => {
posts.classList.add('show');
});
} }
// Trigger fade-in
requestAnimationFrame(() => {
posts.classList.add('show');
});
// Update header (h2) for tags/users // Update header (h2) for tags/users
const container = document.querySelector('.index-container'); const container = document.querySelector('.index-container');
if (container && data.titleHtml !== undefined) { if (container && data.titleHtml !== undefined) {