Key shortcuts on search screen

merge-requests/30/head
Bob Mottram 2021-04-23 10:15:53 +01:00
parent 3691e1d50a
commit 5d267d32d0
19 changed files with 56 additions and 22 deletions

View File

@ -11758,6 +11758,15 @@ class PubServer(BaseHTTPRequestHandler):
'/search?' in self.path: '/search?' in self.path:
if '?' in self.path: if '?' in self.path:
self.path = self.path.split('?')[0] self.path = self.path.split('?')[0]
nickname = self.path.split('/users/')[1]
if '/' in nickname:
nickname = nickname.split('/')[0]
accessKeys = self.server.accessKeys
if self.server.keyShortcuts.get(nickname):
accessKeys = self.server.keyShortcuts[nickname]
# show the search screen # show the search screen
msg = htmlSearch(self.server.cssCache, msg = htmlSearch(self.server.cssCache,
self.server.translate, self.server.translate,
@ -11765,7 +11774,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.domain, self.server.domain,
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.themeName, self.server.themeName,
self.server.textModeBanner).encode('utf-8') self.server.textModeBanner,
accessKeys).encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, cookie, callingDomain) self._set_headers('text/html', msglen, cookie, callingDomain)
self._write(msg) self._write(msg)
@ -14647,6 +14657,7 @@ def runDaemon(brochMode: bool,
# key shortcuts SHIFT + ALT + [key] # key shortcuts SHIFT + ALT + [key]
httpd.accessKeys = { httpd.accessKeys = {
'submitButton': 'y',
'menuTimeline': 't', 'menuTimeline': 't',
'menuEdit': 'e', 'menuEdit': 'e',
'menuProfile': 'p', 'menuProfile': 'p',

View File

@ -426,5 +426,6 @@
"menuRoles": "أدوار", "menuRoles": "أدوار",
"menuSkills": "مهارات", "menuSkills": "مهارات",
"menuLogout": "تسجيل خروج", "menuLogout": "تسجيل خروج",
"menuKeys": "الاختصارات الرئيسية" "menuKeys": "الاختصارات الرئيسية",
"submitButton": "زر الإرسال"
} }

View File

@ -426,5 +426,6 @@
"menuRoles": "Rols", "menuRoles": "Rols",
"menuSkills": "Habilitats", "menuSkills": "Habilitats",
"menuLogout": "Tancar sessió", "menuLogout": "Tancar sessió",
"menuKeys": "Dreceres clau" "menuKeys": "Dreceres clau",
"submitButton": "Envia el botó"
} }

View File

@ -426,5 +426,6 @@
"menuRoles": "Rolau", "menuRoles": "Rolau",
"menuSkills": "Medrau", "menuSkills": "Medrau",
"menuLogout": "Allgofnodi", "menuLogout": "Allgofnodi",
"menuKeys": "Llwybrau byr allweddol" "menuKeys": "Llwybrau byr allweddol",
"submitButton": "Cyflwyno botwm"
} }

View File

@ -426,5 +426,6 @@
"menuRoles": "Rollen", "menuRoles": "Rollen",
"menuSkills": "Kompetenzen", "menuSkills": "Kompetenzen",
"menuLogout": "Ausloggen", "menuLogout": "Ausloggen",
"menuKeys": "Schlüsselverknüpfungen" "menuKeys": "Schlüsselverknüpfungen",
"submitButton": "Button einreichen"
} }

View File

@ -426,5 +426,6 @@
"menuRoles": "Roles", "menuRoles": "Roles",
"menuSkills": "Skills", "menuSkills": "Skills",
"menuLogout": "Logout", "menuLogout": "Logout",
"menuKeys": "Key Shortcuts" "menuKeys": "Key Shortcuts",
"submitButton": "Submit button"
} }

View File

@ -426,5 +426,6 @@
"menuRoles": "Roles", "menuRoles": "Roles",
"menuSkills": "Habilidades", "menuSkills": "Habilidades",
"menuLogout": "Cerrar sesión", "menuLogout": "Cerrar sesión",
"menuKeys": "Atajos clave" "menuKeys": "Atajos clave",
"submitButton": "Botón de enviar"
} }

