悄悄话流星十改:可连点多颗,多颗流星同时滑落 (v26100174)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-02 07:55:21 +00:00
parent 911cd0338b
commit 534ccc3ca6
2 changed files with 21 additions and 19 deletions

View File

@@ -7,7 +7,7 @@
<meta name="mobile-web-app-capable" content="yes"> <meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<title>兜爸心选 · 孕育陪伴</title> <title>兜爸心选 · 孕育陪伴</title>
<!-- V:26100173 缓存版本标记:改 css/js 时同步 bump 该值(与 js/app.js 的 VER 同源),静态资源按 mtime 走 ETag 自动刷新 --> <!-- V:26100174 缓存版本标记:改 css/js 时同步 bump 该值(与 js/app.js 的 VER 同源),静态资源按 mtime 走 ETag 自动刷新 -->
<link rel="stylesheet" href="mama-box.css"> <link rel="stylesheet" href="mama-box.css">
<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script> <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<!-- 共享助手:授权/跳商城/位置上报(分享卡片同步,见 docs/h5-auth-standard.md 第四节) --> <!-- 共享助手:授权/跳商城/位置上报(分享卡片同步,见 docs/h5-auth-standard.md 第四节) -->

View File

@@ -3,7 +3,7 @@
(function () { (function () {
'use strict'; 'use strict';
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */ /* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
var VER = '26100173'; var VER = '26100174';
const $ = (s, c) => (c || document).querySelector(s); const $ = (s, c) => (c || document).querySelector(s);
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s)); const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
@@ -3352,7 +3352,8 @@
const hsh = s => { let h = 7; for (const c of String(s)) h = (h * 31 + c.charCodeAt(0)) >>> 0; return h; }; const hsh = s => { let h = 7; for (const c of String(s)) h = (h * 31 + c.charCodeAt(0)) >>> 0; return h; };
const card = $('#wsc'); const card = $('#wsc');
const seen = new Set(); const seen = new Set();
let cur = 0, mt = null; let cur = 0;
const mts = new Map(); // 十改:可以连点多颗,多颗流星同时往下落;key = 星的序号
function paintDeco() { function paintDeco() {
const box = $('#wskStars'); const box = $('#wskStars');
if (box.childElementCount) return; if (box.childElementCount) return;
@@ -3401,16 +3402,16 @@
} }
/* 七改(用户:「点一个流星底下就出现文字,好像就不用看流星上面写什么了」): /* 七改(用户:「点一个流星底下就出现文字,好像就不用看流星上面写什么了」):
内容卡改到流星划完才浮出来(小字回放 + 抱抱),先看流星、再看卡;中途换星就不出旧卡。 */ 内容卡改到流星划完才浮出来(小字回放 + 抱抱),先看流星、再看卡;中途换星就不出旧卡。 */
function stopMeteor(done) { function stopMeteor(m, done) {
if (!mt) return; if (!m || mts.get(m.i) !== m) return;
cancelAnimationFrame(mt.raf); cancelAnimationFrame(m.raf);
mt.el.remove(); m.el.remove();
mt.btn.classList.remove('flare', 'gone'); m.btn.classList.remove('flare', 'gone');
mt.btn.classList.add('seen'); m.btn.classList.add('seen');
const m = mt; mts.delete(m.i);
mt = null;
if (done) paintCard(m.it, m.i); if (done) paintCard(m.it, m.i);
} }
const stopAll = () => [...mts.values()].forEach(m => stopMeteor(m));
/* 第一次进来:一闪一闪的提示,点过一次星星就永久收起 */ /* 第一次进来:一闪一闪的提示,点过一次星星就永久收起 */
const TIP = 'mmbox.whtip.v1'; const TIP = 'mmbox.whtip.v1';
const tipEl = $('#wskTip'); const tipEl = $('#wskTip');
@@ -3421,8 +3422,7 @@
} }
function launch(i) { function launch(i) {
const it = list()[i - 1]; const it = list()[i - 1];
if (!it) return; if (!it || mts.has(i)) return;
stopMeteor();
cur = i; cur = i;
seen.add(it.id); seen.add(it.id);
$$('.wsk-st.hint', page).forEach(x => x.classList.remove('hint')); $$('.wsk-st.hint', page).forEach(x => x.classList.remove('hint'));
@@ -3460,7 +3460,7 @@
const t0 = performance.now(); const t0 = performance.now();
const frame = now => { const frame = now => {
const t = now - t0; const t = now - t0;
if (t < T0) { mt.raf = requestAnimationFrame(frame); return; } if (t < T0) { m.raf = requestAnimationFrame(frame); return; }
btn.classList.add('gone'); btn.classList.add('gone');
const tc = t - T0, dt = Math.max(0, tc - TR), u = Math.min(1, dt / TE); const tc = t - T0, dt = Math.max(0, tc - TR), u = Math.min(1, dt / TE);
const s = v0 * tc + v0 * tc * tc / 16000 + .5 * A * dt * dt; const s = v0 * tc + v0 * tc * tc / 16000 + .5 * A * dt * dt;
@@ -3479,10 +3479,12 @@
c.style.opacity = (Math.min(1, d / 26) * fade).toFixed(2); c.style.opacity = (Math.min(1, d / 26) * fade).toFixed(2);
c.style.transform = 'translate(' + (x0 + dx * d).toFixed(1) + 'px,' + (y0 + dy * d).toFixed(1) + 'px) translate(-50%,-50%) rotate(' + rot.toFixed(1) + 'deg)'; c.style.transform = 'translate(' + (x0 + dx * d).toFixed(1) + 'px,' + (y0 + dy * d).toFixed(1) + 'px) translate(-50%,-50%) rotate(' + rot.toFixed(1) + 'deg)';
}); });
if (u >= 1) { stopMeteor(true); return; } if (u >= 1) { stopMeteor(m, true); return; }
mt.raf = requestAnimationFrame(frame); m.raf = requestAnimationFrame(frame);
}; };
mt = { el, btn, it, i, raf: requestAnimationFrame(frame) }; const m = { el, btn, it, i, raf: 0 };
mts.set(i, m);
m.raf = requestAnimationFrame(frame);
} }
function nextStar() { function nextStar() {
const l = list(), n = l.length; const l = list(), n = l.length;
@@ -3518,7 +3520,7 @@
launch(g.dataset.next ? nextStar() : +g.dataset.go); launch(g.dataset.next ? nextStar() : +g.dataset.go);
}); });
function openPage() { function openPage() {
stopMeteor(); stopAll();
cur = 0; cur = 0;
card.classList.remove('show'); card.classList.remove('show');
paintPage(); paintPage();
@@ -3529,7 +3531,7 @@
haptic(); haptic();
} }
function closePage() { function closePage() {
stopMeteor(); stopAll();
drawer(false); drawer(false);
page.classList.remove('show'); page.classList.remove('show');
page.setAttribute('aria-hidden', 'true'); page.setAttribute('aria-hidden', 'true');