悄悄话:弹窗只留「被赞 3 次变星星」;星星铺开 6 列;抽屉按方向吸附更跟手、按钮一带上划也能拉开
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
10
js/app.js
10
js/app.js
@@ -3,7 +3,7 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
|
||||
var VER = '26110621';
|
||||
var VER = '26110622';
|
||||
const $ = (s, c) => (c || document).querySelector(s);
|
||||
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
|
||||
|
||||
@@ -4520,9 +4520,11 @@
|
||||
}
|
||||
/* 亮星落在夜空中上部偏右(流星往左下走,右边起步才划得够长);抖动网格,不会叠在一起 */
|
||||
function paintSky(l) {
|
||||
const n = l.length, cols = n > 16 ? 5 : 4, rows = Math.max(2, Math.ceil(n / cols));
|
||||
/* 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; // 铺开时从话题牌下面开始,不压标题
|
||||
const fresh = l.findIndex(x => !x.mine && !seen.has(x.id));
|
||||
const xs = l.map((it, i) => 36 + ((i % cols + .5 + ((hsh(it.id) % 100) / 100 - .5) * .7) / cols) * 58);
|
||||
const xs = l.map((it, i) => X0 + ((i % cols + .5 + ((hsh(it.id) % 100) / 100 - .5) * .7) / cols) * XW);
|
||||
/* 十三改(用户:「每点一下都是一个音符,每一个星星代表不同的音符」):
|
||||
按横向位置从左到右排成一架竖琴——越靠左越低、越靠右越高,五声音阶(C4 起),连着点就是一段旋律 */
|
||||
const rank = xs.map((x, i) => i).sort((p, q) => xs[p] - xs[q]);
|
||||
@@ -4531,7 +4533,7 @@
|
||||
$('#wskBright').innerHTML = l.map((it, i) => {
|
||||
const h = hsh(it.id), r = Math.floor(i / cols);
|
||||
const x = xs[i];
|
||||
const y = 21 + ((r + .5 + (((h >> 8) % 100) / 100 - .5) * .6) / rows) * 38;
|
||||
const y = Y0 + ((r + .5 + (((h >> 8) % 100) / 100 - .5) * .6) / 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>';
|
||||
|
||||
Reference in New Issue
Block a user