feat(星座宝宝): 12 个自绘星座符号;弹窗按火土风水四象重做——头带配色、星图、元素纹样 (v26100426)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
18
js/app.js
18
js/app.js
@@ -3,7 +3,7 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
|
||||
var VER = '26100425';
|
||||
var VER = '26100426';
|
||||
const $ = (s, c) => (c || document).querySelector(s);
|
||||
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
|
||||
|
||||
@@ -885,20 +885,34 @@
|
||||
const M = $('#modalZodiac'); if (!M) return;
|
||||
function fill(n) {
|
||||
const z = ZODIAC[n]; if (!z) return;
|
||||
const el_ = (window.ZODIAC_ELEMENT || {})[n] || 'fire', th = (window.ZODIAC_THEME || {})[el_] || {};
|
||||
M.className = M.className.replace(/\bel-\w+/g, '').trim() + ' el-' + el_;
|
||||
M.style.setProperty('--zc', z[2]);
|
||||
if (th.band) { M.style.setProperty('--zb', th.band); M.style.setProperty('--zbody', th.body); M.style.setProperty('--zi', th.ink); }
|
||||
$('#zdGlyph').innerHTML = window.zodiacIcon ? window.zodiacIcon(n, 30, 1.7) : '';
|
||||
$('#zdName').textContent = n + '宝宝';
|
||||
$('#zdEl').textContent = th.name || '';
|
||||
$('#zdRange').textContent = z[0] + ' · 按预产期推算';
|
||||
$('#zdWords').textContent = th.words || '';
|
||||
// 星图
|
||||
const st = (window.ZODIAC_STARS || {})[n], sky = $('#zdSky');
|
||||
sky.innerHTML = st ? st[1].map(([a, b]) => '<line x1="' + st[0][a][0] * 100 + '" y1="' + st[0][a][1] * 100 + '" x2="' + st[0][b][0] * 100 + '" y2="' + st[0][b][1] * 100 + '"/>').join('') +
|
||||
st[0].map((p, i) => '<circle cx="' + p[0] * 100 + '" cy="' + p[1] * 100 + '" r="' + (1 + p[2] * 1.6).toFixed(2) + '" style="animation-delay:' + (i * .45 % 3).toFixed(2) + 's"/>').join('') : '';
|
||||
const mo = (window.ZODIAC_MOTIF || {})[el_];
|
||||
$('#zdMotif').innerHTML = mo ? mo.map(d => '<path d="' + d + '"/>').join('') : '';
|
||||
$('#zdColor').textContent = z[1]; $('#zdColorTip').textContent = z[3];
|
||||
const T = $('#zdTraits'); T.innerHTML = ''; z[4].forEach(t => T.appendChild(el('span', '', t)));
|
||||
$('#zdPara').textContent = z[5];
|
||||
const J = $('#zdJobs'); J.innerHTML = ''; z[6].forEach(t => J.appendChild(el('span', '', t)));
|
||||
M.scrollTop = 0;
|
||||
}
|
||||
window.addEventListener('mb-zodiac', e => {
|
||||
const names = (e.detail && e.detail.names || []).filter(n => ZODIAC[n]); if (!names.length) return;
|
||||
const sw = $('#zdSwitch'); sw.innerHTML = '';
|
||||
sw.hidden = names.length < 2;
|
||||
if (names.length > 1) names.forEach((n, i) => {
|
||||
const b = el('button', i ? '' : 'on', n + '宝宝'); b.type = 'button';
|
||||
const b = el('button', i ? '' : 'on'); b.type = 'button';
|
||||
b.innerHTML = (window.zodiacIcon ? window.zodiacIcon(n, 12, 2.2) : '') + '<span>' + n + '宝宝</span>';
|
||||
b.addEventListener('click', () => { $$('button', sw).forEach(x => x.classList.toggle('on', x === b)); fill(n); });
|
||||
sw.appendChild(b);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user