diff --git a/src/pyj/read_book/prefs/selection.pyj b/src/pyj/read_book/prefs/selection.pyj index 977dabf771..6789b8145a 100644 --- a/src/pyj/read_book/prefs/selection.pyj +++ b/src/pyj/read_book/prefs/selection.pyj @@ -40,8 +40,15 @@ def create_selection_panel(container, apply_func, cancel_func): ans.checked = True return E.div(style='margin-top:1ex', E.label(ans, '\xa0' + text)) + def url(name, text, title): + ans = E.input(type='url', name=name, value=sd.get(name), size='50', title=title or '') + return E.div(style='margin-top:1ex', E.label(text, E.br(), ans)) + container.appendChild(cb( 'show_selection_bar', _('Show a popup bar with common actions next to selected text'))) + container.appendChild(url( + 'net_search_url', _('URL to query when searching the internet'), + _('The {q} in the URL is replaced by the selected text'))) container.appendChild(create_button_box(restore_defaults, apply_func, cancel_func)) diff --git a/src/pyj/read_book/selection_bar.pyj b/src/pyj/read_book/selection_bar.pyj index d391778865..214880af72 100644 --- a/src/pyj/read_book/selection_bar.pyj +++ b/src/pyj/read_book/selection_bar.pyj @@ -89,7 +89,7 @@ class SelectionBar: text = self.view.currently_showing.selection.text if text: q = encodeURIComponent(text) - url = f'https://google.com/search?q={q}' + url = get_session_data().get('net_search_url').format(q=q) ui_operations.open_url(url) def clear_selection(self): diff --git a/src/pyj/session.pyj b/src/pyj/session.pyj index e3704e0439..2a1e75706e 100644 --- a/src/pyj/session.pyj +++ b/src/pyj/session.pyj @@ -65,6 +65,7 @@ defaults = { 'highlight_style': None, 'custom_highlight_colors': v'[]', 'show_selection_bar': True, + 'net_search_url': 'https://google.com/search?q={q}', } is_local_setting = {