mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
b490c0b791
commit
bde8dadce0
|
|
@ -508,57 +508,58 @@ def _getLikeIconHtml(nickname: str, domainFull: str,
|
||||||
maxLikeCount: int) -> str:
|
maxLikeCount: int) -> str:
|
||||||
"""Returns html for like icon/button
|
"""Returns html for like icon/button
|
||||||
"""
|
"""
|
||||||
|
if not showLikeButton or isModerationPost:
|
||||||
|
return ''
|
||||||
likeStr = ''
|
likeStr = ''
|
||||||
if not isModerationPost and showLikeButton:
|
likeIcon = 'like_inactive.png'
|
||||||
likeIcon = 'like_inactive.png'
|
likeLink = 'like'
|
||||||
likeLink = 'like'
|
likeTitle = 'Like this post'
|
||||||
likeTitle = 'Like this post'
|
if translate.get(likeTitle):
|
||||||
if translate.get(likeTitle):
|
likeTitle = translate[likeTitle]
|
||||||
likeTitle = translate[likeTitle]
|
likeEmoji = ''
|
||||||
likeEmoji = ''
|
likeCount = noOfLikes(postJsonObject)
|
||||||
likeCount = noOfLikes(postJsonObject)
|
|
||||||
|
|
||||||
_logPostTiming(enableTimingLog, postStartTime, '12.1')
|
_logPostTiming(enableTimingLog, postStartTime, '12.1')
|
||||||
|
|
||||||
likeCountStr = ''
|
likeCountStr = ''
|
||||||
if likeCount > 0:
|
if likeCount > 0:
|
||||||
if likeCount <= maxLikeCount:
|
if likeCount <= maxLikeCount:
|
||||||
likeCountStr = ' (' + str(likeCount) + ')'
|
likeCountStr = ' (' + str(likeCount) + ')'
|
||||||
else:
|
else:
|
||||||
likeCountStr = ' (' + str(maxLikeCount) + '+)'
|
likeCountStr = ' (' + str(maxLikeCount) + '+)'
|
||||||
if likedByPerson(postJsonObject, nickname, domainFull):
|
if likedByPerson(postJsonObject, nickname, domainFull):
|
||||||
if likeCount == 1:
|
if likeCount == 1:
|
||||||
# liked by the reader only
|
# liked by the reader only
|
||||||
likeCountStr = ''
|
likeCountStr = ''
|
||||||
likeIcon = 'like.png'
|
likeIcon = 'like.png'
|
||||||
likeLink = 'unlike'
|
likeLink = 'unlike'
|
||||||
likeTitle = 'Undo the like'
|
likeTitle = 'Undo the like'
|
||||||
if translate.get(likeTitle):
|
if translate.get(likeTitle):
|
||||||
likeTitle = translate[likeTitle]
|
likeTitle = translate[likeTitle]
|
||||||
likeEmoji = '👍 '
|
likeEmoji = '👍 '
|
||||||
|
|
||||||
_logPostTiming(enableTimingLog, postStartTime, '12.2')
|
_logPostTiming(enableTimingLog, postStartTime, '12.2')
|
||||||
|
|
||||||
likeStr = ''
|
likeStr = ''
|
||||||
if likeCountStr:
|
if likeCountStr:
|
||||||
# show the number of likes next to icon
|
# show the number of likes next to icon
|
||||||
likeStr += '<label class="likesCount">'
|
likeStr += '<label class="likesCount">'
|
||||||
likeStr += likeCountStr.replace('(', '').replace(')', '').strip()
|
likeStr += likeCountStr.replace('(', '').replace(')', '').strip()
|
||||||
likeStr += '</label>\n'
|
likeStr += '</label>\n'
|
||||||
likePostId = removeIdEnding(postJsonObject['id'])
|
likePostId = removeIdEnding(postJsonObject['id'])
|
||||||
likeStr += \
|
likeStr += \
|
||||||
' <a class="imageAnchor" href="/users/' + nickname + '?' + \
|
' <a class="imageAnchor" href="/users/' + nickname + '?' + \
|
||||||
likeLink + '=' + likePostId + \
|
likeLink + '=' + likePostId + \
|
||||||
pageNumberParam + \
|
pageNumberParam + \
|
||||||
'?actor=' + postJsonObject['actor'] + \
|
'?actor=' + postJsonObject['actor'] + \
|
||||||
'?bm=' + timelinePostBookmark + \
|
'?bm=' + timelinePostBookmark + \
|
||||||
'?tl=' + boxName + '" title="' + \
|
'?tl=' + boxName + '" title="' + \
|
||||||
likeTitle + likeCountStr + '">\n'
|
likeTitle + likeCountStr + '">\n'
|
||||||
likeStr += \
|
likeStr += \
|
||||||
' ' + \
|
' ' + \
|
||||||
'<img loading="lazy" title="' + likeTitle + likeCountStr + \
|
'<img loading="lazy" title="' + likeTitle + likeCountStr + \
|
||||||
'" alt="' + likeEmoji + likeTitle + \
|
'" alt="' + likeEmoji + likeTitle + \
|
||||||
' |" src="/icons/' + likeIcon + '"/></a>\n'
|
' |" src="/icons/' + likeIcon + '"/></a>\n'
|
||||||
return likeStr
|
return likeStr
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue