From 5e4bd5dfcba87d59d75ef9bf8fdbf4a6534de045 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 23 Apr 2021 19:00:11 +0100 Subject: [PATCH] Key shortcuts on edit links screen --- daemon.py | 10 +++++++++- webapp_column_left.py | 9 ++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/daemon.py b/daemon.py index 14790aa7a..d26e8b184 100644 --- a/daemon.py +++ b/daemon.py @@ -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, diff --git a/webapp_column_left.py b/webapp_column_left.py index 0293442ed..298fb87e7 100644 --- a/webapp_column_left.py +++ b/webapp_column_left.py @@ -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, '
\n' + \ '\n' + translate['Switch to timeline view'] + '" ' + \ + 'accesskey="' + accessKeys['menuTimeline'] + '">\n' editLinksForm += '\n' + \ @@ -392,7 +394,8 @@ def htmlEditLinks(cssCache: {}, translate: {}, baseDir: str, path: str, '

' + translate['Edit Links'] + '

' editLinksForm += \ ' \n' + translate['Submit'] + '" ' + \ + 'accesskey="' + accessKeys['submitButton'] + '">\n' editLinksForm += \ ' \n'