Key access to individual timeline posts

merge-requests/30/head
Bob Mottram 2021-04-22 16:06:24 +01:00
parent b4a26ef2ab
commit a8063e1c0d
7 changed files with 42 additions and 20 deletions

View File

@ -178,7 +178,7 @@ def _inboxStorePostToHtmlCache(recentPostsCache: {}, maxRecentPosts: int,
httpPrefix, __version__, boxname, None, httpPrefix, __version__, boxname, None,
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, allowLocalNetworkAccess, peertubeInstances, allowLocalNetworkAccess,
themeName, themeName, 0,
not isDM(postJsonObject), not isDM(postJsonObject),
True, True, False, True) True, True, False, True)

View File

@ -73,7 +73,7 @@ def htmlConfirmDelete(cssCache: {},
YTReplacementDomain, YTReplacementDomain,
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, allowLocalNetworkAccess, peertubeInstances, allowLocalNetworkAccess,
themeName, themeName, 0,
False, False, False, False, False) False, False, False, False, False)
deletePostStr += '<center>' deletePostStr += '<center>'
deletePostStr += \ deletePostStr += \

View File

@ -72,7 +72,7 @@ def _htmlFrontScreenPosts(recentPostsCache: {}, maxRecentPosts: int,
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, peertubeInstances,
allowLocalNetworkAccess, allowLocalNetworkAccess,
themeName, themeName, 0,
False, False, False, True, False) False, False, False, True, False)
if postStr: if postStr:
profileStr += postStr + separatorStr profileStr += postStr + separatorStr

View File

@ -119,7 +119,7 @@ def prepareHtmlPostNickname(nickname: str, postHtml: str) -> str:
def preparePostFromHtmlCache(nickname: str, postHtml: str, boxName: str, def preparePostFromHtmlCache(nickname: str, postHtml: str, boxName: str,
pageNumber: int) -> str: pageNumber: int, accessKeyIndex: int) -> str:
"""Sets the page number on a cached html post """Sets the page number on a cached html post
""" """
# if on the bookmarks timeline then remain there # if on the bookmarks timeline then remain there
@ -134,6 +134,19 @@ def preparePostFromHtmlCache(nickname: str, postHtml: str, boxName: str,
withPageNumber = postHtml.replace(';-999;', ';' + str(pageNumber) + ';') withPageNumber = postHtml.replace(';-999;', ';' + str(pageNumber) + ';')
withPageNumber = withPageNumber.replace('?page=-999', withPageNumber = withPageNumber.replace('?page=-999',
'?page=' + str(pageNumber)) '?page=' + str(pageNumber))
# replace the key shortcut
for keyIndex in range(10):
keyStr = 'accesskey="' + str(keyIndex) + '"'
if keyStr in withPageNumber:
if accessKeyIndex == 0 or accessKeyIndex > 9:
withPageNumber = \
withPageNumber.replace(keyStr, '')
else:
withPageNumber = \
withPageNumber.replace(keyStr,
'accesskey="' +
str(accessKeyIndex) + '"')
break
return prepareHtmlPostNickname(nickname, withPageNumber) return prepareHtmlPostNickname(nickname, withPageNumber)
@ -179,7 +192,8 @@ def _getPostFromRecentCache(session,
postStartTime, postStartTime,
pageNumber: int, pageNumber: int,
recentPostsCache: {}, recentPostsCache: {},
maxRecentPosts: int) -> str: maxRecentPosts: int,
accessKeyIndex: int) -> str:
"""Attempts to get the html post from the recent posts cache in memory """Attempts to get the html post from the recent posts cache in memory
""" """
if boxName == 'tlmedia': if boxName == 'tlmedia':
@ -217,7 +231,8 @@ def _getPostFromRecentCache(session,
return None return None
postHtml = \ postHtml = \
preparePostFromHtmlCache(nickname, postHtml, boxName, pageNumber) preparePostFromHtmlCache(nickname, postHtml, boxName,
pageNumber, accessKeyIndex)
updateRecentPostsCache(recentPostsCache, maxRecentPosts, updateRecentPostsCache(recentPostsCache, maxRecentPosts,
postJsonObject, postHtml) postJsonObject, postHtml)
_logPostTiming(enableTimingLog, postStartTime, '3') _logPostTiming(enableTimingLog, postStartTime, '3')
@ -1140,7 +1155,7 @@ def individualPostAsHtml(allowDownloads: bool,
showPublishedDateOnly: bool, showPublishedDateOnly: bool,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
themeName: str, themeName: str, accessKeyIndex: int,
showRepeats=True, showRepeats=True,
showIcons=False, showIcons=False,
manuallyApprovesFollowers=False, manuallyApprovesFollowers=False,
@ -1199,7 +1214,8 @@ def individualPostAsHtml(allowDownloads: bool,
postStartTime, postStartTime,
pageNumber, pageNumber,
recentPostsCache, recentPostsCache,
maxRecentPosts) maxRecentPosts,
accessKeyIndex)
if postHtml: if postHtml:
return postHtml return postHtml
@ -1652,8 +1668,13 @@ def individualPostAsHtml(allowDownloads: bool,
postHtml = '' postHtml = ''
if boxName != 'tlmedia': if boxName != 'tlmedia':
postHtml = ' <div id="' + timelinePostBookmark + \ if accessKeyIndex > 0 and accessKeyIndex <= 9:
'" class="' + containerClass + '">\n' postHtml = ' <div id="' + timelinePostBookmark + \
'" class="' + containerClass + \
'" accesskey="' + str(accessKeyIndex) + '">\n'
else:
postHtml = ' <div id="' + timelinePostBookmark + \
'" class="' + containerClass + '">\n'
postHtml += avatarImageInPost postHtml += avatarImageInPost
postHtml += ' <div class="post-title">\n' + \ postHtml += ' <div class="post-title">\n' + \
' ' + titleStr + \ ' ' + titleStr + \
@ -1732,7 +1753,7 @@ def htmlIndividualPost(cssCache: {},
YTReplacementDomain, YTReplacementDomain,
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, peertubeInstances,
allowLocalNetworkAccess, themeName, allowLocalNetworkAccess, themeName, 0,
False, authorized, False, False, False) False, authorized, False, False, False)
messageId = removeIdEnding(postJsonObject['id']) messageId = removeIdEnding(postJsonObject['id'])
@ -1760,7 +1781,7 @@ def htmlIndividualPost(cssCache: {},
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, peertubeInstances,
allowLocalNetworkAccess, allowLocalNetworkAccess,
themeName, themeName, 0,
False, authorized, False, authorized,
False, False, False) + postStr False, False, False) + postStr
@ -1791,7 +1812,7 @@ def htmlIndividualPost(cssCache: {},
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, peertubeInstances,
allowLocalNetworkAccess, allowLocalNetworkAccess,
themeName, themeName, 0,
False, authorized, False, authorized,
False, False, False) False, False, False)
cssFilename = baseDir + '/epicyon-profile.css' cssFilename = baseDir + '/epicyon-profile.css'
@ -1833,7 +1854,7 @@ def htmlPostReplies(cssCache: {},
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, peertubeInstances,
allowLocalNetworkAccess, allowLocalNetworkAccess,
themeName, themeName, 0,
False, False, False, False, False) False, False, False, False, False)
cssFilename = baseDir + '/epicyon-profile.css' cssFilename = baseDir + '/epicyon-profile.css'

