forked from indymedia/epicyon
Displaying emoji in name on profile
parent
dff6946442
commit
85c69ffada
|
@ -391,6 +391,17 @@ a:link {
|
||||||
transform: translateY(-40%);
|
transform: translateY(-40%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.container img.emojiprofile {
|
||||||
|
float: none;
|
||||||
|
width: 50px;
|
||||||
|
margin-left: 0px;
|
||||||
|
margin-right: 0px;
|
||||||
|
padding-right: 0px;
|
||||||
|
border-radius: 0px;
|
||||||
|
-ms-transform: translateY(-40%);
|
||||||
|
transform: translateY(-40%);
|
||||||
|
}
|
||||||
|
|
||||||
.containericons {
|
.containericons {
|
||||||
padding: 0px 0px;
|
padding: 0px 0px;
|
||||||
margin: 0px 0px;
|
margin: 0px 0px;
|
||||||
|
|
|
@ -1181,6 +1181,10 @@ def htmlProfile(translate: {},projectVersion: str, \
|
||||||
domain,port=getDomainFromActor(profileJson['id'])
|
domain,port=getDomainFromActor(profileJson['id'])
|
||||||
if not domain:
|
if not domain:
|
||||||
return ""
|
return ""
|
||||||
|
displayName= \
|
||||||
|
addEmojiToDisplayName(baseDir,httpPrefix, \
|
||||||
|
nickname,domain, \
|
||||||
|
displayName,True)
|
||||||
domainFull=domain
|
domainFull=domain
|
||||||
if port:
|
if port:
|
||||||
domainFull=domain+':'+str(port)
|
domainFull=domain+':'+str(port)
|
||||||
|
@ -1414,7 +1418,7 @@ def contentWarningScript() -> str:
|
||||||
'}\n'
|
'}\n'
|
||||||
return script
|
return script
|
||||||
|
|
||||||
def htmlReplaceEmojiFromTags(content: str,tag: [],inMessageContent: bool) -> str:
|
def htmlReplaceEmojiFromTags(content: str,tag: [],messageType: str) -> str:
|
||||||
"""Uses the tags to replace :emoji: with html image markup
|
"""Uses the tags to replace :emoji: with html image markup
|
||||||
"""
|
"""
|
||||||
for tagItem in tag:
|
for tagItem in tag:
|
||||||
|
@ -1431,8 +1435,10 @@ def htmlReplaceEmojiFromTags(content: str,tag: [],inMessageContent: bool) -> str
|
||||||
if tagItem['name'] not in content:
|
if tagItem['name'] not in content:
|
||||||
continue
|
continue
|
||||||
htmlClass='emoji'
|
htmlClass='emoji'
|
||||||
if not inMessageContent:
|
if messageType=='post header':
|
||||||
htmlClass='emojiheader'
|
htmlClass='emojiheader'
|
||||||
|
if messageType=='profile':
|
||||||
|
htmlClass='emojiprofile'
|
||||||
emojiHtml="<img src=\""+tagItem['icon']['url']+"\" alt=\""+tagItem['name'].replace(':','')+"\" align=\"middle\" class=\""+htmlClass+"\"/>"
|
emojiHtml="<img src=\""+tagItem['icon']['url']+"\" alt=\""+tagItem['name'].replace(':','')+"\" align=\"middle\" class=\""+htmlClass+"\"/>"
|
||||||
content=content.replace(tagItem['name'],emojiHtml)
|
content=content.replace(tagItem['name'],emojiHtml)
|
||||||
return content
|
return content
|
||||||
|
@ -1614,7 +1620,7 @@ def rejectAnnounce(announceFilename: str):
|
||||||
|
|
||||||
def addEmojiToDisplayName(baseDir: str,httpPrefix: str, \
|
def addEmojiToDisplayName(baseDir: str,httpPrefix: str, \
|
||||||
nickname: str,domain: str, \
|
nickname: str,domain: str, \
|
||||||
displayName: str) -> str:
|
displayName: str,inProfileName: bool) -> str:
|
||||||
"""Adds emoji icons to display names on individual posts
|
"""Adds emoji icons to display names on individual posts
|
||||||
"""
|
"""
|
||||||
if ':' in displayName:
|
if ':' in displayName:
|
||||||
|
@ -1628,7 +1634,10 @@ def addEmojiToDisplayName(baseDir: str,httpPrefix: str, \
|
||||||
emojiTagsList=[]
|
emojiTagsList=[]
|
||||||
for tagName,tag in emojiTags.items():
|
for tagName,tag in emojiTags.items():
|
||||||
emojiTagsList.append(tag)
|
emojiTagsList.append(tag)
|
||||||
displayName=htmlReplaceEmojiFromTags(displayName,emojiTagsList,False)
|
if not inProfileName:
|
||||||
|
displayName=htmlReplaceEmojiFromTags(displayName,emojiTagsList,'post header')
|
||||||
|
else:
|
||||||
|
displayName=htmlReplaceEmojiFromTags(displayName,emojiTagsList,'profile')
|
||||||
return displayName
|
return displayName
|
||||||
|
|
||||||
def individualPostAsHtml(iconsDir: str,translate: {}, \
|
def individualPostAsHtml(iconsDir: str,translate: {}, \
|
||||||
|
@ -1768,7 +1777,7 @@ def individualPostAsHtml(iconsDir: str,translate: {}, \
|
||||||
displayName= \
|
displayName= \
|
||||||
addEmojiToDisplayName(baseDir,httpPrefix, \
|
addEmojiToDisplayName(baseDir,httpPrefix, \
|
||||||
nickname,domain, \
|
nickname,domain, \
|
||||||
displayName)
|
displayName,False)
|
||||||
titleStr+='<a href="'+messageId+'">'+displayName+'</a>'
|
titleStr+='<a href="'+messageId+'">'+displayName+'</a>'
|
||||||
else:
|
else:
|
||||||
titleStr+='<a href="'+messageId+'">@'+actorNickname+'@'+actorDomain+'</a>'
|
titleStr+='<a href="'+messageId+'">@'+actorNickname+'@'+actorDomain+'</a>'
|
||||||
|
@ -1894,7 +1903,7 @@ def individualPostAsHtml(iconsDir: str,translate: {}, \
|
||||||
displayName= \
|
displayName= \
|
||||||
addEmojiToDisplayName(baseDir,httpPrefix, \
|
addEmojiToDisplayName(baseDir,httpPrefix, \
|
||||||
nickname,domain, \
|
nickname,domain, \
|
||||||
displayName)
|
displayName,False)
|
||||||
titleStr=displayName+' '+titleStr
|
titleStr=displayName+' '+titleStr
|
||||||
|
|
||||||
avatarImageInPost= \
|
avatarImageInPost= \
|
||||||
|
@ -2020,7 +2029,7 @@ def individualPostAsHtml(iconsDir: str,translate: {}, \
|
||||||
contentStr+='</div>'
|
contentStr+='</div>'
|
||||||
|
|
||||||
if postJsonObject['object'].get('tag'):
|
if postJsonObject['object'].get('tag'):
|
||||||
contentStr=htmlReplaceEmojiFromTags(contentStr,postJsonObject['object']['tag'],True)
|
contentStr=htmlReplaceEmojiFromTags(contentStr,postJsonObject['object']['tag'],'content')
|
||||||
|
|
||||||
contentStr='<div class="message">'+contentStr+'</div>'
|
contentStr='<div class="message">'+contentStr+'</div>'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue