Manual selecting emojis on page by codes contain

This commit is contained in:
localhost_frssoft 2022-09-19 23:41:35 +03:00
parent 5f688c6318
commit f219ac0dca
2 changed files with 13 additions and 0 deletions

View File

@ -40,6 +40,16 @@ type TemplateData struct {
Ctx *Context
}
func allowed_emoji_page(emoj string, codes ...string) bool {
for _, code := range codes {
if strings.Contains(emoj, code) {
return true
}
}
return false
}
func emojiHTML(e mastodon.Emoji, height string) string {
return `<img class="emoji" src="` + e.URL + `" alt=":` + e.ShortCode + `:" title=":` + e.ShortCode + `:" height="` + height + `"/>`
}
@ -142,6 +152,7 @@ func NewRenderer(templateGlobPattern string) (r *renderer, err error) {
t := template.New("default")
t, err = t.Funcs(template.FuncMap{
"EmojiFilter": emojiFilter,
"Allowed_emoji_page": allowed_emoji_page,
"StatusContentFilter": statusContentFilter,
"DisplayInteractionCount": displayInteractionCount,
"TimeSince": timeSince,

View File

@ -4,6 +4,7 @@
<div class="emoji-list-container">
{{range .Emojis}}
{{if Allowed_emoji_page .ShortCode "blobfox" "senko" "shiro"}}
<div class="emoji-item-container">
<div class="emoji-item">
<img class="emoji" src="{{.URL}}" alt="{{.ShortCode}}" height="32" loading="lazy" />
@ -11,6 +12,7 @@
</div>
</div>
{{end}}
{{end}}
</div>
{{template "footer.tmpl"}}