孕妈广场:每块 3 个热门,「全部」里家庭/婚姻/职场/母婴轮流排(首页 + 广场页);v26110115

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
deploy
2026-11-01 08:42:16 +00:00
parent 6172a780d3
commit cc8cc3e98a
4 changed files with 21 additions and 13 deletions

View File

@@ -3,7 +3,7 @@
(function () {
'use strict';
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
var VER = '26110114';
var VER = '26110115';
const $ = (s, c) => (c || document).querySelector(s);
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
@@ -4198,8 +4198,16 @@
reportHostLocation(new URL(url, location.href).href);
location.href = url;
}
/* 「全部」:只放热门,四块(家庭/婚姻/职场/母婴)轮流排,别一排全是同一块;选了某块:该块热门在前、其余在后 */
const CATS = ['family', 'marriage', 'work', 'baby'];
function pick(cat) {
if (cat) { const l = T.filter(t => t.cat === cat); return l.filter(t => t.hot).concat(l.filter(t => !t.hot)); }
const by = CATS.map(c => T.filter(t => t.cat === c && t.hot)), out = [];
for (let r = 0; r < 5; r++) by.forEach(l => { if (l[r]) out.push(l[r]); });
return out;
}
function paint(cat) {
const list = T.filter(t => !cat || t.cat === cat);
const list = pick(cat);
row.innerHTML = list.map(t =>
'<button type="button" class="gch-card" data-t="' + esc(t.id) + '" style="--c1:' + t.c[0] + ';--c2:' + t.c[1] + ';--ink:' + t.ink + '">' +
'<i class="gb" aria-hidden="true"></i><span class="gg" aria-hidden="true">' + esc(t.g) + '</span>' +