Preload banner for calendar screen

merge-requests/30/head
Bob Mottram 2024-10-22 13:36:24 +01:00
parent 1dc93f3b89
commit 29107da4c6
2 changed files with 9 additions and 6 deletions

View File

@ -493,16 +493,18 @@ def html_calendar(person_cache: {}, translate: {},
if '/users/' in actor: if '/users/' in actor:
cal_actor = '/users/' + actor.split('/users/')[1] cal_actor = '/users/' + actor.split('/users/')[1]
banner_file, _ = \
get_banner_file(base_dir, nickname, domain, theme)
banner_path = '/users/' + nickname + '/' + banner_file
instance_title = \ instance_title = \
get_config_param(base_dir, 'instanceTitle') get_config_param(base_dir, 'instanceTitle')
preload_images = [] preload_images = [banner_path]
header_str = \ header_str = \
html_header_with_external_style(css_filename, instance_title, None, html_header_with_external_style(css_filename, instance_title, None,
preload_images) preload_images)
# show banner # show banner
banner_file, _ = \
get_banner_file(base_dir, nickname, domain, theme)
calendar_str = \ calendar_str = \
'<header>\n<a href="/users/' + \ '<header>\n<a href="/users/' + \
nickname + '/' + default_timeline + '" title="' + \ nickname + '/' + default_timeline + '" title="' + \
@ -512,7 +514,7 @@ def html_calendar(person_cache: {}, translate: {},
access_keys['menuTimeline'] + '">\n' access_keys['menuTimeline'] + '">\n'
calendar_str += '<img loading="lazy" decoding="async" ' + \ calendar_str += '<img loading="lazy" decoding="async" ' + \
'class="timeline-banner" alt="" ' + \ 'class="timeline-banner" alt="" ' + \
'src="/users/' + nickname + '/' + banner_file + '" /></a>\n' + \ 'src="' + banner_path + '" /></a>\n' + \
'</header>\n' '</header>\n'
# the main graphical calendar as a table # the main graphical calendar as a table

View File

@ -389,6 +389,7 @@ def html_new_post(edit_post_params: {},
# filename of the banner shown at the top # filename of the banner shown at the top
banner_file, _ = \ banner_file, _ = \
get_banner_file(base_dir, nickname, domain, theme) get_banner_file(base_dir, nickname, domain, theme)
banner_path = '/users/' + nickname + '/' + banner_file
if not path.endswith('/newshare') and not path.endswith('/newwanted'): if not path.endswith('/newshare') and not path.endswith('/newwanted'):
if not path.endswith('/newreport'): if not path.endswith('/newreport'):
@ -1085,7 +1086,7 @@ def html_new_post(edit_post_params: {},
date_and_location += end_edit_section() date_and_location += end_edit_section()
instance_title = get_config_param(base_dir, 'instanceTitle') instance_title = get_config_param(base_dir, 'instanceTitle')
preload_images = [] preload_images = [banner_path]
new_post_form = html_header_with_external_style(css_filename, new_post_form = html_header_with_external_style(css_filename,
instance_title, None, instance_title, None,
preload_images) preload_images)
@ -1099,7 +1100,7 @@ def html_new_post(edit_post_params: {},
'accesskey="' + access_keys['menuTimeline'] + '">\n' 'accesskey="' + access_keys['menuTimeline'] + '">\n'
new_post_form += '<img loading="lazy" decoding="async" ' + \ new_post_form += '<img loading="lazy" decoding="async" ' + \
'class="timeline-banner" src="' + \ 'class="timeline-banner" src="' + \
'/users/' + nickname + '/' + banner_file + '" alt="" /></a>\n' + \ banner_path + '" alt="" /></a>\n' + \
'</header>\n' '</header>\n'
mentions_str = '' mentions_str = ''