mirror of https://gitlab.com/bashrc2/epicyon
Try using select rather than search for better mobile/browser compatibility
parent
0c2113c43a
commit
45fa7aa236
|
@ -63,7 +63,7 @@ from filters import is_filtered
|
|||
from follow import is_follower_of_person
|
||||
from follow import get_follower_domains
|
||||
from webapp_frontscreen import html_front_screen
|
||||
from webapp_utils import html_following_data_list
|
||||
from webapp_utils import html_following_dropdown
|
||||
from webapp_utils import edit_number_field
|
||||
from webapp_utils import html_keyboard_navigation
|
||||
from webapp_utils import html_hide_from_screen_reader
|
||||
|
@ -1110,10 +1110,7 @@ def html_profile(signing_priv_key_pem: str,
|
|||
' <input type="hidden" ' + \
|
||||
'name="actor" value="' + actor + '">\n'
|
||||
follow_search_str += \
|
||||
' <input type="search" name="searchtext" ' + \
|
||||
'list="' + selected + 'Handles" placeholder="🔎">\n'
|
||||
follow_search_str += \
|
||||
html_following_data_list(base_dir, nickname, domain,
|
||||
html_following_dropdown(base_dir, nickname, domain,
|
||||
domain_full, selected, False)
|
||||
follow_search_str += \
|
||||
' <button type="submit" class="button" ' + \
|
||||
|
|
|
@ -2016,3 +2016,52 @@ def html_following_data_list(base_dir: str, nickname: str,
|
|||
list_str += '<option>@' + following_address + '</option>\n'
|
||||
list_str += '</datalist>\n'
|
||||
return list_str
|
||||
|
||||
|
||||
def html_following_dropdown(base_dir: str, nickname: str,
|
||||
domain: str, domain_full: str,
|
||||
following_type: str,
|
||||
use_petnames: bool) -> str:
|
||||
"""Returns a select list of handles being followed or of followers
|
||||
"""
|
||||
list_str = '<select name="searchtext">\n'
|
||||
following_filename = \
|
||||
acct_dir(base_dir, nickname, domain) + '/' + following_type + '.txt'
|
||||
msg = None
|
||||
if os.path.isfile(following_filename):
|
||||
with open(following_filename, 'r',
|
||||
encoding='utf-8') as following_file:
|
||||
msg = following_file.read()
|
||||
# add your own handle, so that you can send DMs
|
||||
# to yourself as reminders
|
||||
msg += nickname + '@' + domain_full + '\n'
|
||||
if msg:
|
||||
# include petnames
|
||||
petnames_filename = \
|
||||
acct_dir(base_dir, nickname, domain) + '/petnames.txt'
|
||||
if use_petnames and os.path.isfile(petnames_filename):
|
||||
following_list = []
|
||||
with open(petnames_filename, 'r',
|
||||
encoding='utf-8') as petnames_file:
|
||||
pet_str = petnames_file.read()
|
||||
# extract each petname and append it
|
||||
petnames_list = pet_str.split('\n')
|
||||
for pet in petnames_list:
|
||||
following_list.append(pet.split(' ')[0])
|
||||
# add the following.txt entries
|
||||
following_list += msg.split('\n')
|
||||
else:
|
||||
# no petnames list exists - just use following.txt
|
||||
following_list = msg.split('\n')
|
||||
following_list.sort()
|
||||
if following_list:
|
||||
for following_address in following_list:
|
||||
if not following_address:
|
||||
continue
|
||||
if '@' not in following_address and \
|
||||
'://' not in following_address:
|
||||
continue
|
||||
list_str += '<option value="' + following_address + '">' + \
|
||||
following_address + '</option>\n'
|
||||
list_str += '</select>\n'
|
||||
return list_str
|
||||
|
|
Loading…
Reference in New Issue