大家都在关注 6 篇标题下加作者头像+名字·孕周(头像与广场页同算法)(v26110420)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
15
js/gch/v6.js
15
js/gch/v6.js
@@ -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=26110419';
|
||||
var l = document.createElement('link'); l.rel = 'stylesheet'; l.href = 'js/gch/v4.css?v=26110420';
|
||||
document.head.appendChild(l);
|
||||
var s = document.createElement('script'); s.src = 'js/gch/v4.js?v=26110419';
|
||||
var s = document.createElement('script'); s.src = 'js/gch/v4.js?v=26110420';
|
||||
s.onload = function () { if (sec.querySelector('.g4-foot')) merge(); else sec.addEventListener('gc4-ready', merge, { once: true }); }; /* v4 要先拉 feed.js 才渲染 */
|
||||
document.body.appendChild(s);
|
||||
|
||||
@@ -83,14 +83,21 @@
|
||||
F.slice().sort(function (a, b) { return b.likes - a.likes; }).forEach(function (n) { if (out.length < 6 && out.indexOf(n) < 0) out.push(n); });
|
||||
return out.slice(0, 6);
|
||||
}
|
||||
/* 作者头像:同 guangchang/index.html 的 seed + AV 表(改一边要两边一起改) */
|
||||
var AU_AV = ['m01','m02','m03','m04','m05','m06','m07','m08','m09','m10','m11','m12','m13','m14','m15','m16','m17','m18','m19','m20','m21','m22',
|
||||
'p01','p02','p03','p04','p05','p06','p07','p08','p09','p10','p11','p12','p13','p14','s01','s02','s03','s04','s05','s06','s07','s08','s09','s10',
|
||||
'k01','k02','k03','k04','k05','k06','k07','k08','k09','k10','k11','k12','k13'];
|
||||
function auAv(k) { var h = 7; k = String(k); for (var j = 0; j < k.length; j++) h = (h * 31 + k.charCodeAt(j)) | 0; return 'assets/img/mom/' + AU_AV[Math.abs(h) % AU_AV.length] + '.jpg'; }
|
||||
function paintList() {
|
||||
var l6 = pick6();
|
||||
if (!l6.length) { box.style.display = 'none'; return; }
|
||||
list.innerHTML = l6.map(function (x, i) {
|
||||
var n = x.likes || 0, heat = '<span class="ms-h">' + (i < 3 ? avs(i) : '<svg class="g6-hz" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 20.5s-7.5-4.6-7.5-10.2A4.3 4.3 0 0 1 12 7.6a4.3 4.3 0 0 1 7.5 2.7c0 5.6-7.5 10.2-7.5 10.2z" fill="currentColor"/></svg>') + '<b>' + (n >= 1e4 ? Math.round(n / 1e3) / 10 + '万' : n) + ' 人点赞</b><em class="g6-st">' + esc(x.stage || '') + '</em></span>';
|
||||
var n = x.likes || 0, heat = '<span class="ms-h">' + (i < 3 ? avs(i) : '<svg class="g6-hz" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 20.5s-7.5-4.6-7.5-10.2A4.3 4.3 0 0 1 12 7.6a4.3 4.3 0 0 1 7.5 2.7c0 5.6-7.5 10.2-7.5 10.2z" fill="currentColor"/></svg>') + '<b>' + (n >= 1e4 ? Math.round(n / 1e3) / 10 + '万' : n) + ' 人点赞</b></span>';
|
||||
/* 11-04 用户:「这 6 篇要把作者和头像调出来」→ 标题下加一行 作者头像 + 名字 · 孕周(孕周从点赞行挪过来);头像算法和广场页 avOf 一致,同一作者两边同一张 */
|
||||
var au = x.author ? '<span class="g6-au"><img src="' + esc(x.avatar || auAv(x.author)) + '" alt="" loading="lazy" decoding="async" width="36" height="36"><b>' + esc(x.author) + '</b>' + (x.stage ? '<em>' + esc(x.stage.replace(/\s+/g, '')) + '</em>' : '') + '</span>' : '';
|
||||
var q = new URLSearchParams(location.search); q.set('n', x.id);
|
||||
return '<a class="ms-it ripple g6-nt" href="' + esc('guangchang/?' + q.toString() + location.hash) + '"><i class="ms-no">' + (i + 1) + '</i>' +
|
||||
'<span class="ms-m"><span class="ms-q">' + esc(x.title) + '</span>' + heat + '</span>' +
|
||||
'<span class="ms-m"><span class="ms-q">' + esc(x.title) + '</span>' + au + heat + '</span>' +
|
||||
(x.photo ? '<img class="g6-ph" src="' + esc(x.photo) + '" alt="" loading="lazy">' : '<i class="ms-go">›</i>') + '</a>';
|
||||
}).join('');
|
||||
all.textContent = '去广场看更多 ›';
|
||||
|
||||
Reference in New Issue
Block a user