Clean up modal formatting

This commit is contained in:
Kovid Goyal 2023-10-23 08:43:00 +05:30
parent 7ed3cc1134
commit c379616be0
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 6 additions and 18 deletions

View File

@ -87,21 +87,9 @@ def open_book_url(book_id, fmt, extra_query):
return ans + encode_query(q, '#') return ans + encode_query(q, '#')
def show_note_url(book_id, field, item_id, item_value, library_id=None, close_action='back'):
lid = library_id or current_library_id()
ans = absolute_path('')
q = {
'book_id':book_id + '', 'field': field, 'item':item_value + '',
'item_id': item_id + '', 'panel': 'show_note', 'close_action': close_action
}
if lid:
q.library_id = lid
return ans + encode_query(q, '#')
def show_note(book_id, field, item_id, item_value, replace=False, library_id=None, close_action='back', panel='show_note'): def show_note(book_id, field, item_id, item_value, replace=False, library_id=None, close_action='back', panel='show_note'):
lid = library_id or current_library_id() lid = library_id or current_library_id()
q = {'book_id':book_id + '', 'field': field, 'item':item_value + '', 'item_id': item_id + '', 'panel': panel} q = {'book_id':book_id + '', 'field': field, 'item':item_value + '', 'item_id': (item_id or '')+ '', 'panel': panel}
if panel is 'show_note': if panel is 'show_note':
q.close_action = close_action q.close_action = close_action
if lid: if lid:

View File

@ -233,8 +233,8 @@ def menu_clicked(i):
title = E.h2( title = E.h2(
style='display:flex; align-items: center; border-bottom: solid 1px currentColor; font-weight:bold; font-size:' + get_font_size('title'), style='display:flex; align-items: center; border-bottom: solid 1px currentColor; font-weight:bold; font-size:' + get_font_size('title'),
E.img(src=icon_for_node(node), style='height:2ex'), E.img(src=icon_for_node(node), style='height:2ex; margin-right: 0.5rem'),
E.span('\xa0' + name + suffix) E.span(name + suffix)
) )
container.appendChild(title) container.appendChild(title)
container.appendChild(E.div( container.appendChild(E.div(
@ -257,8 +257,8 @@ def menu_clicked(i):
for text, search_type in items: for text, search_type in items:
li = E.li( li = E.li(
style='display:flex; align-items: center; margin-bottom:0.5ex; padding: 0.5ex; cursor:pointer', style='display:flex; align-items: center; margin-bottom:0.5ex; padding: 0.5ex; cursor:pointer',
E.img(src=absolute_path('{}/{}.png'.format(interface_data.icon_path, search_type)), style='max-height: 2.5ex'), E.img(src=absolute_path('{}/{}.png'.format(interface_data.icon_path, search_type)), style='max-height: 2.5ex; margin-right:0.5rem'),
E.span('\xa0' + text) E.span(text)
) )
li.addEventListener('click', add_to_search.bind(None, node, search_type)) li.addEventListener('click', add_to_search.bind(None, node, search_type))
li.addEventListener('click', hide_modal) li.addEventListener('click', hide_modal)

View File

@ -55,7 +55,7 @@ class ModalContainer:
set_css(div, set_css(div,
position='fixed', top='0', right='0', bottom='0', left='0', # Stretch over entire window position='fixed', top='0', right='0', bottom='0', left='0', # Stretch over entire window
background_color='rgba(0,0,0,0.8)', z_index=MODAL_Z_INDEX + '', background_color='rgba(0,0,0,0.8)', z_index=MODAL_Z_INDEX + '',
display='none', text_align='center', user_select='none' display='none', user_select='none'
) )
# Popup style # Popup style