v26110232 问题页小 Banner + 热度/正在看/看过;专题页工具固定模块 + 相关推荐 3 个 + 评论区;首页「进孕妈广场」「全部 30 份测试」
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
21
js/app.js
21
js/app.js
@@ -3,7 +3,7 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
|
||||
var VER = '26110231';
|
||||
var VER = '26110232';
|
||||
const $ = (s, c) => (c || document).querySelector(s);
|
||||
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
|
||||
|
||||
@@ -5576,8 +5576,13 @@
|
||||
⚠️ band 必须在用它的标题之前声明(11-02 曾写反 → const 暂时性死区报错,「查看全部」点了没反应) */
|
||||
const band = (state.postpartum || state.pregEmpty) ? 0 : qaBand(state.week);
|
||||
$('#qaTitle').textContent = '其他妈妈也在搜';
|
||||
$('#qaHeroT').textContent = band ? '孕 ' + state.week + ' 周,妈妈们最常问的问题' : '妈妈们最常问的问题';
|
||||
$('#qaHeroD').textContent = '点开问题看答案';
|
||||
$('#qaHeroW').textContent = band ? '孕 ' + state.week + ' 周' : '大家都在问';
|
||||
$('#qaHeroT').textContent = '妈妈们最常问的问题';
|
||||
$('#qaHeroD').textContent = bank.length + ' 个问题 · 点开看答案';
|
||||
/* 11-02 用户:列表每条要有热度、多少人正在看、多少人看过 —— 看过 = 「此刻」总人数 × heat(同首页);正在看 = 看过的约万分之六,按分钟轻微浮动(模拟数,AGENTS.md 12b) */
|
||||
const tot = (window.__mbPulse && window.__mbPulse.total && +window.__mbPulse.total.value) || 1510000;
|
||||
const hMax = Math.max.apply(null, bank.map(x => +x.heat || 0)) || 1, mnt = Math.floor(Date.now() / 60000);
|
||||
const wan = n => n >= 1e4 ? (Math.round(n / 1e3) / 10) + '万' : String(Math.round(n));
|
||||
$('#qaTopic').classList.add('hide');
|
||||
const inBand = x => !!(band && x.st && x.st.indexOf(band) >= 0);
|
||||
const order = bank.filter(x => x.href === QA_FIXED)
|
||||
@@ -5606,7 +5611,15 @@
|
||||
if (inBand(x)) it.dataset.st = '1';
|
||||
const h = document.createElement('button'); h.type = 'button'; h.className = 'qa-q';
|
||||
const no = document.createElement('i'); no.className = 'qa-no'; no.textContent = i + 1;
|
||||
const t = document.createElement('span'); t.className = 'qa-tx'; t.textContent = x.q;
|
||||
const t = document.createElement('span'); t.className = 'qa-m';
|
||||
const tq = document.createElement('span'); tq.className = 'qa-tx'; tq.textContent = x.q; t.appendChild(tq);
|
||||
if (+x.heat) {
|
||||
const seen = tot * +x.heat, now = Math.max(6, Math.round(seen * 0.0006 * (0.8 + 0.4 * Math.abs(Math.sin(mnt / 7 + i)))));
|
||||
const st = document.createElement('span'); st.className = 'qa-st';
|
||||
st.innerHTML = '<i class="qh">' + MS_FIRE + '热度<u><s style="width:' + Math.max(18, Math.round(Math.sqrt(+x.heat / hMax) * 100)) + '%"></s></u></i>' +
|
||||
'<i class="qn">' + wan(now) + ' 人正在看</i><i>' + wan(seen) + ' 人看过</i>';
|
||||
t.appendChild(st);
|
||||
}
|
||||
const g = document.createElement('span'); g.className = 'qa-tag' + (x.badge ? ' hot' : ''); g.textContent = x.href ? '专题' : (x.tag || '');
|
||||
const ch = document.createElement('i'); ch.className = 'qa-ch'; ch.textContent = '›';
|
||||
h.appendChild(no); h.appendChild(t); if (g.textContent) h.appendChild(g); h.appendChild(ch);
|
||||
|
||||
Reference in New Issue
Block a user