From 1dc93f3b8980405ec486267b0e0b7bc4ce5658cb Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 22 Oct 2024 13:25:55 +0100 Subject: [PATCH] Preload banner for search screen --- webapp_search.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/webapp_search.py b/webapp_search.py index 59b858e76..a1c42cc95 100644 --- a/webapp_search.py +++ b/webapp_search.py @@ -456,12 +456,6 @@ def html_search(translate: {}, base_dir: str, path: str, domain: str, if os.path.isfile(base_dir + '/search.css'): css_filename = base_dir + '/search.css' - instance_title = get_config_param(base_dir, 'instanceTitle') - preload_images = [] - follow_str = \ - html_header_with_external_style(css_filename, instance_title, None, - preload_images) - # set a search banner search_banner_filename = \ acct_dir(base_dir, search_nickname, domain) + \ @@ -472,10 +466,22 @@ def html_search(translate: {}, base_dir: str, path: str, domain: str, copyfile(base_dir + '/theme/' + theme + '/search_banner.png', search_banner_filename) + users_path = '/users/' + search_nickname # show a banner above the search box search_banner_file, search_banner_filename = \ get_search_banner_file(base_dir, search_nickname, domain, theme) + search_banner_path = users_path + '/' + search_banner_file + + instance_title = get_config_param(base_dir, 'instanceTitle') + + # these images are pre-loaded to prevent the web page from + # jumping around when rendering + preload_images = [search_banner_path] + + follow_str = \ + html_header_with_external_style(css_filename, instance_title, None, + preload_images) text_mode_banner_str = html_keyboard_navigation(text_mode_banner, {}, {}, None, None, None, False) @@ -484,7 +490,6 @@ def html_search(translate: {}, base_dir: str, path: str, domain: str, if os.path.isfile(search_banner_filename): timeline_key = access_keys['menuTimeline'] - users_path = '/users/' + search_nickname follow_str += \ '
\n' + text_mode_banner_str + \ '\n' follow_str += '\n' + \ + search_banner_path + '" alt="" />\n' + \ '
\n' # show the search box