diff --git a/index.html b/index.html index bd93d80..bf23736 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ 兜爸心选 · 孕育陪伴 - + @@ -297,6 +297,9 @@ + +
@@ -307,7 +310,6 @@ 孕妈悄悄话 -
diff --git a/js/app.js b/js/app.js index 43cbee2..d7cc155 100644 --- a/js/app.js +++ b/js/app.js @@ -3,7 +3,7 @@ (function () { 'use strict'; /* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */ - var VER = '26100183'; + var VER = '26100185'; const $ = (s, c) => (c || document).querySelector(s); const $$ = (s, c) => Array.from((c || document).querySelectorAll(s)); @@ -3812,24 +3812,32 @@ return ((_fpData && _fpData.used) || []).some(u => u.appId === SELF_APP[k]); } function rowHTML(f) { - /* 一行:小头像 + 「同周妈妈 · 刚刚」+ 动作(数字标色)。原文「孕 29 周的妈妈 数完胎动……」按「的妈妈 」切 */ + /* 一行:小头像 + 「同周妈妈 · 刚刚」+ 动作(数字标色)。原文「孕 29 周的妈妈 数完胎动……」按「的妈妈 」切。 + 动作能对上首页入口(act ∈ TODAY_GO)→ 整行可点,直接进那个工具 */ 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; - return '
' + momAva(strSeed(t + (f.ago || ''))) + '' + - '' + esc(who) + ' · ' + esc(f.ago || '刚刚') + '' + - esc(what).replace(/(\d+)/g, '$1') + '
'; + const go = f.act && TODAY_GO[f.act] ? ' data-go="' + esc(f.act) + '"' : ''; + return '
' + momAva(strSeed(t + (f.ago || ''))) + '' + + /* 同周版标题已经说了「和你同一周」,行里不再重复「同孕周妈妈」,省出地方给动作。 + 不显示「N 分钟前」:三行按工具错开排(见 paint),时间会前后颠倒,又不能改接口给的时间 */ + (peerMode ? '' : '' + esc(who) + '') + '' + + esc(what).replace(/(\d+)/g, '$1') + '' + + (go ? '' : '') + '
'; } + const FEED_N = 3; /* 常驻三行 */ + const ROW_H = 30; /* = .pl-feed3 .pl-row 高度 */ function tick() { const tr = $('#plTrack'); - if (!tr || feed.length < 2 || document.hidden) return; + if (!tr || feed.length <= FEED_N || document.hidden) return; fi = (fi + 1) % feed.length; - tr.insertAdjacentHTML('beforeend', rowHTML(feed[fi])); + tr.insertAdjacentHTML('beforeend', rowHTML(feed[(fi + FEED_N - 1) % feed.length])); + tr.firstElementChild.classList.add('is-out'); tr.classList.add('is-move'); - tr.style.transform = 'translateY(-26px)'; /* = .pl-row 高度 */ + tr.style.transform = 'translateY(-' + ROW_H + 'px)'; setTimeout(() => { tr.classList.remove('is-move'); - /* 翻动途中若 paint() 重置过轨道(只剩 1 行),别把仅剩的那行也删了 */ - if (tr.childElementCount > 1) tr.removeChild(tr.firstElementChild); + /* 翻动途中若 paint() 重置过轨道,别把刚铺好的三行删掉 */ + if (tr.childElementCount > FEED_N) tr.removeChild(tr.firstElementChild); tr.style.transform = ''; }, 600); } @@ -3889,12 +3897,19 @@ const sig = nf.map(x => x.text).join('|'); if (nf.length && fe.dataset.sig !== sig) { fe.dataset.sig = sig; - feed = nf; + /* 三行尽量是三种不同的工具:按原顺序贪心挑,跟前两条动作不同的优先(挑不到就按原顺序) */ + const pool = nf.slice(), mix = []; + while (pool.length) { + const recent = mix.slice(-(FEED_N - 1)).map(x => x.act); + const k = pool.findIndex(x => recent.indexOf(x.act) < 0); + mix.push(pool.splice(k < 0 ? 0 : k, 1)[0]); + } + feed = mix; fi = 0; const tr = $('#plTrack'); tr.classList.remove('is-move'); tr.style.transform = ''; - tr.innerHTML = rowHTML(feed[0]); + tr.innerHTML = feed.slice(0, FEED_N).map(rowHTML).join(''); if (!ticking) ticking = setInterval(tick, 3000); } } diff --git a/mama-box.css b/mama-box.css index 6b2283d..eaccd5d 100644 --- a/mama-box.css +++ b/mama-box.css @@ -4101,3 +4101,23 @@ a.skip:focus{left:16px;top:16px} .apps-grid .a-ico-letter{width:48px;border-radius:16px;font-size:19px} .apps-grid .a-n{font-size:11.5px;letter-spacing:-.2px} .apps-grid .app.is-done::after{right:calc(50% - 30px)} + +/* ================= 此刻 · 三行使用动态(2026-10-02)================= + 用户:「此刻给我放 3 个使用应用记录」。常驻三行,不再给悄悄话让位;每 3 秒顶上一行淡出、底下补一行。 */ +.pulse.has-wh .pl-feed.pl-feed3{display:block} +.pulse .pl-feed.pl-feed3.hide{display:none} +.pl-feed.pl-feed3{height:90px;margin:10px 0 2px;padding:0;-webkit-mask-image:none;mask-image:none} +.pl-feed3 .pl-row{height:30px;gap:8px;font-size:12.5px;padding:0 2px;border-radius:10px;transition:opacity .45s,background .15s} +.pl-feed3 .pl-row .pr-ava{width:22px;height:22px;box-shadow:0 0 0 1.5px #fff} +.pl-feed3 .pl-row .pr-who{font-size:11.5px} +.pl-feed3 .pl-row .pr-do{color:var(--ink)} +.pl-feed3 .pl-row .pr-do em{font-weight:700} +.pl-feed3 .pl-row .pr-go{flex:none;font-style:normal;font-size:15px;line-height:1;color:#D4B8AC;padding:0 4px} +.pl-feed3 .pl-row.is-go{cursor:pointer} +.pl-feed3 .pl-row.is-go:active{background:rgba(232,131,107,.08)} +.pl-feed3 .pl-row.is-out{opacity:0} +.pl-feed3 .pl-track>.pl-row:last-child:not(:nth-child(-n+3)){animation:plIn .55s var(--ease) both} +@keyframes plIn{from{opacity:0}to{opacity:1}} +.pulse.has-wh .wh-entry{margin-top:10px} +.pl-feed3 .pl-row .pr-ago{flex:none;font-size:11px;color:var(--muted)} +.pl-feed3 .pl-row .pr-go{padding:0 2px 0 0}