style(首页): 此刻减到三行(她们在做合成一句、删今天别忘了、动态压成一行小字);婴儿房空隙恢复 v26100114 版式(用户澄清:要改的是此刻) (v26100117)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
61
js/app.js
61
js/app.js
@@ -3,7 +3,7 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
|
||||
var VER = '26100115';
|
||||
var VER = '26100117';
|
||||
const $ = (s, c) => (c || document).querySelector(s);
|
||||
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
|
||||
|
||||
@@ -3112,10 +3112,10 @@
|
||||
const t = new Date(); t.setHours(0, 0, 0, 0);
|
||||
days = Math.round((state.due - t) / 864e5);
|
||||
}
|
||||
$('#nySub').innerHTML = state.postpartum ? 'TA 已经住进来啦'
|
||||
: days > 0 ? '还有 <em>' + days + '</em> 天入住'
|
||||
: days != null ? 'TA 随时会住进来'
|
||||
: '攒兜豆,一件件布置好';
|
||||
$('#nySub').innerHTML = state.postpartum ? 'TA 已经住进来啦,再添点新东西吧'
|
||||
: days > 0 ? '还有 <em>' + days + '</em> 天入住 · 攒兜豆把它布置好'
|
||||
: days != null ? 'TA 随时会住进来,快去布置好'
|
||||
: '做孕期任务攒兜豆,一件件布置好';
|
||||
}
|
||||
(function nurseryInit() {
|
||||
const sec = $('#nursery');
|
||||
@@ -3227,31 +3227,13 @@
|
||||
if (_fpMode !== 'rows' && _fpMode !== 'guide') return null;
|
||||
return ((_fpData && _fpData.used) || []).some(u => u.appId === SELF_APP[k]);
|
||||
}
|
||||
/* 今日待办(B):只放上面「她们在做」没覆盖的 —— 产检倒数(≤14 天)、本周盲盒没开 / 有可解锁的 */
|
||||
function todos() {
|
||||
const out = [];
|
||||
if (state.pregEmpty === false && !state.postpartum) {
|
||||
const m = String(($('#calNext') || {}).textContent || '').match(/(\d{1,2})月(\d{1,2})日/);
|
||||
if (m) {
|
||||
const t = midnight(new Date()), d = new Date(t.getFullYear(), +m[1] - 1, +m[2]);
|
||||
if (d < t - 86400000 * 60) d.setFullYear(d.getFullYear() + 1);
|
||||
const n = Math.round((d - t) / 86400000);
|
||||
if (n >= 0 && n <= 14) out.push({ k: 'cal', t: n === 0 ? '今天产检' : n === 1 ? '明天产检' : '产检还有 <b>' + n + '</b> 天' });
|
||||
}
|
||||
}
|
||||
if (BB && BB.enabled && !BB.notYet && !BB.needProfile && !BB.ended) {
|
||||
if (!BB.currentOpened && (BB.openable || []).indexOf(BB.week) >= 0) out.push({ k: 'box', t: '本周盲盒还没开', hot: 1 });
|
||||
else if ((BB.locked || []).length && BB.credits) out.push({ k: 'box', t: '可解锁 <b>' + BB.credits + '</b> 个盲盒', hot: 1 });
|
||||
}
|
||||
return out;
|
||||
}
|
||||
function rowHTML(f) {
|
||||
/* 「孕 29 周的妈妈 数完胎动,宝宝动了 13 次」→ 上行「孕 29 周的妈妈 · 刚刚」(同周版式写「一位同周妈妈」),下行动作;数字标色 */
|
||||
/* 一行:小头像 + 「同周妈妈 · 刚刚」+ 动作(数字标色)。原文「孕 29 周的妈妈 数完胎动……」按「的妈妈 」切 */
|
||||
const t = String(f.text || ''), i = t.indexOf('的妈妈 ');
|
||||
const who = peerMode ? '一位同周妈妈' : (i > 0 ? t.slice(0, i + 3) : '一位妈妈'), what = i > 0 ? t.slice(i + 4) : t;
|
||||
const who = peerMode ? '同周妈妈' : (i > 0 ? t.slice(0, i + 3) : '一位妈妈'), what = i > 0 ? t.slice(i + 4) : t;
|
||||
return '<div class="pl-row"><span class="pr-ava">' + momAva(strSeed(t + (f.ago || ''))) + '</span>' +
|
||||
'<span class="pr-t"><span class="pr-who">' + esc(who) + ' · ' + esc(f.ago || '刚刚') + '</span><span class="pr-do">' +
|
||||
esc(what).replace(/(\d+)/g, '<em>$1</em>') + '</span></span></div>';
|
||||
'<span class="pr-who">' + esc(who) + ' · ' + esc(f.ago || '刚刚') + '</span><span class="pr-do">' +
|
||||
esc(what).replace(/(\d+)/g, '<em>$1</em>') + '</span></div>';
|
||||
}
|
||||
function tick() {
|
||||
const tr = $('#plTrack');
|
||||
@@ -3259,7 +3241,7 @@
|
||||
fi = (fi + 1) % feed.length;
|
||||
tr.insertAdjacentHTML('beforeend', rowHTML(feed[fi]));
|
||||
tr.classList.add('is-move');
|
||||
tr.style.transform = 'translateY(-46px)';
|
||||
tr.style.transform = 'translateY(-26px)'; /* = .pl-row 高度 */
|
||||
setTimeout(() => {
|
||||
tr.classList.remove('is-move');
|
||||
/* 翻动途中若 paint() 重置过轨道(只剩 1 行),别把仅剩的那行也删了 */
|
||||
@@ -3277,19 +3259,17 @@
|
||||
function paintPeer(p) {
|
||||
paintAvs(p.week);
|
||||
$('#plTitle').innerHTML = '<b data-n="' + p.count + '">0</b> 位孕 ' + p.week + ' 周妈妈和你同一周';
|
||||
$('#ppDoing').innerHTML = (p.doing || []).map(d => {
|
||||
const me = SELF_TXT[d.key] ? selfDone(d.key) : null;
|
||||
/* 只说一句:优先挑你今天还没做的那项;都做了(或读不到你的足迹)就取第一项 */
|
||||
const ds = (p.doing || []).filter(d => SELF_TXT[d.key]);
|
||||
const pick = ds.find(d => selfDone(d.key) === false) || ds[0];
|
||||
if (pick) {
|
||||
const me = selfDone(pick.key);
|
||||
const meH = me == null ? '' : me
|
||||
? '<span class="pp-me ok">' + SELF_TXT[d.key][1] + ' ✓</span>'
|
||||
: '<button class="pp-me todo" type="button" data-go="' + d.key + '">' + SELF_TXT[d.key][0] + ' ›</button>';
|
||||
return '<div class="pp-do k-' + esc(d.key) + '"><span class="pp-dt">她们 <b>' + (+d.pct || 0) + '%</b> ' + esc(d.label) + '</span>' +
|
||||
'<span class="pp-bar"><i style="width:' + Math.min(100, +d.pct || 0) + '%"></i></span>' + meH + '</div>';
|
||||
}).join('');
|
||||
$('#ppDoing').classList.toggle('hide', !(p.doing || []).length);
|
||||
const td = todos();
|
||||
$('#plTodo').classList.toggle('hide', !td.length);
|
||||
$('#plTodoList').innerHTML = td.map(x => '<button class="tdo-chip' + (x.hot ? ' hot' : '') + '" type="button" data-go="' + x.k + '">' +
|
||||
pulseIco(x.k, 'tdo-ico') + '<span>' + x.t + '</span><i>›</i></button>').join('');
|
||||
? '<span class="pp-me ok">' + SELF_TXT[pick.key][1] + ' ✓</span>'
|
||||
: '<button class="pp-me todo" type="button" data-go="' + pick.key + '">' + SELF_TXT[pick.key][0] + ' ›</button>';
|
||||
$('#ppDoing').innerHTML = '<div class="pp-do"><span class="pp-dt">她们有 <b>' + (+pick.pct || 0) + '%</b> ' + esc(pick.label) + '</span>' + meH + '</div>';
|
||||
}
|
||||
$('#ppDoing').classList.toggle('hide', !pick);
|
||||
}
|
||||
function paint() {
|
||||
const r = last;
|
||||
@@ -3302,7 +3282,6 @@
|
||||
/* 全站版(访客 / real 模式):只留一行总人数 + 滚动动态 */
|
||||
paintAvs(0);
|
||||
$('#ppDoing').classList.add('hide');
|
||||
$('#plTodo').classList.add('hide');
|
||||
const t = r.total;
|
||||
/* 前缀「已有」省掉:一行放得下「10,037 位妈妈在这里迎接宝宝」,带上就会折出一个孤零零的「宝宝」 */
|
||||
$('#plTitle').innerHTML = t ? '<b data-n="' + t.value + '">0</b> ' + esc(t.suffix) : '孕妈们在做什么';
|
||||
|
||||
Reference in New Issue
Block a user