Default avatar if link is broken
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 117 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 148 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 92 KiB |
|
@ -206,16 +206,22 @@ def getAvatarImageHtml(showAvatarOptions: bool,
|
||||||
nickname: str, domainFull: str,
|
nickname: str, domainFull: str,
|
||||||
avatarUrl: str, postActor: str,
|
avatarUrl: str, postActor: str,
|
||||||
translate: {}, avatarPosition: str,
|
translate: {}, avatarPosition: str,
|
||||||
pageNumber: int, messageIdStr: str) -> str:
|
pageNumber: int, messageIdStr: str,
|
||||||
|
iconsPath: str) -> str:
|
||||||
"""Get html for the avatar image
|
"""Get html for the avatar image
|
||||||
"""
|
"""
|
||||||
|
# if the image link is broken then this provides a local substitute
|
||||||
|
brokenLinkSubstitute = \
|
||||||
|
" onerror=\"this.onerror=null; this.src='" + \
|
||||||
|
iconsPath + "/avatar_default.png'\""
|
||||||
|
|
||||||
avatarLink = ''
|
avatarLink = ''
|
||||||
if '/users/news/' not in avatarUrl:
|
if '/users/news/' not in avatarUrl:
|
||||||
avatarLink = ' <a class="imageAnchor" href="' + postActor + '">'
|
avatarLink = ' <a class="imageAnchor" href="' + postActor + '">'
|
||||||
avatarLink += \
|
avatarLink += \
|
||||||
' <img loading="lazy" src="' + avatarUrl + '" title="' + \
|
' <img loading="lazy" src="' + avatarUrl + '" title="' + \
|
||||||
translate['Show profile'] + '" alt=" "' + avatarPosition + \
|
translate['Show profile'] + '" alt=" "' + avatarPosition + \
|
||||||
'/></a>\n'
|
brokenLinkSubstitute + '/></a>\n'
|
||||||
|
|
||||||
if showAvatarOptions and \
|
if showAvatarOptions and \
|
||||||
domainFull + '/users/' + nickname not in postActor:
|
domainFull + '/users/' + nickname not in postActor:
|
||||||
|
@ -227,13 +233,15 @@ def getAvatarImageHtml(showAvatarOptions: bool,
|
||||||
avatarLink += \
|
avatarLink += \
|
||||||
' <img loading="lazy" title="' + \
|
' <img loading="lazy" title="' + \
|
||||||
translate['Show options for this person'] + \
|
translate['Show options for this person'] + \
|
||||||
'" src="' + avatarUrl + '" ' + avatarPosition + '/></a>\n'
|
'" src="' + avatarUrl + '" ' + avatarPosition + \
|
||||||
|
brokenLinkSubstitute + '/></a>\n'
|
||||||
else:
|
else:
|
||||||
# don't link to the person options for the news account
|
# don't link to the person options for the news account
|
||||||
avatarLink += \
|
avatarLink += \
|
||||||
' <img loading="lazy" title="' + \
|
' <img loading="lazy" title="' + \
|
||||||
translate['Show options for this person'] + \
|
translate['Show options for this person'] + \
|
||||||
'" src="' + avatarUrl + '" ' + avatarPosition + '/>\n'
|
'" src="' + avatarUrl + '" ' + avatarPosition + \
|
||||||
|
brokenLinkSubstitute + '/>\n'
|
||||||
return avatarLink.strip()
|
return avatarLink.strip()
|
||||||
|
|
||||||
|
|
||||||
|
@ -1211,7 +1219,8 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
nickname, domainFull,
|
nickname, domainFull,
|
||||||
avatarUrl, postActor,
|
avatarUrl, postActor,
|
||||||
translate, avatarPosition,
|
translate, avatarPosition,
|
||||||
pageNumber, messageIdStr)
|
pageNumber, messageIdStr,
|
||||||
|
iconsPath)
|
||||||
|
|
||||||
avatarImageInPost = \
|
avatarImageInPost = \
|
||||||
' <div class="timeline-avatar">' + avatarLink + '</div>\n'
|
' <div class="timeline-avatar">' + avatarLink + '</div>\n'
|
||||||
|
|