Key shortcuts on edit links screen

main
Bob Mottram 2021-04-23 19:00:11 +01:00
parent 2ead3bcd2a
commit 5e4bd5dfcb
2 changed files with 15 additions and 4 deletions

View File

@ -10435,6 +10435,14 @@ class PubServer(BaseHTTPRequestHandler):
"""Show the links from the left column
"""
if '/users/' in path and path.endswith('/editlinks'):
nickname = 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]
msg = htmlEditLinks(self.server.cssCache,
translate,
baseDir,
@ -10442,7 +10450,7 @@ class PubServer(BaseHTTPRequestHandler):
port,
httpPrefix,
self.server.defaultTimeline,
theme).encode('utf-8')
theme, accessKeys).encode('utf-8')
if msg:
msglen = len(msg)
self._set_headers('text/html', msglen,

View File

@ -342,7 +342,8 @@ def htmlLinksMobile(cssCache: {}, baseDir: str,
def htmlEditLinks(cssCache: {}, translate: {}, baseDir: str, path: str,
domain: str, port: int, httpPrefix: str,
defaultTimeline: str, theme: str) -> str:
defaultTimeline: str, theme: str,
accessKeys: {}) -> str:
"""Shows the edit links screen
"""
if '/users/' not in path:
@ -375,7 +376,8 @@ def htmlEditLinks(cssCache: {}, translate: {}, baseDir: str, path: str,
'<header>\n' + \
'<a href="/users/' + nickname + '/' + defaultTimeline + '" title="' + \
translate['Switch to timeline view'] + '" alt="' + \
translate['Switch to timeline view'] + '">\n'
translate['Switch to timeline view'] + '" ' + \
'accesskey="' + accessKeys['menuTimeline'] + '">\n'
editLinksForm += '<img loading="lazy" class="timeline-banner" ' + \
'alt = "" src="' + \
'/users/' + nickname + '/' + bannerFile + '" /></a>\n' + \
@ -392,7 +394,8 @@ def htmlEditLinks(cssCache: {}, translate: {}, baseDir: str, path: str,
' <h1>' + translate['Edit Links'] + '</h1>'
editLinksForm += \
' <input type="submit" name="submitLinks" value="' + \
translate['Submit'] + '">\n'
translate['Submit'] + '" ' + \
'accesskey="' + accessKeys['submitButton'] + '">\n'
editLinksForm += \
' </div>\n'