diff --git a/src/pyj/book_list/book_details.pyj b/src/pyj/book_list/book_details.pyj index 5a0b309a82..cb3490b1cc 100644 --- a/src/pyj/book_list/book_details.pyj +++ b/src/pyj/book_list/book_details.pyj @@ -133,8 +133,10 @@ def add_stars_to(stars, val, allow_half_stars): window.addEventListener('resize', debounce(adjust_all_iframes, 250)) -def adjusting_sandboxed_html(html): +def adjusting_sandboxed_html(html, extra_css): css = 'html, body {{ overflow: hidden; color: {} }}'.format(get_color('window-foreground')) + if extra_css: + css += '\n\n' + extra_css # allow-same-origin is needed for resizing and allow-popups is needed for # target="_blank" ans = sandboxed_html(html, css, 'allow-same-origin allow-popups allow-popups-to-escape-sandbox') @@ -144,7 +146,7 @@ def adjusting_sandboxed_html(html): return ans -def render_metadata(mi, table, book_id): # {{{ +def render_metadata(mi, table, book_id, iframe_css): # {{{ field_metadata = library_data.field_metadata interface_data = get_interface_data() def allowed_fields(field): @@ -184,7 +186,7 @@ def render_metadata(mi, table, book_id): # {{{ table.appendChild(E.tr(E.td(name + ':'), E.td())) if is_html and /[<>]/.test(val + ''): - table.lastChild.lastChild.appendChild(adjusting_sandboxed_html(val + '')) + table.lastChild.lastChild.appendChild(adjusting_sandboxed_html(val + '', iframe_css)) else: if not join: add_val(val) @@ -371,7 +373,7 @@ def render_metadata(mi, table, book_id): # {{{ name = fm.name or field all_html += f'

{name}

' all_html += comment - iframe = adjusting_sandboxed_html(all_html) + iframe = adjusting_sandboxed_html(all_html, iframe_css) iframe.style.marginTop = '2ex' table.parentNode.appendChild(iframe) # }}} diff --git a/src/pyj/read_book/overlay.pyj b/src/pyj/read_book/overlay.pyj index 46a0ff8810..012b0dfe34 100644 --- a/src/pyj/read_book/overlay.pyj +++ b/src/pyj/read_book/overlay.pyj @@ -625,10 +625,14 @@ class Overlay: container.appendChild(E.div(class_=BD_CLASS_NAME, style='padding: 1ex 1em')) table = E.table(class_='metadata') container.lastChild.appendChild(table) - render_metadata(mi, table) + render_metadata(mi, table, None, f'html {{ font-size: {document.documentElement.style.fontSize} }}') + for a in table.querySelectorAll('a[href]'): + a.removeAttribute('href') + a.removeAttribute('title') + a.classList.remove('blue-link') if pathtoebook: container.lastChild.appendChild(E.div( - style='font-size: smaller; margin-top: 1ex; padding-top: 1ex; border-top: solid 1px', + style='margin-top: 1ex; padding-top: 1ex; border-top: solid 1px', _('Path: {}').format(pathtoebook))) self.panels.push(SimpleOverlay(self, show_metadata_overlay.bind(None, self.view.book.metadata, self.view.book.manifest.pathtoebook), self.view.book.metadata.title))