Show non-reader likes count

main
Bob Mottram 2020-09-05 12:29:52 +01:00
parent 07a07d877a
commit 4763226f70
2 changed files with 20 additions and 6 deletions

View File

@ -26,6 +26,7 @@
--font-size3: 38px;
--font-size4: 22px;
--font-size5: 20px;
--font-size-likes: 16px;
--font-size-pgp-key: 16px;
--font-size-pgp-key2: 8px;
--font-size-tox: 16px;
@ -138,6 +139,11 @@ a:focus {
float: right;
}
.likesCount {
font-size: var(--font-size-likes);
font-family: Arial, Helvetica, sans-serif;
}
.about {
font-size: var(--font-size5);
font-family: Arial, Helvetica, sans-serif;

View File

@ -4214,12 +4214,14 @@ def individualPostAsHtml(allowDownloads: bool,
likeCountStr = ''
if likeCount > 0:
if likeCount > 1:
if likeCount <= 10:
likeCountStr = ' (' + str(likeCount) + ')'
else:
likeCountStr = ' (10+)'
if likedByPerson(postJsonObject, nickname, fullDomain):
if likeCount == 1:
# liked by the reader only
likeCountStr = ''
likeIcon = 'like.png'
likeLink = 'unlike'
likeTitle = translate['Undo the like']
@ -4241,7 +4243,13 @@ def individualPostAsHtml(allowDownloads: bool,
likeStr += \
'<img loading="lazy" title="' + likeTitle + likeCountStr + \
'" alt="' + likeTitle + \
' |" src="/' + iconsDir + '/' + likeIcon + '"/></a>\n'
' |" src="/' + iconsDir + '/' + likeIcon + '"/>'
if likeCountStr:
# show the number of likes next to icon
likeStr += '<label class="likesCount">'
likeStr += likeCountStr.replace('(', '').replace(')', '').strip()
likeStr += '</label>'
likeStr += '</a>\n'
# benchmark 12.5
if not allowDownloads: