From 78fb223bd417f18589bfe959547994509e0caaa0 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 23 Apr 2021 20:06:34 +0100 Subject: [PATCH] Key shortcuts for newswire --- daemon.py | 6 +++++- webapp_column_right.py | 20 +++++++++++++------- webapp_frontscreen.py | 2 +- webapp_timeline.py | 2 +- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/daemon.py b/daemon.py index d26e8b184..8dc85be6c 100644 --- a/daemon.py +++ b/daemon.py @@ -11778,6 +11778,9 @@ class PubServer(BaseHTTPRequestHandler): rssIconAtTop = self.server.rssIconAtTop iconsAsButtons = self.server.iconsAsButtons defaultTimeline = self.server.defaultTimeline + accessKeys = self.server.accessKeys + if self.server.keyShortcuts.get(nickname): + accessKeys = self.server.keyShortcuts[nickname] msg = htmlNewswireMobile(self.server.cssCache, self.server.baseDir, nickname, @@ -11793,7 +11796,8 @@ class PubServer(BaseHTTPRequestHandler): rssIconAtTop, iconsAsButtons, defaultTimeline, - self.server.themeName).encode('utf-8') + self.server.themeName, + accessKeys).encode('utf-8') msglen = len(msg) self._set_headers('text/html', msglen, cookie, callingDomain) diff --git a/webapp_column_right.py b/webapp_column_right.py index 38b955bbb..2e22018a2 100644 --- a/webapp_column_right.py +++ b/webapp_column_right.py @@ -51,7 +51,8 @@ def getRightColumnContent(baseDir: str, nickname: str, domainFull: str, authorized: bool, showHeaderImage: bool, theme: str, - defaultTimeline: str) -> str: + defaultTimeline: str, + accessKeys: {}) -> str: """Returns html content for the right column """ htmlStr = '' @@ -69,7 +70,8 @@ def getRightColumnContent(baseDir: str, nickname: str, domainFull: str, publishButtonStr = \ ' ' + \ + 'title="' + titleStr + '" ' + \ + 'accesskey="' + accessKeys['menuNewPost'] + '">' + \ '\n' else: @@ -124,7 +126,8 @@ def getRightColumnContent(baseDir: str, nickname: str, domainFull: str, # show the edit icon highlighted htmlStr += \ ' ' + \ + '/users/' + nickname + '/editnewswire" ' + \ + 'accesskey="' + accessKeys['menuEdit'] + '">' + \ '' + \
                 translate['Edit newswire'] + ' | ' + \ + '/users/' + nickname + '/editnewswire" ' + \ + 'accesskey="' + accessKeys['menuEdit'] + '">' + \ '' + \
                 translate['Edit newswire'] + ' | ' + \ + '' + \ '\n' @@ -493,7 +499,7 @@ def htmlNewswireMobile(cssCache: {}, baseDir: str, nickname: str, False, timelinePath, showPublishButton, showPublishAsIcon, rssIconAtTop, False, authorized, False, theme, - defaultTimeline) + defaultTimeline, accessKeys) else: if editor: htmlStr += '


\n' diff --git a/webapp_frontscreen.py b/webapp_frontscreen.py index 47325bf9f..01ab2b3bd 100644 --- a/webapp_frontscreen.py +++ b/webapp_frontscreen.py @@ -174,7 +174,7 @@ def htmlFrontScreen(rssIconAtTop: bool, False, False, newswire, False, False, None, False, False, False, True, authorized, True, theme, - defaultTimeline) + defaultTimeline, accessKeys) profileFooterStr += ' \n' profileFooterStr += ' \n' profileFooterStr += ' \n' diff --git a/webapp_timeline.py b/webapp_timeline.py index 85d3851bf..df42ebed5 100644 --- a/webapp_timeline.py +++ b/webapp_timeline.py @@ -780,7 +780,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, showPublishAsIcon, rssIconAtTop, publishButtonAtTop, authorized, True, theme, - defaultTimeline) + defaultTimeline, accessKeys) tlStr += ' ' + \ rightColumnStr + ' \n'