百宝箱轮播:生娃花多少钱那条约70%轮次都在滚(v26110427)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
deploy
2026-11-04 10:18:23 +00:00
parent 0283d9cf43
commit 9cce1503bb
25 changed files with 95 additions and 91 deletions

View File

@@ -3,7 +3,7 @@
(function () {
'use strict';
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
var VER = '26110426';
var VER = '26110427';
const $ = (s, c) => (c || document).querySelector(s);
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));

View File

@@ -244,5 +244,5 @@
}
/* feed.js 首页默认不加载(index.html 只引了 topics.js),这里按需拉一次 */
if (window.GC_FEED) init();
else { var fs = document.createElement('script'); fs.src = 'guangchang/feed.js?v=26110426'; fs.onload = fs.onerror = init; document.body.appendChild(fs); }
else { var fs = document.createElement('script'); fs.src = 'guangchang/feed.js?v=26110427'; fs.onload = fs.onerror = init; document.body.appendChild(fs); }
})();

View File

@@ -6,9 +6,9 @@
(function () {
var sec = document.getElementById('gcHome');
if (!sec) return;
var l = document.createElement('link'); l.rel = 'stylesheet'; l.href = 'js/gch/v4.css?v=26110426';
var l = document.createElement('link'); l.rel = 'stylesheet'; l.href = 'js/gch/v4.css?v=26110427';
document.head.appendChild(l);
var s = document.createElement('script'); s.src = 'js/gch/v4.js?v=26110426';
var s = document.createElement('script'); s.src = 'js/gch/v4.js?v=26110427';
s.onload = function () { if (sec.querySelector('.g4-foot')) merge(); else sec.addEventListener('gc4-ready', merge, { once: true }); }; /* v4 要先拉 feed.js 才渲染 */
document.body.appendChild(s);

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 = '26110426';
var V = '26110427';
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');
@@ -200,9 +200,13 @@
var rs = [].slice.call(box.querySelectorAll('.kit-rows .kr')).filter(function (r) { return r.querySelector('.kr-lv'); });
if (!rs.length) return;
var n = Math.min(rs.length, Math.random() < .5 ? 1 : 2), nx, t = 0; /* 11-04 用户:同时滚动 2~3 条 → 1~2 条,不超过 2 */
do { /* 随机挑 n 条;和上一轮完全一样就重挑,保证每次都有变化 */
nx = rs.map(function (r, i) { return i; }).sort(function () { return Math.random() - .5; }).slice(0, n).sort();
} while (nx.join() === LV_ON.join() && ++t < 9);
/* 11-04 用户:「生娃到底要花多少钱」那条(.hot)尽量多轮播,约 70% 的轮次都有它;其余名额从另外几条里随机挑 */
var hi = -1; rs.forEach(function (r, i) { if (r.classList.contains('hot')) hi = i; });
var withHot = hi >= 0 && Math.random() < .7;
do { /* 和上一轮完全一样就重挑(只有「生娃」一条时允许连着出,它自己的内容每 3 秒在换) */
var rest = rs.map(function (r, i) { return i; }).filter(function (i) { return i !== hi; }).sort(function () { return Math.random() - .5; });
nx = (withHot ? [hi].concat(rest.slice(0, n - 1)) : rest.slice(0, n)).sort();
} while (nx.join() === LV_ON.join() && !(withHot && n === 1) && ++t < 9);
LV_ON = nx;
rs.forEach(function (r, i) {
var go = LV_ON.indexOf(i) >= 0;

View File

@@ -8,7 +8,7 @@
postMessage 不是实时投递,微信在分享那一刻才派发,所以每次换内容都要再报一次;子页面没引 jweixin,这里按需加载。 */
(function (g) {
'use strict';
var V = '26110426';
var V = '26110427';
var isWx = /MicroMessenger/i.test(navigator.userAgent || '');
var waiting = [], loading = false;
function ready(cb) {