feat(首页): 新增「宝宝消消乐」游戏推广入口 (v26093014)

- 工具托盘正下方一张糖果色大卡:「新游戏」角标 + 名字 + 玩法一句话 + 跳动的「开始玩」,
  右侧 3×3 待产用品小棋盘循环演示三连消除,角上星星闪烁。
- 点击走 jumpApp() 跳 https://beian3.douba.top/myxx/index.html(游戏由「母婴消消」维护,
  不需要身份参数,多带无害);GAME_URL 为空时整块隐藏。
- 动效在 prefers-reduced-motion 下关闭;页面隐藏时棋盘动画暂停。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-30 13:29:07 +00:00
parent 9a1ad1fb93
commit 05ce51300e
3 changed files with 83 additions and 4 deletions

View File

@@ -3,7 +3,7 @@
(function () {
'use strict';
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
var VER = '26093013';
var VER = '26093014';
const $ = (s, c) => (c || document).querySelector(s);
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
@@ -3109,6 +3109,32 @@
}
}
/* ================= 宝宝消消乐 · 推广入口(2026-09-30) =================
GAME_URL 为空 → 入口不显示。小棋盘:每 2.6 秒随机一行/一列先亮一下,再「消掉」换一批新的掉下来。 */
const GAME_URL = 'https://beian3.douba.top/myxx/index.html'; // 由「母婴消消」会话维护,部署在 47.120.70.60,不需要身份参数(多带无害)
const GAME_ID = 'baobao-xiaoxiaole';
(function gamePromo() {
const sec = $('#gamePromo'), board = $('#gpBoard');
if (!sec || !GAME_URL) return;
sec.classList.remove('hide');
$('#gpCard').addEventListener('click', () => jumpApp(GAME_URL, GAME_ID));
const ITEMS = ['🍼', '🧸', '👶', '🧦', '🛁', '🧴', '👕', '🎀'];
const rnd = () => ITEMS[Math.floor(Math.random() * ITEMS.length)];
const cells = [];
for (let i = 0; i < 9; i++) { const c = document.createElement('i'); c.textContent = rnd(); board.appendChild(c); cells.push(c); }
if (window.matchMedia && matchMedia('(prefers-reduced-motion: reduce)').matches) return;
const LINES = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8]];
setInterval(() => {
if (document.hidden) return;
const line = LINES[Math.floor(Math.random() * LINES.length)], e = rnd();
line.forEach(k => { cells[k].textContent = e; cells[k].classList.add('is-hint'); });
setTimeout(() => line.forEach(k => { cells[k].classList.remove('is-hint'); cells[k].classList.add('is-pop'); }), 700);
setTimeout(() => line.forEach(k => {
const c = cells[k]; c.textContent = rnd(); c.classList.remove('is-pop', 'is-in'); void c.offsetWidth; c.classList.add('is-in');
}), 1100);
}, 2600);
})();
/* ================= 孕期小知识(2026-09-30) =================
内容 assets/data/preg-tips.json:[{week, baby, mom, eat, care, days:[{t,d}×7]}],孕 4–40 周。
第几天 = state.day(0–6),和首页「孕 N 周 D 天」同一口径。