View File

@ -309,7 +309,7 @@ def htmlProfileAfterSearch(cssCache: {},
YTReplacementDomain, YTReplacementDomain,
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, allowLocalNetworkAccess, peertubeInstances, allowLocalNetworkAccess,
themeName, themeName, 0,
False, False, False, False, False) False, False, False, False, False)
i += 1 i += 1
if i >= 20: if i >= 20:
@ -916,7 +916,7 @@ def _htmlProfilePosts(recentPostsCache: {}, maxRecentPosts: int,
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, peertubeInstances,
allowLocalNetworkAccess, allowLocalNetworkAccess,
themeName, themeName, 0,
False, False, False, True, False) False, False, False, True, False)
if postStr: if postStr:
profileStr += postStr + separatorStr profileStr += postStr + separatorStr

View File

@ -609,7 +609,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, baseDir: str,
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, peertubeInstances,
allowLocalNetworkAccess, allowLocalNetworkAccess,
themeName, themeName, 0,
showIndividualPostIcons, showIndividualPostIcons,
showIndividualPostIcons, showIndividualPostIcons,
False, False, False) False, False, False)
@ -782,7 +782,7 @@ def htmlHashtagSearch(cssCache: {},
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, peertubeInstances,
allowLocalNetworkAccess, allowLocalNetworkAccess,
themeName, themeName, 0,
showRepeats, showIcons, showRepeats, showIcons,
manuallyApprovesFollowers, manuallyApprovesFollowers,
showPublicOnly, showPublicOnly,

View File

@ -697,7 +697,8 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
preparePostFromHtmlCache(nickname, preparePostFromHtmlCache(nickname,
currTlStr, currTlStr,
boxName, boxName,
pageNumber) pageNumber,
itemCtr)
_logTimelineTiming(enableTimingLog, _logTimelineTiming(enableTimingLog,
timelineStartTime, timelineStartTime,
boxName, '10') boxName, '10')
@ -726,7 +727,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, peertubeInstances,
allowLocalNetworkAccess, allowLocalNetworkAccess,
theme, theme, itemCtr + 1,
boxName != 'dm', boxName != 'dm',
showIndividualPostIcons, showIndividualPostIcons,
manuallyApproveFollowers, manuallyApproveFollowers,