Emoji image style in search

master
Bob Mottram 2019-08-19 20:10:55 +01:00
parent 43ad80e2f5
commit 216d2b60ba
2 changed files with 17 additions and 11 deletions

View File

@ -341,6 +341,16 @@ a:link {
border-radius: 10%;
}
.searchEmoji {
float: none;
width: 80px;
margin-left: 0px;
margin-right: 0px;
padding-right: 0px;
padding-left: 0px;
border-radius: 0px;
}
.container img.emoji {
float: none;
width: 50px;

View File

@ -68,19 +68,15 @@ def htmlSearchEmoji(baseDir: str,searchStr: str) -> str:
with open(emojiLookupFilename, 'r') as fp:
emojiJson=commentjson.load(fp)
results={}
if emojiJson.get(searchStr):
# exact match
results[searchStr] = emojiJson[searchStr]+'.png'
else:
for emojiName,filename in emojiJson.items():
if searchStr in emojiName:
results[emojiName] = filename+'.png'
for emojiName,filename in emojiJson.items():
if emojiName in searchStr:
results[emojiName] = filename+'.png'
for emojiName,filename in emojiJson.items():
if searchStr in emojiName:
results[emojiName] = filename+'.png'
for emojiName,filename in emojiJson.items():
if emojiName in searchStr:
results[emojiName] = filename+'.png'
emojiForm+='<center>'
for emojiName,filename in results.items():
emojiForm+='<h5>:'+emojiName+':<img src="/emoji/'+filename+'"/></h5>'
emojiForm+='<p><h3>:'+emojiName+':</h3><img class="searchEmoji" src="/emoji/'+filename+'"/></p>'
emojiForm+='</center>'
emojiForm+=htmlFooter()