fix: 修复文章加载动画功能无论是否启用都能正常工作

- 修改CSS选择器从.post-preview改为.post,匹配所有文章卡片
- 修改JavaScript选择器从article.post-preview改为article.post
- 添加#main.article-list限定,只在文章列表页生效
- 修复清理代码,确保能正确移除所有文章的加载状态
This commit is contained in:
2026-01-23 13:50:36 +08:00
parent 74c32d8faf
commit dc11338ca2
2 changed files with 6 additions and 6 deletions

View File

@@ -2821,8 +2821,8 @@ $(document).pjax("a[href]:not([no-pjax]):not(.no-pjax):not([target='_blank']):no
NProgress.start(); NProgress.start();
pjaxLoading = true; pjaxLoading = true;
}).on('pjax:afterGetContainers', function(e, f, g) { }).on('pjax:afterGetContainers', function(e, f, g) {
if (g.is("#main article.post-preview a.post-title")){ if (g.is("#main.article-list article.post a.post-title")){
let $card = $(g.parents("article.post-preview")[0]); let $card = $(g.parents("article.post")[0]);
let waterflowOn = false; let waterflowOn = false;
if ($("#main").hasClass("waterflow")){ if ($("#main").hasClass("waterflow")){
waterflowOn = true; waterflowOn = true;
@@ -2857,13 +2857,13 @@ $(document).pjax("a[href]:not([no-pjax]):not(.no-pjax):not([target='_blank']):no
cleanupPjaxResources(); cleanupPjaxResources();
// 清理文章列表的 PJAX 加载状态 // 清理文章列表的 PJAX 加载状态
$(".post-preview.post-pjax-loading").removeClass("post-pjax-loading").css({ $(".post.post-pjax-loading").removeClass("post-pjax-loading").css({
"transform": "", "transform": "",
"transition": "", "transition": "",
"left": "", "left": "",
"width": "" "width": ""
}); });
$(".post-preview .loading-css-animation").remove(); $(".post .loading-css-animation").remove();
$("#main").removeClass("post-list-pjax-loading"); $("#main").removeClass("post-list-pjax-loading");
// 更新 UI 状态 // 更新 UI 状态

View File

@@ -3877,13 +3877,13 @@ html.filter-grayscale {
z-index: 10; z-index: 10;
} }
.post-list-pjax-loading .post-preview { #main.post-list-pjax-loading .post {
opacity: 0; opacity: 0;
pointer-events: none; pointer-events: none;
transition: opacity 0.3s ease; transition: opacity 0.3s ease;
} }
.post-list-pjax-loading .post-preview.post-pjax-loading { #main.post-list-pjax-loading .post.post-pjax-loading {
opacity: 1 !important; opacity: 1 !important;
pointer-events: auto; pointer-events: auto;
} }