评论/回复只显示审核通过的(星空留言、广场、专题页,自己也不显示审核中);星空亮星均匀铺满整片夜空

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
deploy
2026-11-07 03:23:48 +00:00
parent 35717e8793
commit 580f5144a7
5 changed files with 32 additions and 25 deletions

View File

@@ -3,7 +3,7 @@
(function () {
'use strict';
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
var VER = '26110622';
var VER = '26110623';
const $ = (s, c) => (c || document).querySelector(s);
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
@@ -4520,23 +4520,26 @@
}
/* 亮星落在夜空中上部偏右(流星往左下走,右边起步才划得够长);抖动网格,不会叠在一起 */
function paintSky(l) {
/* 11-07 用户:可以点的星星再多一些 → 超过 26 颗时铺开到 6 列、更宽更高的一片,点得到不挤 */
const n = l.length, big = n > 26, cols = big ? 6 : n > 16 ? 5 : 4, rows = Math.max(2, Math.ceil(n / cols));
const X0 = big ? 16 : 36, XW = big ? 78 : 58, Y0 = big ? 30 : 21, YH = big ? 38 : 38; // 铺开时从话题牌下面开始,不压标题
/* 11-07 用户:「星星要均匀地挂在星空中,不要密集地放在一个地方」→ 话题牌下面到「说一句」上面整片夜空
(横 8–92%、竖 31–79%)切成差不多正方的格子,n 颗星按等间隔挑格子,每格里小幅抖动 */
const n = l.length, X0 = 8, XW = 84, Y0 = 31, YH = 48;
const pw = page.clientWidth || 390, phh = page.clientHeight || 844;
const cols = Math.max(3, Math.round(Math.sqrt(n * (XW * pw) / (YH * phh)))), rows = Math.max(2, Math.ceil(n / cols));
const cell = l.map((it, i) => Math.floor(i * cols * rows / n));
const fresh = l.findIndex(x => !x.mine && !seen.has(x.id));
const xs = l.map((it, i) => X0 + ((i % cols + .5 + ((hsh(it.id) % 100) / 100 - .5) * .7) / cols) * XW);
const xs = l.map((it, i) => X0 + ((cell[i] % cols + .5 + ((hsh(it.id) % 100) / 100 - .5) * .6) / cols) * XW);
/* 十三改(用户:「每点一下都是一个音符,每一个星星代表不同的音符」):
按横向位置从左到右排成一架竖琴——越靠左越低、越靠右越高,五声音阶(C4 起),连着点就是一段旋律 */
const rank = xs.map((x, i) => i).sort((p, q) => xs[p] - xs[q]);
const note = [];
rank.forEach((i, k) => { note[i] = PENTA[k % PENTA.length]; });
$('#wskBright').innerHTML = l.map((it, i) => {
const h = hsh(it.id), r = Math.floor(i / cols);
const h = hsh(it.id), r = Math.floor(cell[i] / cols);
const x = xs[i];
const y = Y0 + ((r + .5 + (((h >> 8) % 100) / 100 - .5) * .6) / rows) * YH;
const y = Y0 + ((r + .5 + (((h >> 8) % 100) / 100 - .5) * .5) / rows) * YH;
const sz = it.mine ? 26 : Math.round(15 + Math.min(it.hugs || 0, 30) / 30 * 11);
return '<button type="button" class="wsk-st' + (it.mine ? ' mine' : '') + (seen.has(it.id) ? ' used' : '') + (i === fresh && !seen.size ? ' hint' : '') +
'" data-go="' + (i + 1) + '" data-note="' + note[i].toFixed(1) + '" style="left:' + x.toFixed(1) + '%;top:' + y.toFixed(1) + '%;--s:' + sz + 'px;--tw:' + (2 + (h % 30) / 10).toFixed(1) + 's" aria-label="' + esc(it.text) + '"><i></i></button>';
'" data-go="' + (i + 1) + '" data-hx="' + x.toFixed(1) + '" data-hy="' + y.toFixed(1) + '" data-note="' + note[i].toFixed(1) + '" style="left:' + x.toFixed(1) + '%;top:' + y.toFixed(1) + '%;--s:' + sz + 'px;--tw:' + (2 + (h % 30) / 10).toFixed(1) + 's" aria-label="' + esc(it.text) + '"><i></i></button>';
}).join('');
}
function paintList(l) {
@@ -4589,8 +4592,9 @@
function reborn(btn) {
setTimeout(() => {
if (!btn.isConnected || !btn.classList.contains('used')) return;
btn.style.left = (36 + Math.random() * 58).toFixed(1) + '%';
btn.style.top = (21 + Math.random() * 38).toFixed(1) + '%';
/* 回到自己那一格(小幅挪一点),整片星空保持均匀 */
btn.style.left = (+btn.dataset.hx + (Math.random() - .5) * 4).toFixed(1) + '%';
btn.style.top = (+btn.dataset.hy + (Math.random() - .5) * 3).toFixed(1) + '%';
btn.classList.remove('used', 'cur', 'flare', 'gone');
btn.classList.add('born');
setTimeout(() => btn.classList.remove('born'), 1500);
@@ -4991,7 +4995,7 @@
/* 11-07 悄悄话第 2 步(用户定):星空页「说一句」并入留言区 —— 发成置顶笔记下的留言(先审后发),赞够门槛自动挂星 */
if (window.MBWhCm) {
MBWhCm.post(t, data.week)
.then(m => { if (m) { toast(m); return; } closeModal(); toast('发出去了,审核通过后大家就能看到'); })
.then(m => { if (m) { toast(m); return; } closeModal(); toast('已提交,审核通过后才会显示'); })
.then(() => { busy = false; btn.disabled = false; btn.textContent = '悄悄发出'; });
return;
}