diff --git a/src/pyj/iframe_comm.pyj b/src/pyj/iframe_comm.pyj
index 39fcfa456d..35c178c298 100644
--- a/src/pyj/iframe_comm.pyj
+++ b/src/pyj/iframe_comm.pyj
@@ -58,13 +58,14 @@ class Messenger:
class IframeWrapper:
- def __init__(self, handlers, iframe, entry_point, bootstrap_text):
+ def __init__(self, handlers, iframe, entry_point, bootstrap_text, srcdoc):
self.messenger = Messenger()
self.iframe_id = ensure_id(iframe, 'content-iframe')
self.needs_init = True
self.ready = False
self.encrypted_communications = False
self.srcdoc_created = False
+ self.constructor_srcdoc = srcdoc
self.entry_point = entry_point
self.bootstrap_text = bootstrap_text
self.handlers = {k: handlers[k] for k in handlers}
@@ -90,7 +91,7 @@ class IframeWrapper:
}
self.iframe.srcdoc = LOADING_DOC.replace(r, def(match, field): return data[field];)
else:
- self.iframe.srcdoc = '
\xa0
'
+ self.iframe.srcdoc = self.constructor_srcdoc or '\xa0
'
self.srcdoc_created = True
def init(self):
diff --git a/src/pyj/read_book/content_popup.pyj b/src/pyj/read_book/content_popup.pyj
index 32b70d7e5d..569bdfc2e3 100644
--- a/src/pyj/read_book/content_popup.pyj
+++ b/src/pyj/read_book/content_popup.pyj
@@ -7,6 +7,7 @@ from gettext import gettext as _
from dom import add_extra_css, build_rule, clear, svgicon
from iframe_comm import IframeWrapper
+from read_book.globals import runtime
from read_book.resources import load_resources
CLASS_NAME = 'book-content-popup-container'
@@ -56,7 +57,10 @@ class ContentPopupOverlay:
'error': self.view.on_iframe_error,
'content_loaded': self.on_content_loaded,
}
- self.iframe_wrapper = IframeWrapper(handlers, iframe, 'read_book.footnotes', _('Loading data, please wait...'))
+ entry_point = None if runtime.is_standalone_viewer else 'read_book.footnotes'
+ self.iframe_wrapper = IframeWrapper(
+ handlers, iframe, entry_point, _('Loading data, please wait...'),
+ '')
self.pending_load = None
@property
@@ -106,7 +110,7 @@ class ContentPopupOverlay:
def cb(resource_data):
self.loaded_resources = resource_data
done_callback(resource_data)
- load_resources(self.view.ui.db, self.view.book, name, self.loaded_resources, cb)
+ load_resources(self.view.book, name, self.loaded_resources, cb)
def show_footnote(self, data):
self.current_footnote_data = data
diff --git a/src/pyj/viewer-main.pyj b/src/pyj/viewer-main.pyj
index 2a95fde3c7..b321ed206e 100644
--- a/src/pyj/viewer-main.pyj
+++ b/src/pyj/viewer-main.pyj
@@ -17,6 +17,7 @@ from read_book.db import new_book
from read_book.globals import runtime, ui_operations
from read_book.iframe import main as iframe_main
from read_book.view import View
+from read_book.footnotes import main as footnotes_main
from session import session_defaults
from utils import encode_query_with_path
from viewer.constants import FAKE_HOST, FAKE_PROTOCOL
@@ -250,5 +251,9 @@ if window is window.top:
set_css(document.body, background_color=get_color('window-background'), color=get_color('window-foreground'))
else:
# iframe
- iframe_main()
+ div = document.getElementById('calibre-viewer-footnote-iframe')
+ if div:
+ footnotes_main()
+ else:
+ iframe_main()
window.calibre_translations_data = v'undefined'