fix(forum): align forum pages with the reference layout

- cards: restore the shared card shell, add author follow/message actions,
  score group, last-reply meta and reference plate header actions
- home: desktop left tab rail, widget-only sidebar, reference load-more markup
- plate: 1-based tabs, reference defaults (全部/推荐/最新回复/热门/精华)
- post: fixed action rail, score footer, author card, h1 article title
- quick publish: plate selector moved into the submit row like the reference
This commit is contained in:
kate522 committed 2026-11-11 18:06:33 +08:00
1 parent 7a59c65252
commit ec5dfcd82f
15 files changed
+396 -166

No files matched your search

+23 -2
View File
@@ -359,6 +359,24 @@
const label = button.querySelector('text')
if (label) label.textContent = following ? '已关注' : '关注'
else button.textContent = result.data?.label || button.textContent
} else if (action === 'favorite') {
const active = result.data?.active === true
button.classList.toggle('active', active)
const label = button.querySelector('text')
if (label) label.textContent = active ? '已收藏' : '收藏'
} else if (action === 'score') {
// Card score group: flip the active arrow and refresh the shared counter.
const group = button.closest('.score-btns')
if (group) {
const isUp = button.dataset.direction !== 'down'
const userScore = Number(result.data?.user_score || 0)
group.querySelectorAll('.btn-score').forEach((item) => {
const own = (item.dataset.direction !== 'down') === isUp
item.classList.toggle('active', own && userScore !== 0)
})
const counter = group.querySelector('text')
if (counter) counter.textContent = Number(result.data?.score || 0) > 0 ? String(result.data.score) : '评分'
}
} else if (button.querySelector('text')) {
button.querySelector('text').textContent = result.data?.label || result.message || button.querySelector('text').textContent
} else {
@@ -403,7 +421,7 @@
const loadMore = async (link, pane) => {
if (pane.dataset.loading === '1') return
pane.dataset.loading = '1'
const more = link.closest('.forum-more')
const more = link.closest('.theme-pagination') || link.closest('.ajax-pag')
const loader = [...pane.children].find((item) => item.classList.contains('post_ajax_loader'))
more?.classList.add('is-loading')
loader?.classList.add('is-loading')
@@ -414,7 +432,7 @@
const source = doc.getElementById(pane.id)
if (!source) throw new Error('内容不存在')
const anchor = more || null
const incoming = [...source.children].filter((item) => !item.classList.contains('forum-tab-pane') && !item.classList.contains('forum-more') && !item.classList.contains('post_ajax_loader'))
const incoming = [...source.children].filter((item) => !item.classList.contains('forum-tab-pane') && !item.classList.contains('theme-pagination') && !item.classList.contains('post_ajax_loader'))
incoming.forEach((item) => pane.insertBefore(item, anchor))
const next = source.querySelector('[data-forum-more]')
if (next && anchor) anchor.querySelector('[data-forum-more]')?.setAttribute('href', next.getAttribute('href'))
@@ -449,7 +467,10 @@
}
const more = event.target.closest('[data-forum-more]')
if (more) {
// The wrapper also carries .ajax-next for the theme's pagination styles;
// stop the generic handler from firing a second request.
event.preventDefault()
event.stopPropagation()
const pane = more.closest('.forum-tab-pane')
if (pane) loadMore(more, pane)
}