More key shortcuts

merge-requests/30/head
Bob Mottram 2021-04-23 13:04:42 +01:00
parent 5d267d32d0
commit 4b904c8f33
19 changed files with 229 additions and 41 deletions

View File

@ -2845,6 +2845,11 @@ class PubServer(BaseHTTPRequestHandler):
showPublishedDateOnly = self.server.showPublishedDateOnly
allowLocalNetworkAccess = \
self.server.allowLocalNetworkAccess
accessKeys = self.server.accessKeys
if self.server.keyShortcuts.get(nickname):
accessKeys = self.server.keyShortcuts[nickname]
profileStr = \
htmlProfileAfterSearch(self.server.cssCache,
self.server.recentPostsCache,
@ -2867,7 +2872,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.defaultTimeline,
self.server.peertubeInstances,
allowLocalNetworkAccess,
self.server.themeName)
self.server.themeName,
accessKeys)
if profileStr:
msg = profileStr.encode('utf-8')
msglen = len(msg)
@ -5718,6 +5724,13 @@ class PubServer(BaseHTTPRequestHandler):
optionsActor, optionsProfileUrl,
self.server.personCache, 5)
accessKeys = self.server.accessKeys
if '/users/' in path:
nickname = path.split('/users/')[1]
if '/' in nickname:
nickname = nickname.split('/')[0]
if self.server.keyShortcuts.get(nickname):
accessKeys = self.server.keyShortcuts[nickname]
msg = htmlPersonOptions(self.server.defaultTimeline,
self.server.cssCache,
self.server.translate,
@ -5740,7 +5753,8 @@ class PubServer(BaseHTTPRequestHandler):
movedTo, alsoKnownAs,
self.server.textModeBanner,
self.server.newsInstance,
authorized).encode('utf-8')
authorized,
accessKeys).encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
cookie, callingDomain)
@ -14658,6 +14672,14 @@ def runDaemon(brochMode: bool,
# key shortcuts SHIFT + ALT + [key]
httpd.accessKeys = {
'submitButton': 'y',
'followButton': 'f',
'blockButton': 'b',
'infoButton': 'i',
'snoozeButton': 's',
'reportButton': 'r',
'viewButton': 'v',
'enterPetname': 'p',
'enterNotes': 'n',
'menuTimeline': 't',
'menuEdit': 'e',
'menuProfile': 'p',
@ -14673,7 +14695,8 @@ def runDaemon(brochMode: bool,
'menuBlogs': 'b',
'menuNewswire': 'w',
'menuLinks': 'l',
'menuModeration': 'm',
'menuMedia': 'm',
'menuModeration': 'o',
'menuFollowing': 'f',
'menuFollowers': 'g',
'menuRoles': 'o',

View File

@ -427,5 +427,14 @@
"menuSkills": "مهارات",
"menuLogout": "تسجيل خروج",
"menuKeys": "الاختصارات الرئيسية",
"submitButton": "زر الإرسال"
"submitButton": "زر الإرسال",
"menuMedia": "وسائط",
"followButton": "زر متابعة / متابعة",
"blockButton": "زر كتلة",
"infoButton": "زر المعلومات",
"snoozeButton": "زر الغفوة",
"reportButton": "زر تقرير",
"viewButton": "عرض زر",
"enterPetname": "أدخل PETNAME",
"enterNotes": "أدخل الملاحظات"
}

View File

@ -427,5 +427,14 @@
"menuSkills": "Habilitats",
"menuLogout": "Tancar sessió",
"menuKeys": "Dreceres clau",
"submitButton": "Envia el botó"
"submitButton": "Envia el botó",
"menuMedia": "Medis de comunicació",
"followButton": "Seguiu / no seguit",
"blockButton": "Botó de bloc",
"infoButton": "Botó d'informació",
"snoozeButton": "Botó de snooze",
"reportButton": "Botó d'informe",
"viewButton": "Botó Veure",
"enterPetname": "Introduïu PETNAME",
"enterNotes": "Introduïu notes"
}

View File

@ -427,5 +427,14 @@
"menuSkills": "Medrau",
"menuLogout": "Allgofnodi",
"menuKeys": "Llwybrau byr allweddol",
"submitButton": "Cyflwyno botwm"
"submitButton": "Cyflwyno botwm",
"menuMedia": "Chyfryngau",
"followButton": "Dilynwch / Peidiwch â Dilynwch y botwm",
"blockButton": "Botwm bloc",
"infoButton": "Botwm info",
"snoozeButton": "Botwm Snooze",
"reportButton": "Botwm adroddiadau",
"viewButton": "Gweld y botwm",
"enterPetname": "Rhowch enw PETName",
"enterNotes": "Rhowch nodiadau"
}

