v26110267 预览:首页头图倒计时翻牌;百宝箱入口人数改几十万带小数;30 个测试开始页按参考图精简居中;产假计算器模式(calc=1)计算器置顶

Co-Authored-By: AI 助手
This commit is contained in:
deploy
2026-11-03 22:26:34 +00:00
parent a536e81e01
commit aabe4f9b38
14 changed files with 211 additions and 138 deletions

View File

@@ -9,7 +9,7 @@
if (/[?&]kit=0(?:&|$)/.test(location.search)) return;
var box = document.getElementById('kit'), sec = document.getElementById('kitHome');
if (!box || !sec) return;
var V = '26110266';
var V = '26110267';
var l = document.createElement('link'); l.rel = 'stylesheet'; l.href = 'js/kit.css?v=' + V; document.head.appendChild(l);
document.documentElement.classList.add('has-kit');
@@ -21,6 +21,8 @@
var s = q.toString(); return (s ? '?' + s : '') + location.hash;
}
function wan(n) { return n >= 1e6 ? Math.round(n / 1e4) + '万' : n >= 1e4 ? (Math.round(n / 1e3) / 10) + '万' : String(Math.round(n)); } /* 百万以上取整,卡片窄放得下 */
/* 入口专用:万为单位、必带一位小数,碰上整数(如 68.0)挪 0.3,避免看着像凑的整数 */
function wanX(n) { var v = Math.round(n / 1e3) / 10; if (v % 1 === 0) v = +(v + .3).toFixed(1); return v.toFixed(1) + '万'; }
function total() { var p = window.__mbPulse; return (p && p.total && +p.total.value) || 1510000; }
var FIRE = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12.6 2.5c.4 3-1.6 4.6-3 6.2C8 10.4 7 12 7 14.3A5 5 0 0012 19.5a5 5 0 005-5.2c0-2-1-3.6-1.9-4.6-.2 1.3-.9 2.2-1.9 2.6.6-3.4-.2-7-.6-9.8z" fill="currentColor"/></svg>';
@@ -38,11 +40,13 @@
'<div class="kit-lh"><b>大家都在用</b><span class="kit-wk"></span></div><div class="ms-list kit-list"></div>';
sec.classList.remove('hide');
function setCnt(k, t) { var e = box.querySelector('.e-' + k + ' em'); if (e) e.firstChild.nodeValue = t; }
function setNum(k, n) { var e = box.querySelector('.e-' + k + ' .kit-n i'); if (e && n) e.textContent = wan(n); }
/* 人数口径:测过 = 30 个测试 gcTested 之和(同广场「累计 N 万人次参与」);看过 = 「此刻」总人数 × 0.62;算过 = 4 个计算器 heat 之和 × 总人数(同 topic/jisuan) */
function setNum(k, n) { var e = box.querySelector('.e-' + k + ' .kit-n i'); if (e && n) e.textContent = wanX(n); }
/* 人数口径(11-03 改):测过 = 30 个测试 gcTested 之和 × .456;看过 = 「此刻」总人数 × .574;算过 = 4 个计算器 heat 之和 × 总人数(同 topic/jisuan) */
function nums() {
if (window.GC_TESTS_META && window.gcTested) { setNum('qz', window.GC_TESTS_META.reduce(function (a, x) { return a + window.gcTested(x.id); }, 0)); setCnt('qz', window.GC_TESTS_META.length + ' 个测试'); }
setNum('qa', total() * .62);
/* 11-03 用户:「三个入口的人数太大,几十万就行,要有零有整」→ 系数压到几十万(测过 ≈68 万 / 看过 ≈87 万 / 算过 ≈50 万),且一律带一位小数(wanX)。
仍不小于下面列表里单条的最大值(单个测试 ≤12 万、单条百问 ≤64 万、单个计算器 ≤18 万),口径不打架。模拟数,12-31 复核 */
if (window.GC_TESTS_META && window.gcTested) { setNum('qz', window.GC_TESTS_META.reduce(function (a, x) { return a + window.gcTested(x.id); }, 0) * .456); setCnt('qz', window.GC_TESTS_META.length + ' 个测试'); }
setNum('qa', total() * .574);
setNum('js', total() * CALC.reduce(function (a, x) { return a + x.heat; }, 0));
if (QA && QA.length) setCnt('qa', QA.length + ' 个问题');
}
@@ -63,7 +67,7 @@
{ q: '生娃到底要花多少钱?一键算清', h: 'topic/huafei/', heat: .118 },
{ q: '孕期该长多少斤?按身高体重算', h: '/yunqi-tizhong/', heat: .083 },
{ q: '胎儿现在多重?填 B 超数估一估', h: '/taier-guzhong/', heat: .071, gate: 15 },
{ q: '产假能休多少天?哪天回去上班', h: 'topic/zhichang/', heat: .062 }
{ q: '产假能休多少天?哪天回去上班', h: 'topic/zhichang/', heat: .062, cm: 1 } /* cm:带 calc=1,进去第一屏就是计算器(11-03) */
];
var QA = null, day = Math.floor((Date.now() + 288e5) / 864e5);
function band() { var p = window.__mbPreg || {}; return p.postpartum || !p.week ? 0 : (window.__mbQaBand ? window.__mbQaBand(p.week) : 0); }
@@ -83,7 +87,7 @@
}
var cl = CALC.filter(function (x) { return !(x.gate && wk && wk < x.gate); });
if (b >= 5) cl = [cl[cl.length - 1]].concat(cl.slice(0, -1)); /* 孕 29 周起产假排前 */
cl.slice(0, 2).forEach(function (x) { out.js.push({ q: x.q, href: x.h + location.search + location.hash, n: total() * x.heat, u: '人算过' }); });
cl.slice(0, 2).forEach(function (x) { out.js.push({ q: x.q, href: x.h + (x.cm ? (location.search ? location.search + '&' : '?') + 'calc=1' : location.search) + location.hash, n: total() * x.heat, u: '人算过' }); });
var r = [];
for (var k = 0; k < 2; k++) ['qz', 'qa', 'js'].forEach(function (c) { if (out[c][k]) r.push(Object.assign({ c: c }, out[c][k])); });
return { r: r, wk: wk };