fix(ajax): show the reference skeleton on every load-more surface

Clicking 加载更多 in the 多栏目文章 widget showed no skeleton at all — the
list simply stayed still until the response arrived, then the new cards
appeared. The homepage stream, archives and comments already had a working
skeleton; the widget's AJAX load goes through a different client and never
found its loader.

Root cause was DOM placement, not visibility: ContentRenderer emitted
.post_ajax_loader as a *sibling* of .widget-ajaxpager, while the widget REST
client resolves it with container.querySelector('.post_ajax_loader'). The
node existed but could never match, so .is-loading was never added and the
skeleton stayed display:none. Inactive tab panes had the same shape, and the
direct-load branch of ajaxpager() emitted no loader at all.

Changes, all following the reference theme's post_ajax() contract in
zibll/js/main.js (beforeSend anchors the loader to the end of the list;
success only hides it, never removes it):

- ContentRenderer: nest the loader inside .widget-ajaxpager for both the
  direct-load and inactive-tab branches, and drop the sibling append.
- widgets/frontend.js: anchorLoader() moves the loader to the end of the
  list before .ajax-pag on every request; appended cards are inserted before
  it; a replace preserves the node instead of wiping it with innerHTML; a
  fallback loader is created when the DOM has none; loadItems() now returns
  its promise; drop the unreachable is-loading auto-load branch.
- Message centre, user-home panels and the search page switch from spinner /
  opacity feedback to the same .posts-item-shaped skeleton, so all AJAX
  surfaces share one loading contract.
- Remove the second, never-wired skeleton system (.aksrt-skeleton-* in
  core-ui.css) and the dead spinner stylesheets/rules (skeleton.css,
  ajax-spinner.css, .load-more__*, --skeleton-base/--skeleton-shine) plus the
  unregistered assets/js/waterfall.js.
- Extend the widget, message-centre, user-home and asset-ledger contract
  tests to pin the loader inside the container, the class-only visibility
  switch, and the absence of the deleted dead code.

Verified: 470 node tests, 136 PHP widget assertions, admin-contract and
widget-system audits all green; rebuilt public assets after the CSS/JS
removals.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Fable 5 committed 2026-10-03 22:22:15 +08:00
1 parent 271e7f0518
commit cf4554e7c8
25 files changed
+330 -981

No files matched your search

+39 -19
View File
@@ -106,10 +106,20 @@
}
.messages-center.is-loading .messages-center__content {
opacity: 0.55;
pointer-events: none;
}
/* 加载态由消息骨架承担(与文章列表 .post_ajax_loader 同一契约),
不再让按钮 spinner 与内容透明度抢反馈。 */
.messages-list > .post_ajax_loader {
display: none;
}
.messages-list > .post_ajax_loader.is-loading {
display: block;
animation: aksrtFadeIn 0.2s ease both;
}
.messages-list {
display: flex;
flex-direction: column;
@@ -455,22 +465,36 @@ html.dark .message-detail {
transform: translateY(-1px);
}
.messages-center.is-loading .messages-pagination__more span::before {
display: inline-block;
width: 12px;
height: 12px;
margin-right: 7px;
border: 2px solid currentColor;
border-right-color: transparent;
border-radius: 50%;
content: "";
vertical-align: -2px;
animation: messages-pagination-spin 0.7s linear infinite;
/* 消息骨架:复用真实 .message-item 结构与 .placeholder 动画契约,
只把内容换成灰块(参考主题 post_ajax loader 的同构思路)。 */
.messages-list > .post_ajax_loader .message-item--placeholder {
cursor: default;
}
@keyframes messages-pagination-spin {
to {
transform: rotate(360deg);
.messages-list > .post_ajax_loader .message-item--placeholder .message-item__icon {
color: transparent;
}
.messages-list > .post_ajax_loader .message-item--placeholder .message-item__body {
display: flex;
flex-direction: column;
}
.messages-list > .post_ajax_loader .message-item--placeholder .placeholder {
display: block;
}
.messages-list > .post_ajax_loader .message-item--placeholder .placeholder.s1 {
height: 12px;
}
.messages-list > .post_ajax_loader .message-item--placeholder .message-item__actions {
align-self: center;
}
@media (prefers-reduced-motion: reduce) {
.messages-list > .post_ajax_loader .placeholder {
animation: none;
}
}
@@ -479,10 +503,6 @@ html.dark .message-detail {
.messages-pagination__more {
transition: none;
}
.messages-center.is-loading .messages-pagination__more span::before {
animation: none;
}
}
/* ---- 响应式 ---- */