From ce33ebe682c3c1fb49be3b1be754442e04ea83e4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 26 Jan 2021 09:51:52 +0530 Subject: [PATCH] DRYer --- src/pyj/read_book/settings.pyj | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/pyj/read_book/settings.pyj b/src/pyj/read_book/settings.pyj index 1a0a536e24..9574862b2d 100644 --- a/src/pyj/read_book/settings.pyj +++ b/src/pyj/read_book/settings.pyj @@ -110,11 +110,7 @@ def apply_colors(is_content_popup): border-radius: 50%;\ } ''' - - # reference mode hint box - text += f'''\n\n - .calibre-reference-mode [data-calibre-ref-num]::before {{ - content: attr(data-calibre-ref-num) !important;\ + hints_box_css = f''' display: inline-block !important;\ position: absolute !important;\ text-indent: 0 !important;\ @@ -125,6 +121,13 @@ def apply_colors(is_content_popup): cursor: default !important;\ padding: 1px !important;\ border: solid 1px {opts.color_scheme.foreground} !important;\ + ''' + + # reference mode hint box + text += f'''\n\n + .calibre-reference-mode [data-calibre-ref-num]::before {{ + content: attr(data-calibre-ref-num) !important;\ + {hints_box_css} }} ''' @@ -132,17 +135,7 @@ def apply_colors(is_content_popup): text += f'''\n\n .calibre-hint-visible::before {{ content: attr(data-calibre-hint-render) !important;\ - display: inline-block !important;\ - position: absolute !important;\ - text-indent: 0 !important;\ - text-decoration: none !important;\ - font-weight: bold !important;\ - color: {selfg} !important;\ - background: {selbg} !important;\ - cursor: default !important;\ - padding: 1px !important;\ - border: solid 1px {opts.color_scheme.foreground} !important;\ - + {hints_box_css} }} .calibre-hint-enter::before {{