diff --git a/src/pyj/book_list/top_bar.pyj b/src/pyj/book_list/top_bar.pyj index 1270865df0..bb845ef582 100644 --- a/src/pyj/book_list/top_bar.pyj +++ b/src/pyj/book_list/top_bar.pyj @@ -71,7 +71,10 @@ def set_left_data(container, title='calibre', icon='heart', action=None, tooltip a.setAttribute('href', interface_data.donate_link) a.setAttribute('target', 'donate-to-calibre') if action is not None: - a.addEventListener('click', def(event): event.preventDefault(), action();) + a.addEventListener('click', def(event): + event.preventDefault() + action.bind(event)() + ) if callable(title_action): a = a.nextSibling diff --git a/src/pyj/read_book/overlay.pyj b/src/pyj/read_book/overlay.pyj index 2c51a7710f..2e87c0373f 100644 --- a/src/pyj/read_book/overlay.pyj +++ b/src/pyj/read_book/overlay.pyj @@ -220,11 +220,12 @@ add_extra_css(def(): def simple_overlay_title(title, overlay, container): container.style.backgroundColor = get_color('window-background') - create_top_bar(container, title=title, icon='close', action=def (event): - event.preventDefault() - event.stopPropagation() - overlay.hide_current_panel(event) - ) + def action(): + event = this + event.stopPropagation() + overlay.hide_current_panel(event) + + create_top_bar(container, title=title, icon='close', action=action) class MainOverlay: # {{{