mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Use a URL for the web viewer background image setting
This commit is contained in:
parent
3b1753f134
commit
7d6d5b71c6
@ -23,7 +23,7 @@ def clear_image(img_id):
|
|||||||
document.getElementById(img_id).src = BLANK
|
document.getElementById(img_id).src = BLANK
|
||||||
|
|
||||||
|
|
||||||
def background_widget(sd):
|
def standalone_background_widget(sd):
|
||||||
if sd.get('background_image'):
|
if sd.get('background_image'):
|
||||||
src = READER_BACKGROUND_URL
|
src = READER_BACKGROUND_URL
|
||||||
else:
|
else:
|
||||||
@ -40,6 +40,15 @@ def background_widget(sd):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def background_widget(sd):
|
||||||
|
if runtime.is_standalone_viewer:
|
||||||
|
return standalone_background_widget(sd)
|
||||||
|
return E.div(style='margin-bottom: 1ex', E.label(
|
||||||
|
_('Image URL') + ':\xa0',
|
||||||
|
E.input(type='url', name='background_image', value=sd.get('background_image') or '')
|
||||||
|
))
|
||||||
|
|
||||||
|
|
||||||
def background_style_widget(sd):
|
def background_style_widget(sd):
|
||||||
ans = E.div(E.label(
|
ans = E.div(E.label(
|
||||||
_('Background image style') + ':\xa0',
|
_('Background image style') + ':\xa0',
|
||||||
@ -91,9 +100,12 @@ def commit_user_stylesheet(onchange, container):
|
|||||||
if old is not val:
|
if old is not val:
|
||||||
sd.set('user_stylesheet', val)
|
sd.set('user_stylesheet', val)
|
||||||
changed = True
|
changed = True
|
||||||
bg_image = container.querySelector('img.bg-image-preview').src
|
if runtime.is_standalone_viewer:
|
||||||
if bg_image is BLANK:
|
bg_image = container.querySelector('img.bg-image-preview').src
|
||||||
bg_image = None
|
if bg_image is BLANK:
|
||||||
|
bg_image = None
|
||||||
|
else:
|
||||||
|
bg_image = container.querySelector('input[name=background_image]').value
|
||||||
old = sd.get('background_image')
|
old = sd.get('background_image')
|
||||||
if old is not bg_image:
|
if old is not bg_image:
|
||||||
sd.set('background_image', bg_image)
|
sd.set('background_image', bg_image)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user