Refactor: 1167 _esc() → UI.escape() in 36 Dateien, SW by-v1113
Bündel 1 aus dem Duplikat-Audit: existierende zentrale Helper nutzen
statt lokale Duplikate.
Pure Migration ohne neuen Code:
- 1167 _esc()-Aufrufe in 36 Page-Modulen migriert auf UI.escape()
- 24 lokale _esc/_escape-Definitionen entfernt
- lost.js hatte _escape() (Variante) — 17 Aufrufe ebenfalls migriert
- jobs.js + breeder.js: tote Alias-Wrapper entfernt
UI.escape() existierte schon — wurde nur überall lokal nochmal
implementiert. Funktional identisch (gleiche 4-replace-chain für
& < > ").
Tests 19/19 grün. Frontend-LOC um ~120 Zeilen reduziert.
Hinweis: _emptyState (7 Stellen) und _icon (8 Stellen) wurden NICHT
migriert — sie haben abweichende Signaturen von UI.emptyState({...})
bzw. UI.icon(name). Eigener Sprint nötig.
This commit is contained in:
parent
e7939ce98e
commit
c517c9281d
42 changed files with 1115 additions and 1341 deletions
|
|
@ -77,10 +77,10 @@ window.Page_partner = (() => {
|
|||
<div style="position:absolute;top:0;left:0;right:0;height:3px;background:${grad}"></div>
|
||||
<div style="display:flex;align-items:center;gap:var(--space-3)">
|
||||
${p.logo_url
|
||||
? `<img src="${_esc(p.logo_url)}" alt=""
|
||||
? `<img src="${UI.escape(p.logo_url)}" alt=""
|
||||
style="width:56px;height:56px;border-radius:var(--radius-md);object-fit:contain;flex-shrink:0;background:var(--c-surface-2);padding:4px">`
|
||||
: p.avatar_url
|
||||
? `<img src="${_esc(p.avatar_url)}" alt=""
|
||||
? `<img src="${UI.escape(p.avatar_url)}" alt=""
|
||||
style="width:56px;height:56px;border-radius:50%;object-fit:cover;flex-shrink:0">`
|
||||
: `<div style="width:56px;height:56px;border-radius:50%;flex-shrink:0;
|
||||
background:${grad};display:flex;align-items:center;
|
||||
|
|
@ -89,19 +89,19 @@ window.Page_partner = (() => {
|
|||
</div>`
|
||||
}
|
||||
<div class="flex-1-min">
|
||||
<div style="font-weight:700;font-size:var(--text-base)">${_esc(p.display_name || p.name)}</div>
|
||||
${p.tagline ? `<div style="font-size:var(--text-xs);color:var(--c-text-muted);margin-top:1px">${_esc(p.tagline)}</div>` : ''}
|
||||
<div style="font-weight:700;font-size:var(--text-base)">${UI.escape(p.display_name || p.name)}</div>
|
||||
${p.tagline ? `<div style="font-size:var(--text-xs);color:var(--c-text-muted);margin-top:1px">${UI.escape(p.tagline)}</div>` : ''}
|
||||
<div style="display:flex;flex-wrap:wrap;gap:var(--space-2);margin-top:var(--space-1)">
|
||||
${p.website ? `<a href="${_esc(p.website)}" target="_blank" rel="noopener"
|
||||
${p.website ? `<a href="${UI.escape(p.website)}" target="_blank" rel="noopener"
|
||||
style="font-size:var(--text-xs);color:var(--c-primary)">
|
||||
🌐 ${_esc(p.website.replace(/^https?:\/\//, ''))}</a>` : ''}
|
||||
${p.instagram ? `<span class="text-xs-muted">📸 ${_esc(p.instagram)}</span>` : ''}
|
||||
🌐 ${UI.escape(p.website.replace(/^https?:\/\//, ''))}</a>` : ''}
|
||||
${p.instagram ? `<span class="text-xs-muted">📸 ${UI.escape(p.instagram)}</span>` : ''}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
${p.pp_bio || p.bio ? `<p style="margin:var(--space-3) 0 0;font-size:var(--text-sm);
|
||||
color:var(--c-text-secondary);line-height:1.5">
|
||||
${_esc(p.pp_bio || p.bio)}
|
||||
${UI.escape(p.pp_bio || p.bio)}
|
||||
</p>` : ''}
|
||||
${p.photos?.length ? `
|
||||
<div style="display:grid;grid-template-columns:repeat(${Math.min(p.photos.length,3)},1fr);
|
||||
|
|
@ -109,9 +109,9 @@ window.Page_partner = (() => {
|
|||
${p.photos.slice(0,3).map(url => {
|
||||
const isVid = url.endsWith('.mp4') || url.endsWith('.webm');
|
||||
return isVid
|
||||
? `<video src="${_esc(url)}" style="width:100%;aspect-ratio:1;object-fit:cover"
|
||||
? `<video src="${UI.escape(url)}" style="width:100%;aspect-ratio:1;object-fit:cover"
|
||||
muted playsinline loop autoplay></video>`
|
||||
: `<img src="${_esc(url)}" style="width:100%;aspect-ratio:1;object-fit:cover">`;
|
||||
: `<img src="${UI.escape(url)}" style="width:100%;aspect-ratio:1;object-fit:cover">`;
|
||||
}).join('')}
|
||||
</div>` : ''}
|
||||
</div>
|
||||
|
|
@ -143,10 +143,6 @@ window.Page_partner = (() => {
|
|||
`;
|
||||
}
|
||||
|
||||
function _esc(s) {
|
||||
return String(s || '').replace(/[&<>"']/g, c =>
|
||||
({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
|
||||
}
|
||||
|
||||
return { init, refresh, onDogChange };
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue