koishi-plugin-dwrgbwiki 2.0.3 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/basicdata.js CHANGED
@@ -189,9 +189,6 @@ function renderName(name) {
189
189
 
190
190
  function buildRankingHtml(r, config, highlight) {
191
191
  const width = config.width || 1300
192
- const half = Math.ceil(r.rows.length / 2)
193
- const left = r.rows.slice(0, half)
194
- const right = r.rows.slice(half)
195
192
 
196
193
  const hlName = highlight ? String(highlight).trim() : ''
197
194
  const hlBase = hlName ? baseName(hlName) : ''
@@ -212,12 +209,10 @@ function buildRankingHtml(r, config, highlight) {
212
209
  ? '<div class="hl-note">已高亮:' + renderName(hlRow.name) + ' · 该要素第 ' + (hlRow.rank != null ? hlRow.rank : '-') + ' 名' + (typeof hlRow.value === 'number' ? '(' + hlRow.value.toFixed(2) + ')' : '') + '</div>'
213
210
  : ''
214
211
 
215
- const tableHtml = (rows, title) =>
216
- '<div class="table-col">' +
217
- (title ? '<div class="table-title">' + title + '</div>' : '') +
212
+ const tableHtml = (rows) =>
218
213
  '<table><thead><tr><th class="c-rank">排名</th><th class="c-name">角色名</th><th class="c-val">' + esc(r.col.name) + '</th><th class="c-dev">距平</th></tr></thead><tbody>' +
219
214
  rowHtml(rows) +
220
- '</tbody></table></div>'
215
+ '</tbody></table>'
221
216
 
222
217
  return `<!DOCTYPE html>
223
218
  <html lang="zh-CN">
@@ -232,9 +227,6 @@ body { background:#0d1117; color:#c9d1d9; font-family:-apple-system,BlinkMacSyst
232
227
  .title-bar .metric-tag { color:#58a6ff; font-weight:600; }
233
228
  .card { background:#161b22; border:1px solid #30363d; border-radius:18px; padding:20px; }
234
229
  .hl-note { text-align:center; font-size:14px; color:#ffd76d; font-weight:600; margin:0 0 14px; }
235
- .tables { display:flex; gap:20px; align-items:flex-start; flex-wrap:wrap; }
236
- .table-col { flex:1; min-width:320px; }
237
- .table-title { text-align:center; font-size:14px; color:#d2991d; font-weight:700; margin-bottom:8px; letter-spacing:1px; }
238
230
  table { width:100%; border-collapse:collapse; }
239
231
  thead th { background:#21262d; color:#8b949e; font-size:12px; font-weight:600; padding:8px 10px; text-align:center; border:1px solid #30363d; letter-spacing:.05em; }
240
232
  td { padding:7px 10px; font-size:13px; border:1px solid #21262d; text-align:center; }
@@ -264,10 +256,7 @@ tr.hl td.c-val { color:#ffd76d; }
264
256
  </div>
265
257
  <div class="card">
266
258
  ${noteBar}
267
- <div class="tables">
268
- ${tableHtml(left, left.length ? '排名 1-' + left.length : '')}
269
- ${tableHtml(right, right.length ? '排名 ' + (half + 1) + '-' + r.rows.length : '')}
270
- </div>
259
+ ${tableHtml(r.rows)}
271
260
  </div>
272
261
  <div class="foot">基础数据排名 · 数据根据 BWIKI 基础数据计算 · 无数据不计入排名</div>
273
262
  </div>
@@ -280,6 +269,11 @@ function buildCharacterHtml(d, config) {
280
269
  const { row, items } = d
281
270
  const charName = row.name.replace(/["“”]/g, '')
282
271
  const nameHtml = renderName(charName)
272
+ // 头像:直接使用 statics/角色头像/{角色名}.png(去掉括号后缀/引号),失败时回退首字占位
273
+ const avatarName = baseName(charName)
274
+ const avatarUrl = avatarName
275
+ ? (config.dataSource || 'https://website.homeworkkun.top').replace(/\/+$/, '') + '/statics/角色头像/' + encodeURIComponent(avatarName) + '.png'
276
+ : ''
283
277
 
284
278
  const cellHtml = items.map(it => {
285
279
  const up = it.col.sortType === 'desc'
@@ -304,7 +298,9 @@ body { background:#0d1117; color:#c9d1d9; font-family:-apple-system,BlinkMacSyst
304
298
  .title-bar .metric-tag { color:#58a6ff; font-weight:600; }
305
299
  .card { background:#161b22; border:1px solid #30363d; border-radius:18px; padding:22px 24px; }
306
300
  .hero { display:flex; flex-direction:column; align-items:center; gap:8px; text-align:center; margin-bottom:16px; }
307
- .char-avatar { width:84px; height:84px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:38px; font-weight:700; color:#e6edf3; background:linear-gradient(135deg,#1c2333,#22304a); border:2px solid rgba(88,166,255,.35); box-shadow:0 0 30px rgba(88,166,255,.15); }
301
+ .char-avatar { width:84px; height:84px; border-radius:50%; overflow:hidden; display:flex; align-items:center; justify-content:center; font-size:38px; font-weight:700; color:#e6edf3; background:linear-gradient(135deg,#1c2333,#22304a); border:2px solid rgba(88,166,255,.35); box-shadow:0 0 30px rgba(88,166,255,.15); }
302
+ .avatar-img { width:100%; height:100%; object-fit:cover; display:block; }
303
+ .avatar-fb { display:none; font-size:38px; font-weight:700; color:#e6edf3; }
308
304
  .char-name { font-size:30px; font-weight:800; letter-spacing:1px; color:#e6edf3; }
309
305
  .char-name .morph { color:#8ab4f8; font-size:.75em; font-weight:500; margin-left:.25em; }
310
306
  .char-sub { font-size:13px; color:#8b949e; }
@@ -332,7 +328,10 @@ body { background:#0d1117; color:#c9d1d9; font-family:-apple-system,BlinkMacSyst
332
328
  </div>
333
329
  <div class="card">
334
330
  <div class="hero">
335
- <div class="char-avatar">${esc(charName.charAt(0))}</div>
331
+ <div class="char-avatar">
332
+ <img class="avatar-img" src="${avatarUrl}" alt="" onerror="this.style.display='none';this.nextElementSibling.style.display='flex'">
333
+ <span class="avatar-fb">${esc(charName.charAt(0))}</span>
334
+ </div>
336
335
  <div class="char-name">${nameHtml}</div>
337
336
  <div class="char-sub">${d.items.length} 项数据 · ${d.numCount} 项有数值 · 其余无数据/未公布</div>
338
337
  </div>
package/cangtou.js CHANGED
@@ -103,6 +103,7 @@ function buildText(result, text, mode) {
103
103
  : seg.tag.toUpperCase() + ' ' + seg.input
104
104
  lines.push(line + ' → ' + (seg.item ? itemText(seg.item) : '无匹配'))
105
105
  })
106
+ lines.push('可发送/藏头完整 ' + String(text || '').trim() + ' 以查看更多项目')
106
107
  return lines.join('\n')
107
108
  }
108
109