diff --git a/src/pyj/read_book/content_popup.pyj b/src/pyj/read_book/content_popup.pyj index ff97f76a26..2c356f0d04 100644 --- a/src/pyj/read_book/content_popup.pyj +++ b/src/pyj/read_book/content_popup.pyj @@ -135,7 +135,7 @@ class ContentPopupOverlay: def show_footnote_item_stage2(self, resource_data): self.iframe_wrapper.send_unencrypted_message('display', resource_data=resource_data, book=self.view.book, name=self.current_footnote_data.name, - frag=self.current_footnote_data.frag) + frag=self.current_footnote_data.frag, settings=self.view.iframe_settings()) def on_content_loaded(self, data): self.iframe.style.height = f'{data.height}px' diff --git a/src/pyj/read_book/footnotes.pyj b/src/pyj/read_book/footnotes.pyj index 3f050d5088..2f17ff6bfb 100644 --- a/src/pyj/read_book/footnotes.pyj +++ b/src/pyj/read_book/footnotes.pyj @@ -5,6 +5,7 @@ from __python__ import bound_methods, hash_literals from dom import clear from read_book.comm import IframeClient from read_book.resources import finalize_resources, unserialize_html +from read_book.settings import apply_settings, opts block_names = dict.fromkeys(v"['p', 'div', 'li', 'td', 'h1', 'h2', 'h2', 'h3', 'h4', 'h5', 'h6', 'body']", True).as_object() @@ -200,6 +201,7 @@ class PopupIframeBoss: window.URL.revokeObjectURL(self.blob_url_map[name]) root_data, self.mathjax, self.blob_url_map = finalize_resources(self.book, data.name, data.resource_data) self.resource_urls = unserialize_html(root_data, self.content_loaded, self.show_only_footnote) + apply_settings(data.settings) def on_clear(self, data): clear(document.head) @@ -216,4 +218,14 @@ class PopupIframeBoss: show_footnote(self.frag, known_anchors) def content_loaded(self): + self.apply_colors() + self.apply_font_size() self.comm.send_message('content_loaded', height=document.documentElement.scrollHeight + 25) + + def apply_font_size(self): + document.documentElement.style.fontSize = document.body.style.fontSize = '{}px'.format(opts.base_font_size) + + def apply_colors(self): + for elem in (document.documentElement, document.body): + elem.style.color = opts.color_scheme.foreground + elem.style.backgroundColor = opts.color_scheme.background diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj index 4d83ff09d5..e0e881d6e1 100644 --- a/src/pyj/read_book/view.pyj +++ b/src/pyj/read_book/view.pyj @@ -353,12 +353,9 @@ class View: def redisplay_book(self): self.display_book(self.book) - def show_name(self, name, initial_position=None): - if self.currently_showing.loading: - return - self.processing_spine_item_display = False + def iframe_settings(self, name): sd = get_session_data() - settings={ + return { 'margin_left': 0 if name is self.book.manifest.title_page_name else sd.get('margin_left'), 'margin_right': 0 if name is self.book.manifest.title_page_name else sd.get('margin_right'), 'read_mode': sd.get('read_mode'), @@ -366,8 +363,13 @@ class View: 'color_scheme': self.get_color_scheme(True), 'base_font_size': sd.get('base_font_size'), } + + def show_name(self, name, initial_position=None): + if self.currently_showing.loading: + return + self.processing_spine_item_display = False initial_position = initial_position or {'replace_history':False} - self.currently_showing = {'name':name, 'settings':settings, 'initial_position':initial_position, 'loading':True} + self.currently_showing = {'name':name, 'settings':self.iframe_settings(name), 'initial_position':initial_position, 'loading':True} self.show_loading() spine = self.book.manifest.spine idx = spine.indexOf(name)