Fix needing to restart viewer for changes in the background image

This commit is contained in:
Kovid Goyal 2019-09-27 09:11:06 +05:30
parent d9061421e4
commit 77a0a77723
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 2 additions and 3 deletions

View File

@ -442,7 +442,7 @@ class View:
self.iframe.style.backgroundColor = ans.background or 'white' self.iframe.style.backgroundColor = ans.background or 'white'
bg_image = sd.get('background_image') bg_image = sd.get('background_image')
if bg_image: if bg_image:
self.iframe.style.backgroundImage = f'url({READER_BACKGROUND_URL})' if runtime.is_standalone_viewer else f'url({bg_image})' self.iframe.style.backgroundImage = f'url({READER_BACKGROUND_URL}?{Date().getTime()})' if runtime.is_standalone_viewer else f'url({bg_image})'
else: else:
self.iframe.style.backgroundImage = 'none' self.iframe.style.backgroundImage = 'none'
if sd.get('background_image_style') is 'scaled': if sd.get('background_image_style') is 'scaled':

View File

@ -241,8 +241,7 @@ def get_current_cfi(request_id):
def background_image_changed(img_id): def background_image_changed(img_id):
img = document.getElementById(img_id) img = document.getElementById(img_id)
if img: if img:
img.src = '' img.src = READER_BACKGROUND_URL + '?' + Date().getTime()
img.src = READER_BACKGROUND_URL
def onerror(msg, script_url, line_number, column_number, error_object): def onerror(msg, script_url, line_number, column_number, error_object):