View File

@ -427,5 +427,14 @@
"menuSkills": "Kompetenzen",
"menuLogout": "Ausloggen",
"menuKeys": "Schlüsselverknüpfungen",
"submitButton": "Button einreichen"
"submitButton": "Button einreichen",
"menuMedia": "Medien",
"followButton": "Folgen / folgen Sie nicht der Taste",
"blockButton": "Blockknopf",
"infoButton": "Info-Taste",
"snoozeButton": "Schlummertaste",
"reportButton": "Berichtsknopf",
"viewButton": "Schaltfläche anzeigen",
"enterPetname": "Petname eingeben",
"enterNotes": "Notizen eingeben"
}

View File

@ -427,5 +427,14 @@
"menuSkills": "Skills",
"menuLogout": "Logout",
"menuKeys": "Key Shortcuts",
"submitButton": "Submit button"
"submitButton": "Submit button",
"menuMedia": "Media",
"followButton": "Follow/unfollow button",
"blockButton": "Block button",
"infoButton": "Info button",
"snoozeButton": "Snooze button",
"reportButton": "Report button",
"viewButton": "View button",
"enterPetname": "Enter petname",
"enterNotes": "Enter notes"
}

View File

@ -427,5 +427,14 @@
"menuSkills": "Habilidades",
"menuLogout": "Cerrar sesión",
"menuKeys": "Atajos clave",
"submitButton": "Botón de enviar"
"submitButton": "Botón de enviar",
"menuMedia": "Medios de comunicación",
"followButton": "Botón de seguimiento / dejo",
"blockButton": "Botón de bloqueo",
"infoButton": "Botón de información",
"snoozeButton": "El botón de dormitar",
"reportButton": "Botón de informe",
"viewButton": "Botón de vista",
"enterPetname": "Entrar en nombre de pettname",
"enterNotes": "Ingresar notas"
}

View File

@ -427,5 +427,14 @@
"menuSkills": "Compétences",
"menuLogout": "Se déconnecter",
"menuKeys": "Raccourcis clés",
"submitButton": "Bouton de soumission"
"submitButton": "Bouton de soumission",
"menuMedia": "Médias",
"followButton": "Suivez / Bouton Suivi",
"blockButton": "Bouton de bloc",
"infoButton": "Bouton info",
"snoozeButton": "Le bouton de la sieste",
"reportButton": "Bouton de rapport",
"viewButton": "Bouton d'affichage",
"enterPetname": "Entrez PETNAME",
"enterNotes": "Faire entrer des notes"
}

View File

@ -427,5 +427,14 @@
"menuSkills": "Scileanna",
"menuLogout": "Logáil Amach",
"menuKeys": "Príomh-aicearraí",
"submitButton": "Cuir an cnaipe isteach"
"submitButton": "Cuir an cnaipe isteach",
"menuMedia": "Na meáin",
"followButton": "Lean / Cnaipe Unurollow",
"blockButton": "Cnaipe bloc",
"infoButton": "Cnaipe Info",
"snoozeButton": "Cnaipe snooze",
"reportButton": "Cnaipe Tuairisce",
"viewButton": "Féach an cnaipe",
"enterPetname": "Cuir isteach PetName",
"enterNotes": "Cuir nótaí isteach"
}

View File

@ -427,5 +427,14 @@
"menuSkills": "कौशल",
"menuLogout": "लॉग आउट",
"menuKeys": "कुंजी शॉर्टकट",
"submitButton": "जमा करने वाला बटन"
"submitButton": "जमा करने वाला बटन",
"menuMedia": "मीडिया",
"followButton": "फॉलो / अनफ़ॉलो बटन",
"blockButton": "ब्लॉक बटन",
"infoButton": "जानकारी बटन",
"snoozeButton": "अलार्म को थोड़ी देर बंद करने वाला बटन",
"reportButton": "रिपोर्ट बटन",
"viewButton": "देखें बटन",
"enterPetname": "PETNAME दर्ज करें",
"enterNotes": "नोट्स दर्ज करें"
}

View File

@ -427,5 +427,14 @@
"menuSkills": "Competenze",
"menuLogout": "Disconnettersi",
"menuKeys": "Scorciatoie chiave",
"submitButton": "Invia il pulsante"
"submitButton": "Invia il pulsante",
"menuMedia": "Media",
"followButton": "Segui il pulsante Segui / Unfollow",
"blockButton": "Blocco pulsante",
"infoButton": "Pulsante info",
"snoozeButton": "Pulsante snooze.",
"reportButton": "Pulsante report.",
"viewButton": "Visualizza il pulsante",
"enterPetname": "Inserisci PetName",
"enterNotes": "Inserisci le note"
}

View File

@ -427,5 +427,14 @@
"menuSkills": "スキル",
"menuLogout": "ログアウト",
"menuKeys": "キーショートカット",
"submitButton": "送信ボタン"
"submitButton": "送信ボタン",
"menuMedia": "メディア",
"followButton": "フォロー/フォローダウンボタン",
"blockButton": "ブロックボタン",
"infoButton": "情報ボタン",
"snoozeButton": "スヌーズボタン",
"reportButton": "レポートボタン",
"viewButton": "ボタンを見る",
"enterPetname": "PetNameを入力してください",
"enterNotes": "ノートを入力してください"
}

View File

@ -427,5 +427,14 @@
"menuSkills": "Şarezayên",
"menuLogout": "Derkeve",
"menuKeys": "Kurteyên Key",
"submitButton": "Bişkojka bişînin"
"submitButton": "Bişkojka bişînin",
"menuMedia": "Medya",
"followButton": "Bişkojka bişopînin / Nexşe",
"blockButton": "Bişkojka Block",
"infoButton": "Bişkoja INFO",
"snoozeButton": "Bişkojka Snooze",
"reportButton": "Bişkoja Report",
"viewButton": "Bişkoja View",
"enterPetname": "Porê binivîse",
"enterNotes": "Nîşan binivîse"
}

View File

@ -423,5 +423,14 @@
"menuSkills": "Skills",
"menuLogout": "Logout",
"menuKeys": "Key Shortcuts",
"submitButton": "Submit button"
"submitButton": "Submit button",
"menuMedia": "Media",
"followButton": "Follow/unfollow button",
"blockButton": "Block button",
"infoButton": "Info button",
"snoozeButton": "Snooze button",
"reportButton": "Report button",
"viewButton": "View button",
"enterPetname": "Enter petname",
"enterNotes": "Enter notes"
}

View File

@ -427,5 +427,14 @@
"menuSkills": "Habilidades",
"menuLogout": "Sair",
"menuKeys": "Atalhos-chave",
"submitButton": "Botão de envio"
"submitButton": "Botão de envio",
"menuMedia": "meios de comunicação",
"followButton": "Siga / Deixar botão",
"blockButton": "Botão de bloco",
"infoButton": "Botão de informação",
"snoozeButton": "Botão Snooze",
"reportButton": "Botão de relatório",
"viewButton": "Botão de visualização",
"enterPetname": "Digite Petname",
"enterNotes": "Digite notas"
}

View File

@ -427,5 +427,14 @@
"menuSkills": "Навыки и умения",
"menuLogout": "Выйти",
"menuKeys": "Клавичные ярлыки",
"submitButton": "Отправить кнопку"
"submitButton": "Отправить кнопку",
"menuMedia": "СМИ",
"followButton": "Следуйте / отписаться кнопка",
"blockButton": "Кнопка блокировки",
"infoButton": "Информация Кнопка",
"snoozeButton": "Кнопка сножения",
"reportButton": "Кнопка отчета",
"viewButton": "Кнопка просмотра",
"enterPetname": "Введите petname",
"enterNotes": "Введите ноты"
}

View File

@ -427,5 +427,14 @@
"menuSkills": "技能",
"menuLogout": "登出",
"menuKeys": "关键捷径",
"submitButton": "提交按钮"
"submitButton": "提交按钮",
"menuMedia": "媒体",
"followButton": "关注/取消关注按钮",
"blockButton": "块按钮",
"infoButton": "信息按钮",
"snoozeButton": "贪睡按钮",
"reportButton": "报告按钮",
"viewButton": "查看按钮",
"enterPetname": "进入宠物名",
"enterNotes": "输入笔记"
}

View File

@ -54,7 +54,8 @@ def htmlPersonOptions(defaultTimeline: str,
alsoKnownAs: [],
textModeBanner: str,
newsInstance: bool,
authorized: bool) -> str:
authorized: bool,
accessKeys: {}) -> str:
"""Show options for a person: view/follow/block/report
"""
optionsDomain, optionsPort = getDomainFromActor(optionsActor)
@ -234,7 +235,8 @@ def htmlPersonOptions(defaultTimeline: str,
optionsStr += \
' ' + translate['Petname'] + ': \n' + \
' <input type="text" name="optionpetname" value="' + \
petname + '">\n' \
petname + '" ' + \
'accesskey="' + accessKeys['enterPetname'] + '">\n' \
' <button type="submit" class="buttonsmall" ' + \
'name="submitPetname">' + \
translate['Submit'] + '</button><br>\n'
@ -324,40 +326,51 @@ def htmlPersonOptions(defaultTimeline: str,
if authorized and originPathStr == '/users/' + nickname:
optionsStr += \
' <a href="' + backPath + '"><button type="button" ' + \
'class="buttonIcon" name="submitBack">' + translate['Go Back'] + \
'</button></a>\n'
'class="buttonIcon" name="submitBack" ' + \
'accesskey="' + accessKeys['menuTimeline'] + '">' + \
translate['Go Back'] + '</button></a>\n'
else:
optionsStr += \
' <a href="' + originPathStr + '"><button type="button" ' + \
'class="buttonIcon" name="submitBack">' + translate['Go Back'] + \
'class="buttonIcon" name="submitBack" accesskey="' + \
accessKeys['menuTimeline'] + '">' + translate['Go Back'] + \
'</button></a>\n'
if authorized:
optionsStr += \
' <button type="submit" class="button" name="submitView">' + \
' <button type="submit" class="button" ' + \
'name="submitView" accesskey="' + \
accessKeys['viewButton'] + '">' + \
translate['View'] + '</button>\n'
optionsStr += donateStr
if authorized:
optionsStr += \
' <button type="submit" class="button" name="submit' + \
followStr + '">' + translate[followStr] + '</button>\n'
followStr + '" accesskey="' + accessKeys['followButton'] + '">' + \
translate[followStr] + '</button>\n'
optionsStr += \
' <button type="submit" class="button" name="submit' + \
blockStr + '">' + translate[blockStr] + '</button>\n'
blockStr + '" accesskey="' + accessKeys['blockButton'] + '">' + \
translate[blockStr] + '</button>\n'
optionsStr += \
' <button type="submit" class="button" name="submitDM">' + \
' <button type="submit" class="button" name="submitDM" ' + \
'accesskey="' + accessKeys['menuDM'] + '">' + \
translate['DM'] + '</button>\n'
optionsStr += \
' <button type="submit" class="button" name="submit' + \
snoozeButtonStr + '">' + translate[snoozeButtonStr] + \
snoozeButtonStr + '" accesskey="' + \
accessKeys['snoozeButton'] + '">' + translate[snoozeButtonStr] + \
'</button>\n'
optionsStr += \
' <button type="submit" class="button" ' + \
'name="submitReport">' + translate['Report'] + '</button>\n'
'name="submitReport" accesskey="' + \
accessKeys['reportButton'] + '">' + \
translate['Report'] + '</button>\n'
if isModerator(baseDir, nickname):
optionsStr += \
' <button type="submit" class="button" ' + \
'name="submitPersonInfo">' + \
'name="submitPersonInfo" accesskey="' + \
accessKeys['infoButton'] + '">' + \
translate['Info'] + '</button>\n'
personNotes = ''
@ -376,7 +389,8 @@ def htmlPersonOptions(defaultTimeline: str,
translate['Submit'] + '</button><br>\n'
optionsStr += \
' <textarea id="message" ' + \
'name="optionnotes" style="height:400px" spellcheck="true">' + \
'name="optionnotes" style="height:400px" spellcheck="true" ' + \
'accesskey="' + accessKeys['enterNotes'] + '">' + \
personNotes + '</textarea>\n'
optionsStr += ' </form>\n'

View File

@ -67,7 +67,8 @@ def htmlProfileAfterSearch(cssCache: {},
defaultTimeline: str,
peertubeInstances: [],
allowLocalNetworkAccess: bool,
themeName: str) -> str:
themeName: str,
accessKeys: {}) -> str:
"""Show a profile page after a search for a fediverse address
"""
if hasUsersPath(profileHandle) or '/@' in profileHandle:
@ -255,7 +256,7 @@ def htmlProfileAfterSearch(cssCache: {},
profileDescriptionShort,
avatarUrl, imageUrl,
movedTo, profileJson['id'],
alsoKnownAs)
alsoKnownAs, accessKeys)
domainFull = getFullDomain(domain, port)
@ -276,10 +277,12 @@ def htmlProfileAfterSearch(cssCache: {},
' <input type="hidden" name="actor" value="' + \
personUrl + '">\n'
profileStr += \
' <button type="submit" class="button" name="submitYes">' + \
' <button type="submit" class="button" name="submitYes" ' + \
'accesskey="' + accessKeys['followButton'] + '">' + \
translate['Follow'] + '</button>\n'
profileStr += \
' <button type="submit" class="button" name="submitView">' + \
' <button type="submit" class="button" name="submitView" ' + \
'accesskey="' + accessKeys['viewButton'] + '">' + \
translate['View'] + '</button>\n'
profileStr += ' </center>\n'
profileStr += ' </form>\n'
@ -331,14 +334,16 @@ def _getProfileHeader(baseDir: str, httpPrefix: str,
loginButton: str, avatarUrl: str,
theme: str, movedTo: str,
alsoKnownAs: [],
pinnedContent) -> str:
pinnedContent: str,
accessKeys: {}) -> str:
"""The header of the profile screen, containing background
image and avatar
"""
htmlStr = '\n\n <figure class="profileHeader">\n'
htmlStr += ' <a href="/users/' + \
nickname + '/' + defaultTimeline + '" title="' + \
translate['Switch to timeline view'] + '">\n'
translate['Switch to timeline view'] + '" ' + \
'accesskey="' + accessKeys['menuTimeline'] + '">\n'
htmlStr += ' <img class="profileBackground" ' + \
'alt="" ' + \
'src="/users/' + nickname + '/image_' + theme + '.png" /></a>\n'
@ -411,14 +416,16 @@ def _getProfileHeaderAfterSearch(baseDir: str,
profileDescriptionShort: str,
avatarUrl: str, imageUrl: str,
movedTo: str, actor: str,
alsoKnownAs: []) -> str:
alsoKnownAs: [],
accessKeys: {}) -> str:
"""The header of a searched for handle, containing background
image and avatar
"""
htmlStr = '\n\n <figure class="profileHeader">\n'
htmlStr += ' <a href="/users/' + \
nickname + '/' + defaultTimeline + '" title="' + \
translate['Switch to timeline view'] + '">\n'
translate['Switch to timeline view'] + '" ' + \
'accesskey="' + accessKeys['menuTimeline'] + '">\n'
htmlStr += ' <img class="profileBackground" ' + \
'alt="" ' + \
'src="' + imageUrl + '" /></a>\n'
@ -723,7 +730,7 @@ def htmlProfile(rssIconAtTop: bool,
profileDescriptionShort,
loginButton, avatarUrl, theme,
movedTo, alsoKnownAs,
pinnedContent)
pinnedContent, accessKeys)
# keyboard navigation
userPathStr = '/users/' + nickname