Fix: restliche CSP-blockierte Inline-Handler — Bild-Fallbacks (globaler data-fb Error-Handler) + Hover-Effekte (CSS-Utilities + data-hover-play)
App ist jetzt vollständig frei von Inline-Event-Handlern (onerror/onmouseenter/etc.). data-fb Modi: hide/hide-parent/dim-grandparent/sibling/show-el/emoji/initials + data-fb-src. Hover: .by-hover-lift/-surface2/-surface3 in utilities.css. SW v1165
This commit is contained in:
parent
2ddd8ac350
commit
c07b1cc01b
23 changed files with 125 additions and 68 deletions
|
|
@ -500,7 +500,7 @@ window.Page_diary = (() => {
|
|||
const icon = L.divIcon({
|
||||
html: hasPhoto
|
||||
? `<div style="width:44px;height:44px;border-radius:50%;overflow:hidden;border:3px solid var(--c-primary,#C4843A);box-shadow:0 2px 8px rgba(0,0,0,.3);background:#fff">
|
||||
<img src="${UI.escape(loc.cover_preview_url || loc.cover_url)}" style="width:100%;height:100%;object-fit:cover" onerror="this.src='${UI.escape(loc.cover_url)}'">
|
||||
<img src="${UI.escape(loc.cover_preview_url || loc.cover_url)}" style="width:100%;height:100%;object-fit:cover" data-fb-src="${UI.escape(loc.cover_url)}">
|
||||
</div>`
|
||||
: `<div style="width:32px;height:32px;border-radius:50%;background:var(--c-primary,#C4843A);border:3px solid #fff;box-shadow:0 2px 8px rgba(0,0,0,.3);display:flex;align-items:center;justify-content:center">
|
||||
<svg style="width:16px;height:16px;fill:#fff" viewBox="0 0 256 256"><path d="M128,16a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,16Zm0,176a80,80,0,1,1,80-80A80.09,80.09,0,0,1,128,192Zm0-104a24,24,0,1,0,24,24A24,24,0,0,0,128,88Z"/></svg>
|
||||
|
|
@ -513,7 +513,7 @@ window.Page_diary = (() => {
|
|||
const marker = L.marker([loc.gps_lat, loc.gps_lon], { icon });
|
||||
marker.bindPopup(`
|
||||
<div style="min-width:160px;cursor:pointer" class="diary-map-popup" data-id="${loc.id}">
|
||||
${hasPhoto ? `<img src="${UI.escape(loc.cover_preview_url || loc.cover_url)}" style="width:100%;height:100px;object-fit:cover;border-radius:6px;display:block;margin-bottom:8px" onerror="this.src='${UI.escape(loc.cover_url)}'">` : ''}
|
||||
${hasPhoto ? `<img src="${UI.escape(loc.cover_preview_url || loc.cover_url)}" style="width:100%;height:100px;object-fit:cover;border-radius:6px;display:block;margin-bottom:8px" data-fb-src="${UI.escape(loc.cover_url)}">` : ''}
|
||||
<div style="font-weight:600;font-size:13px;margin-bottom:2px">${title}</div>
|
||||
<div style="font-size:11px;color:#888">${dateStr}</div>
|
||||
${loc.media_count > 1 ? `<div style="font-size:11px;color:#888;margin-top:2px">📷 ${loc.media_count} Medien</div>` : ''}
|
||||
|
|
@ -569,7 +569,7 @@ window.Page_diary = (() => {
|
|||
<img src="${UI.escape(m.preview_url || m.url)}"
|
||||
${m.preview_url ? `srcset="${UI.escape(m.preview_url)} 800w, ${UI.escape(m.url)} 2000w" sizes="(max-width:400px) 200px, 400px"` : ''}
|
||||
alt="" loading="lazy"
|
||||
onerror="this.src='${UI.escape(m.url)}'">
|
||||
data-fb-src="${UI.escape(m.url)}">
|
||||
</div>`).join('')
|
||||
}</div>`;
|
||||
content.querySelectorAll('.diary-mosaic-item').forEach(el => {
|
||||
|
|
@ -619,7 +619,7 @@ window.Page_diary = (() => {
|
|||
const key = `${year}-${String(month+1).padStart(2,'0')}-${String(d).padStart(2,'0')}`;
|
||||
const entry = byDate[key];
|
||||
cells.push(`<div class="diary-cal-cell${entry?' has-entry':''}${key===today?' today':''}" data-entry-id="${entry?.id||''}">
|
||||
${entry?.cover_url ? `<img src="${UI.escape(entry.cover_preview_url || entry.cover_url)}" alt="" loading="lazy" onerror="this.src='${UI.escape(entry.cover_url)}'">` : ''}
|
||||
${entry?.cover_url ? `<img src="${UI.escape(entry.cover_preview_url || entry.cover_url)}" alt="" loading="lazy" data-fb-src="${UI.escape(entry.cover_url)}">` : ''}
|
||||
<span class="diary-cal-day">${d}</span>
|
||||
</div>`);
|
||||
}
|
||||
|
|
@ -812,7 +812,7 @@ window.Page_diary = (() => {
|
|||
<img src="${e.cover_preview_url || e.cover_url || coverMedia.preview_url || coverMedia.url}"
|
||||
${(e.cover_preview_url && e.cover_url) ? `srcset="${UI.escape(e.cover_preview_url)} 800w, ${UI.escape(e.cover_url)} 2000w" sizes="(max-width:600px) 300px, 600px"` : ''}
|
||||
alt="Foto" loading="lazy"
|
||||
${e.cover_url ? `onerror="this.src='${UI.escape(e.cover_url)}'"` : ''}>
|
||||
${e.cover_url ? `data-fb-src="${UI.escape(e.cover_url)}"` : ''}>
|
||||
${mediaCount > 1 ? `<span class="diary-card-media-count">${mediaCount}</span>` : ''}
|
||||
</div>`;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue