diff --git a/src/pyj/read_book/content_popup.pyj b/src/pyj/read_book/content_popup.pyj index ad3be23c8c..187d8f2f3b 100644 --- a/src/pyj/read_book/content_popup.pyj +++ b/src/pyj/read_book/content_popup.pyj @@ -22,7 +22,7 @@ add_extra_css(def(): style += build_rule(sel, border_radius='8px', border='solid currentColor 2px', margin='1rem', padding='0.5rem', box_shadow='2px 2px 4px currentColor') sel += ' > div' - style += build_rule(sel, padding_bottom='1ex', margin_bottom='1ex', border_bottom='solid currentColor 2px', display='flex', justify_content='space-between', align_items='center') + style += build_rule(sel, display='flex', justify_content='space-between', align_items='center') sel += ' > div' # button container style += build_rule(sel, display='flex', justify_content='space-between', align_items='center') @@ -134,13 +134,31 @@ class ContentPopupOverlay: if not self.iframe_wrapper: self.create_iframe() self.current_footnote_data = data - width = 100 // data.cols_per_screen c = self.container.firstChild - c.style.width = f'{width}vw' header = c.firstChild + s = header.style + s.paddingLeft = s.paddingRight = s.paddingBottom = s.paddingTop = '0' + s.marginLeft = s.marginRight = s.marginBottom = s.marginTop = '0' + s.borderBottom = s.borderTop = s.borderLeft = s.borderRight = 'solid currentColor 0' + bs = 'solid currentColor 2px' + if self.current_footnote_data.vertical_writing_mode: + c.style.width = str(50 // data.cols_per_screen) + 'vw' + self.iframe.style.height = '80vh' + c.style.writingMode = 'vertical-rl' if self.current_footnote_data.rtl else 'vertical-lr' + if self.current_footnote_data.rtl: + s.paddingLeft = s.marginLeft = '1ex' + s.borderLeft = bs + else: + s.paddingRight = s.marginRight = '1ex' + s.borderRight = bs + else: + c.style.width = str(100 // data.cols_per_screen) + 'vw' + self.iframe.style.height = '12ex' + c.style.writingMode = 'horizontal-rl' if self.current_footnote_data.rtl else 'horizontal-lr' + s.paddingBottom = s.marginBottom = '1ex' + s.borderBottom = bs self.create_footnote_header(header) self.load_doc(data.name, self.show_footnote_item) - self.iframe.style.height = '12ex' self.iframe_wrapper.send_message('clear', text=_('Loading note, please wait...')) def show_footnote_item(self, resource_data): diff --git a/src/pyj/read_book/iframe.pyj b/src/pyj/read_book/iframe.pyj index 149620390a..832bf082a8 100644 --- a/src/pyj/read_book/iframe.pyj +++ b/src/pyj/read_book/iframe.pyj @@ -728,7 +728,11 @@ class IframeBoss: self.send_message('scroll_to_anchor', name=name, frag=frag) def on_fake_popup_activation(self, data): - self.send_message('show_footnote', name=data.name, frag=data.frag, title=data.title, cols_per_screen=calc_columns_per_screen()) + self.send_message( + 'show_footnote', name=data.name, frag=data.frag, title=data.title, + cols_per_screen=calc_columns_per_screen(), rtl=scroll_viewport.rtl, + vertical_writing_mode=scroll_viewport.vertical_writing_mode + ) def scroll_to_anchor(self, frag): if frag: