孕妈悄悄话:留言抽屉底部常露一截、弹窗星空版+三步规则、找人帮我点赞、变星特效、背景小星可点、内容卡自动消失

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
deploy
2026-11-07 02:55:20 +00:00
parent d8435e3dc8
commit 19fb605567
4 changed files with 240 additions and 60 deletions

View File

@@ -3,7 +3,7 @@
(function () {
'use strict';
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
var VER = '26110618';
var VER = '26110621';
const $ = (s, c) => (c || document).querySelector(s);
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
@@ -4553,6 +4553,9 @@
card.classList.remove('show');
void card.offsetWidth;
card.classList.add('show');
/* 11-07 用户:这句话呈现出来之后,过几秒钟就让它消失 */
clearTimeout(paintCard.t);
paintCard.t = setTimeout(() => card.classList.remove('show'), 6500);
const pal = it.mine ? ['#A8723A', '#E0A86A'] : AURA[(i - 1) % AURA.length];
const au = $$('#whvAura i');
au[0].style.backgroundColor = pal[0]; au[1].style.backgroundColor = pal[1];
@@ -4766,6 +4769,29 @@
mts.set(i, m);
m.raf = requestAnimationFrame(frame);
}
/* 11-07 用户:「背后的一些小星星也可以点」—— 点到装饰小星附近,借一颗还没在飞的亮星挪到那儿划出去
(话按顺序轮着来,所以背景星点不完;小星本身闪一下) */
$('#wsk').addEventListener('click', e => {
if (e.target.closest('.wsk-st')) return;
const l = list(); if (!l.length) return;
let best = null, bd = 24 * 24;
$$('#wskStars i').forEach(d => {
const r = d.getBoundingClientRect(), dx = r.left + r.width / 2 - e.clientX, dy = r.top + r.height / 2 - e.clientY, dd = dx * dx + dy * dy;
if (dd < bd) { bd = dd; best = d; }
});
if (!best) return;
let i = 0;
for (let k = 1; k <= l.length; k++) { const j = (deco.n + k) % l.length; if (!mts.has(j + 1)) { i = j + 1; break; } }
if (!i) return;
deco.n = i - 1 + 1;
const btn = $('.wsk-st[data-go="' + i + '"]', page); if (!btn) return;
btn.style.left = best.style.left; btn.style.top = best.style.top;
btn.classList.remove('used', 'born');
best.classList.add('pk'); setTimeout(() => best.classList.remove('pk'), 900);
haptic(); drawer(false);
launch(i);
});
const deco = { n: 0 };
function nextStar() {
const l = list(), n = l.length;
for (let k = 1; k <= n; k++) {
@@ -4838,7 +4864,7 @@
function load(w, silent) {
wk = w;
if (!w) { data = null; show(false); return; }
fetch(API + '?openid=' + encodeURIComponent(oid() || '') + '&week=' + w)
fetch(API + '?openid=' + encodeURIComponent(oid() || '') + '&week=' + w + '&more=1') /* 11-07 用户:星星再多一些 */
.then(r => (r.ok ? r.json() : null))
.then(j => {
const r = j && j.code === 200 && j.result;
@@ -4872,6 +4898,7 @@
page.setAttribute('aria-hidden', 'false');
let gw = 0;
try { const g = JSON.parse(localStorage.getItem('mmbox.gcwk.v1') || 'null'); gw = g && !g.pp && g.w ? +g.w : 0; } catch (e) {}
if (gw < 4 && /[?&]wc=/.test(location.search)) gw = 20; /* 别人转发来请你点赞的:没建档也打开(孕周以服务端档案为准,没有就随便取一周的星空) */
if (gw >= 4) setTimeout(() => load(gw), 0); else setTimeout(autoFail, 0);
}
function autoFail() {
@@ -4941,7 +4968,7 @@
ta.placeholder = th && th.ph ? th.ph : '今天想对谁说点什么?';
$('#whPresets').innerHTML = ((th && th.presets && th.presets.length) ? th.presets : (data.presets || [])).map(t => '<button class="wh-pre" type="button">' + esc(t) + '</button>').join('');
$('#whLeft').textContent = window.MBWhCm ? '' : '今天还能说 ' + data.left + ' 句';
if (window.MBWhCm) { $('#whMLead').textContent = '发出去先审核,通过了大家就能在留言里看到。被赞够 ' + MBWhCm.starLikes() + ' 次,它会变成天上的一颗星星,同孕周的妈妈都点得到。'; }
if (window.MBWhCm && MBWhCm.fillModal) MBWhCm.fillModal(); /* 11-07 弹窗重新设计(规则三步走 + 星空样式),见 js/wh-cm.js */
openModal('modalWhisper');
});
$('#whPresets').addEventListener('click', e => {