mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
f6cbb6c340
commit
5de4310b8c
|
@ -253,8 +253,7 @@ def _htmlNewswire(baseDir: str, newswire: {}, nickname: str, moderator: bool,
|
||||||
if faviconUrl:
|
if faviconUrl:
|
||||||
faviconLink = \
|
faviconLink = \
|
||||||
'<img loading="lazy" src="' + faviconUrl + '" ' + \
|
'<img loading="lazy" src="' + faviconUrl + '" ' + \
|
||||||
'alt="" ' + \
|
'alt="" ' + _getBrokenFavSubstitute() + '/>'
|
||||||
_getBrokenFavSubstitute() + '/>'
|
|
||||||
moderatedItem = item[5]
|
moderatedItem = item[5]
|
||||||
htmlStr += separatorStr
|
htmlStr += separatorStr
|
||||||
if moderatedItem and 'vote:' + nickname in item[2]:
|
if moderatedItem and 'vote:' + nickname in item[2]:
|
||||||
|
@ -270,8 +269,7 @@ def _htmlNewswire(baseDir: str, newswire: {}, nickname: str, moderator: bool,
|
||||||
'<a href="' + url + '" target="_blank" ' + \
|
'<a href="' + url + '" target="_blank" ' + \
|
||||||
'rel="nofollow noopener noreferrer">' + \
|
'rel="nofollow noopener noreferrer">' + \
|
||||||
'<span class="newswireItemVotedOn">' + \
|
'<span class="newswireItemVotedOn">' + \
|
||||||
faviconLink + title + \
|
faviconLink + title + '</span></a>' + totalVotesStr
|
||||||
'</span></a>' + totalVotesStr
|
|
||||||
if moderator:
|
if moderator:
|
||||||
htmlStr += \
|
htmlStr += \
|
||||||
' ' + dateShown + '<a href="/users/' + nickname + \
|
' ' + dateShown + '<a href="/users/' + nickname + \
|
||||||
|
@ -312,8 +310,7 @@ def _htmlNewswire(baseDir: str, newswire: {}, nickname: str, moderator: bool,
|
||||||
htmlStr += '<p class="newswireItem">' + \
|
htmlStr += '<p class="newswireItem">' + \
|
||||||
'<a href="' + url + '" target="_blank" ' + \
|
'<a href="' + url + '" target="_blank" ' + \
|
||||||
'rel="nofollow noopener noreferrer">' + \
|
'rel="nofollow noopener noreferrer">' + \
|
||||||
faviconLink + title + '</a>' + \
|
faviconLink + title + '</a>' + totalVotesStr
|
||||||
totalVotesStr
|
|
||||||
htmlStr += ' <span class="newswireDate">'
|
htmlStr += ' <span class="newswireDate">'
|
||||||
htmlStr += dateShown + '</span></p>\n'
|
htmlStr += dateShown + '</span></p>\n'
|
||||||
|
|
||||||
|
|
|
@ -137,8 +137,7 @@ def htmlConfirmRemoveSharedItem(cssCache: {}, translate: {}, baseDir: str,
|
||||||
if os.path.isfile(baseDir + '/follow.css'):
|
if os.path.isfile(baseDir + '/follow.css'):
|
||||||
cssFilename = baseDir + '/follow.css'
|
cssFilename = baseDir + '/follow.css'
|
||||||
|
|
||||||
instanceTitle = \
|
instanceTitle = getConfigParam(baseDir, 'instanceTitle')
|
||||||
getConfigParam(baseDir, 'instanceTitle')
|
|
||||||
sharesStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
sharesStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||||
sharesStr += '<div class="follow">\n'
|
sharesStr += '<div class="follow">\n'
|
||||||
sharesStr += ' <div class="followAvatar">\n'
|
sharesStr += ' <div class="followAvatar">\n'
|
||||||
|
@ -186,8 +185,7 @@ def htmlConfirmFollow(cssCache: {}, translate: {}, baseDir: str,
|
||||||
if os.path.isfile(baseDir + '/follow.css'):
|
if os.path.isfile(baseDir + '/follow.css'):
|
||||||
cssFilename = baseDir + '/follow.css'
|
cssFilename = baseDir + '/follow.css'
|
||||||
|
|
||||||
instanceTitle = \
|
instanceTitle = getConfigParam(baseDir, 'instanceTitle')
|
||||||
getConfigParam(baseDir, 'instanceTitle')
|
|
||||||
followStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
followStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||||
followStr += '<div class="follow">\n'
|
followStr += '<div class="follow">\n'
|
||||||
followStr += ' <div class="followAvatar">\n'
|
followStr += ' <div class="followAvatar">\n'
|
||||||
|
@ -232,8 +230,7 @@ def htmlConfirmUnfollow(cssCache: {}, translate: {}, baseDir: str,
|
||||||
if os.path.isfile(baseDir + '/follow.css'):
|
if os.path.isfile(baseDir + '/follow.css'):
|
||||||
cssFilename = baseDir + '/follow.css'
|
cssFilename = baseDir + '/follow.css'
|
||||||
|
|
||||||
instanceTitle = \
|
instanceTitle = getConfigParam(baseDir, 'instanceTitle')
|
||||||
getConfigParam(baseDir, 'instanceTitle')
|
|
||||||
followStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
followStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||||
followStr += '<div class="follow">\n'
|
followStr += '<div class="follow">\n'
|
||||||
followStr += ' <div class="followAvatar">\n'
|
followStr += ' <div class="followAvatar">\n'
|
||||||
|
@ -279,8 +276,7 @@ def htmlConfirmUnblock(cssCache: {}, translate: {}, baseDir: str,
|
||||||
if os.path.isfile(baseDir + '/follow.css'):
|
if os.path.isfile(baseDir + '/follow.css'):
|
||||||
cssFilename = baseDir + '/follow.css'
|
cssFilename = baseDir + '/follow.css'
|
||||||
|
|
||||||
instanceTitle = \
|
instanceTitle = getConfigParam(baseDir, 'instanceTitle')
|
||||||
getConfigParam(baseDir, 'instanceTitle')
|
|
||||||
blockStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
blockStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||||
blockStr += '<div class="block">\n'
|
blockStr += '<div class="block">\n'
|
||||||
blockStr += ' <div class="blockAvatar">\n'
|
blockStr += ' <div class="blockAvatar">\n'
|
||||||
|
|
|
@ -26,35 +26,35 @@ def _htmlFollowingDataList(baseDir: str, nickname: str,
|
||||||
listStr = '<datalist id="followingHandles">\n'
|
listStr = '<datalist id="followingHandles">\n'
|
||||||
followingFilename = \
|
followingFilename = \
|
||||||
baseDir + '/accounts/' + nickname + '@' + domain + '/following.txt'
|
baseDir + '/accounts/' + nickname + '@' + domain + '/following.txt'
|
||||||
|
msg = None
|
||||||
if os.path.isfile(followingFilename):
|
if os.path.isfile(followingFilename):
|
||||||
with open(followingFilename, 'r') as followingFile:
|
with open(followingFilename, 'r') as followingFile:
|
||||||
msg = followingFile.read()
|
msg = followingFile.read()
|
||||||
# add your own handle, so that you can send DMs
|
# add your own handle, so that you can send DMs
|
||||||
# to yourself as reminders
|
# to yourself as reminders
|
||||||
msg += nickname + '@' + domainFull + '\n'
|
msg += nickname + '@' + domainFull + '\n'
|
||||||
# include petnames
|
if msg:
|
||||||
petnamesFilename = \
|
# include petnames
|
||||||
baseDir + '/accounts/' + \
|
petnamesFilename = \
|
||||||
nickname + '@' + domain + '/petnames.txt'
|
baseDir + '/accounts/' + nickname + '@' + domain + '/petnames.txt'
|
||||||
if os.path.isfile(petnamesFilename):
|
if os.path.isfile(petnamesFilename):
|
||||||
followingList = []
|
followingList = []
|
||||||
with open(petnamesFilename, 'r') as petnamesFile:
|
with open(petnamesFilename, 'r') as petnamesFile:
|
||||||
petStr = petnamesFile.read()
|
petStr = petnamesFile.read()
|
||||||
# extract each petname and append it
|
# extract each petname and append it
|
||||||
petnamesList = petStr.split('\n')
|
petnamesList = petStr.split('\n')
|
||||||
for pet in petnamesList:
|
for pet in petnamesList:
|
||||||
followingList.append(pet.split(' ')[0])
|
followingList.append(pet.split(' ')[0])
|
||||||
# add the following.txt entries
|
# add the following.txt entries
|
||||||
followingList += msg.split('\n')
|
followingList += msg.split('\n')
|
||||||
else:
|
else:
|
||||||
# no petnames list exists - just use following.txt
|
# no petnames list exists - just use following.txt
|
||||||
followingList = msg.split('\n')
|
followingList = msg.split('\n')
|
||||||
followingList.sort()
|
followingList.sort()
|
||||||
if followingList:
|
if followingList:
|
||||||
for followingAddress in followingList:
|
for followingAddress in followingList:
|
||||||
if followingAddress:
|
if followingAddress:
|
||||||
listStr += \
|
listStr += '<option>@' + followingAddress + '</option>\n'
|
||||||
'<option>@' + followingAddress + '</option>\n'
|
|
||||||
listStr += '</datalist>\n'
|
listStr += '</datalist>\n'
|
||||||
return listStr
|
return listStr
|
||||||
|
|
||||||
|
@ -84,8 +84,7 @@ def _htmlNewPostDropDown(scopeIcon: str, scopeDescription: str,
|
||||||
dropDownContent += ' <label for="my-newPostDropdown"\n'
|
dropDownContent += ' <label for="my-newPostDropdown"\n'
|
||||||
dropDownContent += ' data-toggle="newPostDropdown">\n'
|
dropDownContent += ' data-toggle="newPostDropdown">\n'
|
||||||
dropDownContent += ' <img loading="lazy" alt="" title="" src="/' + \
|
dropDownContent += ' <img loading="lazy" alt="" title="" src="/' + \
|
||||||
'icons/' + scopeIcon + '"/><b>' + \
|
'icons/' + scopeIcon + '"/><b>' + scopeDescription + '</b></label>\n'
|
||||||
scopeDescription + '</b></label>\n'
|
|
||||||
|
|
||||||
if noDropDown:
|
if noDropDown:
|
||||||
dropDownContent += '</div></nav>\n'
|
dropDownContent += '</div></nav>\n'
|
||||||
|
@ -144,12 +143,6 @@ def _htmlNewPostDropDown(scopeIcon: str, scopeDescription: str,
|
||||||
'icons/scope_reminder.png"/><b>' + \
|
'icons/scope_reminder.png"/><b>' + \
|
||||||
translate['Reminder'] + '</b><br>' + \
|
translate['Reminder'] + '</b><br>' + \
|
||||||
translate['Scheduled note to yourself'] + '</a></li>\n'
|
translate['Scheduled note to yourself'] + '</a></li>\n'
|
||||||
# dropDownContent += \
|
|
||||||
# '<li><a href="' + pathBase + dropdownEventSuffix + \
|
|
||||||
# '"><img loading="lazy" alt="" title="" src="/' + \
|
|
||||||
# 'icons/scope_event.png"/><b>' + \
|
|
||||||
# translate['Event'] + '</b><br>' + \
|
|
||||||
# translate['Create an event'] + '</a></li>\n'
|
|
||||||
dropDownContent += \
|
dropDownContent += \
|
||||||
'<li><a href="' + pathBase + dropdownReportSuffix + \
|
'<li><a href="' + pathBase + dropdownReportSuffix + \
|
||||||
'" accesskey="' + accessKeys['reportButton'] + '">' + \
|
'" accesskey="' + accessKeys['reportButton'] + '">' + \
|
||||||
|
@ -230,8 +223,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
||||||
showPublicOnDropdown = False
|
showPublicOnDropdown = False
|
||||||
else:
|
else:
|
||||||
newPostText = \
|
newPostText = \
|
||||||
'<h1>' + \
|
'<h1>' + translate['Write your report below.'] + '</h1>\n'
|
||||||
translate['Write your report below.'] + '</h1>\n'
|
|
||||||
|
|
||||||
# custom report header with any additional instructions
|
# custom report header with any additional instructions
|
||||||
if os.path.isfile(baseDir + '/accounts/report.txt'):
|
if os.path.isfile(baseDir + '/accounts/report.txt'):
|
||||||
|
@ -319,7 +311,6 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
||||||
translate['Subject or Content Warning (optional)'] + '...'
|
translate['Subject or Content Warning (optional)'] + '...'
|
||||||
placeholderMentions = ''
|
placeholderMentions = ''
|
||||||
if inReplyTo:
|
if inReplyTo:
|
||||||
# mentionsAndContent = getMentionsString(content)
|
|
||||||
placeholderMentions = \
|
placeholderMentions = \
|
||||||
translate['Replying to'] + '...'
|
translate['Replying to'] + '...'
|
||||||
placeholderMessage = translate['Write something'] + '...'
|
placeholderMessage = translate['Write something'] + '...'
|
||||||
|
@ -582,8 +573,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
||||||
dateAndLocation += '<input type="text" name="category">\n'
|
dateAndLocation += '<input type="text" name="category">\n'
|
||||||
dateAndLocation += '</div>\n'
|
dateAndLocation += '</div>\n'
|
||||||
|
|
||||||
instanceTitle = \
|
instanceTitle = getConfigParam(baseDir, 'instanceTitle')
|
||||||
getConfigParam(baseDir, 'instanceTitle')
|
|
||||||
newPostForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
newPostForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||||
|
|
||||||
newPostForm += \
|
newPostForm += \
|
||||||
|
@ -711,17 +701,11 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
||||||
submitText + '" ' + \
|
submitText + '" ' + \
|
||||||
'accesskey="' + accessKeys['submitButton'] + '"></td>\n'
|
'accesskey="' + accessKeys['submitButton'] + '"></td>\n'
|
||||||
|
|
||||||
newPostForm += ' </tr>\n'
|
newPostForm += ' </tr>\n</table>\n'
|
||||||
newPostForm += '</table>\n'
|
|
||||||
newPostForm += ' </div>\n'
|
newPostForm += ' </div>\n'
|
||||||
|
|
||||||
newPostForm += ' <div class="containerSubmitNewPost"><center>\n'
|
newPostForm += ' <div class="containerSubmitNewPost"><center>\n'
|
||||||
|
|
||||||
# newPostForm += \
|
|
||||||
# ' <a href="' + pathBase + \
|
|
||||||
# '/inbox"><button class="cancelbtn">' + \
|
|
||||||
# translate['Go Back'] + '</button></a>\n'
|
|
||||||
|
|
||||||
newPostForm += ' </center></div>\n'
|
newPostForm += ' </center></div>\n'
|
||||||
|
|
||||||
newPostForm += replyStr
|
newPostForm += replyStr
|
||||||
|
@ -777,14 +761,13 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
||||||
if not mediaInstance or replyStr:
|
if not mediaInstance or replyStr:
|
||||||
newPostForm += newPostImageSection
|
newPostForm += newPostImageSection
|
||||||
|
|
||||||
newPostForm += ' <div class="container">\n'
|
|
||||||
newPostForm += \
|
newPostForm += \
|
||||||
|
' <div class="container">\n' + \
|
||||||
' <input type="submit" name="submitPost" value="' + \
|
' <input type="submit" name="submitPost" value="' + \
|
||||||
submitText + '">\n'
|
submitText + '">\n' + \
|
||||||
newPostForm += ' </div>\n'
|
' </div>\n' + \
|
||||||
|
' </div>\n' + \
|
||||||
newPostForm += ' </div>\n'
|
'</form>\n'
|
||||||
newPostForm += '</form>\n'
|
|
||||||
|
|
||||||
if not reportUrl:
|
if not reportUrl:
|
||||||
newPostForm = \
|
newPostForm = \
|
||||||
|
|
|
@ -128,22 +128,24 @@ def htmlFrontScreen(rssIconAtTop: bool,
|
||||||
if loginButton:
|
if loginButton:
|
||||||
profileHeaderStr += '<center>' + loginButton + '</center>\n'
|
profileHeaderStr += '<center>' + loginButton + '</center>\n'
|
||||||
|
|
||||||
profileHeaderStr += '<table class="timeline">\n'
|
profileHeaderStr += \
|
||||||
profileHeaderStr += ' <colgroup>\n'
|
'<table class="timeline">\n' + \
|
||||||
profileHeaderStr += ' <col span="1" class="column-left">\n'
|
' <colgroup>\n' + \
|
||||||
profileHeaderStr += ' <col span="1" class="column-center">\n'
|
' <col span="1" class="column-left">\n' + \
|
||||||
profileHeaderStr += ' <col span="1" class="column-right">\n'
|
' <col span="1" class="column-center">\n' + \
|
||||||
profileHeaderStr += ' </colgroup>\n'
|
' <col span="1" class="column-right">\n' + \
|
||||||
profileHeaderStr += ' <tbody>\n'
|
' </colgroup>\n' + \
|
||||||
profileHeaderStr += ' <tr>\n'
|
' <tbody>\n' + \
|
||||||
profileHeaderStr += ' <td valign="top" class="col-left">\n'
|
' <tr>\n' + \
|
||||||
|
' <td valign="top" class="col-left">\n'
|
||||||
profileHeaderStr += \
|
profileHeaderStr += \
|
||||||
getLeftColumnContent(baseDir, 'news', domainFull,
|
getLeftColumnContent(baseDir, 'news', domainFull,
|
||||||
httpPrefix, translate,
|
httpPrefix, translate,
|
||||||
False, False, None, rssIconAtTop, True,
|
False, False, None, rssIconAtTop, True,
|
||||||
True, theme, accessKeys)
|
True, theme, accessKeys)
|
||||||
profileHeaderStr += ' </td>\n'
|
profileHeaderStr += \
|
||||||
profileHeaderStr += ' <td valign="top" class="col-center">\n'
|
' </td>\n' + \
|
||||||
|
' <td valign="top" class="col-center">\n'
|
||||||
|
|
||||||
profileStr = profileHeaderStr
|
profileStr = profileHeaderStr
|
||||||
|
|
||||||
|
@ -177,10 +179,11 @@ def htmlFrontScreen(rssIconAtTop: bool,
|
||||||
False, None, False, False,
|
False, None, False, False,
|
||||||
False, True, authorized, True, theme,
|
False, True, authorized, True, theme,
|
||||||
defaultTimeline, accessKeys)
|
defaultTimeline, accessKeys)
|
||||||
profileFooterStr += ' </td>\n'
|
profileFooterStr += \
|
||||||
profileFooterStr += ' </tr>\n'
|
' </td>\n' + \
|
||||||
profileFooterStr += ' </tbody>\n'
|
' </tr>\n' + \
|
||||||
profileFooterStr += '</table>\n'
|
' </tbody>\n' + \
|
||||||
|
'</table>\n'
|
||||||
|
|
||||||
instanceTitle = \
|
instanceTitle = \
|
||||||
getConfigParam(baseDir, 'instanceTitle')
|
getConfigParam(baseDir, 'instanceTitle')
|
||||||
|
|
|
@ -29,17 +29,19 @@ def getHashtagCategoriesFeed(baseDir: str,
|
||||||
if not hashtagCategories:
|
if not hashtagCategories:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
rssStr = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
|
rssStr = \
|
||||||
rssStr += "<rss version=\"2.0\">\n"
|
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" + \
|
||||||
rssStr += '<channel>\n'
|
"<rss version=\"2.0\">\n" + \
|
||||||
rssStr += ' <title>#categories</title>\n'
|
'<channel>\n' + \
|
||||||
|
' <title>#categories</title>\n'
|
||||||
|
|
||||||
rssDateStr = \
|
rssDateStr = \
|
||||||
datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S UT")
|
datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S UT")
|
||||||
|
|
||||||
for categoryStr, hashtagList in hashtagCategories.items():
|
for categoryStr, hashtagList in hashtagCategories.items():
|
||||||
rssStr += '<item>\n'
|
rssStr += \
|
||||||
rssStr += ' <title>' + categoryStr + '</title>\n'
|
'<item>\n' + \
|
||||||
|
' <title>' + categoryStr + '</title>\n'
|
||||||
listStr = ''
|
listStr = ''
|
||||||
for hashtag in hashtagList:
|
for hashtag in hashtagList:
|
||||||
if ':' in hashtag:
|
if ':' in hashtag:
|
||||||
|
@ -47,75 +49,18 @@ def getHashtagCategoriesFeed(baseDir: str,
|
||||||
if '&' in hashtag:
|
if '&' in hashtag:
|
||||||
continue
|
continue
|
||||||
listStr += hashtag + ' '
|
listStr += hashtag + ' '
|
||||||
rssStr += ' <description>' + listStr.strip() + '</description>\n'
|
rssStr += \
|
||||||
rssStr += ' <link/>\n'
|
' <description>' + listStr.strip() + '</description>\n' + \
|
||||||
rssStr += ' <pubDate>' + rssDateStr + '</pubDate>\n'
|
' <link/>\n' + \
|
||||||
rssStr += '</item>\n'
|
' <pubDate>' + rssDateStr + '</pubDate>\n' + \
|
||||||
|
'</item>\n'
|
||||||
|
|
||||||
rssStr += '</channel>\n'
|
rssStr += \
|
||||||
rssStr += '</rss>\n'
|
'</channel>\n' + \
|
||||||
|
'</rss>\n'
|
||||||
return rssStr
|
return rssStr
|
||||||
|
|
||||||
|
|
||||||
def _getHashtagDomainMax(domainHistogram: {}) -> str:
|
|
||||||
"""Returns the domain with the maximum number of hashtags
|
|
||||||
"""
|
|
||||||
maxCount = 1
|
|
||||||
maxDomain = None
|
|
||||||
for domain, count in domainHistogram.items():
|
|
||||||
if count > maxCount:
|
|
||||||
maxDomain = domain
|
|
||||||
maxCount = count
|
|
||||||
return maxDomain
|
|
||||||
|
|
||||||
|
|
||||||
def _getHashtagDomainHistogram(domainHistogram: {}, translate: {}) -> str:
|
|
||||||
"""Returns the html for a histogram of domains
|
|
||||||
from which hashtags are coming
|
|
||||||
"""
|
|
||||||
totalCount = 0
|
|
||||||
for domain, count in domainHistogram.items():
|
|
||||||
totalCount += count
|
|
||||||
if totalCount == 0:
|
|
||||||
return ''
|
|
||||||
|
|
||||||
htmlStr = ''
|
|
||||||
histogramHeaderStr = '<br><br><center>\n'
|
|
||||||
histogramHeaderStr += ' <h1>' + translate['Hashtag origins'] + '</h1>\n'
|
|
||||||
histogramHeaderStr += ' <table class="domainHistogram">\n'
|
|
||||||
histogramHeaderStr += ' <colgroup>\n'
|
|
||||||
histogramHeaderStr += ' <col span="1" class="domainHistogramLeft">\n'
|
|
||||||
histogramHeaderStr += ' <col span="1" class="domainHistogramRight">\n'
|
|
||||||
histogramHeaderStr += ' </colgroup>\n'
|
|
||||||
histogramHeaderStr += ' <tbody>\n'
|
|
||||||
histogramHeaderStr += ' <tr>\n'
|
|
||||||
|
|
||||||
leftColStr = ''
|
|
||||||
rightColStr = ''
|
|
||||||
|
|
||||||
for i in range(len(domainHistogram)):
|
|
||||||
domain = _getHashtagDomainMax(domainHistogram)
|
|
||||||
if not domain:
|
|
||||||
break
|
|
||||||
percent = int(domainHistogram[domain] * 100 / totalCount)
|
|
||||||
if histogramHeaderStr:
|
|
||||||
htmlStr += histogramHeaderStr
|
|
||||||
histogramHeaderStr = None
|
|
||||||
leftColStr += str(percent) + '%<br>'
|
|
||||||
rightColStr += domain + '<br>'
|
|
||||||
del domainHistogram[domain]
|
|
||||||
|
|
||||||
if htmlStr:
|
|
||||||
htmlStr += ' <td>' + leftColStr + '</td>\n'
|
|
||||||
htmlStr += ' <td>' + rightColStr + '</td>\n'
|
|
||||||
htmlStr += ' </tr>\n'
|
|
||||||
htmlStr += ' </tbody>\n'
|
|
||||||
htmlStr += ' </table>\n'
|
|
||||||
htmlStr += '</center>\n'
|
|
||||||
|
|
||||||
return htmlStr
|
|
||||||
|
|
||||||
|
|
||||||
def htmlHashTagSwarm(baseDir: str, actor: str, translate: {}) -> str:
|
def htmlHashTagSwarm(baseDir: str, actor: str, translate: {}) -> str:
|
||||||
"""Returns a tag swarm of today's hashtags
|
"""Returns a tag swarm of today's hashtags
|
||||||
"""
|
"""
|
||||||
|
@ -244,7 +189,6 @@ def htmlHashTagSwarm(baseDir: str, actor: str, translate: {}) -> str:
|
||||||
getContentWarningButton('alltags', translate, tagSwarmStr)
|
getContentWarningButton('alltags', translate, tagSwarmStr)
|
||||||
|
|
||||||
tagSwarmHtml = categorySwarmStr + tagSwarmStr.strip() + '\n'
|
tagSwarmHtml = categorySwarmStr + tagSwarmStr.strip() + '\n'
|
||||||
# tagSwarmHtml += _getHashtagDomainHistogram(domainHistogram, translate)
|
|
||||||
return tagSwarmHtml
|
return tagSwarmHtml
|
||||||
|
|
||||||
|
|
||||||
|
@ -279,10 +223,11 @@ def htmlSearchHashtagCategory(cssCache: {}, translate: {},
|
||||||
htmlStr += '<img loading="lazy" class="timeline-banner" src="' + \
|
htmlStr += '<img loading="lazy" class="timeline-banner" src="' + \
|
||||||
actor + '/' + searchBannerFile + '" alt="" /></a>\n'
|
actor + '/' + searchBannerFile + '" alt="" /></a>\n'
|
||||||
|
|
||||||
htmlStr += '<div class="follow">'
|
htmlStr += \
|
||||||
htmlStr += '<center><br><br><br>'
|
'<div class="follow">' + \
|
||||||
htmlStr += '<h1><a href="' + actor + '/search"><b>'
|
'<center><br><br><br>' + \
|
||||||
htmlStr += translate['Category'] + ': ' + categoryStr + '</b></a></h1>'
|
'<h1><a href="' + actor + '/search"><b>' + \
|
||||||
|
translate['Category'] + ': ' + categoryStr + '</b></a></h1>'
|
||||||
|
|
||||||
hashtagsDict = getHashtagCategories(baseDir, True, categoryStr)
|
hashtagsDict = getHashtagCategories(baseDir, True, categoryStr)
|
||||||
if hashtagsDict:
|
if hashtagsDict:
|
||||||
|
@ -293,7 +238,8 @@ def htmlSearchHashtagCategory(cssCache: {}, translate: {},
|
||||||
'<a href="' + actor + '/tags/' + tagName + \
|
'<a href="' + actor + '/tags/' + tagName + \
|
||||||
'" class="hashtagswarm">' + tagName + '</a>\n'
|
'" class="hashtagswarm">' + tagName + '</a>\n'
|
||||||
|
|
||||||
htmlStr += '</center>'
|
htmlStr += \
|
||||||
htmlStr += '</div>'
|
'</center>' + \
|
||||||
|
'</div>'
|
||||||
htmlStr += htmlFooter()
|
htmlStr += htmlFooter()
|
||||||
return htmlStr
|
return htmlStr
|
||||||
|
|
Loading…
Reference in New Issue