View File

@ -426,5 +426,6 @@
"menuRoles": "Les rôles", "menuRoles": "Les rôles",
"menuSkills": "Compétences", "menuSkills": "Compétences",
"menuLogout": "Se déconnecter", "menuLogout": "Se déconnecter",
"menuKeys": "Raccourcis clés" "menuKeys": "Raccourcis clés",
"submitButton": "Bouton de soumission"
} }

View File

@ -426,5 +426,6 @@
"menuRoles": "Róil", "menuRoles": "Róil",
"menuSkills": "Scileanna", "menuSkills": "Scileanna",
"menuLogout": "Logáil Amach", "menuLogout": "Logáil Amach",
"menuKeys": "Príomh-aicearraí" "menuKeys": "Príomh-aicearraí",
"submitButton": "Cuir an cnaipe isteach"
} }

View File

@ -426,5 +426,6 @@
"menuRoles": "भूमिकाएँ", "menuRoles": "भूमिकाएँ",
"menuSkills": "कौशल", "menuSkills": "कौशल",
"menuLogout": "लॉग आउट", "menuLogout": "लॉग आउट",
"menuKeys": "कुंजी शॉर्टकट" "menuKeys": "कुंजी शॉर्टकट",
"submitButton": "जमा करने वाला बटन"
} }

View File

@ -426,5 +426,6 @@
"menuRoles": "Ruoli", "menuRoles": "Ruoli",
"menuSkills": "Competenze", "menuSkills": "Competenze",
"menuLogout": "Disconnettersi", "menuLogout": "Disconnettersi",
"menuKeys": "Scorciatoie chiave" "menuKeys": "Scorciatoie chiave",
"submitButton": "Invia il pulsante"
} }

View File

@ -426,5 +426,6 @@
"menuRoles": "役割", "menuRoles": "役割",
"menuSkills": "スキル", "menuSkills": "スキル",
"menuLogout": "ログアウト", "menuLogout": "ログアウト",
"menuKeys": "キーショートカット" "menuKeys": "キーショートカット",
"submitButton": "送信ボタン"
} }

View File

@ -426,5 +426,6 @@
"menuRoles": "Roles", "menuRoles": "Roles",
"menuSkills": "Şarezayên", "menuSkills": "Şarezayên",
"menuLogout": "Derkeve", "menuLogout": "Derkeve",
"menuKeys": "Kurteyên Key" "menuKeys": "Kurteyên Key",
"submitButton": "Bişkojka bişînin"
} }

View File

@ -422,5 +422,6 @@
"menuRoles": "Roles", "menuRoles": "Roles",
"menuSkills": "Skills", "menuSkills": "Skills",
"menuLogout": "Logout", "menuLogout": "Logout",
"menuKeys": "Key Shortcuts" "menuKeys": "Key Shortcuts",
"submitButton": "Submit button"
} }

View File

@ -426,5 +426,6 @@
"menuRoles": "Papéis", "menuRoles": "Papéis",
"menuSkills": "Habilidades", "menuSkills": "Habilidades",
"menuLogout": "Sair", "menuLogout": "Sair",
"menuKeys": "Atalhos-chave" "menuKeys": "Atalhos-chave",
"submitButton": "Botão de envio"
} }

View File

@ -426,5 +426,6 @@
"menuRoles": "Роли", "menuRoles": "Роли",
"menuSkills": "Навыки и умения", "menuSkills": "Навыки и умения",
"menuLogout": "Выйти", "menuLogout": "Выйти",
"menuKeys": "Клавичные ярлыки" "menuKeys": "Клавичные ярлыки",
"submitButton": "Отправить кнопку"
} }

View File

@ -426,5 +426,6 @@
"menuRoles": "角色", "menuRoles": "角色",
"menuSkills": "技能", "menuSkills": "技能",
"menuLogout": "登出", "menuLogout": "登出",
"menuKeys": "关键捷径" "menuKeys": "关键捷径",
"submitButton": "提交按钮"
} }

View File

