mirror of https://gitlab.com/bashrc2/epicyon
Reduce button headers for text-mode browsers
parent
34e0d69ab9
commit
82144b7937
|
|
@ -47,12 +47,21 @@ def header_buttons_timeline(default_timeline: str,
|
||||||
calendar_image: str,
|
calendar_image: str,
|
||||||
follow_approvals: str,
|
follow_approvals: str,
|
||||||
icons_as_buttons: bool,
|
icons_as_buttons: bool,
|
||||||
access_keys: {}) -> str:
|
access_keys: {},
|
||||||
|
is_text_browser: str) -> str:
|
||||||
"""Returns the header at the top of the timeline, containing
|
"""Returns the header at the top of the timeline, containing
|
||||||
buttons for inbox, outbox, search, calendar, etc
|
buttons for inbox, outbox, search, calendar, etc
|
||||||
"""
|
"""
|
||||||
# start of the button header with inbox, outbox, etc
|
# start of the button header with inbox, outbox, etc
|
||||||
tl_str = '<div id="containerHeader" class="containerHeader"><nav>\n'
|
tl_str = '<div id="containerHeader" class="containerHeader"><nav>\n'
|
||||||
|
|
||||||
|
# if this is a news instance and we are viewing the news timeline
|
||||||
|
features_header = False
|
||||||
|
if default_timeline == 'tlfeatures' and box_name == 'tlfeatures':
|
||||||
|
features_header = True
|
||||||
|
|
||||||
|
if not is_text_browser:
|
||||||
|
|
||||||
# first button
|
# first button
|
||||||
if default_timeline == 'tlmedia':
|
if default_timeline == 'tlmedia':
|
||||||
tl_str += \
|
tl_str += \
|
||||||
|
|
@ -95,11 +104,6 @@ def header_buttons_timeline(default_timeline: str,
|
||||||
' accesskey="' + access_keys['menuInbox'] + '">' + \
|
' accesskey="' + access_keys['menuInbox'] + '">' + \
|
||||||
'<span>' + translate['Inbox'] + '</span></button></a>'
|
'<span>' + translate['Inbox'] + '</span></button></a>'
|
||||||
|
|
||||||
# if this is a news instance and we are viewing the news timeline
|
|
||||||
features_header = False
|
|
||||||
if default_timeline == 'tlfeatures' and box_name == 'tlfeatures':
|
|
||||||
features_header = True
|
|
||||||
|
|
||||||
if not features_header:
|
if not features_header:
|
||||||
tl_str += \
|
tl_str += \
|
||||||
'<a href="' + users_path + '/dm" tabindex="2"'
|
'<a href="' + users_path + '/dm" tabindex="2"'
|
||||||
|
|
@ -189,8 +193,8 @@ def header_buttons_timeline(default_timeline: str,
|
||||||
tl_str += \
|
tl_str += \
|
||||||
'><button class="' + \
|
'><button class="' + \
|
||||||
inbox_button + '" accesskey="' + \
|
inbox_button + '" accesskey="' + \
|
||||||
access_keys['menuInbox'] + '"><span>' + translate['Inbox'] + \
|
access_keys['menuInbox'] + '"><span>' + \
|
||||||
'</span></button></a>'
|
translate['Inbox'] + '</span></button></a>'
|
||||||
|
|
||||||
# show todays events buttons on the first inbox page
|
# show todays events buttons on the first inbox page
|
||||||
happening_str = ''
|
happening_str = ''
|
||||||
|
|
@ -245,6 +249,7 @@ def header_buttons_timeline(default_timeline: str,
|
||||||
'<button class="button">' + \
|
'<button class="button">' + \
|
||||||
translate['Happening This Week'] + '</button></a>'
|
translate['Happening This Week'] + '</button></a>'
|
||||||
|
|
||||||
|
if not is_text_browser:
|
||||||
if not features_header:
|
if not features_header:
|
||||||
# button for the outbox
|
# button for the outbox
|
||||||
tl_str += \
|
tl_str += \
|
||||||
|
|
@ -259,10 +264,13 @@ def header_buttons_timeline(default_timeline: str,
|
||||||
|
|
||||||
# add other buttons
|
# add other buttons
|
||||||
tl_str += \
|
tl_str += \
|
||||||
shares_button_str + wanted_button_str + bookmarks_button_str + \
|
shares_button_str + wanted_button_str + \
|
||||||
events_button_str + \
|
bookmarks_button_str + events_button_str + \
|
||||||
moderation_button_str + happening_str + new_post_button_str
|
moderation_button_str + happening_str + new_post_button_str
|
||||||
|
else:
|
||||||
|
tl_str += happening_str
|
||||||
|
|
||||||
|
if not is_text_browser:
|
||||||
if not features_header:
|
if not features_header:
|
||||||
if not icons_as_buttons:
|
if not icons_as_buttons:
|
||||||
# the search icon
|
# the search icon
|
||||||
|
|
@ -291,6 +299,7 @@ def header_buttons_timeline(default_timeline: str,
|
||||||
print('TIMELINE TIMING ' + box_name + ' 5 = ' + str(time_diff))
|
print('TIMELINE TIMING ' + box_name + ' 5 = ' + str(time_diff))
|
||||||
|
|
||||||
# the calendar button
|
# the calendar button
|
||||||
|
if not is_text_browser:
|
||||||
if not features_header:
|
if not features_header:
|
||||||
calendar_alt_text = translate['Calendar']
|
calendar_alt_text = translate['Calendar']
|
||||||
if new_calendar_event:
|
if new_calendar_event:
|
||||||
|
|
@ -340,6 +349,7 @@ def header_buttons_timeline(default_timeline: str,
|
||||||
'><button class="button">' + \
|
'><button class="button">' + \
|
||||||
'<span>' + translate['User'] + '</span></button></a>'
|
'<span>' + translate['User'] + '</span></button></a>'
|
||||||
|
|
||||||
|
if not is_text_browser:
|
||||||
# the newswire button to show right column links
|
# the newswire button to show right column links
|
||||||
if not icons_as_buttons:
|
if not icons_as_buttons:
|
||||||
tl_str += \
|
tl_str += \
|
||||||
|
|
|
||||||
|
|
@ -793,6 +793,7 @@ def html_timeline(default_timeline: str,
|
||||||
'</header>\n'
|
'</header>\n'
|
||||||
|
|
||||||
if full_width_tl_button_header:
|
if full_width_tl_button_header:
|
||||||
|
is_text_browser = text_mode_browser(ua_str)
|
||||||
tl_str += \
|
tl_str += \
|
||||||
header_buttons_timeline(default_timeline, box_name, page_number,
|
header_buttons_timeline(default_timeline, box_name, page_number,
|
||||||
translate, users_path, media_button,
|
translate, users_path, media_button,
|
||||||
|
|
@ -807,7 +808,8 @@ def html_timeline(default_timeline: str,
|
||||||
domain, timeline_start_time,
|
domain, timeline_start_time,
|
||||||
new_calendar_event, calendar_path,
|
new_calendar_event, calendar_path,
|
||||||
calendar_image, follow_approvals,
|
calendar_image, follow_approvals,
|
||||||
icons_as_buttons, access_keys)
|
icons_as_buttons, access_keys,
|
||||||
|
is_text_browser)
|
||||||
|
|
||||||
# start the timeline
|
# start the timeline
|
||||||
tl_str += \
|
tl_str += \
|
||||||
|
|
@ -844,6 +846,7 @@ def html_timeline(default_timeline: str,
|
||||||
tl_str += ' <td valign="top" class="col-center" tabindex="-1">\n'
|
tl_str += ' <td valign="top" class="col-center" tabindex="-1">\n'
|
||||||
|
|
||||||
if not full_width_tl_button_header:
|
if not full_width_tl_button_header:
|
||||||
|
is_text_browser = text_mode_browser(ua_str)
|
||||||
tl_str += \
|
tl_str += \
|
||||||
header_buttons_timeline(default_timeline, box_name, page_number,
|
header_buttons_timeline(default_timeline, box_name, page_number,
|
||||||
translate, users_path, media_button,
|
translate, users_path, media_button,
|
||||||
|
|
@ -858,7 +861,8 @@ def html_timeline(default_timeline: str,
|
||||||
domain, timeline_start_time,
|
domain, timeline_start_time,
|
||||||
new_calendar_event, calendar_path,
|
new_calendar_event, calendar_path,
|
||||||
calendar_image, follow_approvals,
|
calendar_image, follow_approvals,
|
||||||
icons_as_buttons, access_keys)
|
icons_as_buttons, access_keys,
|
||||||
|
is_text_browser)
|
||||||
|
|
||||||
tl_str += \
|
tl_str += \
|
||||||
' <div id="timelineposts" class="timeline-posts" ' + \
|
' <div id="timelineposts" class="timeline-posts" ' + \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue