From 534ccc3ca6b00723305de46afd8cbb32551e7bc1 Mon Sep 17 00:00:00 2001 From: Karlcarlo Date: Fri, 2 Oct 2026 07:55:21 +0000 Subject: [PATCH] =?UTF-8?q?=E6=82=84=E6=82=84=E8=AF=9D=E6=B5=81=E6=98=9F?= =?UTF-8?q?=E5=8D=81=E6=94=B9=EF=BC=9A=E5=8F=AF=E8=BF=9E=E7=82=B9=E5=A4=9A?= =?UTF-8?q?=E9=A2=97=EF=BC=8C=E5=A4=9A=E9=A2=97=E6=B5=81=E6=98=9F=E5=90=8C?= =?UTF-8?q?=E6=97=B6=E6=BB=91=E8=90=BD=20(v26100174)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- index.html | 2 +- js/app.js | 38 ++++++++++++++++++++------------------ 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/index.html b/index.html index 50012be..81cb168 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ 兜爸心选 · 孕育陪伴 - + diff --git a/js/app.js b/js/app.js index 89f4318..f731a0d 100644 --- a/js/app.js +++ b/js/app.js @@ -3,7 +3,7 @@ (function () { 'use strict'; /* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */ - var VER = '26100173'; + var VER = '26100174'; const $ = (s, c) => (c || document).querySelector(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 card = $('#wsc'); const seen = new Set(); - let cur = 0, mt = null; + let cur = 0; + const mts = new Map(); // 十改:可以连点多颗,多颗流星同时往下落;key = 星的序号 function paintDeco() { const box = $('#wskStars'); if (box.childElementCount) return; @@ -3401,16 +3402,16 @@ } /* 七改(用户:「点一个流星底下就出现文字,好像就不用看流星上面写什么了」): 内容卡改到流星划完才浮出来(小字回放 + 抱抱),先看流星、再看卡;中途换星就不出旧卡。 */ - function stopMeteor(done) { - if (!mt) return; - cancelAnimationFrame(mt.raf); - mt.el.remove(); - mt.btn.classList.remove('flare', 'gone'); - mt.btn.classList.add('seen'); - const m = mt; - mt = null; + function stopMeteor(m, done) { + if (!m || mts.get(m.i) !== m) return; + cancelAnimationFrame(m.raf); + m.el.remove(); + m.btn.classList.remove('flare', 'gone'); + m.btn.classList.add('seen'); + mts.delete(m.i); if (done) paintCard(m.it, m.i); } + const stopAll = () => [...mts.values()].forEach(m => stopMeteor(m)); /* 第一次进来:一闪一闪的提示,点过一次星星就永久收起 */ const TIP = 'mmbox.whtip.v1'; const tipEl = $('#wskTip'); @@ -3421,8 +3422,7 @@ } function launch(i) { const it = list()[i - 1]; - if (!it) return; - stopMeteor(); + if (!it || mts.has(i)) return; cur = i; seen.add(it.id); $$('.wsk-st.hint', page).forEach(x => x.classList.remove('hint')); @@ -3460,7 +3460,7 @@ const t0 = performance.now(); const frame = now => { const t = now - t0; - if (t < T0) { mt.raf = requestAnimationFrame(frame); return; } + if (t < T0) { m.raf = requestAnimationFrame(frame); return; } btn.classList.add('gone'); 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; @@ -3479,10 +3479,12 @@ 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)'; }); - if (u >= 1) { stopMeteor(true); return; } - mt.raf = requestAnimationFrame(frame); + if (u >= 1) { stopMeteor(m, true); return; } + 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() { const l = list(), n = l.length; @@ -3518,7 +3520,7 @@ launch(g.dataset.next ? nextStar() : +g.dataset.go); }); function openPage() { - stopMeteor(); + stopAll(); cur = 0; card.classList.remove('show'); paintPage(); @@ -3529,7 +3531,7 @@ haptic(); } function closePage() { - stopMeteor(); + stopAll(); drawer(false); page.classList.remove('show'); page.setAttribute('aria-hidden', 'true');