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%; 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 { .container img.emoji {
float: none; float: none;
width: 50px; width: 50px;

View File

@ -68,19 +68,15 @@ def htmlSearchEmoji(baseDir: str,searchStr: str) -> str:
with open(emojiLookupFilename, 'r') as fp: with open(emojiLookupFilename, 'r') as fp:
emojiJson=commentjson.load(fp) emojiJson=commentjson.load(fp)
results={} results={}
if emojiJson.get(searchStr): for emojiName,filename in emojiJson.items():
# exact match if searchStr in emojiName:
results[searchStr] = emojiJson[searchStr]+'.png' results[emojiName] = filename+'.png'
else: for emojiName,filename in emojiJson.items():
for emojiName,filename in emojiJson.items(): if emojiName in searchStr:
if searchStr in emojiName: results[emojiName] = filename+'.png'
results[emojiName] = filename+'.png'
for emojiName,filename in emojiJson.items():
if emojiName in searchStr:
results[emojiName] = filename+'.png'
emojiForm+='<center>' emojiForm+='<center>'
for emojiName,filename in results.items(): 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+='</center>'
emojiForm+=htmlFooter() emojiForm+=htmlFooter()