Viewer: Fix restoring user stylesheet to default not being applied until a viewer restart

This commit is contained in:
Kovid Goyal 2019-11-10 07:30:38 +05:30
parent 6ec980c99f
commit 263bb0ce88
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -49,13 +49,14 @@ def apply_colors():
def apply_stylesheet(): def apply_stylesheet():
if opts.user_stylesheet: sid = 'calibre-browser-viewer-user-stylesheet'
sid = 'calibre-browser-viewer-user-stylesheet' style = document.getElementById(sid)
style = document.getElementById(sid) if not style:
if not style: if not opts.user_stylesheet:
style = E.style(type='text/css', id=sid) return
document.documentElement.appendChild(style) style = E.style(type='text/css', id=sid)
style.textContent = opts.user_stylesheet document.documentElement.appendChild(style)
style.textContent = opts.user_stylesheet
def apply_settings(): def apply_settings():