mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
ef1a8171bf
commit
1b13231c15
3
maps.py
3
maps.py
|
@ -10,6 +10,7 @@ __module_group__ = "Core"
|
|||
|
||||
import os
|
||||
from flags import is_float
|
||||
from utils import browser_supports_download_filename
|
||||
from utils import get_url_from_post
|
||||
from utils import acct_dir
|
||||
from utils import load_json
|
||||
|
@ -897,7 +898,7 @@ def html_hashtag_maps(base_dir: str, tag_name: str,
|
|||
description = period_str
|
||||
if translate.get(period_str):
|
||||
description = translate[period_str]
|
||||
if 'mozilla' in ua_str_lower or 'firefox' in ua_str_lower:
|
||||
if browser_supports_download_filename(ua_str_lower):
|
||||
html_str += '<a href="' + endpoint_str + \
|
||||
'" download="' + tag_name_str + '.kml">' + \
|
||||
description + '</a>'
|
||||
|
|
11
utils.py
11
utils.py
|
@ -5277,3 +5277,14 @@ def set_searchable_by(base_dir: str, nickname: str, domain: str,
|
|||
fp_search.write(searchable_by)
|
||||
except OSError:
|
||||
print('EX: unable to write searchableByDropdown ' + filename)
|
||||
|
||||
|
||||
def browser_supports_download_filename(ua_str: str) -> bool:
|
||||
"""Does the browser indicated by the user agent string support specifying
|
||||
a default download filename?
|
||||
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#download
|
||||
https://www.w3schools.com/howto/howto_html_download_link.asp
|
||||
"""
|
||||
if 'mozilla' in ua_str or 'firefox' in ua_str:
|
||||
return True
|
||||
return False
|
||||
|
|
|
@ -10,6 +10,7 @@ __module_group__ = "Calendar"
|
|||
import os
|
||||
from datetime import datetime
|
||||
from datetime import date
|
||||
from utils import browser_supports_download_filename
|
||||
from utils import remove_html
|
||||
from utils import get_display_name
|
||||
from utils import get_config_param
|
||||
|
@ -347,7 +348,7 @@ def _html_calendar_day(person_cache: {}, translate: {},
|
|||
|
||||
# icalendar download link
|
||||
ua_str_lower = ua_str.lower()
|
||||
if 'mozilla' in ua_str_lower or 'firefox' in ua_str_lower:
|
||||
if browser_supports_download_filename(ua_str_lower):
|
||||
default_cal_filename = 'calendar_day.ics'
|
||||
calendar_str += \
|
||||
' <a href="' + path + '?ical=true" ' + \
|
||||
|
@ -689,7 +690,7 @@ def html_calendar(person_cache: {}, translate: {},
|
|||
|
||||
# calendar download link
|
||||
ua_str_lower = ua_str.lower()
|
||||
if 'mozilla' in ua_str_lower or 'firefox' in ua_str_lower:
|
||||
if browser_supports_download_filename(ua_str_lower):
|
||||
default_cal_filename = 'calendar_month.ics'
|
||||
calendar_icon_str = \
|
||||
' <a href="' + path + '?ical=true" ' + \
|
||||
|
|
Loading…
Reference in New Issue