测一测:新增热度榜(按测过人数排名,前 10 可展开全部 30);各组按热度排序,推荐位为本组最热未测;考卷编号改 TOP 排名;v26110225

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
deploy
2026-11-02 12:19:49 +00:00
parent 1d3eb9de93
commit cd645dae24
6 changed files with 45 additions and 17 deletions

View File

@@ -325,8 +325,8 @@ mark{background:linear-gradient(transparent 62%,var(--c20) 0);color:inherit;padd
</div>
<div class="toast" id="toast"></div>
<script src="meta.js?v=26110224"></script>
<script src="tests.js?v=26110224"></script>
<script src="meta.js?v=26110225"></script>
<script src="tests.js?v=26110225"></script>
<script>
(function () {
'use strict';

View File

@@ -157,6 +157,20 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:poin
.csf .tx .go{display:inline-flex;align-items:center;gap:2px;margin-top:10px;height:30px;padding:0 14px;border-radius:99px;background:var(--tg);color:#fff;font-size:13px;font-weight:800;box-shadow:0 5px 12px -5px var(--tg)}
.csf .tx .go .ic{width:13px;height:13px;stroke-width:2.4}
.csf img{flex:none;width:118px;height:118px;border-radius:28px 28px 28px 8px;object-fit:cover;object-position:center 30%;border:3px solid #fff;box-shadow:0 8px 18px -10px var(--tg)}
.csk .ckl{margin-top:8px;border-radius:20px;background:#fff;box-shadow:0 3px 12px rgba(170,110,90,.07);overflow:hidden}
.ckr{display:flex;align-items:center;gap:12px;width:100%;padding:11px 12px;text-align:left;border-top:1px solid #F7EDE9}
.ckr:first-child{border-top:0}
.ckr .rk{flex:none;width:26px;text-align:center;font-size:17px;font-weight:900;font-style:italic;color:#C9B3AC;font-family:Georgia,serif}
.ckr .rk.r1,.ckr .rk.r2,.ckr .rk.r3{width:26px;height:26px;border-radius:8px;font-style:normal;font-size:14px;line-height:26px;color:#fff}
.ckr .rk.r1{background:linear-gradient(135deg,#FF8A4C,#F0453A)}.ckr .rk.r2{background:linear-gradient(135deg,#FFB547,#F28A1E)}.ckr .rk.r3{background:linear-gradient(135deg,#FFD166,#F2B21E)}
.ckr .tx{flex:1;min-width:0}
.ckr b{display:block;font-size:14px;font-weight:800;line-height:1.4;color:#2A1E1E;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.ckr .hb{display:block;height:4px;margin:5px 0 4px;border-radius:4px;background:#F6EEEA;overflow:hidden}
.ckr .hb i{display:block;height:100%;border-radius:4px;background:linear-gradient(90deg,#FFB08C,#F0603E)}
.ckr small{display:block;font-size:11.5px;color:#A08B85}
.ckr small em{font-style:normal;font-weight:800;color:var(--tg);margin-right:6px}
.ckr .go{flex:none;height:26px;padding:0 11px;border-radius:99px;background:var(--tl);color:var(--tg);font-size:12px;font-weight:800;line-height:26px}
.ckm{display:block;width:100%;margin-top:8px;height:36px;border-radius:12px;background:rgba(255,255,255,.7);color:#8A7470;font-size:12.5px;font-weight:800}
.csq{margin-top:8px;border-radius:20px;background:#fff;box-shadow:0 3px 12px rgba(170,110,90,.07);overflow:hidden}
.csn{display:flex;align-items:center;gap:12px;width:100%;padding:12px 12px 12px 14px;text-align:left;border-top:1px dashed #F1E2DC}
.csn:first-child{border-top:0}
@@ -590,10 +604,10 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:poin
<div id="sheet" role="dialog" aria-modal="true"><i class="sg"></i><div class="sbd" id="sbd"></div></div>
<div class="toast" id="toast"></div>
<script src="topics.js?v=26110224"></script>
<script src="data.js?v=26110224"></script>
<script src="feed.js?v=26110224"></script>
<script src="ceshi/meta.js?v=26110224"></script>
<script src="topics.js?v=26110225"></script>
<script src="data.js?v=26110225"></script>
<script src="feed.js?v=26110225"></script>
<script src="ceshi/meta.js?v=26110225"></script>
<script>
(function () {
'use strict';
@@ -798,6 +812,8 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:poin
'<div class="nb"><h3>' + esc(x.title) + '</h3><div class="nf">' + (d ? '<span class="gs dn">已测 · ' + esc(d.title) + '</span>' : '<span class="gs">' + TG[x.group] + '</span>') +
'<span class="gt">' + (d ? '再测' : '去测') + ' ›</span></div></div></button>';
}
/* 热度排序:按「N人测过」(ceshi/meta.js gcTested,模拟数,见 AGENTS.md 12b)从高到低 */
var byHot = function (l) { return l.slice().sort(function (a, b) { return gcTested(b.id) - gcTested(a.id); }); }, hotOpen = false;
var TGD = { quiz: '有标准答案,答完看解析', psy: '没有对错,测测你是哪一型', game: '挑战一下,看能拿什么称号', shop: '看看你是哪一类育儿采购玩家' };
/* 每组换一种排法,避免整页一个样:考卷=编号卷宗,心理=双列卡,闯关=横滑大卡,好物=图文行 */
function rest(g, l, done) {
@@ -815,7 +831,7 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:poin
}).join('') + '</ol>';
if (g === 'quiz') return '<div class="csq">' + l.map(function (x, i) {
var d = done[x.id];
return '<button type="button" class="csn" data-test="' + x.id + '"><span class="no"><small>NO.</small>' + ('0' + (TM.filter(function (y) { return y.group === 'quiz'; }).indexOf(x) + 1)).slice(-2) + '</span><span class="tx"><b>' + esc(x.title) + '</b>' +
return '<button type="button" class="csn" data-test="' + x.id + '"><span class="no"><small>TOP</small>' + ('0' + (byHot(TM.filter(function (y) { return y.group === 'quiz'; })).indexOf(x) + 1)).slice(-2) + '</span><span class="tx"><b>' + esc(x.title) + '</b>' +
'<small>' + (d ? '<em>已测 · ' + esc(d.title) + '</em>' : esc(x.sub)) + '</small>' + '<i class="pc">' + gcTestedText(x.id) + '</i>' + '</span><span class="ar"><svg class="ic"><use href="#i-right"/></svg></span></button>';
}).join('') + '</div>';
return l.map(function (x) {
@@ -824,15 +840,26 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:poin
'<small>' + (d ? '<em>已测 · ' + esc(d.title) + '</em>' : esc(x.sub)) + '</small>' + '<i class="pc">' + gcTestedText(x.id) + '</i>' + '</span><span class="ar"><svg class="ic"><use href="#i-right"/></svg></span></button>';
}).join('');
}
function hotHTML(done) {
var l = byHot(TM), top = gcTested(l[0].id);
return '<section class="csg csk"><div class="csg-h"><b>热度榜</b><small>按测过的人数排名</small></div><div class="ckl">' +
l.slice(0, hotOpen ? l.length : 10).map(function (x, i) {
var d = done[x.id];
return '<button type="button" class="ckr g-' + x.group + '" data-test="' + x.id + '"><span class="rk r' + (i < 3 ? i + 1 : 0) + '">' + (i + 1) + '</span>' +
'<span class="tx"><b>' + esc(x.title) + '</b><span class="hb"><i style="width:' + Math.max(18, Math.round(gcTested(x.id) / top * 100)) + '%"></i></span>' +
'<small><em>' + TG[x.group] + '</em>' + gcTestedText(x.id) + (d ? ' · 已测' : '') + '</small></span>' +
'<span class="go">' + (d ? '再测' : '去测') + '</span></button>';
}).join('') + '</div><button type="button" class="ckm" data-hot="1">' + (hotOpen ? '收起' : '查看完整榜单(' + l.length + ' 个)') + '</button></section>';
}
function ceshiListHTML() {
var done = csDone();
return '<div class="csl">' + ['quiz', 'psy', 'game', 'shop'].filter(function (g) { return !tGrp || tGrp === g; }).map(function (g) {
var l = TM.filter(function (x) { return x.group === g; }); if (!l.length) return '';
return '<div class="csl">' + (tGrp ? '' : hotHTML(done)) + ['quiz', 'psy', 'game', 'shop'].filter(function (g) { return !tGrp || tGrp === g; }).map(function (g) {
var l = byHot(TM.filter(function (x) { return x.group === g; })); if (!l.length) return '';
var nd = l.filter(function (x) { return done[x.id]; }).length;
var f = l.filter(function (x) { return !done[x.id]; })[0] || l[0]; /* 推荐位:本组第一个没测过的 */
if (g === 'psy' || g === 'game') return '<section class="csg g-' + g + '"><div class="csg-h"><b>' + TG[g] + '</b><small>' + l.length + ' 套 · ' + TGD[g] + '</small>' + (nd ? '<em>已测 ' + nd + '</em>' : '') + '</div>' + rest(g, l, done) + '</section>';
return '<section class="csg g-' + g + '"><div class="csg-h"><b>' + TG[g] + '</b><small>' + l.length + ' 套 · ' + TGD[g] + '</small>' + (nd ? '<em>已测 ' + nd + '</em>' : '') + '</div>' +
'<button type="button" class="csf" data-test="' + f.id + '"><span class="tx"><small>' + (done[f.id] ? '再测一次' : '本组推荐') + '</small><b>' + esc(f.title) + '</b><p>' + esc(f.sub) + '</p><i class="pc">' + gcTestedText(f.id) + '</i>' +
'<button type="button" class="csf" data-test="' + f.id + '"><span class="tx"><small>' + (done[f.id] ? '再测一次' : f === l[0] ? '本组最热' : '本组推荐') + '</small><b>' + esc(f.title) + '</b><p>' + esc(f.sub) + '</p><i class="pc">' + gcTestedText(f.id) + '</i>' +
'<span class="go">' + (done[f.id] ? '再测' : '开始测') + '<svg class="ic"><use href="#i-right"/></svg></span></span><img src="ceshi/img/' + f.id + '_s.webp" alt="" loading="lazy"></button>' +
rest(g, l.filter(function (x) { return x !== f; }), done) + '</section>';
}).join('') + '</div>';
@@ -1111,6 +1138,7 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:poin
});
}
$('#more').addEventListener('click', function (e) {
if (e.target.closest('[data-hot]')) { e.stopPropagation(); haptic(); hotOpen = !hotOpen; var k = $('#more .csk'); if (k) k.outerHTML = hotHTML(csDone()); return; }
var ts = e.target.closest('[data-test]');
if (ts) { e.stopPropagation(); haptic(); location.href = ceshiURL(ts.dataset.test, true); }
}, true);

View File

@@ -105,7 +105,7 @@ main{padding:6px 16px 0}
</div>
<div class="wb"><button type="button" id="write"><svg class="ic" viewBox="0 0 24 24"><path d="M12 20h9M16.5 3.5a2.1 2.1 0 013 3L7 19l-4 1 1-4z"/></svg>写新的故事</button></div>
<script src="../topics.js?v=26110224"></script>
<script src="../topics.js?v=26110225"></script>
<script>
(function () {
'use strict';