计算器改分步模式(wizard.js,12 个含产假计算器模式)、测试卡图文分开、百宝箱火苗去圈、关注前3条头像各自2~6秒换(v26110419)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
deploy
2026-11-04 08:44:16 +00:00
parent e57bc9f4a5
commit a6e4a73d21
28 changed files with 342 additions and 90 deletions

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=26110418';
var l = document.createElement('link'); l.rel = 'stylesheet'; l.href = 'js/gch/v4.css?v=26110419';
document.head.appendChild(l);
var s = document.createElement('script'); s.src = 'js/gch/v4.js?v=26110418';
var s = document.createElement('script'); s.src = 'js/gch/v4.js?v=26110419';
s.onload = function () { if (sec.querySelector('.g4-foot')) merge(); else sec.addEventListener('gc4-ready', merge, { once: true }); }; /* v4 要先拉 feed.js 才渲染 */
document.body.appendChild(s);
@@ -121,24 +121,28 @@
for (var k = 0; k < c; k++) h += avaEl(LIKE_AVA[avaAt++ % LIKE_AVA.length]);
return '<span class="g6-avs" aria-hidden="true">' + h + '</span>';
}
var likeT = 0;
/* 11-04 用户:前 3 条的小头像各自 2~6 秒随机换一个(每条独立计时);原地换(缩小→换图→弹回),个数、点赞数都不动 */
var likeT = [];
function swapOne(r) {
var ims = r.querySelectorAll('.g6-avs img');
if (!ims.length) return;
var im = ims[Math.floor(Math.random() * ims.length)], on = {}, nx, t = 0;
list.querySelectorAll('.g6-avs img').forEach(function (m) { on[m.getAttribute('src')] = 1; });
do { nx = LIKE_AVA[avaAt++ % LIKE_AVA.length]; } while (on['assets/img/mom/' + nx + '.jpg'] && ++t < LIKE_AVA.length);
im.className = 'sw-o';
setTimeout(function () { im.src = 'assets/img/mom/' + nx + '.jpg'; im.className = 'sw-i'; }, 220);
}
function likeTick() {
clearTimeout(likeT);
likeT = setTimeout(function () {
var rows = list.querySelectorAll('.g6-nt');
if (!document.hidden && rows.length && list.offsetParent) {
/* 11-03 用户:「头像在变,比如 3 个里突然有一个变了;后面点赞数不变」→ 原地换掉其中一个(缩小→换图→弹回),个数、点赞数都不动 */
var r = rows[Math.floor(Math.random() * rows.length)], ims = r.querySelectorAll('.g6-avs img');
if (ims.length) {
var im = ims[Math.floor(Math.random() * ims.length)], on = {}, nx, t = 0;
list.querySelectorAll('.g6-avs img').forEach(function (m) { on[m.getAttribute('src')] = 1; });
do { nx = LIKE_AVA[avaAt++ % LIKE_AVA.length]; } while (on['assets/img/mom/' + nx + '.jpg'] && ++t < LIKE_AVA.length);
im.className = 'sw-o';
setTimeout(function () { im.src = 'assets/img/mom/' + nx + '.jpg'; im.className = 'sw-i'; }, 220);
}
}
likeTick();
}, 4000 + Math.random() * 3000);
likeT.forEach(clearTimeout); likeT = [];
[0, 1, 2].forEach(function (i) {
(function loop() {
likeT[i] = setTimeout(function () {
var r = list.querySelectorAll('.g6-nt')[i];
if (r && !document.hidden && list.offsetParent) swapOne(r);
loop();
}, 2000 + Math.random() * 4000);
})();
});
}
all.addEventListener('click', function () { location.href = 'guangchang/' + location.search + location.hash; });
paintList();