@ -63,12 +63,15 @@ def htmlAccessKeys(cssCache: {}, baseDir: str,
accessKeysForm += ' <form method="POST" action="' + \ accessKeysForm += ' <form method="POST" action="' + \
'/users/' + nickname + '/changeAccessKeys">\n' '/users/' + nickname + '/changeAccessKeys">\n'
timelineKey = accessKeys['menuTimeline']
submitKey = accessKeys['submitButton']
accessKeysForm += \ accessKeysForm += \
' <center>\n' + \ ' <center>\n' + \
' <button type="submit" class="button" ' + \ ' <button type="submit" class="button" ' + \
'name="submitAccessKeysCancel">' + \ 'name="submitAccessKeysCancel" accesskey="' + timelineKey + '">' + \
translate['Go Back'] + '</button>\n' + \ translate['Go Back'] + '</button>\n' + \
' <button type="submit" class="button" name="submitAccessKeys">' + \ ' <button type="submit" class="button" ' + \
'name="submitAccessKeys" accesskey="' + submitKey + '">' + \
translate['Submit'] + '</button>\n </center>\n' translate['Submit'] + '</button>\n </center>\n'
accessKeysForm += ' <table class="accesskeys">\n' accessKeysForm += ' <table class="accesskeys">\n'

View File

@ -319,7 +319,7 @@ def htmlSearchEmojiTextEntry(cssCache: {}, translate: {},
def htmlSearch(cssCache: {}, translate: {}, def htmlSearch(cssCache: {}, translate: {},
baseDir: str, path: str, domain: str, baseDir: str, path: str, domain: str,
defaultTimeline: str, theme: str, defaultTimeline: str, theme: str,
textModeBanner: str) -> str: textModeBanner: str, accessKeys: {}) -> str:
"""Search called from the timeline icon """Search called from the timeline icon
""" """
actor = path.replace('/search', '') actor = path.replace('/search', '')
@ -347,12 +347,14 @@ def htmlSearch(cssCache: {}, translate: {},
textModeBannerStr = '' textModeBannerStr = ''
if os.path.isfile(searchBannerFilename): if os.path.isfile(searchBannerFilename):
timelineKey = accessKeys['menuTimeline']
usersPath = '/users/' + searchNickname usersPath = '/users/' + searchNickname
followStr += \ followStr += \
'<header>\n' + textModeBannerStr + \ '<header>\n' + textModeBannerStr + \
'<a href="' + usersPath + '/' + defaultTimeline + '" title="' + \ '<a href="' + usersPath + '/' + defaultTimeline + '" title="' + \
translate['Switch to timeline view'] + '" alt="' + \ translate['Switch to timeline view'] + '" alt="' + \
translate['Switch to timeline view'] + '">\n' translate['Switch to timeline view'] + '" ' + \
'accesskey="' + timelineKey + '">\n'
followStr += '<img loading="lazy" class="timeline-banner" src="' + \ followStr += '<img loading="lazy" class="timeline-banner" src="' + \
usersPath + '/' + searchBannerFile + '" alt="" /></a>\n' + \ usersPath + '/' + searchBannerFile + '" alt="" /></a>\n' + \
'</header>\n' '</header>\n'
@ -370,8 +372,10 @@ def htmlSearch(cssCache: {}, translate: {},
followStr += \ followStr += \
' <input type="hidden" name="actor" value="' + actor + '">\n' ' <input type="hidden" name="actor" value="' + actor + '">\n'
followStr += ' <input type="text" name="searchtext" autofocus><br>\n' followStr += ' <input type="text" name="searchtext" autofocus><br>\n'
submitKey = accessKeys['submitButton']
followStr += ' <button type="submit" class="button" ' + \ followStr += ' <button type="submit" class="button" ' + \
'name="submitSearch">' + translate['Submit'] + '</button>\n' 'name="submitSearch" accesskey="' + submitKey + '">' + \
translate['Submit'] + '</button>\n'
followStr += ' </form>\n' followStr += ' </form>\n'
followStr += ' <p class="hashtagswarm">' + \ followStr += ' <p class="hashtagswarm">' + \
htmlHashTagSwarm(baseDir, actor, translate) + '</p>\n' htmlHashTagSwarm(baseDir, actor, translate) + '</p>\n'