Books: fix footnote popover background + strip EPUB title tooltips
Popover had transparent background because --bg-card is explicitly transparent; now uses hardcoded colors with theme-aware overrides. Also strips title attributes during EPUB sanitization to prevent native browser tooltips from appearing while reading. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
bfa0439aa1
commit
5504e5c627
2 changed files with 9 additions and 3 deletions
|
|
@ -1738,8 +1738,10 @@ body.reader-immersive.reader-show-bottom .reader-overlay { bottom: var(--bar-h)
|
||||||
.hl-note-btn { background:none; border:1px solid var(--border); color:var(--fg); padding:2px 6px; border-radius:var(--radius); cursor:pointer; }
|
.hl-note-btn { background:none; border:1px solid var(--border); color:var(--fg); padding:2px 6px; border-radius:var(--radius); cursor:pointer; }
|
||||||
|
|
||||||
/* Footnote popover */
|
/* Footnote popover */
|
||||||
.footnote-popover { position:fixed; z-index:500; max-width:min(400px,90vw); max-height:220px; overflow-y:auto; background:var(--bg-card,#1a1a1a); border:1px solid var(--border); border-radius:var(--radius); padding:10px 28px 10px 12px; box-shadow:0 4px 20px rgba(0,0,0,.6); font-size:0.88em; line-height:1.55; pointer-events:auto; }
|
.footnote-popover { position:fixed; z-index:500; max-width:min(400px,90vw); max-height:220px; overflow-y:auto; background:#1a1a1a; color:#e8e8e8; border:1px solid #444; border-radius:var(--radius); padding:10px 28px 10px 12px; box-shadow:0 4px 20px rgba(0,0,0,.6); font-size:0.88em; line-height:1.55; pointer-events:auto; }
|
||||||
.footnote-popover-close { position:absolute; top:4px; right:6px; background:none; border:none; color:var(--fg-muted,#888); cursor:pointer; font-size:14px; padding:2px 4px; line-height:1; }
|
.footnote-popover.reader-theme-sepia { background:#ede0c4; color:#3b2a1a; border-color:#c8b89a; }
|
||||||
|
.footnote-popover.reader-theme-bright { background:#f0f0f0; color:#111; border-color:#bbb; }
|
||||||
|
.footnote-popover-close { position:absolute; top:4px; right:6px; background:none; border:none; color:inherit; opacity:0.5; cursor:pointer; font-size:14px; padding:2px 4px; line-height:1; }
|
||||||
|
|
||||||
/* Highlight marks */
|
/* Highlight marks */
|
||||||
.reader-no-bold * { font-weight: normal !important; }
|
.reader-no-bold * { font-weight: normal !important; }
|
||||||
|
|
|
||||||
|
|
@ -2606,7 +2606,7 @@ function sanitizeEpubHtml(html) {
|
||||||
|
|
||||||
doc.querySelectorAll('*').forEach(el => {
|
doc.querySelectorAll('*').forEach(el => {
|
||||||
Array.from(el.attributes).forEach(attr => {
|
Array.from(el.attributes).forEach(attr => {
|
||||||
if (attr.name.startsWith('on')) el.removeAttribute(attr.name);
|
if (attr.name.startsWith('on') || attr.name === 'title') el.removeAttribute(attr.name);
|
||||||
});
|
});
|
||||||
const tag = el.tagName.toLowerCase();
|
const tag = el.tagName.toLowerCase();
|
||||||
if (tag === 'img') {
|
if (tag === 'img') {
|
||||||
|
|
@ -4897,6 +4897,10 @@ function showFootnotePopover(link) {
|
||||||
|
|
||||||
const popover = document.createElement('div');
|
const popover = document.createElement('div');
|
||||||
popover.className = 'footnote-popover';
|
popover.className = 'footnote-popover';
|
||||||
|
const _overlay = document.getElementById('reader-overlay');
|
||||||
|
['reader-theme-sepia', 'reader-theme-bright'].forEach(cls => {
|
||||||
|
if (_overlay?.classList.contains(cls)) popover.classList.add(cls);
|
||||||
|
});
|
||||||
popover.innerHTML = clone.innerHTML;
|
popover.innerHTML = clone.innerHTML;
|
||||||
|
|
||||||
const closeBtn = document.createElement('button');
|
const closeBtn = document.createElement('button');
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue