From d64f159044d3bfe591647ebcaee119e7385e0997 Mon Sep 17 00:00:00 2001 From: marwin Date: Wed, 29 Apr 2026 11:52:45 +0200 Subject: [PATCH] EPUB reader: add 'Kein Fett' toggle to suppress book bold Publisher EPUBs often set font-weight via / tags or inline style attributes. A new toggle in the settings panel adds the .reader-no-bold class which overrides all font weights to normal. Co-Authored-By: Claude Sonnet 4.6 --- static/css/app.css | 1 + static/js/app.js | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/static/css/app.css b/static/css/app.css index fb20a2c..5827f44 100644 --- a/static/css/app.css +++ b/static/css/app.css @@ -1725,6 +1725,7 @@ 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; } /* Highlight marks */ +.reader-no-bold * { font-weight: normal !important; } .epub-highlight { border-radius:2px; cursor:pointer; } .epub-highlight[data-color="yellow"] { background:rgba(241,196,15,.4); } .epub-highlight[data-color="green"] { background:rgba(46,204,113,.35); } diff --git a/static/js/app.js b/static/js/app.js index a99d822..bb6e526 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -2743,7 +2743,7 @@ async function _evictBookCache(bookList) { // Reader settings let readerSettings = { fontSize: 16, lineHeight: 1.8, maxWidth: 65, theme: 'dark', - fontFamily: 'serif', + fontFamily: 'serif', noBold: false, pdfZoom: 100, pdfInverted: false, pdfPaginated: false, pdfSpread: false }; let readerSettingsPanelOpen = false; let currentPdfDoc = null; @@ -3580,7 +3580,7 @@ function jumpToTocEntry(href) { function loadReaderSettings(bookId) { // Reset to defaults, then apply per-book overrides Object.assign(readerSettings, { fontSize: 16, lineHeight: 1.8, maxWidth: 65, theme: 'dark', - fontFamily: 'serif', + fontFamily: 'serif', noBold: false, pdfZoom: 100, pdfInverted: false, pdfPaginated: false, pdfSpread: false }); try { const saved = JSON.parse(localStorage.getItem(`diora_reader_settings_${bookId}`) || '{}'); @@ -3613,6 +3613,7 @@ function applyReaderSettings(isPdf) { mono: "'Courier New', monospace", }; contentEl.style.fontFamily = fontMap[readerSettings.fontFamily] || fontMap.serif; + contentEl.classList.toggle('reader-no-bold', !!readerSettings.noBold); if (_currentPositionAnchor && currentBookId) { requestAnimationFrame(() => restoreFromAnchor($('reader-content'), _currentPositionAnchor)); } @@ -3657,6 +3658,7 @@ function toggleSettingsPanel() { + @@ -3716,6 +3718,13 @@ function toggleSettingsPanel() { }); }); + panel.querySelector('#rs-no-bold').addEventListener('click', function () { + readerSettings.noBold = !readerSettings.noBold; + this.classList.toggle('active', readerSettings.noBold); + applyReaderSettings(false); + saveReaderSettings(); + }); + panel.querySelectorAll('[data-rs-theme]').forEach(btn => { btn.addEventListener('click', () => { readerSettings.theme = btn.dataset.rsTheme;