底部导航推荐版:线稿图标/缺口托住记一下/暖白底+淡出/我的用头像/来信新信晃动 (v26100198)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-02 13:45:44 +00:00
parent 8f4f77acee
commit 0994781f1e
3 changed files with 78 additions and 6 deletions

View File

@@ -3,7 +3,7 @@
(function () {
'use strict';
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
var VER = '26100197';
var VER = '26100198';
const $ = (s, c) => (c || document).querySelector(s);
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
@@ -798,6 +798,28 @@
if (body) body.classList.remove('no-letter');
if (badge) badge.classList.add('show');
}
/* 2026-10-02 底部导航:「宝宝来信」tab 的信封在有红点时轻轻晃(CSS .has-new)。
红点的 owner 仍是 renderLetterReminder,这里只跟着它的 .show 走,不另立判据。 */
(function () {
const badge = $('#tabBadge'), tab = $('#tabLetter');
if (!badge || !tab || !window.MutationObserver) return;
const sync = () => tab.classList.toggle('has-new', badge.classList.contains('show'));
new MutationObserver(sync).observe(badge, { attributes: true, attributeFilter: ['class'] });
sync();
})();
/* 「我的」tab 图标换成妈妈自己的头像:跟随 #meAvatarImg 的 src(资料接口 / 换头像 都写它),没有就回到线稿小人 */
(function () {
const src = $('#meAvatarImg'), ava = $('#tabAva');
if (!src || !ava || !window.MutationObserver) return;
const sync = () => {
const u = src.getAttribute('src') || '';
if (u) ava.src = u; else ava.removeAttribute('src');
ava.closest('.tab').classList.toggle('has-ava', !!u);
};
ava.addEventListener('error', () => ava.closest('.tab').classList.remove('has-ava'));
new MutationObserver(sync).observe(src, { attributes: true, attributeFilter: ['src'] });
sync();
})();
$$('[data-detail="close"]').forEach(b => b.addEventListener('click', closePanel));